Browse Source
Merge pull request #25660 from deepeshgarg007/promotional_item_cost_center
fix: Breaking cost center validation
develop
rohitwaghchaure
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
0 deletions
-
erpnext/controllers/accounts_controller.py
|
|
@ -368,6 +368,11 @@ class AccountsController(TransactionBase): |
|
|
|
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)) |
|
|
|
|
|
|
|
# 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"): |
|
|
|
self.apply_pricing_rule_on_items(item, ret) |
|
|
|
self.set_pricing_rule_details(item, ret) |
|
|
|