[REF] Account: add domain on bank statement wizard, add constraint on the statement line,improve the configuration wizard of chart of account

bzr revid: ara@tinyerp.com-20101204052420-o6zj7apc4rqv1gfy
This commit is contained in:
ARA (OpenERP) 2010-12-04 10:54:20 +05:30
parent 8e1f11c429
commit eef825be08
4 changed files with 31 additions and 11 deletions

View File

@ -297,14 +297,24 @@ class account_bank_statement(osv.osv):
def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
return st_number + '/' + str(st_line.sequence)
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
st = self.browse(cr, uid, st_id, context)
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
raise osv.except_osv(_('Error !'),
_('The statement balance is incorrect !\n') +
_('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
# def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
# st = self.browse(cr, uid, st_id, context)
# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
# raise osv.except_osv(_('Error !'),
# _('The statement balance is incorrect !\n') +
# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
# return True
def _balance_check(self, cr, uid, ids, context=None):
for st in self.browse(cr, uid, ids):
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
return False
return True
_constraints = [
(_balance_check, 'The statement balance is incorrect !\n The expected balance is different than the computed one.', ['balance_end','balance_end_real']),
]
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
@ -323,7 +333,7 @@ class account_bank_statement(osv.osv):
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
continue
self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
# self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),

View File

@ -2436,7 +2436,7 @@
<attribute name='string'></attribute>
</xpath>
<group string="res_config_contents" position="replace">
<field name="company_id" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_extended"/>
<field name ="code_digits" groups="base.group_extended"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)"/>
<field name ="seq_journal" groups="base.group_extended"/>

View File

@ -826,7 +826,6 @@ class account_voucher_line(osv.osv):
_defaults = {
'name': ''
}
def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
"""
Returns a dict that contains new values and context
@ -949,6 +948,17 @@ class account_bank_statement_line(osv.osv):
res[line.id] = 0.0
return res
def _check_amount(self, cr, uid, ids, context=None):
obj = self.browse(cr, uid, ids[0])
if obj.voucher_id:
if not (obj.amount == obj.voucher_id.amount):
return False
return True
_constraints = [
(_check_amount, 'The amount of the voucher must be the same amount as the one on the statement line', ['statement_id']),
]
_columns = {
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', method=True, type='float'),
@ -968,4 +978,4 @@ class account_bank_statement_line(osv.osv):
account_bank_statement_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -38,7 +38,7 @@
<form string="Import Entries">
<group colspan="4" expand="1">
<separator string="Payable and Receivables" colspan="4"/>
<field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('reconcile_partial_id','=',False)]"/>
<field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('reconcile_partial_id','=',False), ('state', '=', 'valid')]"/>
</group>
<group colspan="4" col="6">
<label string ="" colspan="2"/>