Merge branch 'aii_release' of github.com:webnotes/erpnext into aii_release

This commit is contained in:
Anand Doshi 2013-03-29 16:47:56 +05:30
commit 82433e81c6
32 changed files with 454 additions and 215 deletions

View File

@ -53,4 +53,15 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50'; return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
} }
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
return {
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "Yes",
"debit_or_credit": "Debit",
"company": doc.company
}
}
}
cur_frm.fields_dict.user.get_query = erpnext.utils.profile_query; cur_frm.fields_dict.user.get_query = erpnext.utils.profile_query;

View File

@ -76,7 +76,11 @@ class DocType(BuyingController):
self.update_valuation_rate("entries") self.update_valuation_rate("entries")
def get_credit_to(self): def get_credit_to(self):
acc_head = sql("select name, credit_days from `tabAccount` where (name = %s or (master_name = %s and master_type = 'supplier')) and docstatus != 2", (cstr(self.doc.supplier) + " - " + self.company_abbr,self.doc.supplier)) acc_head = sql("""select name, credit_days from `tabAccount`
where (name = %s or (master_name = %s and master_type = 'supplier'))
and docstatus != 2 and company = %s""",
(cstr(self.doc.supplier) + " - " + self.company_abbr,
self.doc.supplier, self.doc.company))
ret = {} ret = {}
if acc_head and acc_head[0][0]: if acc_head and acc_head[0][0]:
@ -217,7 +221,8 @@ class DocType(BuyingController):
# 3. Is not a PL Account # 3. Is not a PL Account
# ---------------------------- # ----------------------------
def validate_credit_acc(self): def validate_credit_acc(self):
acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s'" % self.doc.credit_to) acc = sql("select debit_or_credit, is_pl_account from tabAccount where name = %s",
self.doc.credit_to)
if not acc: if not acc:
msgprint("Account: "+ self.doc.credit_to + "does not exist") msgprint("Account: "+ self.doc.credit_to + "does not exist")
raise Exception raise Exception
@ -409,7 +414,7 @@ class DocType(BuyingController):
purchase_controller.update_prevdoc_detail(self, is_submit = 1) purchase_controller.update_prevdoc_detail(self, is_submit = 1)
def make_gl_entries(self, is_cancel = 0): def make_gl_entries(self):
from accounts.general_ledger import make_gl_entries from accounts.general_ledger import make_gl_entries
auto_inventory_accounting = \ auto_inventory_accounting = \
cint(webnotes.defaults.get_global_default("auto_inventory_accounting")) cint(webnotes.defaults.get_global_default("auto_inventory_accounting"))
@ -426,7 +431,7 @@ class DocType(BuyingController):
"remarks": self.doc.remarks, "remarks": self.doc.remarks,
"against_voucher": self.doc.name, "against_voucher": self.doc.name,
"against_voucher_type": self.doc.doctype, "against_voucher_type": self.doc.doctype,
}, is_cancel) })
) )
# tax table gl entries # tax table gl entries
@ -441,7 +446,7 @@ class DocType(BuyingController):
"credit": tax.add_deduct_tax == "Deduct" and tax.tax_amount or 0, "credit": tax.add_deduct_tax == "Deduct" and tax.tax_amount or 0,
"remarks": self.doc.remarks, "remarks": self.doc.remarks,
"cost_center": tax.cost_center "cost_center": tax.cost_center
}, is_cancel) })
) )
# accumulate valuation tax # accumulate valuation tax
@ -469,7 +474,7 @@ class DocType(BuyingController):
"debit": flt(item.valuation_rate) * flt(item.conversion_factor) \ "debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
* flt(item.qty), * flt(item.qty),
"remarks": self.doc.remarks or "Accounting Entry for Stock" "remarks": self.doc.remarks or "Accounting Entry for Stock"
}, is_cancel) })
) )
elif flt(item.amount): elif flt(item.amount):
@ -481,7 +486,7 @@ class DocType(BuyingController):
"debit": item.amount, "debit": item.amount,
"remarks": self.doc.remarks, "remarks": self.doc.remarks,
"cost_center": item.cost_center "cost_center": item.cost_center
}, is_cancel) })
) )
if stock_item_and_auto_inventory_accounting and valuation_tax: if stock_item_and_auto_inventory_accounting and valuation_tax:
@ -494,7 +499,7 @@ class DocType(BuyingController):
"against": self.doc.credit_to, "against": self.doc.credit_to,
"credit": valuation_tax, "credit": valuation_tax,
"remarks": self.doc.remarks or "Accounting Entry for Stock" "remarks": self.doc.remarks or "Accounting Entry for Stock"
}, is_cancel) })
) )
# writeoff account includes petty difference in the invoice amount # writeoff account includes petty difference in the invoice amount
@ -507,19 +512,19 @@ class DocType(BuyingController):
"credit": flt(self.doc.write_off_amount), "credit": flt(self.doc.write_off_amount),
"remarks": self.doc.remarks, "remarks": self.doc.remarks,
"cost_center": self.doc.write_off_cost_center "cost_center": self.doc.write_off_cost_center
}, is_cancel) })
) )
if gl_entries: if gl_entries:
make_gl_entries(gl_entries, cancel=is_cancel) make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
def on_cancel(self): def on_cancel(self):
from accounts.utils import remove_against_link_from_jv from accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_voucher") remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_voucher")
self.make_gl_entries(is_cancel=1)
get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0) get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
self.make_cancel_gl_entries()
def on_update(self): def on_update(self):
pass pass

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-02-27 13:45:00", "creation": "2013-03-07 11:42:55",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-07 07:03:26", "modified": "2013-03-29 13:44:37",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -35,6 +35,7 @@
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Item", "options": "Item",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"reqd": 0, "reqd": 0,
"search_index": 1 "search_index": 1
}, },
@ -46,6 +47,7 @@
"label": "Item Name", "label": "Item Name",
"oldfieldname": "item_name", "oldfieldname": "item_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"read_only": 0,
"reqd": 1, "reqd": 1,
"search_index": 0 "search_index": 0
}, },
@ -57,6 +59,7 @@
"oldfieldname": "description", "oldfieldname": "description",
"oldfieldtype": "Text", "oldfieldtype": "Text",
"print_width": "300px", "print_width": "300px",
"read_only": 0,
"width": "300px" "width": "300px"
}, },
{ {
@ -67,6 +70,7 @@
"oldfieldname": "qty", "oldfieldname": "qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"print_hide": 0, "print_hide": 0,
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -75,7 +79,8 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "UOM", "label": "UOM",
"options": "UOM", "options": "UOM",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -83,14 +88,16 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Ref Rate ", "label": "Ref Rate ",
"options": "currency", "options": "currency",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "discount_rate", "fieldname": "discount_rate",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Discount %", "label": "Discount %",
"print_hide": 0 "print_hide": 0,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -101,6 +108,7 @@
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "currency", "options": "currency",
"print_hide": 0, "print_hide": 0,
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -120,7 +128,8 @@
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Ref Rate*", "label": "Ref Rate*",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -131,6 +140,7 @@
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -155,7 +165,8 @@
"options": "Account", "options": "Account",
"print_hide": 1, "print_hide": 1,
"print_width": "120px", "print_width": "120px",
"reqd": 1, "read_only": 0,
"reqd": 0,
"width": "120px" "width": "120px"
}, },
{ {
@ -168,6 +179,7 @@
"options": "Cost Center", "options": "Cost Center",
"print_hide": 1, "print_hide": 1,
"print_width": "120px", "print_width": "120px",
"read_only": 0,
"width": "120px" "width": "120px"
}, },
{ {
@ -177,7 +189,8 @@
"in_filter": 1, "in_filter": 1,
"label": "Project Name", "label": "Project Name",
"options": "Project", "options": "Project",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -187,7 +200,8 @@
"label": "Brand", "label": "Brand",
"oldfieldname": "brand", "oldfieldname": "brand",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -298,7 +312,8 @@
"fieldname": "conversion_factor", "fieldname": "conversion_factor",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Conversion Factor", "label": "Conversion Factor",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -319,6 +334,7 @@
"label": "Page Break", "label": "Page Break",
"no_copy": 1, "no_copy": 1,
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"report_hide": 1 "report_hide": 1
} }
] ]

