From cf77740ab152b04b1005ef261311f4c2849d60bd Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 21 Jun 2019 15:38:36 +0530 Subject: [PATCH 01/16] fix: wrong Casual Leave opening --- .../report/employee_leave_balance/employee_leave_balance.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index 95cb30b7918..5d781dba94f 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -35,6 +35,9 @@ def get_data(filters, leave_types): allocation_records_based_on_to_date = get_leave_allocation_records(filters.to_date) allocation_records_based_on_from_date = get_leave_allocation_records(filters.from_date) + if filters.to_date <= filters.from_date: + frappe.throw(_("From date can not be greater than than To date")) + active_employees = frappe.get_all("Employee", filters = { "status": "Active", "company": filters.company}, fields = ["name", "employee_name", "department", "user_id"]) @@ -51,7 +54,8 @@ def get_data(filters, leave_types): filters.from_date, filters.to_date) # opening balance - opening = get_total_allocated_leaves(employee.name, leave_type, filters.to_date) + opening = get_leave_balance_on(employee.name, leave_type, filters.from_date, + allocation_records_based_on_to_date.get(employee.name, frappe._dict())) # closing balance closing = get_leave_balance_on(employee.name, leave_type, filters.to_date, From b3dec74c6a0faa1f671512e8991fc2c96fd78bce Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 26 Jun 2019 13:31:09 +0530 Subject: [PATCH 02/16] fix: removed unused function --- .../doctype/leave_application/leave_application.py | 13 ------------- .../employee_leave_balance.py | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 88b8f77b2e0..ef8221108cf 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -400,19 +400,6 @@ def get_leave_balance_on(employee, leave_type, date, allocation_records=None, do return flt(allocation.total_leaves_allocated) - (flt(leaves_taken) + flt(leaves_encashed)) -def get_total_allocated_leaves(employee, leave_type, date): - filters= { - 'from_date': ['<=', date], - 'to_date': ['>=', date], - 'docstatus': 1, - 'leave_type': leave_type, - 'employee': employee - } - - leave_allocation_records = frappe.db.get_all('Leave Allocation', filters=filters, fields=['total_leaves_allocated']) - - return flt(leave_allocation_records[0]['total_leaves_allocated']) if leave_allocation_records else flt(0) - def get_leaves_for_period(employee, leave_type, from_date, to_date, status, docname=None): leave_applications = frappe.db.sql(""" select name, employee, leave_type, from_date, to_date, total_leave_days diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py index 5d781dba94f..18431768528 100644 --- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py +++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import frappe from frappe import _ from erpnext.hr.doctype.leave_application.leave_application \ - import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period, get_total_allocated_leaves + import get_leave_allocation_records, get_leave_balance_on, get_approved_leaves_for_period def execute(filters=None): From e68d4c897bc347c84183b4455937d168be435071 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Thu, 27 Jun 2019 11:41:17 +0530 Subject: [PATCH 03/16] fix: open department in tree view via awesome bar --- erpnext/public/js/conf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index 477781bc805..b94e9183bd8 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -41,7 +41,8 @@ $.extend(frappe.create_routes, { "Item Group": "Tree/Item Group", "Sales Person": "Tree/Sales Person", "Account": "Tree/Account", - "Cost Center": "Tree/Cost Center" + "Cost Center": "Tree/Cost Center", + "Department": "Tree/Department", }); // preferred modules for breadcrumbs From b059c6f630f175bc2150d66ecb4b50898cc5a31a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 28 Jun 2019 12:36:27 +0530 Subject: [PATCH 04/16] fix: Fixes related to customer/lead merging (#18075) --- erpnext/controllers/selling_controller.py | 21 +++++++++++++++---- erpnext/controllers/tests/test_mapper.py | 2 +- .../crm/doctype/opportunity/opportunity.py | 4 ++-- erpnext/demo/user/sales.py | 2 +- .../v11_1/set_missing_title_for_quotation.py | 1 + .../setup_wizard/operations/sample_data.py | 2 +- erpnext/templates/utils.py | 6 +++--- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index a9883017cfa..f16d40c4ea8 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -55,14 +55,28 @@ class SellingController(StockController): self.set_price_list_and_item_details(for_validate=for_validate) def set_missing_lead_customer_details(self): + customer, lead = None, None if getattr(self, "customer", None): + customer = self.customer + elif self.doctype == "Opportunity" and self.party_name: + if self.opportunity_from == "Customer": + customer = self.party_name + else: + lead = self.party_name + elif self.doctype == "Quotation" and self.party_name: + if self.quotation_to == "Customer": + customer = self.party_name + else: + lead = self.party_name + + if customer: from erpnext.accounts.party import _get_party_details fetch_payment_terms_template = False if (self.get("__islocal") or self.company != frappe.db.get_value(self.doctype, self.name, 'company')): fetch_payment_terms_template = True - party_details = _get_party_details(self.customer, + party_details = _get_party_details(customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company, fetch_payment_terms_template=fetch_payment_terms_template, @@ -71,10 +85,9 @@ class SellingController(StockController): party_details.pop("sales_team") self.update_if_missing(party_details) - elif getattr(self, "lead", None): + elif lead: from erpnext.crm.doctype.lead.lead import get_lead_details - self.update_if_missing(get_lead_details( - self.lead, + self.update_if_missing(get_lead_details(lead, posting_date=self.get('transaction_date') or self.get('posting_date'), company=self.company)) diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index 14738c5ff2b..d02308d8f21 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -43,7 +43,7 @@ class TestMapper(unittest.TestCase): qtn = frappe.get_doc({ "doctype": "Quotation", "quotation_to": "Customer", - "customer": customer, + "party_name": customer, "order_type": "Sales", "transaction_date" : nowdate(), "valid_till" : add_months(nowdate(), 1) diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index dad249213c7..973b3412b8b 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -320,11 +320,11 @@ def make_opportunity_from_communication(communication, ignore_communication_link if not lead: lead = make_lead_from_communication(communication, ignore_communication_links=True) - enquiry_from = "Lead" + opportunity_from = "Lead" opportunity = frappe.get_doc({ "doctype": "Opportunity", - "enquiry_from": enquiry_from, + "opportunity_from": opportunity_from, "lead": lead }).insert(ignore_permissions=True) diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py index 3809c1f0924..d5b0133f21b 100644 --- a/erpnext/demo/user/sales.py +++ b/erpnext/demo/user/sales.py @@ -99,7 +99,7 @@ def make_quotation(domain): "creation": frappe.flags.current_date, "doctype": "Quotation", "quotation_to": "Customer", - "customer": customer, + "party_name": customer, "currency": party_account_currency or company_currency, "conversion_rate": exchange_rate, "order_type": "Sales", diff --git a/erpnext/patches/v11_1/set_missing_title_for_quotation.py b/erpnext/patches/v11_1/set_missing_title_for_quotation.py index e86b8320c31..e2ef3433d3e 100644 --- a/erpnext/patches/v11_1/set_missing_title_for_quotation.py +++ b/erpnext/patches/v11_1/set_missing_title_for_quotation.py @@ -1,6 +1,7 @@ import frappe def execute(): + frappe.reload_doctype("Quotation") # update customer_name from Customer document if quotation_to is set to Customer frappe.db.sql(''' update tabQuotation, tabCustomer diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py index e21c9bd1089..64c669363d3 100644 --- a/erpnext/setup/setup_wizard/operations/sample_data.py +++ b/erpnext/setup/setup_wizard/operations/sample_data.py @@ -34,7 +34,7 @@ def make_opportunity(items, customer): b = frappe.get_doc({ "doctype": "Opportunity", "opportunity_from": "Customer", - "customer": customer, + "party_name": customer, "opportunity_type": _("Sales"), "with_items": 1 }) diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py index 97e2a7f7235..743657de322 100644 --- a/erpnext/templates/utils.py +++ b/erpnext/templates/utils.py @@ -36,11 +36,11 @@ def send_message(subject="Website Query", message="", sender="", status="Open"): )) if customer: - opportunity.customer = customer[0][0] + opportunity.party_name = customer[0][0] elif lead: - opportunity.lead = lead + opportunity.party_name = lead else: - opportunity.lead = new_lead.name + opportunity.party_name = new_lead.name opportunity.insert(ignore_permissions=True) From c82253e4794a513399522d68a2a5d10625c8339f Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 28 Jun 2019 12:41:16 +0530 Subject: [PATCH 05/16] fix: not able to make salary slip based on timesheet (#18087) --- erpnext/hr/doctype/salary_slip/salary_slip.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index c73c708b204..90391037896 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -281,7 +281,9 @@ class SalarySlip(TransactionBase): wages_row = { "salary_component": salary_component, "abbr": frappe.db.get_value("Salary Component", salary_component, "salary_component_abbr"), - "amount": self.hour_rate * self.total_working_hours + "amount": self.hour_rate * self.total_working_hours, + "default_amount": 0.0, + "additional_amount": 0.0 } doc.append('earnings', wages_row) From fdd1422d31dcfdd7170ad80b8529f5d0cde2b84c Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Fri, 28 Jun 2019 14:09:23 +0530 Subject: [PATCH 06/16] fix: Usability fixes to Serial No and batch selector (#18070) * fix: Usability fixes to Serial No and batch selector * fix: Codacy * Update sales_common.js --- .../js/utils/serial_no_batch_selector.js | 20 +++++++++++++++++-- erpnext/selling/sales_common.js | 18 ++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 0202bbb872a..576ae0fbde1 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -45,6 +45,13 @@ erpnext.SerialNoBatchSelector = Class.extend({ label: __(me.warehouse_details.type), default: me.warehouse_details.name, onchange: function(e) { + + if(me.has_batch) { + fields = fields.concat(me.get_batch_fields()); + } else { + fields = fields.concat(me.get_serial_no_fields()); + } + me.warehouse_details.name = this.get_value(); var batches = this.layout.fields_dict.batches; if(batches) { @@ -232,6 +239,15 @@ erpnext.SerialNoBatchSelector = Class.extend({ get_batch_fields: function() { var me = this; + + let filters = { + item_code: me.item_code + } + + if (me.warehouse || me.warehouse_details.name) { + filters['warehouse'] = me.warehouse || me.warehouse_details.name; + } + return [ { fieldtype: 'Section Break', label: __('Batches') }, { @@ -246,8 +262,8 @@ erpnext.SerialNoBatchSelector = Class.extend({ 'in_list_view': 1, get_query: function () { return { - filters: { item: me.item_code }, - query: 'erpnext.controllers.queries.get_batch_numbers' + filters: filters, + query: 'erpnext.controllers.queries.get_batch_no' }; }, change: function () { diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index c431df403aa..b1b64a3e4ec 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -184,7 +184,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.calculate_incentive(sales_person); refresh_field(["allocated_percentage", "allocated_amount", "commission_rate","incentives"], sales_person.name, sales_person.parentfield); - } + } }, sales_person: function(doc, cdt, cdn) { @@ -215,6 +215,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }, callback:function(r){ if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { + + if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; + me.set_batch_number(cdt, cdn); me.batch_no(doc, cdt, cdn); } @@ -358,13 +361,18 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this._super(doc, cdt, cdn, dont_fetch_price_list_rate); if(frappe.meta.get_docfield(cdt, "stock_qty", cdn) && in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { - this.set_batch_number(cdt, cdn); - } + if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; + this.set_batch_number(cdt, cdn); + } }, qty: function(doc, cdt, cdn) { this._super(doc, cdt, cdn); - this.set_batch_number(cdt, cdn); + + if(in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { + if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; + this.set_batch_number(cdt, cdn); + } }, /* Determine appropriate batch number and set it in the form. @@ -396,7 +404,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if (doc.auto_repeat) { frappe.call({ method:"frappe.desk.doctype.auto_repeat.auto_repeat.update_reference", - args:{ + args:{ docname: doc.auto_repeat, reference:doc.name }, From 5b5156356a8662819c9180a2cca6dd1f8b2847c3 Mon Sep 17 00:00:00 2001 From: Himanshu Date: Fri, 28 Jun 2019 14:12:40 +0530 Subject: [PATCH 07/16] fix(Utils): Do not add duplicate item to items (#17895) * fix: do not add duplicate item to items * fix: compare warehouses, batch and qty for an item * fix: code fixes * Update utils.js * fix: check required_date and delivery_date * Update utils.js * Update utils.js * Update utils.js * fix: mixed spaces and tabs --- erpnext/public/js/utils.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 2dd65fec170..37735646fb3 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -587,6 +587,7 @@ erpnext.utils.map_current_doc = function(opts) { if(!r.exc) { var doc = frappe.model.sync(r.message); cur_frm.dirty(); + erpnext.utils.clear_duplicates(); cur_frm.refresh(); } } @@ -617,6 +618,27 @@ erpnext.utils.map_current_doc = function(opts) { } } +erpnext.utils.clear_duplicates = function() { + const unique_items = new Map(); + /* + Create a Map of items with + item_code => [qty, warehouse, batch_no] + */ + let items = []; + + for (let item of cur_frm.doc.items) { + if (!(unique_items.has(item.item_code) && unique_items.get(item.item_code)[0] === item.qty && + unique_items.get(item.item_code)[1] === item.warehouse && unique_items.get(item.item_code)[2] === item.batch_no && + unique_items.get(item.item_code)[3] === item.delivery_date && unique_items.get(item.item_code)[4] === item.required_date && + unique_items.get(item.item_code)[5] === item.rate)) { + + unique_items.set(item.item_code, [item.qty, item.warehouse, item.batch_no, item.delivery_date, item.required_date, item.rate]); + items.push(item); + } + } + cur_frm.doc.items = items; +} + frappe.form.link_formatters['Item'] = function(value, doc) { if(doc && doc.item_name && doc.item_name !== value) { return value? value + ': ' + doc.item_name: doc.item_name; From 69051c41978afe3b8614598a58fcad0665ebbe47 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Fri, 28 Jun 2019 14:36:53 +0530 Subject: [PATCH 08/16] fix(buying): Translate label for "Supplier Addresses And Contacts" Report --- erpnext/config/buying.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py index e99b1d88aa5..1db5233b026 100644 --- a/erpnext/config/buying.py +++ b/erpnext/config/buying.py @@ -199,7 +199,7 @@ def get_data(): "type": "report", "is_query_report": True, "name": "Address And Contacts", - "label": "Supplier Addresses And Contacts", + "label": _("Supplier Addresses And Contacts"), "doctype": "Address", "route_options": { "party_type": "Supplier" From dfe0a9002ac9daa42fa40a6ee77d3d39ca6c5db5 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 28 Jun 2019 19:22:51 +0530 Subject: [PATCH 09/16] fix: mapped doc --- erpnext/public/js/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 37735646fb3..4e589dadb66 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -619,6 +619,7 @@ erpnext.utils.map_current_doc = function(opts) { } erpnext.utils.clear_duplicates = function() { + if(!cur_frm.doc.items) return; const unique_items = new Map(); /* Create a Map of items with From 30c9c56d6cf18a5a440cc8f923ce72bb1b96971b Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 28 Jun 2019 19:35:05 +0530 Subject: [PATCH 10/16] fix: add a more descriptive message when no records are found (#18083) * fix: add a more descriptive message when no records are found * fix: translation by passing string to translation function --- .../exchange_rate_revaluation.js | 4 +- .../exchange_rate_revaluation.py | 20 +- .../exchange_rate_revaluation_account.json | 874 +++++++++--------- 3 files changed, 461 insertions(+), 437 deletions(-) diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js index 779cd6197e9..cb3aef72c32 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js @@ -39,8 +39,6 @@ frappe.ui.form.on('Exchange Rate Revaluation', { }); frm.events.get_total_gain_loss(frm); refresh_field("accounts"); - } else { - frappe.msgprint(__("No records found")); } } }); @@ -54,7 +52,7 @@ frappe.ui.form.on('Exchange Rate Revaluation', { d.gain_loss = flt(d.new_balance_in_base_currency, precision("new_balance_in_base_currency", d)) - flt(d.balance_in_base_currency, precision("balance_in_base_currency", d)); total_gain_loss += flt(d.gain_loss, precision("gain_loss", d)); }); - + frm.set_value("total_gain_loss", flt(total_gain_loss, precision("total_gain_loss"))); frm.refresh_fields(); }, diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py index cdfe34beadb..9594706d0f6 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py +++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py @@ -22,7 +22,7 @@ class ExchangeRateRevaluation(Document): - flt(d.balance_in_base_currency, d.precision("balance_in_base_currency")) total_gain_loss += flt(d.gain_loss, d.precision("gain_loss")) self.total_gain_loss = flt(total_gain_loss, self.precision("total_gain_loss")) - + def validate_mandatory(self): if not (self.company and self.posting_date): frappe.throw(_("Please select Company and Posting Date to getting entries")) @@ -33,8 +33,9 @@ class ExchangeRateRevaluation(Document): company_currency = erpnext.get_company_currency(self.company) precision = get_field_precision(frappe.get_meta("Exchange Rate Revaluation Account") .get_field("new_balance_in_base_currency"), company_currency) - for d in self.get_accounts_from_gle(): - + + account_details = self.get_accounts_from_gle() + for d in account_details: current_exchange_rate = d.balance / d.balance_in_account_currency \ if d.balance_in_account_currency else 0 new_exchange_rate = get_exchange_rate(d.account_currency, company_currency, self.posting_date) @@ -52,6 +53,10 @@ class ExchangeRateRevaluation(Document): "new_exchange_rate": new_exchange_rate, "new_balance_in_base_currency": new_balance_in_base_currency }) + + if not accounts: + self.throw_invalid_response_message(account_details) + return accounts def get_accounts_from_gle(self): @@ -83,11 +88,18 @@ class ExchangeRateRevaluation(Document): return account_details + def throw_invalid_response_message(self, account_details): + if account_details: + message = _("No outstanding invoices require exchange rate revaluation") + else: + message = _("No outstanding invoices found") + frappe.msgprint(message) + def make_jv_entry(self): if self.total_gain_loss == 0: return - unrealized_exchange_gain_loss_account = frappe.get_cached_value('Company', self.company, + unrealized_exchange_gain_loss_account = frappe.get_cached_value('Company', self.company, "unrealized_exchange_gain_loss_account") if not unrealized_exchange_gain_loss_account: frappe.throw(_("Please set Unrealized Exchange Gain/Loss Account in Company {0}") diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json index 98ecd486ca5..30ff9ebed5b 100644 --- a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json +++ b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.json @@ -1,461 +1,475 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2018-04-13 18:30:06.110433", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2018-04-13 18:30:06.110433", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "account", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "account", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Account", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "party_type", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Party Type", - "length": 0, - "no_copy": 0, - "options": "DocType", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "party_type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party Type", + "length": 0, + "no_copy": 0, + "options": "DocType", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "party", - "fieldtype": "Dynamic Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Party", - "length": 0, - "no_copy": 0, - "options": "party_type", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "party", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Party", + "length": 0, + "no_copy": 0, + "options": "party_type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_2", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "account_currency", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Account Currency", - "length": 0, - "no_copy": 0, - "options": "Currency", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "account_currency", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Account Currency", + "length": 0, + "no_copy": 0, + "options": "Currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "balance_in_account_currency", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Balance In Account Currency", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "balance_in_account_currency", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Balance In Account Currency", + "length": 0, + "no_copy": 0, + "options": "account_currency", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "balances", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "balances", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "current_exchange_rate", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Current Exchange Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "current_exchange_rate", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Current Exchange Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "balance_in_base_currency", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Balance In Base Currency", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "balance_in_base_currency", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Balance In Base Currency", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_9", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "column_break_9", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "new_exchange_rate", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "New Exchange Rate", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "new_exchange_rate", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "New Exchange Rate", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "new_balance_in_base_currency", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "New Balance In Base Currency", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "new_balance_in_base_currency", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "New Balance In Base Currency", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "gain_loss", - "fieldtype": "Currency", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Gain/Loss", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "gain_loss", + "fieldtype": "Currency", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Gain/Loss", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2019-01-07 16:52:07.327930", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Exchange Rate Revaluation Account", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-06-26 18:57:51.762345", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Exchange Rate Revaluation Account", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, "track_views": 0 } \ No newline at end of file From 2a0be68cb37df312c55fe2c9070b8fe5077bab15 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 28 Jun 2019 17:18:03 +0530 Subject: [PATCH 11/16] fix: incorrect value booked in the accumulated depreciation account on sell of the asset --- .../doctype/sales_invoice/sales_invoice.py | 9 +- .../sales_invoice_item.json | 121 +++++++++++++++++- erpnext/assets/doctype/asset/depreciation.py | 36 ++++-- erpnext/assets/doctype/asset/test_asset.py | 9 +- 4 files changed, 155 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index e06db8f4bc6..5b61fbfa138 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -770,7 +770,14 @@ class SalesInvoice(SellingController): if item.is_fixed_asset: asset = frappe.get_doc("Asset", item.asset) - fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount) + if (len(asset.finance_books) > 1 and not item.finance_book + and asset.finance_books[0].finance_book): + frappe.throw(_("Select finance book for the item {0} at row {1}") + .format(item.item_code, item.idx)) + + fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, + item.base_net_amount, item.finance_book) + for gle in fixed_asset_gl_entries: gle["against"] = self.customer gl_entries.append(self.get_gl_dict(gle)) diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index a95f3146616..5e712d1846e 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -21,6 +21,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "barcode", "fieldtype": "Data", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 1, "collapsible": 0, "columns": 4, + "fetch_if_empty": 0, "fieldname": "item_code", "fieldtype": "Link", "hidden": 0, @@ -86,6 +88,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break1", "fieldtype": "Column Break", "hidden": 0, @@ -116,6 +119,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_name", "fieldtype": "Data", "hidden": 0, @@ -149,6 +153,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "customer_item_code", "fieldtype": "Data", "hidden": 1, @@ -180,6 +185,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_6", "fieldtype": "Section Break", "hidden": 0, @@ -212,6 +218,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -247,6 +254,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_8", "fieldtype": "Column Break", "hidden": 0, @@ -278,6 +286,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image_view", "fieldtype": "Image", "hidden": 0, @@ -311,6 +320,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "image", "fieldtype": "Attach", "hidden": 1, @@ -343,6 +353,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "quantity_and_rate", "fieldtype": "Section Break", "hidden": 0, @@ -374,6 +385,7 @@ "bold": 1, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "qty", "fieldtype": "Float", "hidden": 0, @@ -407,6 +419,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_uom", "fieldtype": "Link", "hidden": 0, @@ -439,6 +452,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break2", "fieldtype": "Column Break", "hidden": 0, @@ -469,6 +483,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "uom", "fieldtype": "Link", "hidden": 0, @@ -502,6 +517,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "conversion_factor", "fieldtype": "Float", "hidden": 0, @@ -534,6 +550,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_qty", "fieldtype": "Float", "hidden": 0, @@ -566,6 +583,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_17", "fieldtype": "Section Break", "hidden": 0, @@ -597,6 +615,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -631,6 +650,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_price_list_rate", "fieldtype": "Currency", "hidden": 0, @@ -665,6 +685,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "discount_and_margin", "fieldtype": "Section Break", "hidden": 0, @@ -698,6 +719,7 @@ "collapsible": 0, "columns": 0, "depends_on": "price_list_rate", + "fetch_if_empty": 0, "fieldname": "margin_type", "fieldtype": "Select", "hidden": 0, @@ -732,6 +754,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.margin_type && doc.price_list_rate", + "fetch_if_empty": 0, "fieldname": "margin_rate_or_amount", "fieldtype": "Float", "hidden": 0, @@ -765,6 +788,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fetch_if_empty": 0, "fieldname": "rate_with_margin", "fieldtype": "Currency", "hidden": 0, @@ -798,6 +822,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_19", "fieldtype": "Column Break", "hidden": 0, @@ -830,6 +855,7 @@ "collapsible": 0, "columns": 0, "depends_on": "price_list_rate", + "fetch_if_empty": 0, "fieldname": "discount_percentage", "fieldtype": "Percent", "hidden": 0, @@ -865,6 +891,7 @@ "collapsible": 0, "columns": 0, "depends_on": "discount_percentage", + "fetch_if_empty": 0, "fieldname": "discount_amount", "fieldtype": "Currency", "hidden": 0, @@ -899,6 +926,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fetch_if_empty": 0, "fieldname": "base_rate_with_margin", "fieldtype": "Currency", "hidden": 0, @@ -932,6 +960,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break1", "fieldtype": "Section Break", "hidden": 0, @@ -962,6 +991,7 @@ "bold": 1, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "rate", "fieldtype": "Currency", "hidden": 0, @@ -996,6 +1026,7 @@ "bold": 0, "collapsible": 0, "columns": 2, + "fetch_if_empty": 0, "fieldname": "amount", "fieldtype": "Currency", "hidden": 0, @@ -1030,6 +1061,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break3", "fieldtype": "Column Break", "hidden": 0, @@ -1060,6 +1092,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_rate", "fieldtype": "Currency", "hidden": 0, @@ -1094,6 +1127,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_amount", "fieldtype": "Currency", "hidden": 0, @@ -1128,6 +1162,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "pricing_rule", "fieldtype": "Link", "hidden": 0, @@ -1160,6 +1195,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_21", "fieldtype": "Section Break", "hidden": 0, @@ -1191,6 +1227,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1224,6 +1261,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1257,6 +1295,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_24", "fieldtype": "Column Break", "hidden": 0, @@ -1288,6 +1327,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_rate", "fieldtype": "Currency", "hidden": 0, @@ -1321,6 +1361,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "base_net_amount", "fieldtype": "Currency", "hidden": 0, @@ -1355,6 +1396,7 @@ "collapsible": 1, "collapsible_depends_on": "eval:doc.delivered_by_supplier==1", "columns": 0, + "fetch_if_empty": 0, "fieldname": "drop_ship", "fieldtype": "Section Break", "hidden": 0, @@ -1387,6 +1429,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "delivered_by_supplier", "fieldtype": "Check", "hidden": 0, @@ -1419,6 +1462,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "accounting", "fieldtype": "Section Break", "hidden": 0, @@ -1450,6 +1494,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "income_account", "fieldtype": "Link", "hidden": 0, @@ -1486,6 +1531,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "expense_account", "fieldtype": "Link", "hidden": 0, @@ -1519,6 +1565,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break4", "fieldtype": "Column Break", "hidden": 0, @@ -1550,6 +1597,7 @@ "collapsible": 0, "columns": 0, "default": ":Company", + "fetch_if_empty": 0, "fieldname": "cost_center", "fieldtype": "Link", "hidden": 0, @@ -1586,6 +1634,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "deferred_revenue", "fieldtype": "Section Break", "hidden": 0, @@ -1619,6 +1668,7 @@ "collapsible": 0, "columns": 0, "depends_on": "enable_deferred_revenue", + "fetch_if_empty": 0, "fieldname": "deferred_revenue_account", "fieldtype": "Link", "hidden": 0, @@ -1653,6 +1703,7 @@ "collapsible": 0, "columns": 0, "depends_on": "enable_deferred_revenue", + "fetch_if_empty": 0, "fieldname": "service_stop_date", "fieldtype": "Date", "hidden": 0, @@ -1686,6 +1737,7 @@ "collapsible": 0, "columns": 0, "default": "0", + "fetch_if_empty": 0, "fieldname": "enable_deferred_revenue", "fieldtype": "Check", "hidden": 0, @@ -1718,6 +1770,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_50", "fieldtype": "Column Break", "hidden": 0, @@ -1750,6 +1803,7 @@ "collapsible": 0, "columns": 0, "depends_on": "enable_deferred_revenue", + "fetch_if_empty": 0, "fieldname": "service_start_date", "fieldtype": "Date", "hidden": 0, @@ -1783,6 +1837,7 @@ "collapsible": 0, "columns": 0, "depends_on": "enable_deferred_revenue", + "fetch_if_empty": 0, "fieldname": "service_end_date", "fieldtype": "Date", "hidden": 0, @@ -1815,6 +1870,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_18", "fieldtype": "Section Break", "hidden": 0, @@ -1847,6 +1903,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_per_unit", "fieldtype": "Float", "hidden": 0, @@ -1880,6 +1937,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "total_weight", "fieldtype": "Float", "hidden": 0, @@ -1912,6 +1970,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_21", "fieldtype": "Column Break", "hidden": 0, @@ -1943,6 +2002,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "weight_uom", "fieldtype": "Link", "hidden": 0, @@ -1978,6 +2038,7 @@ "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "warehouse_and_reference", "fieldtype": "Section Break", "hidden": 0, @@ -2009,6 +2070,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "warehouse", "fieldtype": "Link", "hidden": 0, @@ -2043,6 +2105,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "target_warehouse", "fieldtype": "Link", "hidden": 1, @@ -2077,6 +2140,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:!doc.__islocal", + "fetch_if_empty": 0, "fieldname": "quality_inspection", "fieldtype": "Link", "hidden": 0, @@ -2110,6 +2174,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "batch_no", "fieldtype": "Link", "hidden": 0, @@ -2142,6 +2207,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "col_break5", "fieldtype": "Column Break", "hidden": 0, @@ -2172,6 +2238,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "allow_zero_valuation_rate", "fieldtype": "Check", "hidden": 0, @@ -2204,6 +2271,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "serial_no", "fieldtype": "Small Text", "hidden": 0, @@ -2238,6 +2306,7 @@ "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "item_group", "fieldtype": "Link", "hidden": 1, @@ -2272,6 +2341,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "brand", "fieldtype": "Data", "hidden": 1, @@ -2305,6 +2375,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "item_tax_rate", "fieldtype": "Small Text", "hidden": 1, @@ -2338,6 +2409,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "actual_batch_qty", "fieldtype": "Float", "hidden": 0, @@ -2372,6 +2444,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "actual_qty", "fieldtype": "Float", "hidden": 0, @@ -2405,6 +2478,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "edit_references", "fieldtype": "Section Break", "hidden": 0, @@ -2437,6 +2511,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sales_order", "fieldtype": "Link", "hidden": 0, @@ -2471,6 +2546,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "so_detail", "fieldtype": "Data", "hidden": 1, @@ -2504,6 +2580,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_74", "fieldtype": "Column Break", "hidden": 0, @@ -2535,6 +2612,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "delivery_note", "fieldtype": "Link", "hidden": 0, @@ -2569,6 +2647,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "dn_detail", "fieldtype": "Data", "hidden": 1, @@ -2602,6 +2681,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "delivered_qty", "fieldtype": "Float", "hidden": 0, @@ -2635,6 +2715,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "is_fixed_asset", "fieldtype": "Check", "hidden": 1, @@ -2667,6 +2748,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "asset", "fieldtype": "Link", "hidden": 0, @@ -2700,6 +2782,42 @@ "bold": 0, "collapsible": 0, "columns": 0, + "depends_on": "asset", + "fetch_if_empty": 0, + "fieldname": "finance_book", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Finance Book", + "length": 0, + "no_copy": 0, + "options": "Finance Book", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_54", "fieldtype": "Section Break", "hidden": 0, @@ -2731,6 +2849,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "page_break", "fieldtype": "Check", "hidden": 0, @@ -2766,7 +2885,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-02-18 18:59:52.223628", + "modified": "2019-06-28 17:04:25.870346", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py index 797075b8873..61108ec4a37 100644 --- a/erpnext/assets/doctype/asset/depreciation.py +++ b/erpnext/assets/doctype/asset/depreciation.py @@ -36,7 +36,7 @@ def make_depreciation_entry(asset_name, date=None): fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \ get_depreciation_accounts(asset) - depreciation_cost_center, depreciation_series = frappe.get_cached_value('Company', asset.company, + depreciation_cost_center, depreciation_series = frappe.get_cached_value('Company', asset.company, ["depreciation_cost_center", "series_for_depreciation_entry"]) depreciation_cost_center = asset.cost_center or depreciation_cost_center @@ -70,7 +70,7 @@ def make_depreciation_entry(asset_name, date=None): je.submit() d.db_set("journal_entry", je.name) - + idx = cint(d.finance_book_id) finance_books = asset.get('finance_books')[idx - 1] finance_books.value_after_depreciation -= d.depreciation_amount @@ -88,15 +88,15 @@ def get_depreciation_accounts(asset): fieldname = ['fixed_asset_account', 'accumulated_depreciation_account', 'depreciation_expense_account'], as_dict=1) - if accounts: + if accounts: fixed_asset_account = accounts.fixed_asset_account accumulated_depreciation_account = accounts.accumulated_depreciation_account depreciation_expense_account = accounts.depreciation_expense_account - + if not accumulated_depreciation_account or not depreciation_expense_account: - accounts = frappe.get_cached_value('Company', asset.company, + accounts = frappe.get_cached_value('Company', asset.company, ["accumulated_depreciation_account", "depreciation_expense_account"]) - + if not accumulated_depreciation_account: accumulated_depreciation_account = accounts[0] if not depreciation_expense_account: @@ -135,11 +135,11 @@ def scrap_asset(asset_name): je.flags.ignore_permissions = True je.submit() - + frappe.db.set_value("Asset", asset_name, "disposal_date", today()) frappe.db.set_value("Asset", asset_name, "journal_entry_for_scrap", je.name) asset.set_status("Scrapped") - + frappe.msgprint(_("Asset scrapped via Journal Entry {0}").format(je.name)) @frappe.whitelist() @@ -147,21 +147,29 @@ def restore_asset(asset_name): asset = frappe.get_doc("Asset", asset_name) je = asset.journal_entry_for_scrap - + asset.db_set("disposal_date", None) asset.db_set("journal_entry_for_scrap", None) - + frappe.get_doc("Journal Entry", je).cancel() asset.set_status() @frappe.whitelist() -def get_gl_entries_on_asset_disposal(asset, selling_amount=0): +def get_gl_entries_on_asset_disposal(asset, selling_amount=0, finance_book=None): fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset) disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company) depreciation_cost_center = asset.cost_center or depreciation_cost_center - accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation) + idx = 1 + if finance_book: + for d in asset.finance_books: + if d.finance_book == finance_book: + idx = d.idx + break + + value_after_depreciation = asset.finance_books[idx - 1].value_after_depreciation + accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(value_after_depreciation) gl_entries = [ { @@ -176,7 +184,7 @@ def get_gl_entries_on_asset_disposal(asset, selling_amount=0): } ] - profit_amount = flt(selling_amount) - flt(asset.value_after_depreciation) + profit_amount = flt(selling_amount) - flt(value_after_depreciation) if profit_amount: debit_or_credit = "debit" if profit_amount < 0 else "credit" gl_entries.append({ @@ -190,7 +198,7 @@ def get_gl_entries_on_asset_disposal(asset, selling_amount=0): @frappe.whitelist() def get_disposal_account_and_cost_center(company): - disposal_account, depreciation_cost_center = frappe.get_cached_value('Company', company, + disposal_account, depreciation_cost_center = frappe.get_cached_value('Company', company, ["disposal_account", "depreciation_cost_center"]) if not disposal_account: diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index ef85ffa1cb8..fceccfbd1c9 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -366,8 +366,9 @@ class TestAsset(unittest.TestCase): self.assertTrue(asset.journal_entry_for_scrap) expected_gle = ( - ("_Test Accumulated Depreciations - _TC", 100000.0, 0.0), - ("_Test Fixed Asset - _TC", 0.0, 100000.0) + ("_Test Accumulated Depreciations - _TC", 147.54, 0.0), + ("_Test Fixed Asset - _TC", 0.0, 100000.0), + ("_Test Gain/Loss on Asset Disposal - _TC", 99852.46, 0.0) ) gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry` @@ -411,9 +412,9 @@ class TestAsset(unittest.TestCase): self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Sold") expected_gle = ( - ("_Test Accumulated Depreciations - _TC", 100000.0, 0.0), + ("_Test Accumulated Depreciations - _TC", 23051.47, 0.0), ("_Test Fixed Asset - _TC", 0.0, 100000.0), - ("_Test Gain/Loss on Asset Disposal - _TC", 0, 25000.0), + ("_Test Gain/Loss on Asset Disposal - _TC", 51948.53, 0.0), ("Debtors - _TC", 25000.0, 0.0) ) From ad99934b4c8b384e69499ae713842b4e5de7036f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Jul 2019 15:16:10 +0530 Subject: [PATCH 12/16] Update accounts_controller.py --- erpnext/controllers/accounts_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 79695732683..b98fbf42cdd 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -374,7 +374,7 @@ class AccountsController(TransactionBase): def validate_qty_is_not_zero(self): for item in self.items: if not item.qty: - frappe.throw("Item quantity can not be zero") + frappe.throw(_("Item quantity can not be zero")) def validate_account_currency(self, account, account_currency=None): valid_currency = [self.company_currency] From fb59d770bad3a3e37faea12b1ab811e37b2e6659 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 1 Jul 2019 16:31:36 +0530 Subject: [PATCH 13/16] fix: translated title (#18121) --- erpnext/stock/page/stock_balance/stock_balance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js index 85ea5b19be7..10ea3b7e228 100644 --- a/erpnext/stock/page/stock_balance/stock_balance.js +++ b/erpnext/stock/page/stock_balance/stock_balance.js @@ -1,7 +1,7 @@ frappe.pages['stock-balance'].on_page_load = function(wrapper) { var page = frappe.ui.make_app_page({ parent: wrapper, - title: 'Stock Summary', + title: __('Stock Summary'), single_column: true }); page.start = 0; From 47bca7f651db89b90932d8d30e34adbdea365dc7 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 1 Jul 2019 20:38:27 +0530 Subject: [PATCH 14/16] fix: multiple minor issues in delayed order report --- .../delayed_item_report/delayed_item_report.js | 2 +- .../delayed_item_report/delayed_item_report.py | 15 ++++++++++++--- .../delayed_order_report/delayed_order_report.js | 2 +- .../delayed_order_report/delayed_order_report.py | 13 ++++++++++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/erpnext/stock/report/delayed_item_report/delayed_item_report.js b/erpnext/stock/report/delayed_item_report/delayed_item_report.js index f1ead2c9fbb..40e6abefeb0 100644 --- a/erpnext/stock/report/delayed_item_report/delayed_item_report.js +++ b/erpnext/stock/report/delayed_item_report/delayed_item_report.js @@ -55,7 +55,7 @@ frappe.query_reports["Delayed Item Report"] = { label: __("Based On"), fieldtype: "Select", options: ["Delivery Note", "Sales Invoice"], - default: "Delivery Note", + default: "Sales Invoice", reqd: 1 }, ] diff --git a/erpnext/stock/report/delayed_item_report/delayed_item_report.py b/erpnext/stock/report/delayed_item_report/delayed_item_report.py index f8aa98886c1..a3d1faf9d3f 100644 --- a/erpnext/stock/report/delayed_item_report/delayed_item_report.py +++ b/erpnext/stock/report/delayed_item_report/delayed_item_report.py @@ -46,7 +46,8 @@ class DelayedItemReport(object): self.transactions = frappe.db.sql(""" SELECT `tab{child_doc}`.item_code, `tab{child_doc}`.item_name, `tab{child_doc}`.item_group, `tab{child_doc}`.qty, `tab{child_doc}`.rate, `tab{child_doc}`.amount, `tab{child_doc}`.so_detail, `tab{child_doc}`.{so_field} as sales_order, - `tab{doctype}`.customer, `tab{doctype}`.posting_date, `tab{doctype}`.name, `tab{doctype}`.grand_total + `tab{doctype}`.shipping_address_name, `tab{doctype}`.po_no, `tab{doctype}`.customer, + `tab{doctype}`.posting_date, `tab{doctype}`.name, `tab{doctype}`.grand_total FROM `tab{child_doc}`, `tab{doctype}` WHERE `tab{child_doc}`.parent = `tab{doctype}`.name and `tab{doctype}`.docstatus = 1 and @@ -97,12 +98,20 @@ class DelayedItemReport(object): "fieldtype": "Link", "options": based_on, "width": 100 - },{ + }, + { "label": _("Customer"), "fieldname": "customer", "fieldtype": "Link", "options": "Customer", - "width": 100 + "width": 200 + }, + { + "label": _("Shipping Address"), + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "options": "Address", + "width": 120 }, { "label": _("Expected Delivery Date"), diff --git a/erpnext/stock/report/delayed_order_report/delayed_order_report.js b/erpnext/stock/report/delayed_order_report/delayed_order_report.js index 5b02a58fafc..aab0f3d0d1f 100644 --- a/erpnext/stock/report/delayed_order_report/delayed_order_report.js +++ b/erpnext/stock/report/delayed_order_report/delayed_order_report.js @@ -55,7 +55,7 @@ frappe.query_reports["Delayed Order Report"] = { label: __("Based On"), fieldtype: "Select", options: ["Delivery Note", "Sales Invoice"], - default: "Delivery Note", + default: "Sales Invoice", reqd: 1 }, ] diff --git a/erpnext/stock/report/delayed_order_report/delayed_order_report.py b/erpnext/stock/report/delayed_order_report/delayed_order_report.py index d2a1a30d9e2..79dc5d88219 100644 --- a/erpnext/stock/report/delayed_order_report/delayed_order_report.py +++ b/erpnext/stock/report/delayed_order_report/delayed_order_report.py @@ -42,7 +42,14 @@ class DelayedOrderReport(DelayedItemReport): "fieldname": "customer", "fieldtype": "Link", "options": "Customer", - "width": 100 + "width": 200 + }, + { + "label": _("Shipping Address"), + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "options": "Address", + "width": 140 }, { "label": _("Expected Delivery Date"), @@ -73,11 +80,11 @@ class DelayedOrderReport(DelayedItemReport): "fieldname": "sales_order", "fieldtype": "Link", "options": "Sales Order", - "width": 100 + "width": 150 }, { "label": _("Customer PO"), "fieldname": "po_no", "fieldtype": "Data", - "width": 100 + "width": 110 }] \ No newline at end of file From 48474a2d4e15e4489e4af68f5d9117675d3981ef Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 2 Jul 2019 10:11:02 +0530 Subject: [PATCH 15/16] fix: Fiter passing fix in get batch query (#18130) --- erpnext/controllers/queries.py | 1 - erpnext/public/js/utils/serial_no_batch_selector.js | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index a40f0eff43b..e7f8c27d6df 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -297,7 +297,6 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters): order by batch.expiry_date, sle.batch_no desc limit %(start)s, %(page_len)s""".format(cond, match_conditions=get_match_cond(doctype)), args) - if batch_nos: return batch_nos else: return frappe.db.sql("""select name, concat('MFG-', manufacturing_date), concat('EXP-',expiry_date) from `tabBatch` batch diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 576ae0fbde1..c6086b9962b 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -240,14 +240,6 @@ erpnext.SerialNoBatchSelector = Class.extend({ get_batch_fields: function() { var me = this; - let filters = { - item_code: me.item_code - } - - if (me.warehouse || me.warehouse_details.name) { - filters['warehouse'] = me.warehouse || me.warehouse_details.name; - } - return [ { fieldtype: 'Section Break', label: __('Batches') }, { @@ -262,7 +254,10 @@ erpnext.SerialNoBatchSelector = Class.extend({ 'in_list_view': 1, get_query: function () { return { - filters: filters, + filters: { + item_code: me.item_code, + warehouse: me.warehouse || me.warehouse_details.name + }, query: 'erpnext.controllers.queries.get_batch_no' }; }, From 53e367492474cb6a651d480a1ae34b8a556fb66f Mon Sep 17 00:00:00 2001 From: Sahil Khan Date: Tue, 2 Jul 2019 19:06:20 +0550 Subject: [PATCH 16/16] bumped to version 11.1.43 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 8c70de3cc19..6b1ce9e669c 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '11.1.42' +__version__ = '11.1.43' def get_default_company(user=None): '''Get default company for user'''