[IMP]account: pep-8 in account cash statement
bzr revid: ssi@tinyerp.com-20101021120826-dpd7zuwcujb3rdk3
This commit is contained in:
parent
ea61572b9a
commit
84a6dad5ce
|
@ -52,14 +52,14 @@ class account_cashbox_line(osv.osv):
|
|||
@param number:
|
||||
"""
|
||||
sub = pieces * number
|
||||
return {'value':{'subtotal': sub or 0.0}}
|
||||
return {'value': {'subtotal': sub or 0.0}}
|
||||
|
||||
_columns = {
|
||||
'pieces': fields.float('Values', digits_compute=dp.get_precision('Account')),
|
||||
'number': fields.integer('Number'),
|
||||
'subtotal': fields.function(_sub_total, method=True, string='Sub Total', type='float', digits_compute=dp.get_precision('Account')),
|
||||
'starting_id': fields.many2one('account.bank.statement',ondelete='cascade'),
|
||||
'ending_id': fields.many2one('account.bank.statement',ondelete='cascade'),
|
||||
'starting_id': fields.many2one('account.bank.statement', ondelete='cascade'),
|
||||
'ending_id': fields.many2one('account.bank.statement', ondelete='cascade'),
|
||||
}
|
||||
|
||||
account_cashbox_line()
|
||||
|
@ -85,7 +85,7 @@ class account_cash_statement(osv.osv):
|
|||
for line in statement.starting_details_ids:
|
||||
amount_total+= line.pieces * line.number
|
||||
res[statement.id] = {
|
||||
'balance_start':amount_total
|
||||
'balance_start': amount_total
|
||||
}
|
||||
return res
|
||||
|
||||
|
@ -165,13 +165,13 @@ class account_cash_statement(osv.osv):
|
|||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append(dct)
|
||||
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','cash')], context=context)
|
||||
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')], context=context)
|
||||
if journal_ids:
|
||||
results = self.search(cr, uid, [('journal_id','in',journal_ids),('state','=','confirm')],context=context)
|
||||
results = self.search(cr, uid, [('journal_id', 'in', journal_ids),('state', '=', 'confirm')], context=context)
|
||||
if results:
|
||||
cash_st = self.browse(cr, uid, results, context)[0]
|
||||
for cash_line in cash_st.ending_details_ids:
|
||||
|
@ -185,8 +185,8 @@ class account_cash_statement(osv.osv):
|
|||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append(dct)
|
||||
return res
|
||||
|
@ -196,10 +196,10 @@ class account_cash_statement(osv.osv):
|
|||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append((0,0,dct))
|
||||
res.append((0, 0, dct))
|
||||
return res
|
||||
|
||||
def _get_cash_open_close_box_lines(self, cr, uid, context={}):
|
||||
|
@ -209,34 +209,34 @@ class account_cash_statement(osv.osv):
|
|||
starting_details = self._get_cash_open_box_lines(cr, uid, context)
|
||||
ending_details = self._get_default_cash_close_box_lines(cr, uid, context)
|
||||
for start in starting_details:
|
||||
start_l.append((0,0,start))
|
||||
start_l.append((0, 0, start))
|
||||
for end in ending_details:
|
||||
end_l.append((0,0,end))
|
||||
end_l.append((0, 0, end))
|
||||
res['start'] = start_l
|
||||
res['end'] = end_l
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
|
||||
'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm': [('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
|
||||
'state': fields.selection(
|
||||
[('draft', 'Draft'),
|
||||
('confirm', 'Closed'),
|
||||
('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
|
||||
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
|
||||
'closing_date':fields.datetime("Closed On"),
|
||||
'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
|
||||
'closing_date': fields.datetime("Closed On"),
|
||||
'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"),
|
||||
'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"),
|
||||
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
|
||||
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
|
||||
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'),
|
||||
'user_id':fields.many2one('res.users', 'Responsible', required=False),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=False),
|
||||
}
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
'date': time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'user_id': lambda self, cr, uid, context=None: uid,
|
||||
'starting_details_ids':_get_cash_open_box_lines,
|
||||
'ending_details_ids':_get_default_cash_close_box_lines
|
||||
'starting_details_ids': _get_cash_open_box_lines,
|
||||
'ending_details_ids': _get_default_cash_close_box_lines
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
|
@ -250,20 +250,20 @@ class account_cash_statement(osv.osv):
|
|||
|
||||
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
|
||||
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
|
||||
if vals.get('starting_details_ids',False):
|
||||
if vals.get('starting_details_ids', False):
|
||||
for start in vals.get('starting_details_ids'):
|
||||
dict_val = start[2]
|
||||
for end in open_close['end']:
|
||||
if end[2]['pieces'] == dict_val['pieces']:
|
||||
end[2]['number'] += dict_val['number']
|
||||
vals.update({
|
||||
'ending_details_ids':open_close['start'],
|
||||
'starting_details_ids':open_close['end']
|
||||
'ending_details_ids': open_close['start'],
|
||||
'starting_details_ids': open_close['end']
|
||||
})
|
||||
else:
|
||||
vals.update({
|
||||
'ending_details_ids':False,
|
||||
'starting_details_ids':False
|
||||
'ending_details_ids': False,
|
||||
'starting_details_ids': False
|
||||
})
|
||||
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
|
||||
self.write(cr, uid, [res_id], {})
|
||||
|
@ -337,8 +337,8 @@ class account_cash_statement(osv.osv):
|
|||
})
|
||||
|
||||
vals.update({
|
||||
'date':time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state':'open',
|
||||
'date': time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state': 'open',
|
||||
|
||||
})
|
||||
self.write(cr, uid, [statement.id], vals)
|
||||
|
@ -367,14 +367,14 @@ class account_cash_statement(osv.osv):
|
|||
|
||||
def button_confirm_cash(self, cr, uid, ids, context=None):
|
||||
super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
|
||||
return self.write(cr, uid, ids, {'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
|
||||
return self.write(cr, uid, ids, {'closing_date': time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
cash_box_line_pool = self.pool.get('account.cashbox.line')
|
||||
super(account_cash_statement, self).button_cancel(cr, uid, ids, context=context)
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
for end in st.ending_details_ids:
|
||||
cash_box_line_pool.write(cr, uid, [end.id], {'number':0})
|
||||
cash_box_line_pool.write(cr, uid, [end.id], {'number': 0})
|
||||
return True
|
||||
|
||||
account_cash_statement()
|
||||
|
|
Loading…
Reference in New Issue