diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt index 2420ad5503..7eda7fd62f 100755 --- a/accounts/doctype/pos_setting/pos_setting.txt +++ b/accounts/doctype/pos_setting/pos_setting.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 12:15:51", "docstatus": 0, - "modified": "2013-08-28 19:13:42", + "modified": "2013-10-15 11:12:02", "modified_by": "Administrator", "owner": "Administrator" }, @@ -80,16 +80,6 @@ "read_only": 0, "reqd": 1 }, - { - "doctype": "DocField", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Conversion Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "read_only": 0, - "reqd": 1 - }, { "doctype": "DocField", "fieldname": "selling_price_list", diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js index 5220c0fa20..46e336f029 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.js +++ b/accounts/doctype/sales_invoice/sales_invoice.js @@ -147,7 +147,6 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }); } } - }, debit_to: function() { diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 516d1925a8..b168ba64fd 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-10-03 18:54:31", + "modified": "2013-10-11 13:12:38", "modified_by": "Administrator", "owner": "Administrator" }, @@ -225,7 +225,6 @@ "reqd": 1 }, { - "default": "1.00", "description": "Rate at which Customer Currency is converted to customer's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 927b24980f..3af9c7a547 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): + def set_price_list_currency(self, buying_or_selling, for_validate=False): if self.meta.get_field("currency"): company_currency = get_company_currency(self.doc.company) @@ -60,14 +60,13 @@ class AccountsController(TransactionBase): fieldname = "selling_price_list" if buying_or_selling.lower() == "selling" \ else "buying_price_list" if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname): - if not self.doc.price_list_currency: - self.doc.price_list_currency = webnotes.conn.get_value("Price List", - self.doc.fields.get(fieldname), "currency") + self.doc.price_list_currency = webnotes.conn.get_value("Price List", + self.doc.fields.get(fieldname), "currency") if self.doc.price_list_currency == company_currency: self.doc.plc_conversion_rate = 1.0 - elif not self.doc.plc_conversion_rate: + elif not self.doc.plc_conversion_rate or not for_validate: self.doc.plc_conversion_rate = self.get_exchange_rate( self.doc.price_list_currency, company_currency) @@ -77,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: + elif not self.doc.conversion_rate or not for_validate: 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 fd3428e6ad..2aa7c834da 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") + self.set_price_list_currency("Buying", for_validate) # 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 37674ee4bf..845ba859e0 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() + self.set_price_list_and_item_details(for_validate) 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): - self.set_price_list_currency("Selling") + def set_price_list_and_item_details(self, for_validate=False): + self.set_price_list_currency("Selling", for_validate) self.set_missing_item_details(get_item_details) def get_other_charges(self): diff --git a/docs/user/accounts/docs.user.accounts.pos.md b/docs/user/accounts/docs.user.accounts.pos.md index 654a5d6dfa..7bd668ef72 100644 --- a/docs/user/accounts/docs.user.accounts.pos.md +++ b/docs/user/accounts/docs.user.accounts.pos.md @@ -13,33 +13,34 @@ You can make a Sales Invoice of type POS by checking on “Is POS”. When you c - Update Stock: If this is checked, Stock Ledger Entries will be made when you “Submit” this Sales Invoice thereby eliminating the need for a separate Delivery Note.
 - In your Items table, update inventory information like Warehouse (saved as default), Serial Number, or Batch Number if applicable.
 -- Update Payment Details like your Bank / Cash Account, paid amount etc.
 +- Update Payment Details like your Bank / Cash Account, Paid amount etc.
 - If you are writing off certain amount. For example when you receive extra cash as a result of not having exact denomination of change, check on ‘Write off Outstanding Amount’ and set the Account. -Setup [POS Setting](docs.user.setup.pos_setting.html) #### Enable POS View -Sales Invoice has 2 different interfaces, Invoice View and POS View. The current view used by most users is the Invoice View. This view is preferred by non-retailing companies.The POS view is used by retailing companies. For retailers it is very important to provide bill or sales invoice at the point of sale. Their customers cannot wait to receive the bill by post. The customers want an immediate bill for the payment which they make. In such cases, the POS View is preferred. +- Every Sales & Purchase documents has 2 different interfaces, Invoice View and POS View. The current view used by most users is the Invoice View. This view is preferred by non-retailing companies.The POS view is used by retailing companies. For retailers it is very important to provide bill or sales invoice at the point of sale. Their customers cannot wait to receive the bill by post. The customers want an immediate bill for the payment which they make. In such cases, the POS View is preferred. > Setup > Show/Hide Features ![POS View](img/pos-features-setup.png) +- Setup [POS Setting](docs.user.setup.pos_setting.html) + ### Adding an Item -At the billing counter, the retailer needs to select Items which the consumer buys. In the POS interface you can select an Item by two methods. One, is by clicking on the Item image and the other, is through the Barcode. +At the billing counter, the retailer needs to select Items which the consumer buys. In the POS interface you can select an Item by two methods. One, is by clicking on the Item image and the other, is through the Barcode / Serial No. **Select Item** - To select a product click on the Item image and add it into the cart. A cart is an area that prepares a customer for checkout by allowing to edit product information, adjust taxes and add discounts. -**Barcode** - A Barcode is an optical machine-readable representation of data relating to the object to which it is attached. Enter Barcode in the barcode box and pause for a second. The Item will be automatically added to the cart. +**Barcode / Serial No** - A Barcode / Serial No is an optical machine-readable representation of data relating to the object to which it is attached. Enter Barcode / Serial No in the box as shown in the image below and pause for a second, the item will be automatically added to the cart. ![POS](img/pos-add-item.png) > Tip: To change the quantity of an Item, enter your desired quantity in the quantity box. These are mostly used if the same Item is purchased in bulk. -If your product list is very long use the universal search field, to type the product name and select faster. +If your product list is very long use the Search field, type the product name in Search box. ### Removing an Item @@ -48,7 +49,7 @@ There are two ways to remove an Item. - Select an Item by clicking on the row of that Item from Item cart. Then click on “Del” button. OR -- Type 0 in the ‘select quantity’ field to delete the record. +- Enter 0(zero) quantity of any item to delete that item. To remove multiple Items together, select multiple rows & click on “Del” button. @@ -62,11 +63,11 @@ After all the Items and their quantities are added into the cart, you are ready 1. Click on “Make Payment” to get the Payment window. 1. Select your “Mode of Payment”. -1. Click on “Pay” button to Save the Sales Invoice. +1. Click on “Pay” button to Save the document. ![POS Payment](img/pos-make-payment.png) -Submit the document to finalise the record. After the Invoice is submitted, you can either print an invoice or email it directly to the customer. +Submit the document to finalise the record. After the document is submitted, you can either print or email it directly to the customer. #### Accounting entries (GL Entry) for a Point of Sale: diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.day_1.md b/docs/user/five_day_setup/docs.user.five_day_setup.day_1.md index 9f39810f1a..bbb8b86e34 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.day_1.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.day_1.md @@ -10,10 +10,8 @@ After logging into your account you will receive a pop-up form to fill. Please f #### Form Part I ![1st Form](img/firstdaysetup-1.png) -
