本文整理汇总了Python中webnotes.model.doc.Document.company方法的典型用法代码示例。如果您正苦于以下问题:Python Document.company方法的具体用法?Python Document.company怎么用?Python Document.company使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.company方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_installation_note
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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 company [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: make_patient
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def make_patient(self):
d = Document('Patient Register')
d.customer_name = self.doc.first_name + ' ' + self.doc.last_name
d.mobile = self.doc.phone_number
d.company=self.doc.company
d.save()
return d.name
示例4: make_bank_voucher
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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: reorder_indent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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)
示例6: create_advance_entry
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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 company [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: create_sal_slip
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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)
示例9: upload_accounts_transactions
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [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)
示例10: create_email_digest
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def create_email_digest(self):
"""
create a default weekly email digest
* Weekly Digest
* For all companies
* Recipients: System Managers
* Full content
* Enabled by default
"""
import webnotes
companies_list = webnotes.conn.sql("SELECT company_name FROM `tabCompany`", as_list=1)
from webnotes.profile import get_system_managers
system_managers = get_system_managers()
if not system_managers:
return
from webnotes.model.doc import Document
for company in companies_list:
if company and company[0]:
edigest = Document("Email Digest")
edigest.name = "Default Weekly Digest - " + company[0]
edigest.company = company[0]
edigest.frequency = "Weekly"
edigest.recipient_list = "\n".join(system_managers)
for f in [
"new_leads",
"new_enquiries",
"new_quotations",
"new_sales_orders",
"new_purchase_orders",
"new_transactions",
"payables",
"payments",
"expenses_booked",
"invoiced_amount",
"collections",
"income",
"bank_balance",
"stock_below_rl",
"income_year_to_date",
"enabled",
]:
edigest.fields[f] = 1
exists = webnotes.conn.sql(
"""\
SELECT name FROM `tabEmail Digest`
WHERE name = %s""",
edigest.name,
)
if (exists and exists[0]) and exists[0][0]:
continue
else:
edigest.save(1)
示例11: create_customer
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def create_customer(self,args):
d = Document('Customer')
d.customer_name = args['Customer Name']
d.innoworth_id=args['Id']
d.customer_type='Individual'
d.customer_group='Commercial'
d.territory='India'
d.company='InnoWorth'
d.save()
return d.name
示例12: create_lead
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def create_lead(email):
"""create a lead if it does not exist"""
lead = Document("Lead")
lead.fields["__islocal"] = 1
lead.lead_name = email
lead.email_id = email
lead.status = "Open"
lead.naming_series = lead_naming_series or get_lead_naming_series()
lead.company = webnotes.conn.get_default("company")
lead.source = "Email"
lead.save()
示例13: on_submit
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def on_submit(self):
if self.doc.status =='Approved':
d = Document('Employee')
d.employee_name=self.doc.recruiter_name
d.salutation=self.doc.r_salutations
d.gender=self.doc.r_gender
d.date_of_joining=self.doc.posting_date
d.date_of_birth=self.doc.birth_date
d.company='Medsynaptic'
d.save()
示例14: create_lead
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def create_lead(email_id):
"""create a lead if it does not exist"""
from email.utils import parseaddr
real_name, email_id = parseaddr(email_id)
lead = Document("Lead")
lead.fields["__islocal"] = 1
lead.lead_name = real_name or email_id
lead.email_id = email_id
lead.status = "Open"
lead.naming_series = lead_naming_series or get_lead_naming_series()
lead.company = webnotes.conn.get_default("company")
lead.source = "Email"
lead.save()
示例15: create_account_head
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import company [as 别名]
def create_account_head(self,args):
company='InnoWorth'
abbr = 'innow'
parent_account = 'Accounts Receivable - innow'
name=args['Customer Name']+' - '+args['Id']
d = Document('Account')
d.account_name = name
d.parent_account= parent_account
d.group_or_ledger='Ledger'
d.company=company
d.master_type='Customer'
d.debit_or_credit='Debit'
d.is_pl_account='No'
d.master_name=args['Customer Name']+' - '+args['Id']
d.freeze_account= "No"
d.save()