diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index e980f0a2bc..8192fe5c52 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -29,7 +29,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte // toggle to pos view if is_pos is 1 in user_defaults if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || cur_frm.doc.is_pos) && cint(wn.defaults.get_user_defaults("fs_pos_view"))===1) { - if(this.frm.doc.__islocal && !this.frm.doc.amended_from) { + if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) { this.frm.set_value("is_pos", 1); this.is_pos(function() {cur_frm.cscript.toggle_pos(true);}); } diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 3af9c7a547..2b6a21f5ed 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -52,7 +52,7 @@ class AccountsController(TransactionBase): msgprint(_("Account for this ") + fieldname + _(" has been freezed. ") + self.doc.doctype + _(" can not be made."), raise_exception=1) - def set_price_list_currency(self, buying_or_selling, for_validate=False): + def set_price_list_currency(self, buying_or_selling): if self.meta.get_field("currency"): company_currency = get_company_currency(self.doc.company) @@ -66,7 +66,7 @@ class AccountsController(TransactionBase): if self.doc.price_list_currency == company_currency: self.doc.plc_conversion_rate = 1.0 - elif not self.doc.plc_conversion_rate or not for_validate: + elif not self.doc.plc_conversion_rate: self.doc.plc_conversion_rate = self.get_exchange_rate( self.doc.price_list_currency, company_currency) @@ -76,7 +76,7 @@ class AccountsController(TransactionBase): self.doc.conversion_rate = self.doc.plc_conversion_rate elif self.doc.currency == company_currency: self.doc.conversion_rate = 1.0 - elif not self.doc.conversion_rate or not for_validate: + elif not self.doc.conversion_rate: self.doc.conversion_rate = self.get_exchange_rate(self.doc.currency, company_currency) diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 2aa7c834da..fd3428e6ad 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -28,7 +28,7 @@ class BuyingController(StockController): super(BuyingController, self).set_missing_values(for_validate) self.set_supplier_from_item_default() - self.set_price_list_currency("Buying", for_validate) + self.set_price_list_currency("Buying") # set contact and address details for supplier, if they are not mentioned if self.doc.supplier and not (self.doc.contact_person and self.doc.supplier_address): diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index 845ba859e0..37674ee4bf 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -20,7 +20,7 @@ class SellingController(StockController): # set contact and address details for customer, if they are not mentioned self.set_missing_lead_customer_details() - self.set_price_list_and_item_details(for_validate) + self.set_price_list_and_item_details() if self.doc.fields.get("__islocal"): self.set_taxes("other_charges", "charge") @@ -38,8 +38,8 @@ class SellingController(StockController): if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname): self.doc.fields[fieldname] = val - def set_price_list_and_item_details(self, for_validate=False): - self.set_price_list_currency("Selling", for_validate) + def set_price_list_and_item_details(self): + self.set_price_list_currency("Selling") self.set_missing_item_details(get_item_details) def get_other_charges(self): diff --git a/docs/user/stock/docs.user.stock.item.md b/docs/user/stock/docs.user.stock.item.md index f7746c4842..fdf304559b 100644 --- a/docs/user/stock/docs.user.stock.item.md +++ b/docs/user/stock/docs.user.stock.item.md @@ -38,11 +38,11 @@ In ERPNext, you can select different type of Warehouses to stock your different ### Serialized and Batched Inventory -These numbers help to track individual units or batches of Items which you sell. It also tracks warranty and returns. In case any individual Item is recalled by the supplier the number system helps to track individual Item. The numbering system also manages expiry dates. Please note that if you sell your items in thousands, and if the items are very small like pens or erasers, you need not serialize them. In ERPNext, you will have to mention the serial number in some accounting entries. To create serial numbers you will have to manually create all the numbers in your entries. If your product is not a big consumer durable Item, if it has no warranty and has no chances of being recalled, avoid giving serial numbers. +These numbers help to track individual units or batches of Items which you sell. It also tracks warranty and returns. In case any individual Item is recalled by the supplier the number system helps to track individual Item. The numbering system also manages expiry dates. Please note that if you sell your items in thousands, and if the items are very small like pens or erasers, you need not serialize them. In ERPNext, you will have to mention the serial number in some accounting entries. To create serial numbers you will have to manually create all the numbers in your entries. If your product is not a big consumer durable Item, if it has no warranty and has no chances of being recalled, avoid giving serial numbers. > Important: Once you mark an item as serialized or batched or neither, you cannot change it after you have made any stock entry. -- [Disucssion on Serialized Inventory](docs.user.stock.serialized.html) +- [Discussion on Serialized Inventory](docs.user.stock.serialized.html) ### Re Ordering diff --git a/public/js/transaction.js b/public/js/transaction.js index 79ea53623f..e32fe1533e 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -24,9 +24,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, function(fieldname, value) { if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) me.frm.set_value(fieldname, value); - }); - - me.frm.script_manager.trigger("company"); + }); } if(this.other_fname) { @@ -39,9 +37,9 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, onload_post_render: function() { - if(this.frm.doc.__islocal && this.frm.doc.company && - !this.frm.doc.customer && !this.frm.doc.is_pos) { - var me = this; + var me = this; + if(this.frm.doc.__islocal && this.frm.doc.company && !this.frm.doc.is_pos) { + if(!this.frm.doc.customer) { return this.frm.call({ doc: this.frm.doc, method: "onload_post_render", @@ -50,8 +48,12 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ // remove this call when using client side mapper me.set_default_values(); me.set_dynamic_labels(); + me.calculate_taxes_and_totals() } }); + } else { + this.calculate_taxes_and_totals(); + } } },