View File

@ -80,7 +80,8 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
'total_commission', 'advances']; 'total_commission', 'advances'];
item_flds_normal = ['sales_order', 'delivery_note'] item_flds_normal = ['sales_order', 'delivery_note']
item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty'] item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty',
'delivered_qty', 'expense_account']
if(cint(doc.is_pos) == 1) { if(cint(doc.is_pos) == 1) {
hide_field(par_flds); hide_field(par_flds);

View File

@ -16,6 +16,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
import webnotes.defaults
from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \ from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
get_first_day, get_last_day get_first_day, get_last_day
@ -131,7 +132,7 @@ class DocType(SellingController):
sales_com_obj.update_prevdoc_detail(0, self) sales_com_obj.update_prevdoc_detail(0, self)
self.make_gl_entries() self.make_cancel_gl_entries()
def on_update_after_submit(self): def on_update_after_submit(self):
self.validate_recurring_invoice() self.validate_recurring_invoice()

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-03-25 15:35:04", "creation": "2013-03-26 11:03:08",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-25 15:35:23", "modified": "2013-03-28 15:42:14",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -210,7 +210,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "expense_account", "fieldname": "expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 0,
"in_filter": 1, "in_filter": 1,
"label": "Expense Account", "label": "Expense Account",
"options": "Account", "options": "Account",

View File

@ -264,48 +264,61 @@ def create_stock_in_hand_jv(reverse=False):
from webnotes.utils import nowdate from webnotes.utils import nowdate
today = nowdate() today = nowdate()
fiscal_year = get_fiscal_year(today)[0] fiscal_year = get_fiscal_year(today)[0]
jv_list = []
for company in webnotes.conn.sql_list("select name from `tabCompany`"): for company in webnotes.conn.sql_list("select name from `tabCompany`"):
stock_rbnb_value = get_stock_rbnb_value(company) stock_rbnb_value = get_stock_rbnb_value(company)
stock_rbnb_value = reverse and -1*stock_rbnb_value or stock_rbnb_value
if stock_rbnb_value:
jv = webnotes.bean([
{
"doctype": "Journal Voucher",
"naming_series": "_PATCH-",
"company": company,
"posting_date": today,
"fiscal_year": fiscal_year,
"voucher_type": "Journal Entry",
"user_remark": "Accounting Entry for Stock: \
Initial booking of stock received but not billed account"
},
{
"doctype": "Journal Voucher Detail",
"parentfield": "entries",
"account": get_company_default(company, "stock_received_but_not_billed"),
(stock_rbnb_value > 0 and "credit" or "debit"): abs(stock_rbnb_value)
},
{
"doctype": "Journal Voucher Detail",
"parentfield": "entries",
"account": get_company_default(company, "stock_adjustment_account"),
(stock_rbnb_value > 0 and "debit" or "credit"): abs(stock_rbnb_value),
"cost_center": get_company_default(company, "stock_adjustment_cost_center")
},
])
jv.insert()
jv.submit()
jv_list.append(jv.doc.name)
if jv_list:
webnotes.msgprint("""Folowing Journal Vouchers has been created automatically:
%s""" % '\n'.join(jv_list))
webnotes.msgprint("""Please refresh the system to get effect of Auto Inventory Accounting""")
jv = webnotes.bean([
{
"doctype": "Journal Voucher",
"naming_series": "_PATCH-",
"company": company,
"posting_date": today,
"fiscal_year": fiscal_year,
"voucher_type": "Journal Entry"
},
{
"doctype": "Journal Voucher Detail",
"parentfield": "entries",
"account": get_company_default(company, "stock_received_but_not_billed"),
(reverse and "debit" or "credit"): stock_rbnb_value
},
{
"doctype": "Journal Voucher Detail",
"parentfield": "entries",
"account": get_company_default(company, "stock_adjustment_account"),
(reverse and "credit" or "debit"): stock_rbnb_value
},
])
jv.insert()
jv.submit()
def get_stock_rbnb_value(company): def get_stock_rbnb_value(company):
total_received_amount = webnotes.conn.sql("""select sum(valuation_amount) total_received_amount = webnotes.conn.sql("""select sum(valuation_rate*qty*conversion_factor)
from `tabPurchase Receipt Item` pr_item where docstatus=1 from `tabPurchase Receipt Item` pr_item where docstatus=1
and exists(select name from `tabItem` where name = pr_item.item_code and exists(select name from `tabItem` where name = pr_item.item_code
and is_stock_item='Yes') and is_stock_item='Yes')
and exist(select name from `tabPurchase Receipt` and exists(select name from `tabPurchase Receipt`
where name = pr_item.parent and company = %s)""", company) where name = pr_item.parent and company = %s)""", company)
total_billed_amount = webnotes.conn.sql("""select sum(valuation_amount) total_billed_amount = webnotes.conn.sql("""select sum(valuation_rate*qty*conversion_factor)
from `tabPurchase Invoice Item` pi_item where docstatus=1 from `tabPurchase Invoice Item` pi_item where docstatus=1
and exists(select name from `tabItem` where name = pi_item.item_code and exists(select name from `tabItem` where name = pi_item.item_code
and is_stock_item='Yes') and is_stock_item='Yes')
and exist(select name from `tabPurchase Invoice` and exists(select name from `tabPurchase Invoice`
where name = pi_item.parent and company = %s)""", company) where name = pi_item.parent and company = %s)""", company)
return flt(total_received_amount[0][0]) - flt(total_billed_amount[0][0]) return flt(total_received_amount[0][0]) - flt(total_billed_amount[0][0])

View File

@ -41,9 +41,10 @@ class SellingController(StockController):
self.doc.in_words_export = money_in_words(disable_rounded_total and self.doc.in_words_export = money_in_words(disable_rounded_total and
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency) self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
def set_buying_amount(self): def set_buying_amount(self, stock_ledger_entries = None):
from stock.utils import get_buying_amount from stock.utils import get_buying_amount
stock_ledger_entries = self.get_stock_ledger_entries() if not stock_ledger_entries:
stock_ledger_entries = self.get_stock_ledger_entries()
item_sales_bom = {} item_sales_bom = {}
for d in self.doclist.get({"parentfield": "packing_details"}): for d in self.doclist.get({"parentfield": "packing_details"}):
@ -66,3 +67,7 @@ class SellingController(StockController):
if item.buying_amount and not item.expense_account: if item.buying_amount and not item.expense_account:
msgprint(_("""Expense account is mandatory for item: """) + item.item_code, msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
raise_exception=1) raise_exception=1)
if item.buying_amount and not item.cost_center:
msgprint(_("""Cost Center is mandatory for item: """) + item.item_code,
raise_exception=1)

View File

@ -16,7 +16,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes import msgprint, _ from webnotes.utils import cint
import webnotes.defaults
from controllers.accounts_controller import AccountsController from controllers.accounts_controller import AccountsController
class StockController(AccountsController): class StockController(AccountsController):
@ -73,3 +74,9 @@ class StockController(AccountsController):
warehouse_list.append(item.warehouse) warehouse_list.append(item.warehouse)
return list(set(item_list)), list(set(warehouse_list)) return list(set(item_list)), list(set(warehouse_list))
def make_cancel_gl_entries(self):
if 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()

View File

@ -17,10 +17,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cint, cstr, flt, now, nowdate from webnotes.utils import cint, cstr, flt, nowdate
from webnotes.model import db_exists
from webnotes.model.doc import Document from webnotes.model.doc import Document
from webnotes.model.bean import copy_doclist
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from webnotes import msgprint from webnotes import msgprint
@ -49,7 +47,7 @@ class DocType:
emp_query = "select name from `tabEmployee` " emp_query = "select name from `tabEmployee` "
if flag == 1: if flag == 1:
emp_query += condition emp_query += condition
e = sql(emp_query, debug=1) e = sql(emp_query)
return e return e
# ---------------- # ----------------

View File

@ -17,7 +17,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cint, cstr, flt, now, nowdate from webnotes.utils import cint, cstr, flt, now, nowdate
from webnotes.model.doc import Document, addchild from webnotes.model.doc import addchild
from webnotes.model.bean import getlist from webnotes.model.bean import getlist
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from webnotes import msgprint, _ from webnotes import msgprint, _
@ -76,7 +76,7 @@ class DocType:
def get_item_details(self, item_code): def get_item_details(self, item_code):
res = sql("""select description, stock_uom as uom res = sql("""select description, stock_uom as uom
from `tabItem` where item_code = %s""", item_code, as_dict = 1, debug=1) from `tabItem` where item_code = %s""", item_code, as_dict = 1)
return res and res[0] or {} return res and res[0] or {}
def get_workstation_details(self,workstation): def get_workstation_details(self,workstation):

View File

@ -1,10 +1,30 @@
import webnotes import webnotes
from webnotes.utils import now_datetime
def execute(): def execute():
dn_list = webnotes.conn.sql("""select name from `tabDelivery Note` where docstatus < 2""") webnotes.conn.auto_commit_on_many_writes = True
for dn in dn_list: for company in webnotes.conn.sql("select name from `tabCompany`"):
webnotes.bean("Delivery Note", dn[0]).run_method("set_buying_amount") print company[0]
stock_ledger_entries = webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
voucher_detail_no, posting_date, posting_time, stock_value,
warehouse, actual_qty as qty from `tabStock Ledger Entry`
where ifnull(`is_cancelled`, "No") = "No" and company = %s
order by item_code desc, warehouse desc,
posting_date desc, posting_time desc, name desc""", company[0], as_dict=True)
si_list = webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus < 2""") dn_list = webnotes.conn.sql("""select name from `tabDelivery Note`
for si in si_list: where docstatus < 2 and company = %s""", company[0])
webnotes.bean("Sales Invoice", si[0]).run_method("set_buying_amount") print "Total Delivery Note: ", len(dn_list)
for dn in dn_list:
dn = webnotes.get_obj("Delivery Note", dn[0], with_children = 1)
dn.set_buying_amount(stock_ledger_entries)
si_list = webnotes.conn.sql("""select name from `tabSales Invoice`
where docstatus < 2 and company = %s""", company[0])
print "Total Sales Invoice: ", len(si_list)
for si in si_list:
si = webnotes.get_obj("Sales Invoice", si[0], with_children = 1)
si.set_buying_amount(stock_ledger_entries)
webnotes.conn.auto_commit_on_many_writes = False

View File

@ -2,12 +2,12 @@ import webnotes
def execute(): def execute():
for purchase_invoice in webnotes.conn.sql_list("""select distinct parent for purchase_invoice in webnotes.conn.sql_list("""select distinct parent
from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(valuation_rate, 0)=0"""): from `tabPurchase Invoice Item` pi_item where docstatus = 1 and ifnull(valuation_rate, 0)=0
pi = webnotes.get_obj("Purchase Invoice", purchase_invoice) and exists(select name from `tabPurchase Invoice` where name = pi_item.parent)"""):
pi.calculate_taxes_and_totals() pi = webnotes.get_obj("Purchase Invoice", purchase_invoice)
pi.update_raw_material_cost() pi.calculate_taxes_and_totals()
pi.update_valuation_rate("entries") pi.update_raw_material_cost()
for item in pi.doclist.get({"parentfield": "entries"}): pi.update_valuation_rate("entries")
webnotes.conn.set_value("Purchase Invoice Item", item.name, "valuation_rate", for item in pi.doclist.get({"parentfield": "entries"}):
item.valuation_rate) webnotes.conn.set_value("Purchase Invoice Item", item.name, "valuation_rate",
item.valuation_rate)

View File

@ -2,6 +2,7 @@ import webnotes
def execute(): def execute():
add_group_accounts() add_group_accounts()
add_ledger_accounts() add_ledger_accounts()
add_aii_cost_center()
def _check(parent_account, company): def _check(parent_account, company):
def _get_root(is_pl_account, debit_or_credit): def _get_root(is_pl_account, debit_or_credit):
@ -34,7 +35,6 @@ def add_group_accounts():
def add_ledger_accounts(): def add_ledger_accounts():
accounts_to_add = [ accounts_to_add = [
["Stock In Hand", "Stock Assets", "Ledger", ""], ["Stock In Hand", "Stock Assets", "Ledger", ""],
["Stock Debit But Not Billed", "Stock Assets", "Ledger", ""],
["Cost of Goods Sold", "Stock Expenses", "Ledger", "Expense Account"], ["Cost of Goods Sold", "Stock Expenses", "Ledger", "Expense Account"],
["Stock Adjustment", "Stock Expenses", "Ledger", "Expense Account"], ["Stock Adjustment", "Stock Expenses", "Ledger", "Expense Account"],
["Expenses Included In Valuation", "Stock Expenses", "Ledger", "Expense Account"], ["Expenses Included In Valuation", "Stock Expenses", "Ledger", "Expense Account"],
@ -59,3 +59,20 @@ def add_accounts(accounts_to_add, check_fn=None):
"company": company "company": company
}) })
account.insert() account.insert()
def add_aii_cost_center():
for company, abbr in webnotes.conn.sql("""select name, abbr from `tabCompany`"""):
if not webnotes.conn.exists("Cost Center", "Auto Inventory Accounting - %s" % abbr):
parent_cost_center = webnotes.conn.get_value("Cost Center",
{"parent_cost_center['']": '', "company_name": company}, 'name')
cc = webnotes.bean({
"doctype": "Cost Center",
"cost_center_name": "Auto Inventory Accounting",
"parent_cost_center": parent_cost_center,
"group_or_ledger": "Ledger",
"company_name": company
})
cc.insert()

View File

@ -0,0 +1,11 @@
def execute():
import webnotes
from webnotes import get_obj
pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice`
where docstatus = 1 and ifnull(against_expense_account, '') = ''""")
for pi in pi_list:
pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1)
pi_obj.set_against_expense_account()
webnotes.conn.set_value("Purchase Invoice", pi[0],
"against_expense_account", pi_obj.doc.against_expense_account)

View File

@ -0,0 +1,19 @@
import webnotes
import json
def execute():
"""replace item_tax_rate stored as string with a json string"""
webnotes.conn.auto_commit_on_many_writes = 1
for dt in ["Quotation Item", "Sales Order Item", "Sales Invoice Item",
"Delivery Note Item", "Supplier Quotation Item", "Purchase Order Item",
"Purchase Invoice Item", "Purchase Receipt Item"]:
for d in webnotes.conn.sql("""select name, item_tax_rate from `tab%s`
where ifnull(item_tax_rate, '')!=''""" % (dt,), as_dict=1):
try:
json.loads(d["item_tax_rate"])
except ValueError, e:
webnotes.conn.sql("""update `tab%s` set item_tax_rate=%s
where name=%s""" % (dt, "%s", "%s"),
(json.dumps(eval(d["item_tax_rate"])), d["name"]))
webnotes.conn.auto_commit_on_many_writes = 0

View File

@ -224,5 +224,10 @@ patch_list = [
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)", "execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
"patches.march_2013.p09_unset_user_type_partner", "patches.march_2013.p09_unset_user_type_partner",
"patches.march_2013.p10_set_fiscal_year_for_stock", "patches.march_2013.p10_set_fiscal_year_for_stock",
"patches.march_2013.p10_update_against_expense_account",
"patches.march_2013.p11_update_attach_files", "patches.march_2013.p11_update_attach_files",
"patches.march_2013.p12_set_item_tax_rate_in_json",
"patches.march_2013.p07_update_valuation_rate",
"patches.march_2013.p08_create_aii_accounts",
"patches.march_2013.p03_update_buying_amount",
] ]

View File

@ -361,7 +361,7 @@ class DocType(TransactionBase):
sales_team_list = obj.doclist.get({"parentfield": "sales_team"}) sales_team_list = obj.doclist.get({"parentfield": "sales_team"})
total_allocation = sum([flt(d.allocated_percentage) for d in sales_team_list]) total_allocation = sum([flt(d.allocated_percentage) for d in sales_team_list])
if sales_team_list and total_allocation != 100.0: if sales_team_list and total_allocation != 100.0:
msgprint("Total Allocated %% of Sales Persons should be 100%", raise_exception=True) msgprint("Total Allocated % of Sales Persons should be 100%", raise_exception=True)
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults) # Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
# =========================================================================== # ===========================================================================

View File

@ -89,9 +89,6 @@ cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
cur_frm.fields_dict["expenses_included_in_valuation"].get_query = cur_frm.fields_dict["expenses_included_in_valuation"].get_query =
cur_frm.fields_dict["stock_adjustment_account"].get_query; cur_frm.fields_dict["stock_adjustment_account"].get_query;
cur_frm.fields_dict["stock_delivered_but_not_billed"].get_query =
cur_frm.fields_dict["stock_in_hand_account"].get_query;
cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) { cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_account_list", "query": "accounts.utils.get_account_list",
@ -106,6 +103,6 @@ cur_frm.fields_dict["stock_received_but_not_billed"].get_query = function(doc) {
cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) { cur_frm.fields_dict["stock_adjustment_cost_center"].get_query = function(doc) {
return { return {
"query": "accounts.utils.get_cost_center_list", "query": "accounts.utils.get_cost_center_list",
"filters": {"company": doc.name} "filters": {"company_name": doc.name}
} }
} }

View File

@ -49,8 +49,6 @@ class DocType:
['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''], ['Earnest Money','Securities and Deposits','Ledger','No','','Debit',self.doc.name,''],
['Stock Assets','Current Assets','Group','No','','Debit',self.doc.name,''], ['Stock Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
['Stock In Hand','Stock Assets','Ledger','No','','Debit',self.doc.name,''], ['Stock In Hand','Stock Assets','Ledger','No','','Debit',self.doc.name,''],
['Stock Delivered But Not Billed', 'Stock Assets', 'Ledger',
'No', '', 'Debit', self.doc.name, ''],
['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''], ['Tax Assets','Current Assets','Group','No','','Debit',self.doc.name,''],
['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''], ['Fixed Assets','Application of Funds (Assets)','Group','No','','Debit',self.doc.name,''],
['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''], ['Capital Equipments','Fixed Assets','Ledger','No','Fixed Asset Account','Debit',self.doc.name,''],

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-03-21 17:41:00", "creation": "2013-03-26 11:03:08",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-25 15:35:34", "modified": "2013-03-28 16:04:27",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -25,14 +25,19 @@
}, },
{ {
"amend": 0, "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Company", "parent": "Company",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1, "report": 1,
"submit": 0 "role": "System Manager",
"submit": 0,
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@ -43,7 +48,8 @@
"fieldname": "details", "fieldname": "details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Company Details", "label": "Company Details",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"read_only": 0
}, },
{ {
"description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.", "description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.",
@ -54,12 +60,14 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "abbr", "oldfieldname": "abbr",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "cb0", "fieldname": "cb0",
"fieldtype": "Column Break" "fieldtype": "Column Break",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -69,6 +77,7 @@
"no_copy": 0, "no_copy": 0,
"oldfieldname": "company_name", "oldfieldname": "company_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -76,7 +85,8 @@
"fieldname": "default_settings", "fieldname": "default_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Default Settings", "label": "Default Settings",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -84,6 +94,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Currency", "label": "Default Currency",
"options": "Currency", "options": "Currency",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -95,14 +106,16 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "default_bank_account", "oldfieldname": "default_bank_account",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_cash_account", "fieldname": "default_cash_account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Cash Account", "label": "Default Cash Account",
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
@ -113,7 +126,8 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "receivables_group", "oldfieldname": "receivables_group",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
@ -124,13 +138,15 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "payables_group", "oldfieldname": "payables_group",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break0", "fieldname": "column_break0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"oldfieldtype": "Column Break", "oldfieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -140,7 +156,8 @@
"fieldtype": "Int", "fieldtype": "Int",
"label": "Credit Days", "label": "Credit Days",
"oldfieldname": "credit_days", "oldfieldname": "credit_days",
"oldfieldtype": "Int" "oldfieldtype": "Int",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
@ -150,7 +167,8 @@
"label": "Credit Limit", "label": "Credit Limit",
"oldfieldname": "credit_limit", "oldfieldname": "credit_limit",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "default_currency" "options": "default_currency",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
@ -160,7 +178,8 @@
"label": "If Yearly Budget Exceeded", "label": "If Yearly Budget Exceeded",
"oldfieldname": "yearly_bgt_flag", "oldfieldname": "yearly_bgt_flag",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nWarn\nIgnore\nStop" "options": "\nWarn\nIgnore\nStop",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
@ -170,14 +189,16 @@
"label": "If Monthly Budget Exceeded", "label": "If Monthly Budget Exceeded",
"oldfieldname": "monthly_bgt_flag", "oldfieldname": "monthly_bgt_flag",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nWarn\nIgnore\nStop" "options": "\nWarn\nIgnore\nStop",
"read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal && sys_defaults.auto_inventory_accounting", "depends_on": "eval:!doc.__islocal",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "auto_inventory_accounting_settings", "fieldname": "auto_inventory_accounting_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Auto Inventory Accounting Settings" "label": "Auto Inventory Accounting Settings",
"read_only": 0
}, },
{ {
"description": "This account will be used to maintain value of available stock", "description": "This account will be used to maintain value of available stock",
@ -195,12 +216,14 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Stock Received But Not Billed", "label": "Stock Received But Not Billed",
"no_copy": 1, "no_copy": 1,
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "col_break23", "fieldname": "col_break23",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -209,7 +232,8 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Stock Adjustment Account", "label": "Stock Adjustment Account",
"no_copy": 1, "no_copy": 1,
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -217,7 +241,8 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Expenses Included In Valuation", "label": "Expenses Included In Valuation",
"no_copy": 1, "no_copy": 1,
"options": "Account" "options": "Account",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -225,14 +250,16 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Stock Adjustment Cost Center", "label": "Stock Adjustment Cost Center",
"no_copy": 1, "no_copy": 1,
"options": "Cost Center" "options": "Cost Center",
"read_only": 0
}, },
{ {
"description": "For reference only.", "description": "For reference only.",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "company_info", "fieldname": "company_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Company Info" "label": "Company Info",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -240,13 +267,15 @@
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Address", "label": "Address",
"oldfieldname": "address", "oldfieldname": "address",
"oldfieldtype": "Small Text" "oldfieldtype": "Small Text",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"oldfieldtype": "Column Break", "oldfieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -256,7 +285,8 @@
"label": "Phone No", "label": "Phone No",
"oldfieldname": "phone_no", "oldfieldname": "phone_no",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Phone" "options": "Phone",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -265,7 +295,8 @@
"label": "Fax", "label": "Fax",
"oldfieldname": "fax", "oldfieldname": "fax",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Phone" "options": "Phone",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -274,7 +305,8 @@
"label": "Email", "label": "Email",
"oldfieldname": "email", "oldfieldname": "email",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Email" "options": "Email",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -282,7 +314,8 @@
"fieldtype": "Data", "fieldtype": "Data",
"label": "Website", "label": "Website",
"oldfieldname": "website", "oldfieldname": "website",
"oldfieldtype": "Data" "oldfieldtype": "Data",
"read_only": 0
}, },
{ {
"description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.", "description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.",
@ -291,6 +324,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Registration Info", "label": "Registration Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -300,7 +334,8 @@
"fieldtype": "Code", "fieldtype": "Code",
"label": "Registration Details", "label": "Registration Details",
"oldfieldname": "registration_details", "oldfieldname": "registration_details",
"oldfieldtype": "Code" "oldfieldtype": "Code",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -313,19 +348,6 @@
"read_only": 1 "read_only": 1
}, },
{ {
"cancel": 1, "doctype": "DocPerm"
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "System Manager",
"write": 1
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "All",
"write": 0
} }
] ]

View File

@ -45,7 +45,7 @@ keydict = {
'session_expiry': 'session_expiry', 'session_expiry': 'session_expiry',
'disable_rounded_total': 'disable_rounded_total', 'disable_rounded_total': 'disable_rounded_total',
"update_stock": "update_stock", "update_stock": "update_stock",
# "auto_inventory_accounting": "auto_inventory_accounting", "auto_inventory_accounting": "auto_inventory_accounting",
} }
class DocType: class DocType:
@ -62,7 +62,6 @@ class DocType:
def on_update(self): def on_update(self):
"""update defaults""" """update defaults"""
self.validate_session_expiry() self.validate_session_expiry()
for key in keydict: for key in keydict:

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-02-21 12:28:24", "creation": "2013-03-25 11:08:14",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-21 15:42:59", "modified": "2013-03-28 15:41:03",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -27,6 +27,8 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
@ -48,19 +50,22 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "general", "fieldname": "general",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "General" "label": "General",
"read_only": 0
}, },
{ {
"description": "Session Expiry in Hours e.g. 06:00", "description": "Session Expiry in Hours e.g. 06:00",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "session_expiry", "fieldname": "session_expiry",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Session Expiry" "label": "Session Expiry",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break" "fieldtype": "Column Break",
"read_only": 0
}, },
{ {
"description": "For Server Side Print Formats", "description": "For Server Side Print Formats",
@ -68,13 +73,15 @@
"fieldname": "print_style", "fieldname": "print_style",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Print Format Style", "label": "Print Format Style",
"options": "Standard\nClassic\nModern\nSpartan" "options": "Standard\nClassic\nModern\nSpartan",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "company", "fieldname": "company",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Company" "label": "Company",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -82,6 +89,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Company", "label": "Default Company",
"options": "Company", "options": "Company",
"read_only": 0,
"reqd": 0 "reqd": 0
}, },
{ {
@ -90,6 +98,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Current Fiscal Year", "label": "Current Fiscal Year",
"options": "Fiscal Year", "options": "Fiscal Year",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -97,12 +106,14 @@
"fieldname": "date_format", "fieldname": "date_format",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Date Format", "label": "Date Format",
"options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy" "options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -111,7 +122,8 @@
"fieldname": "hide_currency_symbol", "fieldname": "hide_currency_symbol",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Hide Currency Symbol", "label": "Hide Currency Symbol",
"options": "\nNo\nYes" "options": "\nNo\nYes",
"read_only": 0
}, },
{ {
"default": "INR", "default": "INR",
@ -120,6 +132,7 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Currency", "label": "Default Currency",
"options": "Currency", "options": "Currency",
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -128,7 +141,8 @@
"fieldname": "number_format", "fieldname": "number_format",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Number Format", "label": "Number Format",
"options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###" "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###",
"read_only": 0
}, },
{ {
"description": "Precision for Float fields (quantities, discounts, percentages etc) only for display. Floats will still be calculated up to 6 decimals.", "description": "Precision for Float fields (quantities, discounts, percentages etc) only for display. Floats will still be calculated up to 6 decimals.",
@ -136,18 +150,21 @@
"fieldname": "float_precision", "fieldname": "float_precision",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Float Precision", "label": "Float Precision",
"options": "\n2\n3\n4\n5\n6" "options": "\n2\n3\n4\n5\n6",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "stock", "fieldname": "stock",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Stock" "label": "Stock",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -155,54 +172,62 @@
"fieldname": "default_item_group", "fieldname": "default_item_group",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Item Group", "label": "Default Item Group",
"options": "Item Group" "options": "Item Group",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "ighelp", "fieldname": "ighelp",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "IGHelp", "label": "IGHelp",
"options": "<a href=\"#!Sales Browser/Item Group\">To manage Item Groups, click here</a>" "options": "<a href=\"#!Sales Browser/Item Group\">To manage Item Groups, click here</a>",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_stock_uom", "fieldname": "default_stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Stock UOM", "label": "Default Stock UOM",
"options": "UOM" "options": "UOM",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_valuation_method", "fieldname": "default_valuation_method",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Default Valuation Method", "label": "Default Valuation Method",
"options": "FIFO\nMoving Average" "options": "FIFO\nMoving Average",
"read_only": 0
}, },
{ {
"description": "Applicable only if valuation method is moving average", "description": "Applicable only if valuation method is moving average",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "allow_negative_stock", "fieldname": "allow_negative_stock",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Allow Negative Stock" "label": "Allow Negative Stock",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_warehouse_type", "fieldname": "default_warehouse_type",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Warehouse Type", "label": "Default Warehouse Type",
"options": "Warehouse Type" "options": "Warehouse Type",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "auto_indent", "fieldname": "auto_indent",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Raise Material Request when stock reaches re-order level" "label": "Raise Material Request when stock reaches re-order level",
"read_only": 0
}, },
{ {
"default": "1", "default": "1",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -210,14 +235,16 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "tolerance", "fieldname": "tolerance",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Allowance Percent" "label": "Allowance Percent",
"read_only": 0
}, },
{ {
"description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person", "description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "stock_frozen_upto", "fieldname": "stock_frozen_upto",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Stock Frozen Upto" "label": "Stock Frozen Upto",
"read_only": 0
}, },
{ {
"description": "Users with this role are allowed to do / modify stock entry before frozen date", "description": "Users with this role are allowed to do / modify stock entry before frozen date",
@ -225,20 +252,32 @@
"fieldname": "stock_auth_role", "fieldname": "stock_auth_role",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Authorized Role (Frozen Entry)", "label": "Authorized Role (Frozen Entry)",
"options": "Role" "options": "Role",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "accounts", "fieldname": "accounts",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Accounts" "label": "Accounts",
"read_only": 0
},
{
"description": "If enabled, the system will post accounting entries for inventory automatically",
"doctype": "DocField",
"fieldname": "auto_inventory_accounting",
"fieldtype": "Check",
"label": "Auto Inventory Accounting",
"no_copy": 0,
"print_hide": 1
}, },
{ {
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person", "description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "acc_frozen_upto", "fieldname": "acc_frozen_upto",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Accounts Frozen Upto" "label": "Accounts Frozen Upto",
"read_only": 0
}, },
{ {
"description": "Users with this role are allowed to do / modify accounting entry before frozen date", "description": "Users with this role are allowed to do / modify accounting entry before frozen date",
@ -246,39 +285,45 @@
"fieldname": "bde_auth_role", "fieldname": "bde_auth_role",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Authourized Role (Frozen Entry)", "label": "Authourized Role (Frozen Entry)",
"options": "Role" "options": "Role",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "credit_controller", "fieldname": "credit_controller",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Credit Controller", "label": "Credit Controller",
"options": "Role" "options": "Role",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break4", "fieldname": "column_break4",
"fieldtype": "Column Break" "fieldtype": "Column Break",
"read_only": 0
}, },
{ {
"description": "If checked, then in POS Sales Invoice, Update Stock gets checked by default", "description": "If checked, then in POS Sales Invoice, Update Stock gets checked by default",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "update_stock", "fieldname": "update_stock",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Update Stock when using POS Sales Invoice" "label": "Update Stock when using POS Sales Invoice",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "account_info", "fieldname": "account_info",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "Account Info", "label": "Account Info",
"options": "<div class=\"help-box\">For more accounting defaults, Open <a href=\"#!List/Company\">Company</a></div>" "options": "<div class=\"help-box\">For more accounting defaults, Open <a href=\"#!List/Company\">Company</a></div>",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "selling", "fieldname": "selling",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Selling" "label": "Selling",
"read_only": 0
}, },
{ {
"default": "Customer Name", "default": "Customer Name",
@ -286,40 +331,46 @@
"fieldname": "cust_master_name", "fieldname": "cust_master_name",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Customer Master created by ", "label": "Customer Master created by ",
"options": "Customer Name\nNaming Series" "options": "Customer Name\nNaming Series",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_customer_group", "fieldname": "default_customer_group",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Customer Group", "label": "Default Customer Group",
"options": "Customer Group" "options": "Customer Group",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "cghelp", "fieldname": "cghelp",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "CGHelp", "label": "CGHelp",
"options": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>" "options": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_territory", "fieldname": "default_territory",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Territory", "label": "Default Territory",
"options": "Territory" "options": "Territory",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "territoryhelp", "fieldname": "territoryhelp",
"fieldtype": "HTML", "fieldtype": "HTML",
"label": "TerritoryHelp", "label": "TerritoryHelp",
"options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>" "options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break5", "fieldname": "column_break5",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -327,14 +378,16 @@
"fieldname": "default_price_list", "fieldname": "default_price_list",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Price List", "label": "Default Price List",
"options": "Price List" "options": "Price List",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_price_list_currency", "fieldname": "default_price_list_currency",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Price List Currency", "label": "Default Price List Currency",
"options": "Currency" "options": "Currency",
"read_only": 0
}, },
{ {
"default": "No", "default": "No",
@ -342,7 +395,8 @@
"fieldname": "so_required", "fieldname": "so_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Sales Order Required", "label": "Sales Order Required",
"options": "No\nYes" "options": "No\nYes",
"read_only": 0
}, },
{ {
"default": "No", "default": "No",
@ -350,27 +404,31 @@
"fieldname": "dn_required", "fieldname": "dn_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Delivery Note Required", "label": "Delivery Note Required",
"options": "No\nYes" "options": "No\nYes",
"read_only": 0
}, },
{ {
"description": "If disable, 'Rounded Total' field will not be visible in any transaction", "description": "If disable, 'Rounded Total' field will not be visible in any transaction",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "disable_rounded_total", "fieldname": "disable_rounded_total",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Disable Rounded Total" "label": "Disable Rounded Total",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "buying", "fieldname": "buying",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Buying" "label": "Buying",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "default_supplier_type", "fieldname": "default_supplier_type",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Supplier Type", "label": "Default Supplier Type",
"options": "Supplier Type" "options": "Supplier Type",
"read_only": 0
}, },
{ {
"default": "Supplier Name", "default": "Supplier Name",
@ -378,12 +436,14 @@
"fieldname": "supp_master_name", "fieldname": "supp_master_name",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Supplier Master created by ", "label": "Supplier Master created by ",
"options": "Supplier Name\nNaming Series" "options": "Supplier Name\nNaming Series",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "column_break6", "fieldname": "column_break6",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
@ -392,7 +452,8 @@
"fieldname": "po_required", "fieldname": "po_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Purchase Order Required", "label": "Purchase Order Required",
"options": "No\nYes" "options": "No\nYes",
"read_only": 0
}, },
{ {
"default": "No", "default": "No",
@ -400,20 +461,23 @@
"fieldname": "pr_required", "fieldname": "pr_required",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Purchase Receipt Required", "label": "Purchase Receipt Required",
"options": "No\nYes" "options": "No\nYes",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "maintain_same_rate", "fieldname": "maintain_same_rate",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Maintain same rate throughout purchase cycle" "label": "Maintain same rate throughout purchase cycle",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "hr", "fieldname": "hr",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "HR", "label": "HR",
"options": "<div style=\"padding-top: 8px;\" class=\"columnHeading\">HR</div>" "options": "<div style=\"padding-top: 8px;\" class=\"columnHeading\">HR</div>",
"read_only": 0
}, },
{ {
"description": "Employee record is created using selected field. ", "description": "Employee record is created using selected field. ",
@ -421,24 +485,22 @@
"fieldname": "emp_created_by", "fieldname": "emp_created_by",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Employee Records to be created by ", "label": "Employee Records to be created by ",
"options": "Naming Series\nEmployee Number" "options": "Naming Series\nEmployee Number",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "system", "fieldname": "system",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "System" "label": "System",
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "sms_sender_name", "fieldname": "sms_sender_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "SMS Sender Name" "label": "SMS Sender Name",
}, "read_only": 0
{
"amend": 0,
"cancel": 0,
"doctype": "DocPerm"
}, },
{ {
"doctype": "DocPerm" "doctype": "DocPerm"

View File

@ -74,6 +74,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.toggle_display("contact_info", doc.customer); cur_frm.toggle_display("contact_info", doc.customer);
set_print_hide(doc, cdt, cdn); 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.bean import getlist
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from webnotes import msgprint from webnotes import msgprint
import webnotes.defaults
sql = webnotes.conn.sql sql = webnotes.conn.sql
@ -312,7 +314,7 @@ class DocType(SellingController):
webnotes.conn.set(self.doc, 'status', 'Cancelled') webnotes.conn.set(self.doc, 'status', 'Cancelled')
self.cancel_packing_slips() self.cancel_packing_slips()
self.make_gl_entries() self.make_cancel_gl_entries()
def check_next_docstatus(self): def check_next_docstatus(self):

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-03-25 11:55:16", "creation": "2013-03-26 11:03:09",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-25 15:43:04", "modified": "2013-03-28 15:42:41",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -248,7 +248,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "expense_account", "fieldname": "expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 0,
"label": "Expense Account", "label": "Expense Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
@ -260,11 +260,12 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 1, "hidden": 0,
"label": "Cost Center", "label": "Cost Center",
"no_copy": 1, "no_copy": 1,
"options": "Cost Center", "options": "Cost Center",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"width": "120px" "width": "120px"
}, },
{ {

View File

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

View File

@ -19,7 +19,7 @@ import webnotes
from webnotes.utils import cint, getdate, nowdate from webnotes.utils import cint, getdate, nowdate
import datetime import datetime
from webnotes import msgprint, _ from webnotes import msgprint
from controllers.stock_controller import StockController from controllers.stock_controller import StockController
@ -103,7 +103,12 @@ class DocType(StockController):
elif self.doc.status == 'In Store': elif self.doc.status == 'In Store':
webnotes.conn.set(self.doc, 'status', 'Not in Use') webnotes.conn.set(self.doc, 'status', 'Not in Use')
self.make_stock_ledger_entry(-1) 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): def on_cancel(self):

View File

@ -77,7 +77,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
}; };
if (sys_defaults.auto_inventory_accounting) { 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() { this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
return { return {

View File

@ -16,6 +16,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
import webnotes.defaults
from webnotes.utils import cstr, cint, flt, comma_or from webnotes.utils import cstr, cint, flt, comma_or
from webnotes.model.doc import Document, addchild from webnotes.model.doc import Document, addchild
@ -67,7 +68,7 @@ class DocType(StockController):
self.update_serial_no(0) self.update_serial_no(0)
self.update_stock_ledger(1) self.update_stock_ledger(1)
self.update_production_order(0) self.update_production_order(0)
self.make_gl_entries() self.make_cancel_gl_entries()
def validate_fiscal_year(self): def validate_fiscal_year(self):
import accounts.utils import accounts.utils
@ -426,16 +427,18 @@ class DocType(StockController):
def get_warehouse_details(self, args): def get_warehouse_details(self, args):
args = json.loads(args) args = json.loads(args)
args.update({ ret = {}
"posting_date": self.doc.posting_date, if args.get('warehouse') and args.get('item_code'):
"posting_time": self.doc.posting_time, args.update({
}) "posting_date": self.doc.posting_date,
args = webnotes._dict(args) "posting_time": self.doc.posting_time,
})
args = webnotes._dict(args)
ret = { ret = {
"actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0, "actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0,
"incoming_rate" : self.get_incoming_rate(args) "incoming_rate" : self.get_incoming_rate(args)
} }
return ret return ret
def get_items(self): 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, "docstatus": 0,
"modified": "2013-03-26 07:24:53", "modified": "2013-03-29 15:31:42",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -116,6 +116,7 @@
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Delivery Note", "options": "Delivery Note",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 1 "search_index": 1
@ -129,7 +130,8 @@
"label": "Sales Invoice No", "label": "Sales Invoice No",
"no_copy": 1, "no_copy": 1,
"options": "Sales Invoice", "options": "Sales Invoice",
"print_hide": 1 "print_hide": 1,
"read_only": 0
}, },
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
@ -145,6 +147,7 @@
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Purchase Receipt", "options": "Purchase Receipt",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 1 "search_index": 1
@ -201,7 +204,9 @@
"fieldname": "expense_adjustment_account", "fieldname": "expense_adjustment_account",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Expense/Adjustment Account", "label": "Expense/Adjustment Account",
"options": "Account" "options": "Account",
"print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -550,6 +555,7 @@
"label": "Fiscal Year", "label": "Fiscal Year",
"options": "link:Fiscal Year", "options": "link:Fiscal Year",
"print_hide": 1, "print_hide": 1,
"read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
@ -620,5 +626,13 @@
{ {
"doctype": "DocPerm", "doctype": "DocPerm",
"role": "Manufacturing User" "role": "Manufacturing User"
},
{
"doctype": "DocPerm",
"role": "Manufacturing Manager"
},
{
"doctype": "DocPerm",
"role": "Material Manager"
} }
] ]

View File

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