diff --git a/docs/docs.user.stock.perpetual_inventory.md b/docs/docs.user.stock.perpetual_inventory.md
index 8dc2a2d807..0ff5517dfe 100644
--- a/docs/docs.user.stock.perpetual_inventory.md
+++ b/docs/docs.user.stock.perpetual_inventory.md
@@ -26,13 +26,13 @@ Migration from Periodic Inventory is not a one click settings, it involves some
Steps to be followed:
+- Nullify current stock-in-hand / fixed-asset account balance through Journal Voucher.
+- Create new warehouse for each existing warehouse.
+- Assign Asset / Expense account while creating new warehouse.
- Follow Activation Step 1 & 2
-- To enable Perpetual Inventory, existing stock balances must be synced with relevant account balances. To do that, calculate available stock value and book stock-in-hand/fixed-asset (asset) against cost-of-goods-sold (expense) through Journal Voucher.
-- Create new warehouse for every existing warehouse.
-- Assign Asset / Expense account while creating warehouse.
- Create Stock Entry (Material Transfer) to transfer available stock from existing warehouse to new warehouse
->Note: System will not post any accounting entries for existing stock transactions submitted prior to the activation of Perpetual Inventory.
+>Note: System will not post any accounting entries for existing stock transactions submitted prior to the activation of Perpetual Inventory as those old warehouses will not be linked to account.
-
@@ -216,11 +216,11 @@ Here apart from normal account entries for invoice, "Stock In Hand" and "Cost of
**Stock Ledger**
-![si_stock_ledger](img/accounting-for-stock-9.png)
+![mr_stock_ledger](img/accounting-for-stock-9.png)
**General Ledger**
-![si_stock_ledger](img/accounting-for-stock-10.png)
+![mr_stock_ledger](img/accounting-for-stock-10.png)
--
@@ -238,11 +238,11 @@ Here apart from normal account entries for invoice, "Stock In Hand" and "Cost of
**Stock Ledger**
-![si_stock_ledger](img/accounting-for-stock-11.png)
+![mi_stock_ledger](img/accounting-for-stock-11.png)
**General Ledger**
-![si_stock_ledger](img/accounting-for-stock-12.png)
+![mi_stock_ledger](img/accounting-for-stock-12.png)
--
@@ -262,8 +262,53 @@ Here apart from normal account entries for invoice, "Stock In Hand" and "Cost of
**Stock Ledger**
-![si_stock_ledger](img/accounting-for-stock-13.png)
+![mtn_stock_ledger](img/accounting-for-stock-13.png)
**General Ledger**
-No General Ledger Entry
\ No newline at end of file
+No General Ledger Entry
+
+--
+
+### **Stock Entry (Sales Return - Sales Invoice booked)**
+
+>**Items:**
+>
+>
+> Item | Target Warehouse | Qty | Rate | Amount |
+>
+>
+> RM0001 | Stores | 2 | 200 | 400 |
+>
+>
+
+**Stock Ledger**
+
+![sret_stock_ledger](img/accounting-for-stock-14.png)
+
+**General Ledger**
+
+![sret_general_ledger](img/accounting-for-stock-15.png)
+
+
+--
+
+### **Stock Entry (Purchase Return)**
+
+>**Items:**
+>
+>
+> Item | Source Warehouse | Qty | Rate | Amount |
+>
+>
+> RM0001 | Stores | 4 | 220 | 880 |
+>
+>
+
+**Stock Ledger**
+
+![pret_stock_ledger](img/accounting-for-stock-16.png)
+
+**General Ledger**
+
+![pret_general_ledger](img/accounting-for-stock-17.png)
diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
index 3a8cb78d2e..542acbeebe 100644
--- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
+++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
@@ -2,19 +2,47 @@
// License: GNU General Public License v3. See license.txt
-cur_frm.fields_dict['lc_pr_details'].grid.get_field("purchase_receipt").get_query = function(doc, cdt, cdn) {
- return {
- filters:[['Purchase Receipt', 'docstatus', '=', '1']]
- }
-}
+wn.provide("erpnext.stock");
+wn.require("public/app/js/controllers/stock_controller.js");
-cur_frm.fields_dict['landed_cost_details'].grid.get_field("account_head").get_query = function(doc, cdt, cdn) {
- return{
- filters:[
- ['Account', 'group_or_ledger', '=', 'Ledger'],
- ['Account', 'account_type', 'in', 'Tax, Chargeable'],
- ['Account', 'is_pl_account', '=', 'Yes'],
- ['Account', 'debit_or_credit', '=', 'Debit']
- ]
+erpnext.stock.LandedCostWizard = erpnext.stock.StockController.extend({
+ setup: function() {
+ var me = this;
+ this.frm.fields_dict.lc_pr_details.grid.get_field('purchase_receipt').get_query =
+ function() {
+ if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+ return {
+ filters:[
+ ['Purchase Receipt', 'docstatus', '=', '1'],
+ ['Purchase Receipt', 'company', '=', me.frm.doc.company],
+ ]
+ }
+ };
+
+ this.frm.fields_dict.landed_cost_details.grid.get_field('account_head').get_query = function() {
+ if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+ return {
+ filters:[
+ ['Account', 'group_or_ledger', '=', 'Ledger'],
+ ['Account', 'account_type', 'in', 'Tax, Chargeable'],
+ ['Account', 'is_pl_account', '=', 'Yes'],
+ ['Account', 'debit_or_credit', '=', 'Debit'],
+ ['Account', 'company', '=', me.frm.doc.company]
+ ]
+ }
+ },
+
+ this.frm.fields_dict.landed_cost_details.grid.get_field('cost_center').get_query =
+ function() {
+ if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+ return {
+ filters:[
+ ['Cost Center', 'group_or_ledger', '=', 'Ledger'],
+ ['Cost Center', 'company', '=', me.frm.doc.company]
+ ]
+ }
+ }
}
-}
+});
+
+cur_frm.script_manager.make(erpnext.stock.LandedCostWizard);
\ No newline at end of file
diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
index ec9ece1f09..40f2e23c90 100644
--- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
+++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-01-22 16:50:39",
"docstatus": 0,
- "modified": "2013-09-02 13:45:54",
+ "modified": "2013-09-02 19:13:09",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -38,6 +38,14 @@
"doctype": "DocType",
"name": "Landed Cost Wizard"
},
+ {
+ "doctype": "DocField",
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "label": "Company",
+ "options": "Company",
+ "reqd": 1
+ },
{
"doctype": "DocField",
"fieldname": "section_break0",