fixes in cleanup data

This commit is contained in:
Nabin Hait
2013-03-12 10:41:21 +05:30
parent 29ece5f95b
commit bffbc18b2d
2 changed files with 74 additions and 69 deletions

View File

@@ -724,6 +724,8 @@ class DocType(SellingController):
# expense account gl entries
if auto_inventory_accounting and flt(item.buying_amount):
self.check_expense_account(item)
gl_entries.append(
self.get_gl_dict({
"account": item.expense_account,
@@ -814,6 +816,11 @@ class DocType(SellingController):
return item_buying_amount
def check_expense_account(self, item):
if not item.expense_account:
msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
raise_exception=1)
def update_c_form(self):
"""Update amended id in C-form"""
if self.doc.c_form_no and self.doc.amended_from:

View File

@@ -20,16 +20,14 @@ import webnotes
def delete_transactions():
print "Deleting transactions..."
trans = ['Timesheet','Task','Support Ticket','Stock Reconciliation', 'Stock Ledger Entry', \
'Stock Entry','Sales Order','Salary Slip','Sales Invoice','Quotation', 'Quality Inspection', \
'Purchase Receipt','Purchase Order','Production Order', 'POS Setting','Period Closing Voucher', \
'Purchase Invoice','Maintenance Visit','Maintenance Schedule','Leave Application', \
'Leave Allocation', 'Lead', 'Journal Voucher', 'Installation Note','Material Request', \
'GL Entry','Expense Claim','Opportunity','Delivery Note','Customer Issue','Bin', \
'Authorization Rule','Attendance', 'C-Form', 'Form 16A', 'Lease Agreement', \
'Lease Installment', 'TDS Payment', 'TDS Return Acknowledgement', 'Appraisal', \
'Installation Note', 'Communication'
]
trans = ['Timesheet', 'Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry',
'Stock Entry', 'Sales Order', 'Salary Slip','Sales Invoice', 'Quotation',
'Quality Inspection', 'Purchase Receipt', 'Purchase Order', 'Production Order',
'POS Setting', 'Period Closing Voucher', 'Purchase Invoice', 'Maintenance Visit',
'Maintenance Schedule', 'Leave Application', 'Leave Allocation', 'Lead', 'Journal Voucher',
'Installation Note', 'Material Request', 'GL Entry', 'Expense Claim', 'Opportunity',
'Delivery Note', 'Customer Issue', 'Bin', 'Authorization Rule', 'Attendance', 'C-Form',
'Appraisal', 'Installation Note', 'Communication']
for d in trans:
for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
webnotes.conn.sql("delete from `tab%s`" % (t))
@@ -115,7 +113,7 @@ def reset_all_series():
def reset_transaction_series():
webnotes.conn.sql("""update tabSeries set current = 0 where name in
('JV', 'INV', 'BILL', 'SO', 'DN', 'PO', 'LEAD', 'ENQUIRY', 'ENQ', 'CI',
'IN', 'PS', 'IDT', 'QAI', 'QTN', 'STE', 'SQTN', 'SUP', 'TDSP', 'SR',
'IN', 'PS', 'IDT', 'QAI', 'QTN', 'STE', 'SQTN', 'SUP', 'SR',
'POS', 'LAP', 'LAL', 'EXP')""")
print "Series updated"
@@ -128,27 +126,27 @@ def delete_main_masters():
webnotes.conn.sql("delete from `tab%s`" % (d))
print "Deleted " + d
def reset_global_defaults():
flds = {
'default_company': '',
'default_currency': '',
'current_fiscal_year': '',
'default_company': None,
'default_currency': None,
'current_fiscal_year': None,
'date_format': 'dd-mm-yyyy',
'sms_sender_name': '',
'sms_sender_name': None,
'default_item_group': 'Default',
'default_stock_uom': 'Nos',
'default_valuation_method': 'FIFO',
'default_warehouse_type': 'Default Warehouse Type',
'tolerance': '',
'acc_frozen_upto': '',
'bde_auth_role': '',
'credit_controller': '',
'tolerance': None,
'acc_frozen_upto': None,
'bde_auth_role': None,
'credit_controller': None,
'default_customer_group': 'Default Customer Group',
'default_territory': 'Default',
'default_price_list': 'Standard',
'default_supplier_type': 'Default Supplier Type'
'default_supplier_type': 'Default Supplier Type',
'hide_currency_symbol': None,
'default_price_list_currency': None,
}
from webnotes.model.code import get_obj