Community: Framework mailing list archives

expert-framework@mail.odoo.com

Unreacheable code in OpenERP 7.0 account.py

by
manuel
- 09/26/2014 21:28:18
I'm reviewing the account.py module and notice that the validate method 
of account.move has code that would never do anything beyond wasting time:

Line 1580-1597 contain the following:

                 account = {}
                 account2 = {}

                 if journal.type in ('purchase','sale'):
                     for line in move.line_id:
                         code = amount = 0
                         key = (line.account_id.id, line.tax_code_id.id)
                         if key in account2:
                             code = account2[key][0]
                             amount = account2[key][1] * (line.debit + 
line.credit)
                         elif line.account_id.id in account:
                             code = account[line.account_id.id][0]
                             amount = account[line.account_id.id][1] * 
(line.debit + line.credit)
                         if (code or amount) and not (line.tax_code_id 
or line.tax_amount):
                             obj_move_line.write(cr, uid, [line.id], {
                                 'tax_code_id': code,
                                 'tax_amount': amount
                             }, context, check=False)


Notice that both `account` and `account2` are never updated. Therefore 
the `key in account2` and `line.account_id.id in account` will always be 
False and both `code` and `amount` will remain 0.  So nothing would change.

Am I right?

Best regards,
Manuel.