mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
[fix] [mapper] add rows only table is blank, allow multiple time pull and validation if same item pulled twice
This commit is contained in:
@@ -114,16 +114,6 @@ class DocType(BuyingController):
|
||||
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
|
||||
return ret
|
||||
|
||||
def validate_duplicate_docname(self,doctype):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if doctype == 'purchase_receipt' and cstr(self.doc.purchase_receipt_main) == cstr(d.purchase_receipt):
|
||||
msgprint(cstr(self.doc.purchase_receipt_main) + " purchase receipt details have already been pulled.")
|
||||
raise Exception , " Validation Error. "
|
||||
|
||||
if doctype == 'purchase_order' and cstr(self.doc.purchase_order_main) == cstr(d.purchase_order) and not d.purchase_receipt:
|
||||
msgprint(cstr(self.doc.purchase_order_main) + " purchase order details have already been pulled.")
|
||||
raise Exception , " Validation Error. "
|
||||
|
||||
def check_active_purchase_items(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
if d.item_code: # extra condn coz item_code is not mandatory in PV
|
||||
|
||||
@@ -276,25 +276,6 @@ class DocType(SellingController):
|
||||
|
||||
if self.doc.debit_to:
|
||||
self.doc.customer = webnotes.conn.get_value('Account',self.doc.debit_to,'master_name')
|
||||
|
||||
def update_accounts(self):
|
||||
if not self.doc.debit_to:
|
||||
self.doc.debit_to = self.get_debit_to().get("debit_to")
|
||||
|
||||
self.get_income_expense_account('entries')
|
||||
|
||||
def get_income_expense_account(self,doctype):
|
||||
auto_inventory_accounting = cint(webnotes.defaults.get_global_default("auto_inventory_accounting"))
|
||||
default_cost_center = webnotes.conn.get_value("Company", self.doc.company, "cost_center")
|
||||
for d in getlist(self.doclist, doctype):
|
||||
if d.item_code:
|
||||
item = webnotes.conn.get_value("Item", d.item_code, ["default_income_account",
|
||||
"default_sales_cost_center", "purchase_account"], as_dict=True)
|
||||
d.income_account = item['default_income_account'] or ""
|
||||
d.cost_center = item['default_sales_cost_center'] or default_cost_center
|
||||
|
||||
if auto_inventory_accounting and cint(self.doc.update_stock):
|
||||
d.expense_account = item['purchase_account'] or ""
|
||||
|
||||
def get_barcode_details(self, barcode):
|
||||
return get_obj('Sales Common').get_barcode_details(barcode)
|
||||
|
||||
Reference in New Issue
Block a user