PEP8 on account_bank_statement_tax

This commit is contained in:
Sandy Carter
2014-08-25 17:19:13 -04:00
parent 596304f48f
commit c978f11306
2 changed files with 19 additions and 11 deletions

View File

@@ -50,8 +50,8 @@ class AccountBankStatement(orm.Model):
fiscal_position = ( fiscal_position = (
st_line.partner_id.property_account_position st_line.partner_id.property_account_position
if st_line.partner_id and if st_line.partner_id
st_line.partner_id.property_account_position and st_line.partner_id.property_account_position
else False) else False)
tax_ids = self.pool.get('account.fiscal.position').map_tax( tax_ids = self.pool.get('account.fiscal.position').map_tax(
cr, uid, fiscal_position, [st_line.tax_id]) cr, uid, fiscal_position, [st_line.tax_id])
@@ -66,25 +66,33 @@ class AccountBankStatement(orm.Model):
update_move_line['tax_code_id'] = tax['base_code_id'] update_move_line['tax_code_id'] = tax['base_code_id']
update_move_line['tax_amount'] = tax['base_sign'] * ( update_move_line['tax_amount'] = tax['base_sign'] * (
computed_taxes.get('total', 0.0)) computed_taxes.get('total', 0.0))
# As the tax is inclusive, we need to correct the amount on the # As the tax is inclusive, we need to correct the amount
# original move line # on the original move line
amount = computed_taxes.get('total', 0.0) amount = computed_taxes.get('total', 0.0)
update_move_line['credit'] = ((amount < 0) and -amount) or 0.0 update_move_line['credit'] = (
update_move_line['debit'] = ((amount > 0) and amount) or 0.0 (amount < 0) and -amount) or 0.0
update_move_line['debit'] = (
(amount > 0) and amount) or 0.0
move_lines.append({ move_lines.append({
'move_id': defaults['move_id'], 'move_id': defaults['move_id'],
'name': defaults.get('name', '') + ' ' + ustr(tax['name'] or ''), 'name': (
defaults.get('name', '')
+ ' ' + ustr(tax['name'] or '')),
'date': defaults.get('date', False), 'date': defaults.get('date', False),
'partner_id': defaults.get('partner_id', False), 'partner_id': defaults.get('partner_id', False),
'ref': defaults.get('ref', False), 'ref': defaults.get('ref', False),
'statement_id': defaults.get('statement_id'), 'statement_id': defaults.get('statement_id'),
'tax_code_id': tax['tax_code_id'], 'tax_code_id': tax['tax_code_id'],
'tax_amount': tax['tax_sign'] * tax.get('amount', 0.0), 'tax_amount': tax['tax_sign'] * tax.get('amount', 0.0),
'account_id': tax.get('account_collected_id', defaults['account_id']), 'account_id': (
tax.get('account_collected_id',
defaults['account_id'])),
'credit': tax['amount'] < 0 and - tax['amount'] or 0.0, 'credit': tax['amount'] < 0 and - tax['amount'] or 0.0,
'debit': tax['amount'] > 0 and tax['amount'] or 0.0, 'debit': tax['amount'] > 0 and tax['amount'] or 0.0,
'account_id': tax.get('account_collected_id', defaults['account_id']), 'account_id': (
tax.get('account_collected_id',
defaults['account_id'])),
}) })
return move_lines, update_move_line return move_lines, update_move_line