← Back to team overview

openobject-italia-core-devs team mailing list archive

[Merge] lp:~agilebg/openobject-italia/7.0-bug-1214971-elbati into lp:openobject-italia/7.0

 

Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/openobject-italia/7.0-bug-1214971-elbati into lp:openobject-italia/7.0.

Requested reviews:
  OpenERP Italia core devs (openobject-italia-core-devs)
Related bugs:
  Bug #1214971 in OpenERP Italia: "[7.0] [6.1] l10n_it_vat_registries - wrong invoice total when negative lines are present"
  https://bugs.launchpad.net/openobject-italia/+bug/1214971

For more details, see:
https://code.launchpad.net/~agilebg/openobject-italia/7.0-bug-1214971-elbati/+merge/181349
-- 
https://code.launchpad.net/~agilebg/openobject-italia/7.0-bug-1214971-elbati/+merge/181349
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~agilebg/openobject-italia/7.0-bug-1214971-elbati into lp:openobject-italia/7.0.
=== modified file 'l10n_it_vat_registries/invoice.py'
--- l10n_it_vat_registries/invoice.py	2013-05-09 15:48:45 +0000
+++ l10n_it_vat_registries/invoice.py	2013-08-21 16:25:23 +0000
@@ -65,6 +65,15 @@
             res.append(tax_item)
             index += 1
         return res
+
+    def _get_invoice_total(self, move):
+        total = 0.0
+        for move_line in move.line_id:
+            if move_line.account_id.type == 'receivable':
+                total += move_line.debit or ( - move_line.credit)
+            elif move_line.account_id.type == 'payable':
+                total += ( - move_line.debit) or move_line.credit
+        return abs(total)
     
     def build_parent_tax_codes(self, tax_code):
         res={}
@@ -132,6 +141,7 @@
             'used_tax_codes': {},
             'start_date': self._get_start_date,
             'end_date': self._get_end_date,
+            'invoice_total': self._get_invoice_total,
         })
 
     def set_context(self, objects, data, ids, report_type=None):

=== modified file 'l10n_it_vat_registries/templates/registro_iva_vendite.mako'
--- l10n_it_vat_registries/templates/registro_iva_vendite.mako	2013-05-03 14:05:15 +0000
+++ l10n_it_vat_registries/templates/registro_iva_vendite.mako	2013-08-21 16:25:23 +0000
@@ -93,7 +93,7 @@
                     </td><td class="right_without_line">
                 %endif
                 %if line['index']==0:
-                    ${ formatLang(object.amount) | entity}
+                    ${ formatLang(invoice_total(object)) | entity}
                 %endif
                 </td>
                 %if line['index']==0:


Follow ups