本文整理汇总了Python中webnotes.model.doc.make_autoname函数的典型用法代码示例。如果您正苦于以下问题:Python make_autoname函数的具体用法?Python make_autoname怎么用?Python make_autoname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_autoname函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: autoname
def autoname(self):
#self.doc.name = make_autoname(self.doc.naming_series+'.#####')
# custom autoname
if self.doc.sub_category == 'INR':
self.doc.name = make_autoname(cstr(self.doc.supplier_name)+'/'+self.doc.naming_series+'/I/.####')
elif self.doc.sub_category == 'DI':
self.doc.name = make_autoname(cstr(self.doc.supplier_name)+'/'+self.doc.naming_series+'/D/.####')
示例2: autoname
def autoname(self):
ret = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'emp_created_by'")
if not ret:
msgprint("To Save Employee, please go to Setup -->Global Defaults. Click on HR and select 'Employee Records to be created by'.")
raise Exception
else:
if ret[0][0]=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif ret[0][0]=='Employee Number':
self.doc.name = make_autoname(self.doc.employee_number)
示例3: autoname
def autoname(self):
ret = sql("select value from `tabSingles` where doctype = 'Global Defaults' and field = 'emp_created_by'")
if not ret:
msgprint("Please setup Employee Naming System in Setup > Global Defaults > HR", raise_exception=True)
else:
if ret[0][0]=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif ret[0][0]=='Employee Number':
self.doc.name = make_autoname(self.doc.employee_number)
self.doc.employee = self.doc.name
示例4: autoname
def autoname(self):
key = webnotes.conn.get_value("LocGlobKey", None, "key")
curr = webnotes.conn.get_value('Series','A'+str(date.today().year)[-2:]+key,'current')
if cint(curr)==99:
key1 = key[0]
key2 = key[1]
key2 = key2.replace(key2,chr(ord(key2)+1))
key = key1 + key2
webnotes.conn.set_value("LocGlobKey", "LocGlobKey", "key", key)
self.doc.patient_local_id = make_autoname('A'+str(date.today().year)[-2:]+key+'.##')
# self.doc.name = self.doc.patient_local_id
dt=today()
ss="C"+cstr(dt[2:4]+cstr(dt[5:7]))+self.doc.lab_branch[1:]+"-"+key+"-"+''
key="GID.##"
n = ''
l = key.split('.')
series_set = False
doctype=''
for e in l:
en = ''
if e.startswith('#'):
if not series_set:
digits = len(e)
en = self.getseries(n, digits, doctype)
series_set = True
else: en = e
n+=en
self.doc.patient_online_id=ss+n[3:]
self.doc.name = self.doc.patient_online_id
示例5: test_5_make_autoname
def test_5_make_autoname(self):
new_name = doc.make_autoname(self.test_doc.name,self.test_doc.parenttype)
last_name = testlib.test_conn.sql("select name from `tab%s` order by name desc limit 1"%testlib.test_doctype)
if not last_name:
last_name = '0'
webnotes.conn.commit()
assert (cint(new_name[get_num_start_pos(new_name):])) - cint(last_name[get_num_start_pos(last_name):])
示例6: convert_into_recurring
def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice:
self.set_next_date()
if not self.doc.recurring_id:
webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
elif self.doc.recurring_id:
webnotes.conn.sql("""update `tabReceivable Voucher` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
示例7: validate_serial_no
def validate_serial_no(self, item_det):
if item_det.has_serial_no=="No":
if self.doc.serial_no:
webnotes.throw(_("Serial Number should be blank for Non Serialized Item" + ": " + self.doc.item),
SerialNoNotRequiredError)
else:
if self.doc.serial_no:
serial_nos = get_serial_nos(self.doc.serial_no)
if cint(self.doc.actual_qty) != flt(self.doc.actual_qty):
webnotes.throw(_("Serial No qty cannot be a fraction") + \
(": %s (%s)" % (self.doc.item_code, self.doc.actual_qty)))
if len(serial_nos) and len(serial_nos) != abs(cint(self.doc.actual_qty)):
webnotes.throw(_("Serial Nos do not match with qty") + \
(": %s (%s)" % (self.doc.item_code, self.doc.actual_qty)), SerialNoQtyError)
# check serial no exists, if yes then source
for serial_no in serial_nos:
if webnotes.conn.exists("Serial No", serial_no):
sr = webnotes.bean("Serial No", serial_no)
if sr.doc.item_code!=self.doc.item_code:
webnotes.throw(_("Serial No does not belong to Item") + \
(": %s (%s)" % (self.doc.item_code, serial_no)), SerialNoItemError)
sr.make_controller().via_stock_ledger = True
if self.doc.actual_qty < 0:
if sr.doc.warehouse!=self.doc.warehouse:
webnotes.throw(_("Warehouse does not belong to Item") + \
(": %s (%s)" % (self.doc.item_code, serial_no)), SerialNoWarehouseError)
if self.doc.voucher_type in ("Delivery Note", "Sales Invoice") \
and sr.doc.status != "Available":
webnotes.throw(_("Serial No status must be 'Available' to Deliver") + \
": " + serial_no, SerialNoStatusError)
sr.doc.warehouse = None
sr.save()
else:
sr.doc.warehouse = self.doc.warehouse
sr.save()
else:
if self.doc.actual_qty < 0:
# transfer out
webnotes.throw(_("Serial No must exist to transfer out.") + \
": " + serial_no, SerialNoNotExistsError)
else:
# transfer in
self.make_serial_no(serial_no)
else:
if item_det.serial_no_series:
from webnotes.model.doc import make_autoname
serial_nos = []
for i in xrange(cint(self.doc.actual_qty)):
serial_nos.append(self.make_serial_no(make_autoname(item_det.serial_no_series)))
self.doc.serial_no = "\n".join(serial_nos)
else:
webnotes.throw(_("Serial Number Required for Serialized Item" + ": " + self.doc.item),
SerialNoRequiredError)
示例8: autoname
def autoname(self):
cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
if cust_master_name == 'Customer Name':
if webnotes.conn.exists("Supplier", self.doc.customer_name):
msgprint(_("A Supplier exists with same name"), raise_exception=1)
self.doc.name = self.doc.customer_name
else:
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
示例9: autoname
def autoname(self):
if webnotes.conn.get_default("item_naming_by")=="Naming Series":
from webnotes.model.doc import make_autoname
self.doc.item_code = make_autoname(self.doc.naming_series+'.#####')
elif not self.doc.item_code:
msgprint(_("Item Code (item_code) is mandatory because Item naming is not sequential."), raise_exception=1)
self.doc.name = self.doc.item_code
示例10: autoname
def autoname(self):
supp_master_name = get_defaults()['supp_master_name']
if supp_master_name == 'Supplier Name':
if webnotes.conn.exists("Customer", self.doc.supplier_name):
webnotes.msgprint(_("A Customer exists with same name"), raise_exception=1)
self.doc.name = self.doc.supplier_name
else:
self.doc.name = make_autoname(self.doc.naming_series + '.#####')
示例11: convert_into_recurring
def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice:
if not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
msgprint("Invoice period from date and to date is mandatory for recurring invoice", raise_exception=1)
self.set_next_date()
if not self.doc.recurring_id:
webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
elif self.doc.recurring_id:
webnotes.conn.sql("""update `tabSales Invoice` set convert_into_recurring_invoice = 0 where recurring_id = %s""", self.doc.recurring_id)
示例12: autoname
def autoname(self):
naming_method = webnotes.conn.get_value("HR Settings", None, "emp_created_by")
if not naming_method:
webnotes.throw(_("Please setup Employee Naming System in Human Resource > HR Settings"))
else:
if naming_method=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif naming_method=='Employee Number':
self.doc.name = self.doc.employee_number
self.doc.employee = self.doc.name
示例13: convert_into_recurring
def convert_into_recurring(self):
if self.doc.convert_into_recurring_invoice:
self.set_next_date()
if not self.doc.recurring_id:
webnotes.conn.set(self.doc, "recurring_id", make_autoname("RECINV/.#####"))
elif self.doc.recurring_id:
webnotes.conn.sql(
"""update `tabReceivable Voucher` set convert_into_recurring_invoice = 0 where recurring_id = %s""",
self.doc.recurring_id,
)
self.manage_scheduler()
示例14: convert_to_recurring
def convert_to_recurring(self):
if self.doc.convert_into_recurring_invoice:
if not self.doc.recurring_id:
webnotes.conn.set(self.doc, "recurring_id",
make_autoname("RECINV/.#####"))
self.set_next_date()
elif self.doc.recurring_id:
webnotes.conn.sql("""update `tabSales Invoice`
set convert_into_recurring_invoice = 0
where recurring_id = %s""", (self.doc.recurring_id,))
示例15: autoname
def autoname(self):
cust_master_name = get_defaults().get('cust_master_name')
if cust_master_name == 'Customer Name':
# filter out bad characters in name
#cust = self.doc.customer_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
cust = self.doc.customer_name
supp = sql("select name from `tabSupplier` where name = %s", (cust))
supp = supp and supp[0][0] or ''
if supp:
msgprint("You already have a Supplier with same name")
raise Exception("You already have a Supplier with same name")
else:
self.doc.name = cust
else:
self.doc.name = make_autoname(self.doc.naming_series+'.#####')