fix: can't add child table in item price
This commit is contained in:
parent
c837b5f48c
commit
2be23309bb
@ -50,16 +50,18 @@ class ItemPrice(Document):
|
|||||||
|
|
||||||
def check_duplicates(self):
|
def check_duplicates(self):
|
||||||
conditions = "where item_code=%(item_code)s and price_list=%(price_list)s and name != %(name)s"
|
conditions = "where item_code=%(item_code)s and price_list=%(price_list)s and name != %(name)s"
|
||||||
|
condition_data_dict = dict(item_code=self.item_code, price_list=self.price_list, name=self.name)
|
||||||
|
|
||||||
for field in ['uom', 'valid_from',
|
for field in ['uom', 'valid_from',
|
||||||
'valid_upto', 'packing_unit', 'customer', 'supplier']:
|
'valid_upto', 'packing_unit', 'customer', 'supplier']:
|
||||||
if self.get(field):
|
if self.get(field):
|
||||||
conditions += " and {0} = %({1})s".format(field, field)
|
conditions += " and {0} = %({1})s".format(field, field)
|
||||||
|
condition_data_dict[field] = self.get(field)
|
||||||
|
|
||||||
price_list_rate = frappe.db.sql("""
|
price_list_rate = frappe.db.sql("""
|
||||||
SELECT price_list_rate
|
SELECT price_list_rate
|
||||||
FROM `tabItem Price`
|
FROM `tabItem Price`
|
||||||
{conditions} """.format(conditions=conditions), self.as_dict())
|
{conditions} """.format(conditions=conditions), condition_data_dict)
|
||||||
|
|
||||||
if price_list_rate :
|
if price_list_rate :
|
||||||
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty and Dates."), ItemPriceDuplicateItem)
|
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty and Dates."), ItemPriceDuplicateItem)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user