aii: patches and fine tuning

This commit is contained in:
Nabin Hait
2013-03-25 11:06:00 +05:30
parent b632ba5f51
commit 0fc2454384
21 changed files with 255 additions and 124 deletions

View File

@@ -97,4 +97,11 @@ cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
"company": doc.name
}
}
}
cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
return {
"query": "accounts.utils.get_cost_center_list",
"filters": {"company": doc.name}
}
}

View File

@@ -199,12 +199,7 @@ class DocType:
if not self.doc.payables_group and webnotes.conn.exists('Account',
'Accounts Payable - ' + self.doc.abbr):
webnotes.conn.set(self.doc, 'payables_group', 'Accounts Payable - ' + self.doc.abbr)
if not self.doc.stock_delivered_but_not_billed and webnotes.conn.exists("Account",
"Stock Delivered But Not Billed - " + self.doc.abbr):
webnotes.conn.set(self.doc, "stock_delivered_but_not_billed",
"Stock Delivered But Not Billed - " + self.doc.abbr)
if not self.doc.stock_received_but_not_billed and webnotes.conn.exists("Account",
"Stock Received But Not Billed - " + self.doc.abbr):
webnotes.conn.set(self.doc, "stock_received_but_not_billed",
@@ -219,7 +214,12 @@ class DocType:
"Expenses Included In Valuation - " + self.doc.abbr):
webnotes.conn.set(self.doc, "expenses_included_in_valuation",
"Expenses Included In Valuation - " + self.doc.abbr)
if not self.doc.stock_adjustment_cost_center and webnotes.conn.exists("Cost Center",
"Auto Inventory Accounting - " + self.doc.abbr):
webnotes.conn.set(self.doc, "stock_adjustment_cost_center",
"Auto Inventory Accounting - " + self.doc.abbr)
# Create default cost center
# ---------------------------------------------------
def create_default_cost_center(self):

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-27 09:38:05",
"docstatus": 0,
"modified": "2013-03-19 12:52:00",
"modified": "2013-03-22 18:19:36",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -189,16 +189,10 @@
},
{
"doctype": "DocField",
"fieldname": "stock_adjustment_account",
"fieldname": "stock_received_but_not_billed",
"fieldtype": "Link",
"label": "Stock Adjustment Account",
"options": "Account"
},
{
"doctype": "DocField",
"fieldname": "expenses_included_in_valuation",
"fieldtype": "Link",
"label": "Expenses Included In Valuation",
"label": "Stock Received But Not Billed",
"no_copy": 1,
"options": "Account"
},
{
@@ -209,18 +203,28 @@
},
{
"doctype": "DocField",
"fieldname": "stock_delivered_but_not_billed",
"fieldname": "stock_adjustment_account",
"fieldtype": "Link",
"label": "Stock Delivered But Not Billed",
"label": "Stock Adjustment Account",
"no_copy": 1,
"options": "Account"
},
{
"doctype": "DocField",
"fieldname": "stock_received_but_not_billed",
"fieldname": "expenses_included_in_valuation",
"fieldtype": "Link",
"label": "Stock Received But Not Billed",
"label": "Expenses Included In Valuation",
"no_copy": 1,
"options": "Account"
},
{
"doctype": "DocField",
"fieldname": "stock_adjustment_cost_center",
"fieldtype": "Link",
"label": "Stock Adjustment Cost Center",
"no_copy": 1,
"options": "Cost Center"
},
{
"description": "For reference only.",
"doctype": "DocField",

View File

@@ -44,11 +44,20 @@ keydict = {
'session_expiry': 'session_expiry',
'disable_rounded_total': 'disable_rounded_total',
"update_stock": "update_stock",
# "auto_inventory_accounting": "auto_inventory_accounting",
}
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
previous_auto_inventory_accounting = cint(webnotes.conn.get_value("Global Defaults", None,
"auto_inventory_accounting"))
if cint(self.doc.auto_inventory_accounting) != previous_auto_inventory_accounting:
from accounts.utils import create_stock_in_hand_jv
create_stock_in_hand_jv(reverse = \
cint(self.doc.auto_inventory_accounting) < previous_auto_inventory_accounting)
def on_update(self):
"""update defaults"""