From a74468b35378eb01074295469fb1091d60c6d374 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 30 Dec 2014 18:33:52 +0530 Subject: [PATCH] set missing cost center using default --- erpnext/controllers/accounts_controller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 49845f6868..f6d47dd420 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -119,6 +119,10 @@ class AccountsController(TransactionBase): item.get(fieldname) is None and value is not None: item.set(fieldname, value) + if fieldname == "cost_center" and item.meta.get_field("cost_center") \ + and not item.get("cost_center") and value is not None: + item.set(fieldname, value) + if ret.get("pricing_rule"): for field in ["base_price_list_rate", "price_list_rate", "discount_percentage", "base_rate", "rate"]: