[validation] invoice rate will be same as order/delivery
This commit is contained in:
parent
455c245dce
commit
d39b30ab99
@ -74,9 +74,11 @@ class DocType(SellingController):
|
||||
self.set_aging_date()
|
||||
self.set_against_income_account()
|
||||
self.validate_c_form()
|
||||
self.validate_rate_with_refdoc()
|
||||
self.validate_time_logs_are_submitted()
|
||||
self.validate_recurring_invoice()
|
||||
|
||||
|
||||
def on_submit(self):
|
||||
if cint(self.doc.is_pos) == 1:
|
||||
if cint(self.doc.update_stock) == 1:
|
||||
@ -213,8 +215,9 @@ class DocType(SellingController):
|
||||
if self.doc.customer:
|
||||
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
||||
where (name = %s or (master_name = %s and master_type = 'customer'))
|
||||
and docstatus != 2""",
|
||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr(), self.doc.customer))
|
||||
and docstatus != 2 and company = %s""",
|
||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr(),
|
||||
self.doc.customer, self.doc.company))
|
||||
|
||||
if acc_head and acc_head[0][0]:
|
||||
return acc_head[0][0]
|
||||
@ -551,6 +554,19 @@ class DocType(SellingController):
|
||||
|
||||
webnotes.conn.set(self.doc, 'c_form_no', '')
|
||||
|
||||
def validate_rate_with_refdoc(self):
|
||||
"""Validate values with reference document with previous document"""
|
||||
for d in self.doclist.get({"parentfield": "entries"}):
|
||||
if d.so_detail:
|
||||
self.check_value("Sales Order", d.so_detail, d.export_rate, d.item_code)
|
||||
if d.dn_detail:
|
||||
self.check_value("Delivery Note", d.dn_detail, d.export_rate, d.item_code)
|
||||
|
||||
def check_value(self, ref_dt, ref_dn, val, item_code):
|
||||
ref_val = webnotes.conn.get_value(ref_dt + "Item", ref_dn, "export_rate")
|
||||
if flt(ref_val) != val:
|
||||
msgprint(_("Rate is not matching with ") + ref_dt + ": " + ref_dn +
|
||||
_(" for item: ") + item_code, raise_exception=True)
|
||||
|
||||
def update_current_stock(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
|
Loading…
Reference in New Issue
Block a user