From aa028d785665d5b9a113bd08548371ea1acc0a83 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Apr 2019 15:49:38 +0530 Subject: [PATCH] fix: don't allocate advances if POS --- erpnext/accounts/doctype/sales_invoice/sales_invoice.js | 1 + erpnext/controllers/accounts_controller.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 44af743ebf..90a0ef4639 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -369,6 +369,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte set_pos_data: function() { if(this.frm.doc.is_pos) { + this.frm.set_value("allocate_advances_automatically", this.frm.doc.is_pos ? 0 : 1); if(!this.frm.doc.company) { this.frm.set_value("is_pos", 0); frappe.msgprint(__("Please specify Company to proceed")); diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 63ea2591c5..90dc0861ca 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -89,7 +89,7 @@ class AccountsController(TransactionBase): self.validate_paid_amount() if self.doctype in ['Purchase Invoice', 'Sales Invoice']: - if cint(self.allocate_advances_automatically): + if cint(self.allocate_advances_automatically) and not cint(self.is_pos): self.set_advances() if self.is_return: