本文整理汇总了Python中webnotes.model.doc.Document.docstatus方法的典型用法代码示例。如果您正苦于以下问题:Python Document.docstatus方法的具体用法?Python Document.docstatus怎么用?Python Document.docstatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webnotes.model.doc.Document
的用法示例。
在下文中一共展示了Document.docstatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_material_request
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [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
示例2: addchild
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def addchild(self, fieldname, childtype = '', doclist=None):
"""
Returns a child record of the give `childtype`.
* if local is set, it does not save the record
* if doclist is passed, it append the record to the doclist
"""
from webnotes.model.doc import Document
d = Document()
d.parent = self.name
d.parenttype = self.doctype
d.parentfield = fieldname
d.doctype = childtype
d.docstatus = 0;
d.name = ''
d.owner = webnotes.session['user']
d.fields['__islocal'] = 1 # for Client to identify unsaved doc
if doclist != None:
doclist.append(d)
if doclist:
d.idx = max([(d.idx or 0) for d in doclist if d.doctype==childtype]) + 1
return d
示例3: create_advance_entry
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [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)
示例4: upload_accounts_transactions
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [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)
示例5: create_parent
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def create_parent(self, sample_dict):
d = Document('Test Allocation')
d.sample_no = sample_dict['sample_no']
d.bottle_no = sample_dict['bottle_no']
d.priority = sample_dict['priority']
d.specification = sample_dict['specification']
d.group_name = sample_dict['test_group']
d.docstatus = 1
d.save()
self.update_sample_master(sample_dict)
return d.name
示例6: add_permission
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def add_permission(self,args=''):
parent, role, level = eval(args)
if sql("select name from tabDocPerm where parent=%s and role=%s and permlevel=%s", (parent, role, level)):
msgprint("This permission rule already exists!")
return
d = Document('DocPerm')
d.parent = parent
d.parenttype = 'DocType'
d.parentfield = 'permissions'
d.role = role
d.permlevel = cint(level)
d.docstatus = 0
d.save(1)
sql("update tabDocType set modified = %s where name = %s",(now(), parent))
示例7: set_delivery_serial_no_values
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def set_delivery_serial_no_values(self, obj, serial_no):
s = Document('Serial No', serial_no)
s.delivery_document_type = obj.doc.doctype
s.delivery_document_no = obj.doc.name
s.delivery_date = obj.doc.posting_date
s.delivery_time = obj.doc.posting_time
s.customer = obj.doc.customer
s.customer_name = obj.doc.customer_name
s.delivery_address = obj.doc.address_display
s.territory = obj.doc.territory
s.warranty_expiry_date = s.warranty_period and add_days(cstr(obj.doc.posting_date), s.warranty_period) or ''
s.docstatus = 1
s.status = 'Delivered'
s.modified = nowdate()
s.modified_by = session['user']
s.save()
示例8: update_jv
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def update_jv(self):
jv_details=webnotes.conn.sql("select name,sales_order_number,total_debit from `tabJournal Voucher` where docstatus=1 and ifnull(sales_order_number,'')<>'' and status='False'",as_list=1)
if jv_details:
for jv in jv_details:
so_details=webnotes.conn.sql(""" select sales_person,allocated_percentage,quater,fiscal_year from `tabSales Team`
where parent='%s' and ifnull(quater,'')<>'' and eligible='True' and ifnull(fiscal_year,'')<>''"""%(jv[1]),as_list=1)
if so_details:
for so in so_details:
jvp=Document('Variable Pay Summary')
jvp.sales_person=so[0]
jvp.percent=so[1]
jvp.quater=so[2]
jvp.fiscal_year=so[3]
jvp.amount=cstr(flt(jv[2])*flt(so[1])/flt(100))
jvp.parent=jv[0]
jvp.docstatus=1
jvp.status='False'
jvp.save()
webnotes.conn.sql("update `tabJournal Voucher` set status='True' where name='%s'"%(jv[0]))
webnotes.conn.sql("commit")
self.calculate_variable()
示例9: update_serial_no
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def update_serial_no(self, is_submit):
sl_obj = get_obj('Stock Ledger')
if is_submit:
sl_obj.validate_serial_no_warehouse(self, 'mtn_details')
for d in getlist(self.doclist, 'mtn_details'):
if d.serial_no:
serial_nos = sl_obj.get_sr_no_list(d.serial_no)
for x in serial_nos:
serial_no = x.strip()
if d.s_warehouse:
sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
if d.t_warehouse:
sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose)
if self.doc.purpose == 'Purchase Return':
#delete_doc("Serial No", serial_no)
serial_doc = Document("Serial No", serial_no)
serial_doc.status = is_submit and 'Purchase Returned' or 'In Store'
serial_doc.docstatus = is_submit and 2 or 0
serial_doc.save()
示例10: update_serial_no
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def update_serial_no(self, is_submit):
sl_obj = get_obj("Stock Ledger")
if is_submit:
sl_obj.validate_serial_no_warehouse(self, "mtn_details")
for d in getlist(self.doclist, "mtn_details"):
if d.serial_no:
serial_nos = sl_obj.get_sr_no_list(d.serial_no)
for x in serial_nos:
serial_no = x.strip()
if d.s_warehouse:
sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
if d.t_warehouse:
sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose)
if self.doc.purpose == "Purchase Return":
# delete_doc("Serial No", serial_no)
serial_doc = Document("Serial No", serial_no)
serial_doc.status = "Purchase Returned"
serial_doc.docstatus = 2
serial_doc.save()
示例11: update_serial_no
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def update_serial_no(self, is_submit):
"""Create / Update Serial No"""
from stock.utils import get_valid_serial_nos
sl_obj = get_obj("Stock Ledger")
if is_submit:
sl_obj.validate_serial_no_warehouse(self, "mtn_details")
for d in getlist(self.doclist, "mtn_details"):
if cstr(d.serial_no).strip():
for x in get_valid_serial_nos(d.serial_no):
serial_no = x.strip()
if d.s_warehouse:
sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit)
if d.t_warehouse:
sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose)
if self.doc.purpose == "Purchase Return":
serial_doc = Document("Serial No", serial_no)
serial_doc.status = is_submit and "Purchase Returned" or "In Store"
serial_doc.docstatus = is_submit and 2 or 0
serial_doc.save()
示例12: get_leadcomm_detail
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def get_leadcomm_detail(self):
check_communication_exist=webnotes.conn.sql("select name from `tabCommunication` where parent='%s'"%(self.doc.name))
if not check_communication_exist:
if self.doc.lead:
res=webnotes.conn.sql("select name from `tabCommunication` where parent='%s'"%(self.doc.lead))
for name in res:
#webnotes.errprint(name)
content=webnotes.conn.sql("select * from `tabCommunication` where name='%s'"%(name[0]),as_dict=1)
if content:
for data in content:
d=Document('Communication')
d.content=data.content
d.parent=self.doc.name
d.parenttype='Opportunity'
d.idx=data.idx
d.docstatus=data.docstatus
d.parentfield=data.parentfield
d.sender=data.sender
d.recipients=data.recipients
d.sent_or_received=data.sent_or_received
d.communication_medium=data.communication_medium
d.subject=data.subject
d.save()
示例13: sales_tax_html
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def sales_tax_html(self,parent,name,c):
tax_html=''
gl_data=[]
voucher_no=name
tax_data=sql("select charge_type,account_head,rate,description,tax_amount,total,parenttype,row_id from `tabSales Taxes and Charges` where parent='"+parent+"'",as_dict=1)
if tax_data:
for tax in tax_data:
if cint(c)==1:
t=Document('Sales Taxes and Charges')
t.parent=name
t.account_head=tax['account_head']
t.parentfield="other_charges"
t.charge_type=tax['charge_type']
t.description=tax['description']
t.row_id=tax['row_id']
t.docstatus=1
t.parenttype='Sales Invoice'
t.rate=tax['rate']
t.tax_amount=tax['tax_amount']
t.total=tax['total']
t.save()
tax_html+=("<tr><td style='width:50%;'>"+tax['description']+"</td><td style='width:50%;text-align:right;'>₹ "+cstr(tax['tax_amount'])+"</td></tr>")
if name==None:
voucher_no=parent
gl_data.append({
"account":tax['account_head'],
"cost_center":'Main - Frsh',
"debit":0,
"credit":cstr(tax['tax_amount']),
"against":webnotes.conn.get_value('Sales Invoice',voucher_no,'debit_to'),
"against_voucher":"",
"against_voucher_type":"",
"voucher_type":"Sales Invoice",
"voucher_no":voucher_no
})
self.create_gl(gl_data)
return tax_html
示例14: make_ledger
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def make_ledger(self):
from webnotes.model.doc import Document
for d in getlist(self.doclist, 'entries'):
check=webnotes.conn.sql("select status from `tabSerial No` where name='"+(d.serial_no).strip()+"'",as_list=1)
if check[0][0]=='Available':
sle=Document('Stock Ledger Entry')
sle.item_code=d.item_code
sle.serial_no=d.serial_no
sle.posting_date=nowdate()
sle.posting_time=nowtime()
sle.actual_qty=-d.qty
qty_data=webnotes.conn.sql("select b.actual_qty,foo.warehouse from(select item_code,warehouse from `tabSerial No` where name='"+(d.serial_no).strip()+"') as foo,tabBin as b where b.item_code=foo.item_code and b.warehouse=foo.warehouse",as_list=1,debug=1)
after_transfer=cstr(flt(qty_data[0][0])-flt(d.qty))
update_bin=webnotes.conn.sql("update `tabBin` set actual_qty='"+after_transfer+"', projected_qty='"+after_transfer+"' where item_code='"+d.item_code+"' and warehouse='"+qty_data[0][1]+"'")
sle.qty_after_transaction=after_transfer
sle.warehouse=qty_data[0][1]
sle.voucher_type='Delivery Note'
sle.voucher_no='GRN000056'
sle.stock_uom=webnotes.conn.get_value("Item",d.item_code,"stock_uom")
sle.company='PowerCap'
sle.fiscal_year=webnotes.conn.get_value("Global Defaults", None, "current_fiscal_year")
update_serial=webnotes.conn.sql("update `tabSerial No` set status='Delivered',warehouse=(select name from tabCustomer where 1=2) where name='"+(d.serial_no).strip()+"'")
sle.docstatus=1
sle.save()
示例15: sle
# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import docstatus [as 别名]
def sle(self):
make_bin=[]
qry="select sum(actual_qty) from `tabStock Ledger Entry` where item_code='"+self.doc.item+"' and warehouse='Finished Goods - P'"
#ebnotes.errprint(qry)
w3=webnotes.conn.sql(qry)
qty_after_transaction=cstr(cint(w3[0][0])+cint(self.doc.quantity))
actual_qty=self.doc.quantity
import time
tim=time.strftime("%X")
from webnotes.model.doc import Document
d = Document('Stock Ledger Entry')
d.item_code=self.doc.item
d.batch_no=self.doc.name
d.stock_uom='Nos'
d.warehouse='Finished Goods - P'
d.actual_qty=actual_qty
d.posting_date=today()
d.posting_time=tim
d.voucher_type='Purchase Receipt'
d.serial_no=self.doc.serial_no.replace('\n','')
d.qty_after_transaction=qty_after_transaction
d.is_cancelled = 'No'
d.company='PowerCap'
d.docstatus = 1;
d.name = 'Batch wise item updation'
d.owner = webnotes.session['user']
d.fields['__islocal'] = 1
d.save(new=1)
make_bin.append({
"doctype": 'b',
"sle_id":d.name,
"item_code": self.doc.item,
"warehouse": 'Finished Goods - P',
"actual_qty": actual_qty
})