~akretion-team/account-invoicing/70-add-invoice_fiscal_position_update

« back to all changes in this revision

Viewing changes to invoice_fiscal_position_update/account_invoice.py

  • Committer: Alexis de Lattre
  • Date: 2014-01-06 23:25:07 UTC
  • Revision ID: alexis@via.ecp.fr-20140106232507-x9ht6ikdfhs6kaf0
Better FR translation.
Update variable name, for easier porting to sale/purchase.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        assert len(ids) in (0, 1), 'One ID max'
38
38
        fp_obj = self.pool['account.fiscal.position']
39
39
        res = {}
40
 
        iline_dict = self.resolve_2many_commands(
 
40
        line_dict = self.resolve_2many_commands(
41
41
            cr, uid, 'invoice_line', invoice_line, context=context)
42
42
        lines_without_product = []
43
43
        if fiscal_position:
44
44
            fp = fp_obj.browse(cr, uid, fiscal_position, context=context)
45
45
        else:
46
46
            fp = False
47
 
        for line in iline_dict:
48
 
            # Reformat iline_dict so as to be compatible with what is
 
47
        for line in line_dict:
 
48
            # Reformat line_dict so as to be compatible with what is
49
49
            # accepted in res['value']
50
50
            for key, value in line.iteritems():
51
51
                if isinstance(value, tuple) and len(value) == 2:
80
80
            else:
81
81
                lines_without_product.append(line.get('name'))
82
82
        res['value'] = {}
83
 
        res['value']['invoice_line'] = iline_dict
 
83
        res['value']['invoice_line'] = line_dict
84
84
 
85
85
        if lines_without_product:
86
86
            res['warning'] = {'title': _('Warning')}
87
 
            if len(lines_without_product) == len(iline_dict):
 
87
            if len(lines_without_product) == len(line_dict):
88
88
                res['warning']['message'] = _(
89
89
                    "The invoice lines were not updated to the new "
90
90
                    "Fiscal Position because they don't have products.\n"