-Fix for updated get_default_cost_center
-Back to not updating item's defaults child table
This commit is contained in:
parent
127b3f552b
commit
7d9ee83d5a
@ -86,7 +86,7 @@ class Item(WebsiteGenerator):
|
||||
def after_insert(self):
|
||||
'''set opening stock and item price'''
|
||||
if self.standard_rate:
|
||||
for default in self.item_defaults:
|
||||
for default in self.item_defaults or [frappe._dict()]:
|
||||
self.add_price(default.default_price_list)
|
||||
|
||||
if self.opening_stock:
|
||||
@ -126,9 +126,6 @@ class Item(WebsiteGenerator):
|
||||
self.validate_fixed_asset()
|
||||
self.validate_retain_sample()
|
||||
self.validate_uom_conversion_factor()
|
||||
self.validate_item_defaults()
|
||||
self.update_defaults_from_item_group()
|
||||
self.update_defaults_add_company()
|
||||
|
||||
if not self.get("__islocal"):
|
||||
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
|
||||
@ -136,10 +133,6 @@ class Item(WebsiteGenerator):
|
||||
from `tabWebsite Item Group`
|
||||
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
|
||||
|
||||
def update_defaults_add_company(self):
|
||||
if not self.item_defaults:
|
||||
self.append("item_defaults", {"company": frappe.defaults.get_defaults().company})
|
||||
|
||||
def on_update(self):
|
||||
invalidate_cache_for_item(self)
|
||||
self.validate_name_with_item_group()
|
||||
@ -181,7 +174,7 @@ class Item(WebsiteGenerator):
|
||||
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
|
||||
|
||||
# default warehouse, or Stores
|
||||
for default in self.item_defaults:
|
||||
for default in self.item_defaults or [frappe._dict({'company': frappe.defaults.get_defaults().company})]:
|
||||
default_warehouse = (default.default_warehouse
|
||||
or frappe.db.get_single_value('Stock Settings', 'default_warehouse')
|
||||
or frappe.db.get_value('Warehouse', {'warehouse_name': _('Stores')}))
|
||||
|
@ -10,6 +10,7 @@ from erpnext.stock.utils import get_incoming_rate
|
||||
from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError, get_valuation_rate
|
||||
from erpnext.stock.get_item_details import get_bin_details, get_default_cost_center, get_conversion_factor, get_reserved_qty_for_so
|
||||
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
|
||||
from erpnext.setup.doctype.brand.brand import get_brand_defaults
|
||||
from erpnext.stock.doctype.batch.batch import get_batch_no, set_batch_nos, get_batch_qty
|
||||
from erpnext.stock.doctype.item.item import get_item_defaults
|
||||
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no, add_additional_cost
|
||||
@ -631,6 +632,7 @@ class StockEntry(StockController):
|
||||
|
||||
item = item[0]
|
||||
item_group_defaults = get_item_group_defaults(item.name, self.company)
|
||||
brand_defaults = get_brand_defaults(item.name, self.company)
|
||||
|
||||
ret = frappe._dict({
|
||||
'uom' : item.stock_uom,
|
||||
@ -639,7 +641,7 @@ class StockEntry(StockController):
|
||||
'image' : item.image,
|
||||
'item_name' : item.item_name,
|
||||
'expense_account' : args.get("expense_account"),
|
||||
'cost_center' : get_default_cost_center(args, item, item_group_defaults),
|
||||
'cost_center' : get_default_cost_center(args, item, item_group_defaults, brand_defaults),
|
||||
'qty' : args.get("qty"),
|
||||
'transfer_qty' : args.get('qty'),
|
||||
'conversion_factor' : 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user