fix(repost item valuation): reorder function call

This commit is contained in:
ravibharathi656
2025-08-29 14:55:49 +05:30
parent aedb171dd4
commit aaa4f0ae26
2 changed files with 17 additions and 1 deletions

View File

@@ -132,4 +132,19 @@ frappe.ui.form.on("Repost Item Valuation", {
},
});
},
voucher_type: function (frm) {
console.log(frm.doc);
frm.trigger("set_company_on_transaction");
},
voucher_no: function (frm) {
frm.trigger("set_company_on_transaction");
},
set_company_on_transaction(frm) {
if (frm.doc.voucher_no && frm.doc.voucher_no) {
frm.call("set_company");
}
},
});

View File

@@ -70,10 +70,10 @@ class RepostItemValuation(Document):
)
def validate(self):
self.set_company()
self.validate_period_closing_voucher()
self.set_status(write=False)
self.reset_field_values()
self.set_company()
self.validate_accounts_freeze()
self.reset_recreate_stock_ledgers()
@@ -162,6 +162,7 @@ class RepostItemValuation(Document):
def on_trash(self):
self.clear_attachment()
@frappe.whitelist()
def set_company(self):
if self.based_on == "Transaction":
self.company = frappe.get_cached_value(self.voucher_type, self.voucher_no, "company")