aii fixes

This commit is contained in:
Nabin Hait
2013-03-29 16:42:33 +05:30
parent acecb94a0f
commit 787c02ee42
27 changed files with 294 additions and 150 deletions

View File

@@ -74,6 +74,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer);
set_print_hide(doc, cdt, cdn);
// unhide expense_account and cost_center is auto_inventory_accounting enabled
var aii_enabled = cint(sys_defaults.auto_inventory_accounting)
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("expense_account", aii_enabled);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp("cost_center", aii_enabled);
}

View File

@@ -21,6 +21,8 @@ from webnotes.utils import cstr, flt, getdate, cint
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
import webnotes.defaults
sql = webnotes.conn.sql
@@ -312,7 +314,7 @@ class DocType(SellingController):
webnotes.conn.set(self.doc, 'status', 'Cancelled')
self.cancel_packing_slips()
self.make_gl_entries()
self.make_cancel_gl_entries()
def check_next_docstatus(self):

View File

@@ -21,6 +21,7 @@ from webnotes.utils import cstr, flt, cint
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
import webnotes.defaults
sql = webnotes.conn.sql
@@ -290,7 +291,7 @@ class DocType(BuyingController):
# 6. Update last purchase rate
pc_obj.update_last_purchase_rate(self, 0)
self.make_gl_entries()
self.make_cancel_gl_entries()
def bk_flush_supp_wh(self, is_submit):
for d in getlist(self.doclist, 'pr_raw_material_details'):
@@ -326,7 +327,7 @@ class DocType(BuyingController):
gl_entries = self.get_gl_entries_for_stock(against_stock_account, total_valuation_amount)
if gl_entries:
make_gl_entries(gl_entries, cancel=self.doc.docstatus == 2)
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
def get_total_valuation_amount(self):
total_valuation_amount = 0.0

View File

@@ -19,7 +19,7 @@ import webnotes
from webnotes.utils import cint, getdate, nowdate
import datetime
from webnotes import msgprint, _
from webnotes import msgprint
from controllers.stock_controller import StockController
@@ -103,7 +103,12 @@ class DocType(StockController):
elif self.doc.status == 'In Store':
webnotes.conn.set(self.doc, 'status', 'Not in Use')
self.make_stock_ledger_entry(-1)
self.make_gl_entries(cancel=True)
if cint(webnotes.defaults.get_global_default("auto_inventory_accounting")) \
and webnotes.conn.sql("""select name from `tabGL Entry`
where voucher_type=%s and voucher_no=%s and ifnull(is_cancelled, 'No')='No'""",
(self.doc.doctype, self.doc.name)):
self.make_gl_entries(cancel=True)
def on_cancel(self):

View File

@@ -77,7 +77,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
};
if (sys_defaults.auto_inventory_accounting) {
this.frm.add_fetch("company", "expense_adjustment_account", "stock_adjustment_account");
this.frm.add_fetch("company", "stock_adjustment_account", "expense_adjustment_account");
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
return {

View File

@@ -16,6 +16,7 @@
from __future__ import unicode_literals
import webnotes
import webnotes.defaults
from webnotes.utils import cstr, cint, flt, comma_or
from webnotes.model.doc import Document, addchild
@@ -67,7 +68,7 @@ class DocType(StockController):
self.update_serial_no(0)
self.update_stock_ledger(1)
self.update_production_order(0)
self.make_gl_entries()
self.make_cancel_gl_entries()
def validate_fiscal_year(self):
import accounts.utils
@@ -426,16 +427,18 @@ class DocType(StockController):
def get_warehouse_details(self, args):
args = json.loads(args)
args.update({
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time,
})
args = webnotes._dict(args)
ret = {}
if args.get('warehouse') and args.get('item_code'):
args.update({
"posting_date": self.doc.posting_date,
"posting_time": self.doc.posting_time,
})
args = webnotes._dict(args)
ret = {
"actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0,
"incoming_rate" : self.get_incoming_rate(args)
}
ret = {
"actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0,
"incoming_rate" : self.get_incoming_rate(args)
}
return ret
def get_items(self):

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-26 06:51:17",
"creation": "2013-03-28 15:56:40",
"docstatus": 0,
"modified": "2013-03-26 07:24:53",
"modified": "2013-03-29 15:31:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -116,6 +116,7 @@
"oldfieldtype": "Link",
"options": "Delivery Note",
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1
@@ -129,7 +130,8 @@
"label": "Sales Invoice No",
"no_copy": 1,
"options": "Sales Invoice",
"print_hide": 1
"print_hide": 1,
"read_only": 0
},
{
"allow_on_submit": 0,
@@ -145,6 +147,7 @@
"oldfieldtype": "Link",
"options": "Purchase Receipt",
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1
@@ -201,7 +204,9 @@
"fieldname": "expense_adjustment_account",
"fieldtype": "Link",
"label": "Expense/Adjustment Account",
"options": "Account"
"options": "Account",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
@@ -550,6 +555,7 @@
"label": "Fiscal Year",
"options": "link:Fiscal Year",
"print_hide": 1,
"read_only": 0,
"reqd": 1
},
{
@@ -620,5 +626,13 @@
{
"doctype": "DocPerm",
"role": "Manufacturing User"
},
{
"doctype": "DocPerm",
"role": "Manufacturing Manager"
},
{
"doctype": "DocPerm",
"role": "Material Manager"
}
]

View File

@@ -16,6 +16,7 @@
from __future__ import unicode_literals
import webnotes
import webnotes.defaults
import json
from webnotes import msgprint, _
from webnotes.utils import cstr, flt, cint
@@ -37,7 +38,7 @@ class DocType(StockController):
def on_cancel(self):
self.delete_stock_ledger_entries()
self.make_gl_entries()
self.make_cancel_gl_entries()
def validate_data(self):
if not self.doc.reconciliation_json: