本文整理汇总了Python中webnotes.msgprint函数的典型用法代码示例。如果您正苦于以下问题:Python msgprint函数的具体用法?Python msgprint怎么用?Python msgprint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msgprint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: make_gl_entries
def make_gl_entries(self, doc, doclist, cancel=0, adv_adj = 0, use_mapper='', merge_entries = 1, update_outstanding='Yes'):
self.entries = []
# get entries
le_map_list = webnotes.conn.sql("select * from `tabGL Mapper Detail` where parent = %s", use_mapper or doc.doctype, as_dict=1)
self.td, self.tc = 0.0, 0.0
for le_map in le_map_list:
if le_map['table_field']:
for d in getlist(doclist,le_map['table_field']):
# purchase_tax_details is the table of other charges in purchase cycle
if le_map['table_field'] != 'purchase_tax_details' or (le_map['table_field'] == 'purchase_tax_details' and d.fields.get('category') != 'For Valuation'):
self.make_single_entry(doc,d,le_map,cancel, merge_entries)
else:
self.make_single_entry(None,doc,le_map,cancel, merge_entries)
# save entries
self.save_entries(cancel, adv_adj, update_outstanding)
# check total debit / credit
# Due to old wrong entries (total debit != total credit) some voucher could be cancelled
if abs(self.td - self.tc) > 0.001 and not cancel:
msgprint("Debit and Credit not equal for this voucher: Diff (Debit) is %s" % (self.td-self.tc))
raise Exception
# set as cancelled
if cancel:
vt, vn = self.get_val(le_map['voucher_type'], doc, doc), self.get_val(le_map['voucher_no'], doc, doc)
webnotes.conn.sql("update `tabGL Entry` set is_cancelled='Yes' where voucher_type=%s and voucher_no=%s", (vt, vn))
开发者ID:Coalas,项目名称:erpnext,代码行数:27,代码来源:gl_control.py
示例2: check_if_expired
def check_if_expired():
"""check if account is expired. If expired, do not allow login"""
import conf
# check if expires_on is specified
if not hasattr(conf, 'expires_on'): return
# check if expired
from datetime import datetime, date
expires_on = datetime.strptime(conf.expires_on, '%Y-%m-%d').date()
if date.today() <= expires_on: return
# if expired, stop user from logging in
from webnotes.utils import formatdate
msg = """Oops! Your subscription expired on <b>%s</b>.<br>""" % formatdate(conf.expires_on)
if 'System Manager' in webnotes.user.get_roles():
msg += """Just drop in a mail at <b>[email protected]</b> and
we will guide you to get your account re-activated."""
else:
msg += """Just ask your System Manager to drop in a mail at <b>[email protected]</b> and
we will guide him to get your account re-activated."""
webnotes.msgprint(msg)
webnotes.response['message'] = 'Account Expired'
raise webnotes.AuthenticationError
开发者ID:frank1638,项目名称:erpnext,代码行数:26,代码来源:event_handlers.py
示例3: get_balance
def get_balance(self):
if not getlist(self.doclist,'entries'):
msgprint("Please enter atleast 1 entry in 'GL Entries' table")
else:
flag, self.doc.total_debit, self.doc.total_credit = 0, 0, 0
diff = flt(self.doc.difference, 2)
# If any row without amount, set the diff on that row
for d in getlist(self.doclist,'entries'):
if not d.credit and not d.debit and diff != 0:
if diff>0:
d.credit = diff
elif diff<0:
d.debit = diff
flag = 1
# Set the diff in a new row
if flag == 0 and diff != 0:
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
if diff>0:
jd.credit = abs(diff)
elif diff<0:
jd.debit = abs(diff)
# Set the total debit, total credit and difference
for d in getlist(self.doclist,'entries'):
self.doc.total_debit += flt(d.debit, 2)
self.doc.total_credit += flt(d.credit, 2)
self.doc.difference = flt(self.doc.total_debit, 2) - flt(self.doc.total_credit, 2)
开发者ID:cocoy,项目名称:erpnext,代码行数:30,代码来源:journal_voucher.py
示例4: on_update
def on_update(self):
# Set default warehouse from pos setting
if cint(self.doc.is_pos) == 1:
if cint(self.doc.update_stock) == 1:
w = self.get_warehouse()
if w:
for d in getlist(self.doclist, 'entries'):
if not d.warehouse:
d.warehouse = cstr(w)
self.make_packing_list()
else:
self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
if flt(self.doc.paid_amount) == 0:
if self.doc.cash_bank_account:
webnotes.conn.set(self.doc, 'paid_amount',
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
else:
# show message that the amount is not paid
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
else:
self.doclist = self.doc.clear_table(self.doclist, 'packing_details')
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.conn.set(self.doc, 'outstanding_amount',
flt(self.doc.grand_total) - flt(self.doc.total_advance) -
flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
开发者ID:masums,项目名称:erpnext,代码行数:30,代码来源:sales_invoice.py
示例5: execute_cmd
def execute_cmd(cmd):
"""execute a request as python module"""
validate_cmd(cmd)
method = get_method(cmd)
# check if whitelisted
if webnotes.session['user'] == 'Guest':
if (method not in webnotes.guest_methods):
webnotes.response['403'] = 1
raise Exception, 'Not Allowed, %s' % str(method)
else:
if not method in webnotes.whitelisted:
webnotes.response['403'] = 1
webnotes.msgprint('Not Allowed, %s' % str(method))
raise Exception, 'Not Allowed, %s' % str(method)
if not webnotes.conn.in_transaction:
webnotes.conn.begin()
if 'arg' in webnotes.form_dict:
# direct method call
ret = method(webnotes.form_dict.get('arg'))
else:
ret = method()
# returns with a message
if ret:
webnotes.response['message'] = ret
# update session
webnotes.session_obj.update()
if webnotes.conn.in_transaction:
webnotes.conn.commit()
开发者ID:mehulsbhatt,项目名称:wnframework,代码行数:34,代码来源:handler.py
示例6: check_mandatory
def check_mandatory(self):
""" Check mandatory fields """
if not self.doc.from_pr_date or not self.doc.to_pr_date:
msgprint("Please enter From and To PR Date", raise_exception=1)
if not self.doc.currency:
msgprint("Please enter Currency.", raise_exception=1)
开发者ID:trycatcher,项目名称:erpnext,代码行数:7,代码来源:landed_cost_wizard.py
示例7: validate_proj_cust
def validate_proj_cust(self):
"""check for does customer belong to same project as entered.."""
if self.doc.project_name and self.doc.customer:
res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
if not res:
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
raise Exception
开发者ID:masums,项目名称:erpnext,代码行数:7,代码来源:sales_invoice.py
示例8: validate_time_logs_are_submitted
def validate_time_logs_are_submitted(self):
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
if d.time_log_batch:
status = webnotes.conn.get_value("Time Log Batch", d.time_log_batch, "status")
if status!="Submitted":
webnotes.msgprint(_("Time Log Batch status must be 'Submitted'") + ":" + d.time_log_batch,
raise_exception=True)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:7,代码来源:sales_invoice.py
示例9: get_bank_cash_account
def get_bank_cash_account(mode_of_payment):
val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
if not val:
webnotes.msgprint("Default Bank / Cash Account not set in Mode of Payment: %s. Please add a Default Account in Mode of Payment master." % mode_of_payment)
return {
"cash_bank_account": val
}
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:7,代码来源:sales_invoice.py
示例10: update_add_node
def update_add_node(doctype, name, parent, parent_field):
"""
insert a new node
"""
from webnotes.utils import now
n = now()
# get the last sibling of the parent
if parent:
right = webnotes.conn.sql("select rgt from `tab%s` where name='%s'" % (doctype, parent))[0][0]
else: # root
right = webnotes.conn.sql("select ifnull(max(rgt),0)+1 from `tab%s` where ifnull(`%s`,'') =''" % (doctype, parent_field))[0][0]
right = right or 1
# update all on the right
webnotes.conn.sql("update `tab%s` set rgt = rgt+2, modified='%s' where rgt >= %s" %(doctype,n,right))
webnotes.conn.sql("update `tab%s` set lft = lft+2, modified='%s' where lft >= %s" %(doctype,n,right))
# update index of new node
if webnotes.conn.sql("select * from `tab%s` where lft=%s or rgt=%s"% (doctype, right, right+1)):
webnotes.msgprint("Nested set error. Please send mail to support")
raise Exception
webnotes.conn.sql("update `tab%s` set lft=%s, rgt=%s, modified='%s' where name='%s'" % (doctype,right,right+1,n,name))
return right
开发者ID:frank1638,项目名称:wnframework,代码行数:25,代码来源:nestedset.py
示例11: on_trash
def on_trash(self):
parent = self.doc.fields[self.nsm_parent_field]
if not parent:
msgprint(_("Root ") + self.doc.doctype + _(" cannot be deleted."), raise_exception=1)
parent = ""
update_nsm(self)
开发者ID:frank1638,项目名称:wnframework,代码行数:7,代码来源:nestedset.py
示例12: do_stock_reco
def do_stock_reco(self, is_submit = 1):
"""
Make stock entry of qty diff, calculate incoming rate to maintain valuation rate.
If no qty diff, but diff in valuation rate, make (+1,-1) entry to update valuation
"""
for row in self.data:
# Get qty as per system
sys_stock = self.get_system_stock(row[0],row[1])
# Diff between file and system
qty_diff = row[2] != '~' and flt(row[2]) - flt(sys_stock['actual_qty']) or 0
rate_diff = row[3] != '~' and flt(row[3]) - flt(sys_stock['val_rate']) or 0
# Make sl entry
if qty_diff:
self.make_sl_entry(is_submit, row, qty_diff, sys_stock)
elif rate_diff:
self.make_sl_entry(is_submit, row, 1, sys_stock)
sys_stock['val_rate'] = row[3]
sys_stock['actual_qty'] += 1
self.make_sl_entry(is_submit, row, -1, sys_stock)
if is_submit == 1:
self.add_data_in_CSV(qty_diff, rate_diff)
msgprint("Stock Reconciliation Completed Successfully...")
开发者ID:antoxin,项目名称:erpnext,代码行数:26,代码来源:stock_reconciliation.py
示例13: on_submit
def on_submit(self):
if self.doc.status != "Approved":
webnotes.msgprint("""Only Leave Applications with status 'Approved' can be Submitted.""",
raise_exception=True)
# notify leave applier about approval
self.notify_employee(self.doc.status)
开发者ID:gangadhar-kadam,项目名称:erpnext,代码行数:7,代码来源:leave_application.py
示例14: update_against_document_in_jv
def update_against_document_in_jv(self, obj, table_field_name, against_document_no, against_document_doctype, account_head, dr_or_cr,doctype):
for d in getlist(obj.doclist, table_field_name):
self.validate_jv_entry(d, account_head, dr_or_cr)
if flt(d.advance_amount) == flt(d.allocated_amount):
# cancel JV
jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj =1)
# update ref in JV Detail
webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s' where name = '%s'" % (doctype=='Purchase Invoice' and 'against_voucher' or 'against_invoice', cstr(against_document_no), d.jv_detail_no))
# re-submit JV
jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj =1)
elif flt(d.advance_amount) > flt(d.allocated_amount):
# cancel JV
jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children=1)
get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel =1, adv_adj = 1)
# add extra entries
self.add_extra_entry(jv_obj, d.journal_voucher, d.jv_detail_no, flt(d.allocated_amount), account_head, doctype, dr_or_cr, against_document_no)
# re-submit JV
jv_obj = get_obj('Journal Voucher', d.journal_voucher, with_children =1)
get_obj(dt='GL Control').make_gl_entries(jv_obj.doc, jv_obj.doclist, cancel = 0, adv_adj = 1)
else:
msgprint("Allocation amount cannot be greater than advance amount")
raise Exception
开发者ID:Coalas,项目名称:erpnext,代码行数:29,代码来源:gl_control.py
示例15: send
def send(self):
"""
* Execute get method
* Send email to recipients
"""
if not self.doc.recipient_list: return
self.sending = True
result, email_body = self.get()
recipient_list = self.doc.recipient_list.split("\n")
# before sending, check if user is disabled or not
# do not send if disabled
profile_list = webnotes.conn.sql("SELECT name, enabled FROM tabProfile", as_dict=1)
for profile in profile_list:
if profile['name'] in recipient_list and profile['enabled'] == 0:
del recipient_list[recipient_list.index(profile['name'])]
from webnotes.utils.email_lib import sendmail
try:
#webnotes.msgprint('in send')
sendmail(
recipients=recipient_list,
sender='[email protected]',
reply_to='[email protected]',
subject=self.doc.frequency + ' Digest',
msg=email_body,
from_defs=1
)
except Exception, e:
webnotes.msgprint('There was a problem in sending your email. Please contact [email protected]')
webnotes.errprint(webnotes.getTraceback())
开发者ID:antoxin,项目名称:erpnext,代码行数:33,代码来源:email_digest.py
示例16: set_last_contact_date
def set_last_contact_date(self):
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
self.doc.last_contact_date=self.doc.contact_date_ref
else:
msgprint("Contact Date Cannot be before Last Contact Date")
raise Exception
开发者ID:tobrahma,项目名称:erpnext,代码行数:7,代码来源:enquiry.py
示例17: validate_order_type
def validate_order_type(self):
valid_types = ["Sales", "Maintenance", "Shopping Cart"]
if not self.doc.order_type:
self.doc.order_type = "Sales"
elif self.doc.order_type not in valid_types:
msgprint(_(self.meta.get_label("order_type")) + " " +
_("must be one of") + ": " + comma_or(valid_types), raise_exception=True)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:7,代码来源:selling_controller.py
示例18: validate_fiscal_year
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
ysd=fy and fy[0][0] or ""
yed=add_days(str(ysd),365)
if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
msgprint("Enquiry Date is not within the Fiscal Year selected")
raise Exception
开发者ID:tobrahma,项目名称:erpnext,代码行数:7,代码来源:enquiry.py
示例19: validate_item_fetch
def validate_item_fetch(args, item):
from stock.utils import validate_end_of_life
validate_end_of_life(item.name, item.end_of_life)
# validate company
if not args.company:
msgprint(_("Please specify Company"), raise_exception=True)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:7,代码来源:transaction_base.py
示例20: on_cancel
def on_cancel(self):
chk = sql("select t1.name from `tabQuotation` t1, `tabQuotation Detail` t2 where t2.parent = t1.name and t1.docstatus=1 and (t1.status!='Order Lost' and t1.status!='Cancelled') and t2.prevdoc_docname = %s",self.doc.name)
if chk:
msgprint("Quotation No. "+cstr(chk[0][0])+" is submitted against this Enquiry. Thus can not be cancelled.")
raise Exception
else:
set(self.doc, 'status', 'Cancelled')
开发者ID:tobrahma,项目名称:erpnext,代码行数:7,代码来源:enquiry.py
注:本文中的webnotes.msgprint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论