Fix cost center not getting pulled in DN and SINV (#8878)
* Fixes for getting selling cost center instead of company's default cost center. * fix error in update_item
This commit is contained in:
parent
67ddcf9d32
commit
3b04b030eb
@ -826,7 +826,8 @@ def make_delivery_note(source_name, target_doc=None):
|
||||
"parent": "against_sales_invoice",
|
||||
"serial_no": "serial_no",
|
||||
"sales_order": "against_sales_order",
|
||||
"so_detail": "so_detail"
|
||||
"so_detail": "so_detail",
|
||||
"cost_center": "cost_center"
|
||||
},
|
||||
"postprocess": update_item,
|
||||
"condition": lambda doc: doc.delivered_by_supplier!=1
|
||||
|
@ -427,6 +427,11 @@ def make_delivery_note(source_name, target_doc=None):
|
||||
target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate)
|
||||
target.qty = flt(source.qty) - flt(source.delivered_qty)
|
||||
|
||||
item = frappe.db.get_value("Item", target.item_code, ["item_group", "selling_cost_center"], as_dict=1)
|
||||
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center") \
|
||||
or item.selling_cost_center \
|
||||
or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
|
||||
|
||||
target_doc = get_mapped_doc("Sales Order", source_name, {
|
||||
"Sales Order": {
|
||||
"doctype": "Delivery Note",
|
||||
|
@ -398,7 +398,8 @@ def make_sales_invoice(source_name, target_doc=None):
|
||||
"parent": "delivery_note",
|
||||
"so_detail": "so_detail",
|
||||
"against_sales_order": "sales_order",
|
||||
"serial_no": "serial_no"
|
||||
"serial_no": "serial_no",
|
||||
"cost_center": "cost_center"
|
||||
},
|
||||
"postprocess": update_item,
|
||||
"filter": lambda d: abs(d.qty) - abs(invoiced_qty_map.get(d.name, 0))<=0
|
||||
|
Loading…
Reference in New Issue
Block a user