Technical mailing list archives


Unreacheable code in OpenERP 7.0

- 26 سبتمبر, 2014 09:28:18
I'm reviewing the 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 = (,
                         if key in account2:
                             code = account2[key][0]
                             amount = account2[key][1] * (line.debit +
                         elif in account:
                             code = account[][0]
                             amount = account[][1] * 
(line.debit +
                         if (code or amount) and not (line.tax_code_id 
or line.tax_amount):
                             obj_move_line.write(cr, uid, [], {
                                 '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 ` in account` will always be 
False and both `code` and `amount` will remain 0.  So nothing would change.

Am I right?

Best regards,