mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-12 17:51:20 +00:00
* fix: UOM was not fetching in purchase invoice * fix: Changes requested Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
@@ -330,23 +330,6 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
frm: cur_frm
|
frm: cur_frm
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
item_code: function(frm, cdt, cdn) {
|
|
||||||
var row = locals[cdt][cdn];
|
|
||||||
if(row.item_code) {
|
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.assets.doctype.asset_category.asset_category.get_asset_category_account",
|
|
||||||
args: {
|
|
||||||
"item": row.item_code,
|
|
||||||
"fieldname": "fixed_asset_account",
|
|
||||||
"company": frm.doc.company
|
|
||||||
},
|
|
||||||
callback: function(r, rt) {
|
|
||||||
frappe.model.set_value(cdt, cdn, "expense_account", r.message);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
|
cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice);
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ def get_asset_category_account(fieldname, item=None, asset=None, account=None, a
|
|||||||
account=None
|
account=None
|
||||||
|
|
||||||
if not account:
|
if not account:
|
||||||
asset_category, company = frappe.db.get_value("Asset", asset, ["asset_category", "company"])
|
asset_details = frappe.db.get_value("Asset", asset, ["asset_category", "company"])
|
||||||
|
asset_category, company = asset_details or [None, None]
|
||||||
|
|
||||||
account = frappe.db.get_value("Asset Category Account",
|
account = frappe.db.get_value("Asset Category Account",
|
||||||
filters={"parent": asset_category, "company_name": company}, fieldname=fieldname)
|
filters={"parent": asset_category, "company_name": company}, fieldname=fieldname)
|
||||||
|
|||||||
@@ -254,6 +254,12 @@ def get_basic_details(args, item, overwrite_warehouse=True):
|
|||||||
args['material_request_type'] = frappe.db.get_value('Material Request',
|
args['material_request_type'] = frappe.db.get_value('Material Request',
|
||||||
args.get('name'), 'material_request_type', cache=True)
|
args.get('name'), 'material_request_type', cache=True)
|
||||||
|
|
||||||
|
expense_account = None
|
||||||
|
|
||||||
|
if args.get('doctype') == 'Purchase Invoice' and item.is_fixed_asset:
|
||||||
|
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
|
||||||
|
expense_account = get_asset_category_account(fieldname = "fixed_asset_account", item = args.item_code, company= args.company)
|
||||||
|
|
||||||
#Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master
|
#Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master
|
||||||
if not args.uom:
|
if not args.uom:
|
||||||
if args.get('doctype') in sales_doctypes:
|
if args.get('doctype') in sales_doctypes:
|
||||||
@@ -271,7 +277,7 @@ def get_basic_details(args, item, overwrite_warehouse=True):
|
|||||||
"image": cstr(item.image).strip(),
|
"image": cstr(item.image).strip(),
|
||||||
"warehouse": warehouse,
|
"warehouse": warehouse,
|
||||||
"income_account": get_default_income_account(args, item_defaults, item_group_defaults, brand_defaults),
|
"income_account": get_default_income_account(args, item_defaults, item_group_defaults, brand_defaults),
|
||||||
"expense_account": get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults),
|
"expense_account": expense_account or get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults) ,
|
||||||
"cost_center": get_default_cost_center(args, item_defaults, item_group_defaults, brand_defaults),
|
"cost_center": get_default_cost_center(args, item_defaults, item_group_defaults, brand_defaults),
|
||||||
'has_serial_no': item.has_serial_no,
|
'has_serial_no': item.has_serial_no,
|
||||||
'has_batch_no': item.has_batch_no,
|
'has_batch_no': item.has_batch_no,
|
||||||
|
|||||||
Reference in New Issue
Block a user