diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js index 8f396c4bc62..613f93cc3f3 100644 --- a/erpnext/public/js/controllers/buying.js +++ b/erpnext/public/js/controllers/buying.js @@ -164,39 +164,18 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ this.price_list_rate(doc, cdt, cdn); }, -<<<<<<< HEAD - qty: function(doc, cdt, cdn) { - var item = frappe.get_doc(cdt, cdn); -======= qty(doc, cdt, cdn) { ->>>>>>> 5fb5a757cf (refactor: (ux) Accepted/Rejected/Received Qty UX) if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) { this.calculate_received_qty(doc, cdt, cdn) } this._super(doc, cdt, cdn); }, -<<<<<<< HEAD - batch_no: function(doc, cdt, cdn) { - this._super(doc, cdt, cdn); - }, - - received_qty: function(doc, cdt, cdn) { - this.calculate_accepted_qty(doc, cdt, cdn) - }, - - rejected_qty: function(doc, cdt, cdn) { - this.calculate_accepted_qty(doc, cdt, cdn) - }, - - calculate_accepted_qty: function(doc, cdt, cdn){ -======= rejected_qty(doc, cdt, cdn) { this.calculate_received_qty(doc, cdt, cdn) - } + }, calculate_received_qty(doc, cdt, cdn){ ->>>>>>> 5fb5a757cf (refactor: (ux) Accepted/Rejected/Received Qty UX) var item = frappe.get_doc(cdt, cdn); frappe.model.round_floats_in(item, ["qty", "rejected_qty"]); @@ -205,19 +184,13 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ let received_qty = flt(item.qty + item.rejected_qty, precision("received_qty", item)); let received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(received_qty); -<<<<<<< HEAD - item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item)); - this.qty(doc, cdt, cdn); - }, -======= frappe.model.set_value(cdt, cdn, "received_qty", received_qty); frappe.model.set_value(cdt, cdn, "received_stock_qty", received_stock_qty); - } + }, batch_no(doc, cdt, cdn) { super.batch_no(doc, cdt, cdn); - } ->>>>>>> 5fb5a757cf (refactor: (ux) Accepted/Rejected/Received Qty UX) + }, validate_negative_quantity: function(cdt, cdn, item, fieldnames){ if(!item || !fieldnames) { return } diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index f0d1cba579d..c4f1fd34236 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -1380,49 +1380,6 @@ class TestPurchaseReceipt(ERPNextTestCase): 'enable_perpetual_inventory_for_non_stock_items', before_test_value ) -<<<<<<< HEAD -======= - def test_purchase_receipt_with_exchange_rate_difference(self): - from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import ( - make_purchase_receipt as create_purchase_receipt, - ) - from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import ( - make_purchase_invoice as create_purchase_invoice, - ) - - pi = create_purchase_invoice(company="_Test Company with perpetual inventory", - cost_center = "Main - TCP1", - warehouse = "Stores - TCP1", - expense_account ="_Test Account Cost for Goods Sold - TCP1", - currency = "USD", conversion_rate = 70) - - pr = create_purchase_receipt(pi.name) - pr.conversion_rate = 80 - pr.items[0].purchase_invoice = pi.name - pr.items[0].purchase_invoice_item = pi.items[0].name - - pr.save() - pr.submit() - - # Get exchnage gain and loss account - exchange_gain_loss_account = frappe.db.get_value( - 'Company', pr.company, 'exchange_gain_loss_account' - ) - - # fetching the latest GL Entry with exchange gain and loss account account - amount = frappe.db.get_value( - 'GL Entry', - { - 'account': exchange_gain_loss_account, - 'voucher_no': pr.name - }, - 'credit' - ) - discrepancy_caused_by_exchange_rate_diff = abs(pi.items[0].base_net_amount - pr.items[0].base_net_amount) - - self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount) - ->>>>>>> 293f6cbafd (fix: Sider, Linter and Server Side Test) def test_payment_terms_are_fetched_when_creating_purchase_invoice(self): from erpnext.accounts.doctype.payment_entry.test_payment_entry import ( create_payment_terms_template,