mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-30 03:58:26 +00:00
Merge branch 'version-14-hotfix' into mergify/bp/version-14-hotfix/pr-35306
This commit is contained in:
@@ -905,7 +905,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
function(d) { return flt(d.amount) }));
|
||||
|
||||
frm.set_value("difference_amount", difference_amount - total_deductions +
|
||||
frm.doc.base_total_taxes_and_charges);
|
||||
flt(frm.doc.base_total_taxes_and_charges));
|
||||
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
},
|
||||
|
||||
@@ -425,7 +425,7 @@ class Asset(AccountsController):
|
||||
depreciation_amount += value_after_depreciation - finance_book.expected_value_after_useful_life
|
||||
skip_row = True
|
||||
|
||||
if depreciation_amount > 0:
|
||||
if flt(depreciation_amount, self.precision("gross_purchase_amount")) > 0:
|
||||
self._add_depreciation_row(
|
||||
schedule_date,
|
||||
depreciation_amount,
|
||||
@@ -1287,9 +1287,11 @@ def get_straight_line_or_manual_depr_amount(asset, row):
|
||||
)
|
||||
# if the Depreciation Schedule is being prepared for the first time
|
||||
else:
|
||||
return (flt(asset.gross_purchase_amount) - flt(row.expected_value_after_useful_life)) / flt(
|
||||
row.total_number_of_depreciations
|
||||
)
|
||||
return (
|
||||
flt(asset.gross_purchase_amount)
|
||||
- flt(asset.opening_accumulated_depreciation)
|
||||
- flt(row.expected_value_after_useful_life)
|
||||
) / flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked)
|
||||
|
||||
|
||||
def get_wdv_or_dd_depr_amount(
|
||||
|
||||
@@ -649,7 +649,7 @@ class TestDepreciationMethods(AssetSetup):
|
||||
)
|
||||
|
||||
self.assertEqual(asset.status, "Draft")
|
||||
expected_schedules = [["2032-12-31", 30000.0, 77095.89], ["2033-06-06", 12904.11, 90000.0]]
|
||||
expected_schedules = [["2032-12-31", 42904.11, 90000.0]]
|
||||
schedules = [
|
||||
[cstr(d.schedule_date), flt(d.depreciation_amount, 2), d.accumulated_depreciation_amount]
|
||||
for d in asset.get("schedules")
|
||||
|
||||
@@ -91,6 +91,12 @@ frappe.ui.form.on("Sales Invoice", {
|
||||
});
|
||||
|
||||
frappe.ui.form.on('Purchase Invoice', {
|
||||
setup: (frm) => {
|
||||
frm.make_methods = {
|
||||
'Landed Cost Voucher': function () { frm.trigger('create_landedcost_voucher') },
|
||||
}
|
||||
},
|
||||
|
||||
mode_of_payment: function(frm) {
|
||||
get_payment_mode_account(frm, frm.doc.mode_of_payment, function(account){
|
||||
frm.set_value('cash_bank_account', account);
|
||||
@@ -99,6 +105,20 @@ frappe.ui.form.on('Purchase Invoice', {
|
||||
|
||||
payment_terms_template: function() {
|
||||
cur_frm.trigger("disable_due_date");
|
||||
},
|
||||
|
||||
create_landedcost_voucher: function (frm) {
|
||||
let lcv = frappe.model.get_new_doc('Landed Cost Voucher');
|
||||
lcv.company = frm.doc.company;
|
||||
|
||||
let lcv_receipt = frappe.model.get_new_doc('Landed Cost Purchase Invoice');
|
||||
lcv_receipt.receipt_document_type = 'Purchase Invoice';
|
||||
lcv_receipt.receipt_document = frm.doc.name;
|
||||
lcv_receipt.supplier = frm.doc.supplier;
|
||||
lcv_receipt.grand_total = frm.doc.grand_total;
|
||||
lcv.purchase_receipts = [lcv_receipt];
|
||||
|
||||
frappe.set_route("Form", lcv.doctype, lcv.name);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user