+

#### Form Part II -
- To understand about Company Financial Year or Fiscal Year visit [Fiscal Year](docs.user.knowledge.fiscal_year.html) @@ -61,8 +59,6 @@ To understand how to fill an Item in detail, visit [Item](docs.user.stock.item.h
#### Setup Page - Suppliers -
- On the Setup page go to Supplier. ![Supplier](img/firstdaysetup-supplier.png) diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.day_2.md b/docs/user/five_day_setup/docs.user.five_day_setup.day_2.md index d2e826f5e7..f01662319b 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.day_2.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.day_2.md @@ -4,8 +4,8 @@ } --- -#### Setup Page- Accounts - +#### Setup Page - Accounts +
Go to the Accounts icon and make ledgers under Chart of Accounts. ![Accounts](img/seconddaysetup-accounts.png) @@ -21,8 +21,6 @@ Create acccounting ledgers. To begin Opening Entries, go to 'Opening Accounts and Stock' on the Setup Page. -
- ![Ledger](img/seconddaysetup-accounts-jv.png)
@@ -30,6 +28,8 @@ To begin Opening Entries, go to 'Opening Accounts and Stock' on the Setup Page. To understand how to create opening entries in detail visit [Opening Entry](docs.user.setup.opening.html). +
+ #### Opening Stock You can upload your opening stock in the system using Stock Reconciliation. Stock Reconciliation will update your stock for any given Item. @@ -40,6 +40,7 @@ You can upload your opening stock in the system using Stock Reconciliation. Stoc To understand Stock Opening in detail visit [Opening Stock](docs.user.accounts.opening_stock.html). +
#### Setup Page - HR Setup diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.day_3.md b/docs/user/five_day_setup/docs.user.five_day_setup.day_3.md index 4a15f5c90b..e0c4114c06 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.day_3.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.day_3.md @@ -8,8 +8,10 @@ After completing the set-up and account opening process, it is advisable to com ### Sales Cycle -Complete a standard sales cycle - Lead > Opportunity > Quotation > Sales Order > Delivery Note > Sales Invoice > Payment (Journal Voucher) +Complete a standard Sales Cycle. +> Lead > Opportunity > Quotation > Sales Order > Delivery Note > Sales Invoice > Payment (Journal Voucher) +
#### Lead To begin the sales cycle, go to the Selling Icon. On the selling page, click on Lead. @@ -20,6 +22,7 @@ Fill the Lead form. > To understand Lead in detail, visit [Lead](docs.user.selling.lead.html) +
#### Opportunity After completing the Lead form, assume that, this same lead is getting converted into an Opportunity. Thus, to create an Opportunity from the existing lead, click on Create Opportunity, on the Lead page. @@ -38,7 +41,7 @@ You can also generate an Opportunity directly from the Selling Page. > To understand Opportunity in detail visit [Opportunity](docs.user.selling.opportunity.html). - +
#### Quotation Imagine that your Opportunity has shown interest and asked for a Quotation. To generate a Quotation from the same Opportunity, open the submitted Opportunity and click on Create Quotation. @@ -49,7 +52,7 @@ You can also generate a Quotation directly from the Selling Page. > To understand Quotation in detail visit [Quotation](docs.user.selling.quotation.html) - +
#### Sales Order Imagine that the Quotation which you sent was accepted by the prospect. You are now reequired to send him a Sales Order. To make a sales order from this same Quotation, go to that Quotation page and click on Make Sales Order. @@ -60,6 +63,7 @@ You can also generate a Sales Order directly from the Selling Page. > To understand Sales Order in detail visit [Sales Order](docs.user.selling.sales_order.html). +
#### Delivery Note If your organisation has the practice of sending Delivery Note, this section will be helpful. To create a Delivery Note from the a Sales Order, go to that Sales Order and click on Make Delivery. @@ -69,7 +73,7 @@ If your organisation has the practice of sending Delivery Note, this section wil > To understand Delivery Note in detail, visit [Delivery Note](docs.user.stock.delivery_note.html) - +
#### Sales Invoice Save and Submit your Delivery Note to generate a Sales Invoice. You can also generate an Invoice from Sales Order. @@ -91,9 +95,10 @@ A Journal Voucher or a payment entry can be generated directly from the Sales In ### Purchase Cycle -Complete a standard purchase cycle - Material Request > Purchase Order > Purchase Receipt > Payment (Journal Voucher). - +Complete a standard Purchase Cycle. +> Material Request > Purchase Order > Purchase Receipt > Payment (Journal Voucher). +
#### Material Request To create a Material Request, go to Stock/Buying and Click on Material Request. @@ -102,6 +107,7 @@ To create a Material Request, go to Stock/Buying and Click on Material Request. > To understand Material Request in detail, visit [Material Request](docs.user.buying.material_request.html) +
#### Purchase Order To create a Purchase Order go to Buying and click on Purchase Order @@ -110,26 +116,24 @@ To create a Purchase Order go to Buying and click on Purchase Order > To understand Purchase Order in detail, visit [Purchase Order](docs.user.buying.purchase_order.html) +
#### Purchase Receipt To create a Purchase Receipt from an existing Purchase Order, open that purchase order and click on Make Purchase Receipt. ![Purchase Receipt](img/thirddaysetup-purchase-receipt.png) -
>To understand Purchase Receipt in detail, visit [Purchase Receipt](docs.user.stock.purchase_receipt.html)
-#### Payment( Journal Voucher) +#### Payment (Journal Voucher) Payments made against Sales Invoices or Purchase Invoices can be made by clicking on “Make Payment Entry” button on “Submitted” invoices. ![Payment Entry](img/thirddaysetup-payment-entry.png) -
> To understand Payment Entry in detail, visit [Payment Entry](docs.user.accounts.payments.html). - diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.day_4.md b/docs/user/five_day_setup/docs.user.five_day_setup.day_4.md index cdd43f0a75..af6e636554 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.day_4.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.day_4.md @@ -6,81 +6,71 @@ ### Manufacturing Cycle -Complete a manufacturing cycle (if applicable) - BOM > Production Planning Tool > Production Order > Stock Entry (material issue) > Stock Entry (sales return) +Complete a manufacturing cycle (if applicable). +> BOM > Production Planning Tool > Production Order > Stock Entry (Material Issue) > Stock Entry (Sales Return) +
#### Bill of Materials To go to Bill of Materials, Click on Manufacturing. On the Manufacturing page, click on Bill of Materials. ![Bill of Materials](img/fourthdaysetup-bom.png) -
- > To understand BOM in detail, visit [Bill of Materials](docs.user.mfg.bom.html) +
#### Production Planning Tool To go to Production Planning Tool, click on the Manufacturing Icon. On the Manufacturing Page, click on Production Planning Tool to go to that page. ![Production Planning Page](img/fourthdaysetup-ppt.png) -
- > To understand Production Planning Tool in detail, visit [Production Planning](docs.user.mfg.planning.html) - +
#### Production Order To go to Production Order click on the Manufacturing Icon. On the Manufacturing Page, click on Production Order. ![Production Order](img/fourthdaysetup-po.png) -
- > To understand Production Order in detail, visit [Production Order](docs.user.mfg.production_order.html) +
#### Stock Entry To go to Stock Entry, click on the Stock Icon and go to Stock Entry. ![Stock Entry](img/fourthdaysetup-stock.png) +> To understand Material Issue, visit [Material Issue](docs.user.stock.material_issue.html). + +> To understand Sales Return, visit [Sales Return](docs.user.stock.sales_return.html). +
- -> To understand Material Issue, visit [Material Issue](docs.user.stock.material_issue.html) - - -> To understand Sales Return, visit [Sales Return](docs.user.stock.sales_return.html) - - #### Delivery Note To go to Delivery Note, click on Stock. On the Stock Page, click on Delivery Note. ![Delivery Note](img/fourthdaysetup-delivery-note.png) -
- > To understand Delivery Note in detail, visit [Delivery Note](docs.user.stock.delivery_note.html) - - +
#### Warehouse To go to Warehouse, Click on Stock. On the Stock Page, go to Warehouse. ![Warehouse](img/fourthdaysetup-warehouse.png) +> To understand Warehouse in detail, visit [Warehouse](docs.user.stock.warehouse.html) +
- -> To understand Warehouse in detail, visit [Warehouse](docs.user.stock.warehouse.html) - - #### Accounts Make a few Journal Vouchers. Generate some Accounting Reports. -#### Journal Voucher. +#### Journal Voucher To go to a Journal Voucher, click on Accounts. On the Accounts page, click on Journal Voucher. @@ -88,9 +78,9 @@ To go to a Journal Voucher, click on Accounts. On the Accounts page, click on Jo > To understand Journal Voucher in detail, visit [Journal Voucher](docs.user.accounts.journal_voucher.html) -#### Accounting Reports +
+### Accounting Reports Some of the major Accounting Reports are General Ledger, Trial Balance, Accounts Payable and Accounts Receivables, and Sales and Purchase Register. > To be able to generate these accounts, visti [Accounting Reports](docs.user.accounts.report.html) - diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.day_5.md b/docs/user/five_day_setup/docs.user.five_day_setup.day_5.md index d0572db3c2..db386a0a3e 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.day_5.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.day_5.md @@ -1,6 +1,6 @@ --- { - "_label": "Day-5: Projects Calendar and Website" + "_label": "Day-5: Projects, Calendar, and Website" } --- @@ -8,6 +8,7 @@ ERPNext helps you to manage your Projects by breaking them into Tasks and allocating them to different people. +
#### Tasks Project is divided into Tasks and each Task is allocated to a resource. In ERPNext, you can also create and allocate a Task independently of a Project. @@ -16,19 +17,16 @@ To create a Task, go to Project and click on Task. ![Tasks](img/fifthdaysetup-tasks.png) -
- - -> To understand Projects in detail, visit [Projects](docs.user.projects.html) +> To understand Projects in detail, visit [Projects](docs.user.projects.html). > To understand Task in detail, visit [Tasks](docs.user.projects.tasks.html) +
#### Calendar > To understand Calendar in detail, visit [Calendar](docs.user.tools.calendar.html) - +
#### Website > To understand Website in detail, visit [Website](docs.user.website.html) - diff --git a/docs/user/five_day_setup/docs.user.five_day_setup.md b/docs/user/five_day_setup/docs.user.five_day_setup.md index d296914f9e..90aeb56c22 100644 --- a/docs/user/five_day_setup/docs.user.five_day_setup.md +++ b/docs/user/five_day_setup/docs.user.five_day_setup.md @@ -45,5 +45,4 @@ The setup help is divided into day-wise instructions for 5 consecutive days. - Projects - Calendar -- Website - +- Website \ No newline at end of file diff --git a/docs/user/knowledge/docs.user.knowledge.attachment_csv.md b/docs/user/knowledge/docs.user.knowledge.attachment_csv.md index 311934d7f4..eecc42ddcf 100644 --- a/docs/user/knowledge/docs.user.knowledge.attachment_csv.md +++ b/docs/user/knowledge/docs.user.knowledge.attachment_csv.md @@ -1,6 +1,6 @@ --- { - "_label": "Attachement and CSV files" + "_label": "Attachment and CSV files" } --- diff --git a/docs/user/setup/docs.user.setup.md b/docs/user/setup/docs.user.setup.md index fa9680a062..585811f66e 100644 --- a/docs/user/setup/docs.user.setup.md +++ b/docs/user/setup/docs.user.setup.md @@ -18,7 +18,7 @@ "docs.user.setup.email", "docs.user.setup.sms", "docs.user.setup.taxes", - "docs.user.setup.price_lists", + "docs.user.setup.price_list", "docs.user.setup.opening", "docs.user.setup.pos_setting", "docs.user.setup.third_party_backups" diff --git a/docs/user/setup/docs.user.setup.price_list.md b/docs/user/setup/docs.user.setup.price_list.md index 021df09041..7214fff514 100644 --- a/docs/user/setup/docs.user.setup.price_list.md +++ b/docs/user/setup/docs.user.setup.price_list.md @@ -7,7 +7,7 @@ A Price List is a place where different rate plans can be stored. It’s a name An Item can have multiple prices based on customer, currency, region, shipping cost etc, which can be stored as different rate plans. In ERPNext, you are required to store all the lists seperately. Buying Price List is different from Selling Price List and thus is stored separately. -> Selling > Price List +> Setup > Price List ![Price-List](img/price-lists.png) @@ -15,7 +15,14 @@ An Item can have multiple prices based on customer, currency, region, shipping c > For multiple currencies, maintain multiple Price Lists. +
+### Add Item in Price List -To add a new Item to the Price List, add the Item Code and its rate in the Item Prices table. +> Setup > Item Price -You can also import Item Prices via [Data Import Tool](docs.user.setup.data_import.html) \ No newline at end of file +- Enter Price List and Item Code, Valid for Buying or Selling, Item Name & Item Description will be automatically fetched. +- Enter Rate and save the document. + +![Item-Price](img/item-price.png) + +For bulk upload of Item Prices, use [Data Import Tool](docs.user.setup.data_import.html) \ No newline at end of file diff --git a/public/js/transaction.js b/public/js/transaction.js index e12d1084e9..79ea53623f 100644 --- a/public/js/transaction.js +++ b/public/js/transaction.js @@ -21,8 +21,6 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ company: wn.defaults.get_default("company"), fiscal_year: wn.defaults.get_default("fiscal_year"), is_subcontracted: "No", - conversion_rate: 1.0, - plc_conversion_rate: 1.0 }, function(fieldname, value) { if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) me.frm.set_value(fieldname, value); @@ -41,18 +39,19 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }, onload_post_render: function() { - if(this.frm.doc.__islocal && this.frm.doc.company && !this.frm.doc.customer) { - var me = this; - return this.frm.call({ - doc: this.frm.doc, - method: "onload_post_render", - freeze: true, - callback: function(r) { - // remove this call when using client side mapper - me.set_default_values(); - me.set_dynamic_labels(); - } - }); + if(this.frm.doc.__islocal && this.frm.doc.company && + !this.frm.doc.customer && !this.frm.doc.is_pos) { + var me = this; + return this.frm.call({ + doc: this.frm.doc, + method: "onload_post_render", + freeze: true, + callback: function(r) { + // remove this call when using client side mapper + me.set_default_values(); + me.set_dynamic_labels(); + } + }); } }, @@ -131,10 +130,18 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ company: function() { if(this.frm.doc.company && this.frm.fields_dict.currency) { - if(!this.frm.doc.currency) { - this.frm.set_value("currency", this.get_company_currency()); + var company_currency = this.get_company_currency(); + if (!this.frm.doc.currency) { + this.frm.set_value("currency", company_currency); } + if (this.frm.doc.currency == company_currency) { + this.frm.set_value("conversion_rate", 1.0); + } + if (this.frm.doc.price_list_currency == company_currency) { + this.frm.set_value('plc_conversion_rate', 1.0); + } + this.frm.script_manager.trigger("currency"); } }, @@ -146,15 +153,13 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ currency: function() { var me = this; this.set_dynamic_labels(); - + var company_currency = this.get_company_currency(); if(this.frm.doc.currency !== company_currency) { this.get_exchange_rate(this.frm.doc.currency, company_currency, function(exchange_rate) { - if(exchange_rate) { - me.frm.set_value("conversion_rate", exchange_rate); - me.conversion_rate(); - } + me.frm.set_value("conversion_rate", exchange_rate); + me.conversion_rate(); }); } else { this.conversion_rate(); @@ -168,7 +173,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ this.frm.doc.plc_conversion_rate !== this.frm.doc.conversion_rate) { this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate); } - + this.calculate_taxes_and_totals(); }, @@ -233,29 +238,6 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ this.calculate_taxes_and_totals(); }, - // serial_no: function(doc, cdt, cdn) { - // var me = this; - // var item = wn.model.get_doc(cdt, cdn); - // if (!item.item_code) { - // wn.call({ - // method: 'accounts.doctype.sales_invoice.pos.get_item_from_serial_no', - // args: {serial_no: this.serial_no.$input.val()}, - // callback: function(r) { - // if (r.message) { - // var item_code = r.message[0].item_code; - // var child = wn.model.add_child(me.frm.doc, this.frm.doctype + " Item", - // this.frm.cscript.fname); - // child.item_code = item_code; - // me.frm.cscript.item_code(me.frm.doc, child.doctype, child.name); - // } - // else - // msgprint(wn._("Invalid Serial No.")); - // me.refresh(); - // } - // }); - // } - // }, - row_id: function(doc, cdt, cdn) { var tax = wn.model.get_doc(cdt, cdn); try { @@ -486,12 +468,8 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ } var company_currency = this.get_company_currency(); - var valid_conversion_rate = this.frm.doc.conversion_rate ? - ((this.frm.doc.currency == company_currency && this.frm.doc.conversion_rate == 1.0) || - (this.frm.doc.currency != company_currency && this.frm.doc.conversion_rate != 1.0)) : - false; - if(!valid_conversion_rate) { + if(!this.frm.doc.conversion_rate) { wn.throw(wn._("Please enter valid") + " " + wn._(conversion_rate_label) + " 1 " + this.frm.doc.currency + " = [?] " + company_currency); } diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt index 3f97c980bc..62c36b432f 100644 --- a/selling/doctype/quotation/quotation.txt +++ b/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2013-09-10 10:46:33", + "modified": "2013-10-11 13:21:07", "modified_by": "Administrator", "owner": "Administrator" }, @@ -257,7 +257,6 @@ "width": "100px" }, { - "default": "1.00", "description": "Rate at which customer's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt index 94e63888e3..46a06b5bc4 100644 --- a/selling/doctype/sales_order/sales_order.txt +++ b/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2013-08-09 14:46:17", + "modified": "2013-10-11 13:18:47", "modified_by": "Administrator", "owner": "Administrator" }, @@ -272,7 +272,6 @@ "width": "100px" }, { - "default": "1.00", "description": "Rate at which customer's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt index f1493bb3bf..6834365b3f 100644 --- a/stock/doctype/delivery_note/delivery_note.txt +++ b/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2013-08-09 14:46:32", + "modified": "2013-10-11 13:19:40", "modified_by": "Administrator", "owner": "Administrator" }, @@ -230,7 +230,7 @@ "depends_on": "eval:doc.po_no", "doctype": "DocField", "fieldname": "po_date", - "fieldtype": "Data", + "fieldtype": "Date", "hidden": 1, "label": "Customer's Purchase Order Date", "no_copy": 0, @@ -263,7 +263,6 @@ "reqd": 1 }, { - "default": "1.00", "description": "Rate at which customer's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/stock/doctype/purchase_receipt/purchase_receipt.txt b/stock/doctype/purchase_receipt/purchase_receipt.txt index 11846435ce..f228a147c3 100755 --- a/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2013-08-09 14:47:05", + "modified": "2013-10-11 13:20:13", "modified_by": "Administrator", "owner": "Administrator" }, @@ -215,7 +215,6 @@ "reqd": 1 }, { - "default": "1.00", "description": "Rate at which supplier's currency is converted to company's base currency", "doctype": "DocField", "fieldname": "conversion_rate", diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 36231bf4f1..0f4d6bcacd 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -144,7 +144,6 @@ class TransactionBase(StatusUpdater): def get_customer_address(self, args): args = load_json(args) - webnotes.errprint(args) ret = { 'customer_address' : args["address"], 'address_display' : get_address_display(args["address"]), @@ -432,14 +431,7 @@ def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, c company_currency = webnotes.conn.get_value("Company", company, "default_currency") - # parenthesis for 'OR' are necessary as we want it to evaluate as - # mandatory valid condition and (1st optional valid condition - # or 2nd optional valid condition) - valid_conversion_rate = (conversion_rate and - ((currency == company_currency and conversion_rate == 1.00) - or (currency != company_currency and conversion_rate != 1.00))) - - if not valid_conversion_rate: + if not conversion_rate: msgprint(_('Please enter valid ') + conversion_rate_label + (': ') + ("1 %s = [?] %s" % (currency, company_currency)), raise_exception=True)