mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Merge pull request #25660 from deepeshgarg007/promotional_item_cost_center
fix: Breaking cost center validation
This commit is contained in:
@@ -368,6 +368,11 @@ class AccountsController(TransactionBase):
|
|||||||
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
|
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
|
||||||
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
|
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
|
||||||
|
|
||||||
|
# Double check for cost center
|
||||||
|
# Items add via promotional scheme may not have cost center set
|
||||||
|
if hasattr(item, 'cost_center') and not item.get('cost_center'):
|
||||||
|
item.set('cost_center', self.get('cost_center') or erpnext.get_default_cost_center(self.company))
|
||||||
|
|
||||||
if ret.get("pricing_rules"):
|
if ret.get("pricing_rules"):
|
||||||
self.apply_pricing_rule_on_items(item, ret)
|
self.apply_pricing_rule_on_items(item, ret)
|
||||||
self.set_pricing_rule_details(item, ret)
|
self.set_pricing_rule_details(item, ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user