本文整理汇总了Python中webnotes.model.doc.Document.fiscal_year方法的典型用法代码示例。如果您正苦于以下问题:Python Document.fiscal_year方法的具体用法?Python Document.fiscal_year怎么用?Python Document.fiscal_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.fiscal_year方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_installation_note
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def get_installation_note(customer,emp_id,_type='POST'):
#return "hello "+customer
qr="select customer_name from `tabCustomer` where customer_name="+customer+" "
res=webnotes.conn.sql(qr)
#return res
from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
today = nowdate()
qry="select name from `tabFiscal Year` where is_fiscal_year_closed='No'"
res1=webnotes.conn.sql(qry)
#return res1[0][0]
from webnotes.model.doc import Document
import time
if res :
d= Document('Installation Note')
d.customer=customer[1:-1]
d.customer_name=customer[1:-1]
d.inst_time=time.strftime("%H:%M:%S")
d.inst_date=today
d.employee_id=emp_id[1:-1]
return d.employee_id
d.fiscal_year=res1[0][0]
d.company='medsynaptic'
d.territory='India'
d.customer_group='Individual'
#return d.fiscal_year
d.save()
webnotes.conn.commit()
return d.name
else:
d= Document('Customer')
d.customer_name=customer[1:-1]
d.customer_type='Individual'
d.customer_group='Individual'
d.territory='India'
d.save()
webnotes.conn.commit()
c= Document('Installation Note')
c.customer=customer[1:-1]
c.inst_time=time.strftime("%H:%M:%S")
c.inst_date=today
c.fiscal_year=res1[0][0]
c.employee_id=emp_id[1:-1]
c.company='Medsynaptic'
c.territory='India'
c.customer_group='Individual'
c.save()
webnotes.conn.commit()
return c.name
示例2: create_material_request
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_material_request(self,args):
mr=Document('Material Request')
mr.material_request_type='Purchase'
mr.naming_series='MREQ-'
mr.company='InnoWorth'
mr.transaction_date=nowdate()
mr.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
mr.status='Submitted'
mr.docstatus=1
mr.save()
mrc=Document('Material Request Item')
mrc.parent=mr.name
mrc.item_code=args[0][0]
mrc.qty=args[0][1]
mrc.schedule_date=args[0][2]
mrc.docstatus=1
mrc.warehouse=args[0][3]
mrc.item_name=args[0][4]
mrc.uom=args[0][5]
mrc.description=args[0][6]
mrc.parentfield='indent_details'
mrc.parenttype='Material Request'
mrc.save()
child_data=[]
child_data.append([mrc.item_code,mrc.qty,mrc.schedule_date,mr.name,mrc.warehouse,mrc.item_name,mrc.uom,mrc.description,mrc.name,args[0][7]])
data=[]
data.append({"item_code":mrc.item_code,"so_qty":cstr(mrc.qty),"proj_qty":('+'+cstr(mrc.qty)),"warehouse":mrc.warehouse,"bin_iqty":"Bin.indented_qty","bin_pqty":"Bin.projected_qty","type":"po"})
self.update_bin(data)
import_amount=self.create_child_po(child_data)
return import_amount
示例3: process_payroll
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def process_payroll(self):
sal_slip_str = ""
if self.doc.month and self.doc.fiscal_year and self.doc.year:
e = self.get_employee()
if e:
self.doc.emp_lst = e
sal_slip_str += "Sucessfully created following salary slips:"
for i in e:
ss = Document("Salary Slip")
ss.fiscal_year = self.doc.fiscal_year
ss.employee = i
ss.month = self.doc.month
ss.year = self.doc.year
ss.arrear_amount = self.doc.arrear_amount
ss.email_check = self.doc.email_check
ss.save(1)
salary_obj = get_obj("Salary Slip", ss.name, with_children=1)
salary_obj.process_payroll_all()
sal_slip_str += "<br/>" + ss.name
else:
msgprint("For Process Payroll Fiscal Year, Month, Year fields are mandatory.")
if not sal_slip_str:
sal_slip_str = "No record found."
return cstr(sal_slip_str)
示例4: make_bank_voucher
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def make_bank_voucher(self):
self.set_flag()
"""
get default bank account,default salary acount from company
"""
#amt = self.get_total_salary()
com = webnotes.conn.sql("""select default_bank_account, default_expense_account from `tabCompany`
where name = '%s'""" % self.doc.company,as_list=1)
if not com[0][0] or not com[0][1]:
msgprint("You can set Default Bank Account in Company master.")
if not self.doc.jv:
jv = Document('Journal Voucher')
jv.voucher_type = 'Bank Voucher'
jv.user_remark = 'Referrals Payment'
jv.fiscal_year = '2013-14'
jv.total_credit = jv.total_debit = self.doc.total_amount
jv.company = self.doc.company
jv.posting_date = nowdate()
jv.save()
jvd = Document('Journal Voucher Detail')
jvd.account = com and com[0][0] or ''
jvd.credit = self.doc.total_amount
jvd.parent = jv.name
jvd.save()
jvd1 = Document('Journal Voucher Detail')
jvd1.account = com and com[0][1] or ''
jvd1.debit = self.doc.total_amount
jvd1.parent = jv.name
jvd1.save()
self.doc.jv = jv.name
self.doc.save()
示例5: create_account_balances
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_account_balances(self):
# get periods
period_list = self.get_period_list()
cnt = 0
# get accounts
al = sql("select name from tabAccount")
for a in al:
# check
if sql("select count(*) from `tabAccount Balance` where fiscal_year=%s and account=%s", (self.doc.name, a[0]))[0][0] < 13:
for p in period_list:
# check if missing
if not sql("select name from `tabAccount Balance` where period=%s and account=%s and fiscal_year=%s", (p[0], a[0], self.doc.name)):
d = Document('Account Balance')
d.account = a[0]
d.period = p[0]
d.start_date = p[1].strftime('%Y-%m-%d')
d.end_date = p[2].strftime('%Y-%m-%d')
d.fiscal_year = p[3]
d.debit = 0
d.credit = 0
d.opening = 0
d.balance = 0
d.save(1)
cnt += 1
if cnt % 100 == 0:
sql("commit")
sql("start transaction")
return cnt
示例6: create_advance_entry
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_advance_entry(advance_amount, customer_name, debit_to, company):
jv = Document('Journal Voucher')
jv.voucher_type = 'Cash Voucher'
jv.user_remark = 'Advance Payment'
jv.fiscal_year = webnotes.conn.get_value('Global Defaults',None,'current_fiscal_year')
jv.user_remark = "Advance from patient %s"%customer_name
jv.remark = "User Remark : Advance from patient %s"%customer_name
jv.company = company
jv.posting_date = nowdate()
jv.docstatus=1
jv.save()
chld1 = Document('Journal Voucher Detail')
chld1.parent = jv.name
chld1.account = debit_to
chld1.cost_center = webnotes.conn.get_value('Company',company,'cost_center')
chld1.credit = advance_amount
chld1.is_advance = 'Yes'
chld1.save()
chld2 = Document('Journal Voucher Detail')
chld2.parent = jv.name
chld2.account = webnotes.conn.get_value('Company',company,'default_cash_account')
chld2.cost_center = webnotes.conn.get_value('Company',company,'cost_center')
chld2.debit = advance_amount
chld2.save()
create_gl_entry(jv.name, jv.user_remark, company)
示例7: create_auto_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
""" Create indent on reaching reorder level """
indent = Document('Purchase Request')
indent.transaction_date = nowdate()
indent.naming_series = 'IDT'
indent.company = get_defaults()['company']
indent.fiscal_year = get_defaults()['fiscal_year']
indent.remark = "This is an auto generated Purchase Request. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
indent.save(1)
indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
indent_details_child = addchild(indent_obj.doc,'indent_details','Purchase Request Item',0)
indent_details_child.item_code = self.doc.item_code
indent_details_child.uom = self.doc.stock_uom
indent_details_child.warehouse = self.doc.warehouse
indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
indent_details_child.item_name = i['item_name']
indent_details_child.description = i['description']
indent_details_child.item_group = i['item_group']
indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty))
indent_details_child.brand = i['brand']
indent_details_child.save()
indent_obj = get_obj('Purchase Request',indent.name,with_children=1)
indent_obj.validate()
set(indent_obj.doc,'docstatus',1)
indent_obj.on_submit()
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Purchase Request %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
if(i['email_notify']):
send_email_notification(doc_type,doc_name)
示例8: reorder_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
indent = Document('Indent')
indent.transaction_date = nowdate()
indent.naming_series = 'IDT'
indent.company = get_defaults()['company']
indent.fiscal_year = get_defaults()['fiscal_year']
indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
indent.save(1)
indent_obj = get_obj('Indent',indent.name,with_children=1)
indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
indent_details_child.item_code = self.doc.item_code
indent_details_child.uom = self.doc.stock_uom
indent_details_child.warehouse = self.doc.warehouse
indent_details_child.schedule_date= add_days(nowdate(),cint(i['lead_time_days']))
indent_details_child.item_name = i['item_name']
indent_details_child.description = i['description']
indent_details_child.item_group = i['item_group']
if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
else:
indent_details_child.qty = i['min_order_qty']
indent_details_child.brand = i['brand']
indent_details_child.save()
indent_obj = get_obj('Indent',indent.name,with_children=1)
indent_obj.validate()
set(indent_obj.doc,'docstatus',1)
indent_obj.on_submit()
msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
if(email_notify):
send_email_notification(doc_type,doc_name)
示例9: create_sal_slip
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_sal_slip(self):
"""
Creates salary slip for selected employees if already not created
"""
emp_list = self.get_emp_list()
ss_list = []
for emp in emp_list:
if not sql("""select name from `tabSalary Slip`
where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
""", (emp[0], self.doc.month, self.doc.fiscal_year, self.doc.company)):
ss = Document('Salary Slip')
ss.fiscal_year = self.doc.fiscal_year
ss.employee = emp[0]
ss.month = self.doc.month
ss.email_check = self.doc.send_email
ss.company = self.doc.company
ss.save(1)
ss_obj = get_obj('Salary Slip', ss.name, with_children=1)
ss_obj.get_emp_and_leave_details()
ss_obj.calculate_net_pay()
ss_obj.validate()
ss_obj.doc.save()
for d in getlist(ss_obj.doclist, 'earning_details'):
d.save()
for d in getlist(ss_obj.doclist, 'deduction_details'):
d.save()
ss_list.append(ss.name)
return self.create_log(ss_list)
示例10: upload_accounts_transactions
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def upload_accounts_transactions(self):
import csv
data = csv.reader(self.get_csv_data().splitlines())
abbr = sql("select concat(' - ',abbr) as abbr from tabCompany where name=%s", self.doc.company)
updated = 0
jv_name = ""
# jv = Document('Journal Voucher')
global line, jv, name, jv_go
for line in data:
if len(line) >= 7: # Minimum no of fields
if line[3] != jv_name: # Create JV
if jv_name != "":
jv_go = get_obj("Journal Voucher", name, with_children=1)
jv_go.validate()
jv_go.on_submit()
jv_name = line[3]
jv = Document("Journal Voucher")
jv.voucher_type = line[0]
jv.naming_series = line[1]
jv.voucher_date = formatdate(line[2])
jv.posting_date = formatdate(line[2])
# jv.name = line[3]
jv.fiscal_year = self.doc.fiscal_year
jv.company = self.doc.company
jv.remark = len(line) == 8 and line[3] + " " + line[7] or line[3] + " Uploaded Record"
jv.docstatus = 1
jv.save(1)
name = jv.name
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = line[4] + abbr[0][0]
jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
if line[5] != "":
jc.debit = line[5]
else:
jc.credit = line[6]
jc.save()
else: # Create JV Child
jc = addchild(jv, "entries", "Journal Voucher Detail", 0)
jc.account = line[4] + abbr[0][0]
jc.cost_center = len(line) == 9 and line[8] or self.doc.default_cost_center
if line[5] != "":
jc.debit = line[5]
else:
jc.credit = line[6]
jc.save()
else:
msgprint("[Ignored] Incorrect format: %s" % str(line))
if jv_name != "":
jv_go = get_obj("Journal Voucher", name, with_children=1)
jv_go.validate()
jv_go.on_submit()
msgprint("<b>%s</b> items updated" % updated)
示例11: create_period
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_period(self,arg):
p = Document('Period')
p.period_name = arg['pn']
p.start_date = arg['sd']
p.end_date = arg['ed']
p.period_type = arg['pt']
p.fiscal_year = arg['fy']
try:
p.save(1)
except NameError, e:
msgprint('Period %s already exists' % p.period_name)
raise Exception
示例12: set_year_balance
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def set_year_balance(self):
p = sql("select name, start_date, end_date, fiscal_year from `tabPeriod` where docstatus != 2 and period_type in ('Month', 'Year')")
for d in p:
if not sql("select name from `tabAccount Balance` where account=%s and period=%s", (self.doc.name, d[0])):
ac = Document('Account Balance')
ac.account = self.doc.name
ac.period = d[0]
ac.start_date = d[1].strftime('%Y-%m-%d')
ac.end_date = d[2].strftime('%Y-%m-%d')
ac.fiscal_year = d[3]
ac.opening = 0
ac.debit = 0
ac.credit = 0
ac.balance = 0
ac.save(1)
示例13: allocate_leave
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def allocate_leave(self):
self.validate_values()
for d in self.get_employees():
la = Document('Leave Allocation')
la.employee = cstr(d[0])
la.employee_name = webnotes.conn.get_value('Employee',cstr(d[0]),'employee_name')
la.leave_type = self.doc.leave_type
la.fiscal_year = self.doc.fiscal_year
la.posting_date = nowdate()
la.carry_forward = cint(self.doc.carry_forward)
la.new_leaves_allocated = flt(self.doc.no_of_days)
la_obj = get_obj(doc=la)
la_obj.doc.docstatus = 1
la_obj.validate()
la_obj.on_update()
la_obj.doc.save(1)
msgprint("Leaves Allocated Successfully")
示例14: create_gl
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_gl(self,data):
for r in data:
gl=Document("GL Entry")
gl.account=r['account']
gl.debit=r['debit']
gl.credit=r['credit']
gl.against=r['against']
gl.against_voucher_type=r['against_voucher_type']
gl.voucher_type=r['voucher_type']
gl.against_voucher=r['against_voucher']
gl.voucher_no=r['voucher_no']
gl.cost_center=r['cost_center']
gl.posting_date=nowdate()
gl.aging_date=nowdate()
gl.fiscal_year=webnotes.conn.get_value("Global Defaults",None,"current_fiscal_year")
gl.company='InnoWorth'
gl.is_opening='No'
gl.save()
示例15: create_new_balances
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import fiscal_year [as 别名]
def create_new_balances(self, det):
# check
if sql("select count(t1.name) from `tabAccount Balance` t1, tabAccount t2 where t1.fiscal_year=%s and t2.lft <= %s and t2.rgt >= %s and t2.name = t1.account", (self.doc.fiscal_year, det[0][0], det[0][1]))[0][0] < 13*(cint(det[0][1]) - cint(det[0][0]) +1)/2:
period_list = self.get_period_list()
accounts = sql("select name from tabAccount where lft <= %s and rgt >= %s" % (det[0][0], det[0][1]))
for p in period_list:
for a in accounts:
# check if missing
if not sql("select name from `tabAccount Balance` where period=%s and account=%s and fiscal_year=%s", (p[0], a[0], self.doc.fiscal_year)):
d = Document('Account Balance')
d.account = a[0]
d.period = p[0]
d.start_date = p[1].strftime('%Y-%m-%d')
d.end_date = p[2].strftime('%Y-%m-%d')
d.fiscal_year = self.doc.fiscal_year
d.debit = 0
d.credit = 0
d.opening = 0
d.balance = 0
d.save(1)