← Back to team overview

account-payment-team team mailing list archive

[Merge] lp:~agilebg/account-payment/7.0-bug-1276077-elbati into lp:account-payment/7.0

 

Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/account-payment/7.0-bug-1276077-elbati into lp:account-payment/7.0.

Requested reviews:
  Account Payment (account-payment-team)
Related bugs:
  Bug #1276077 in Additional payment, bank statement and voucher addons for OpenERP: "[7.0] account_vat_on_payment - impossible to compute VAT based on invoice total in case of write-off"
  https://bugs.launchpad.net/account-payment/+bug/1276077

For more details, see:
https://code.launchpad.net/~agilebg/account-payment/7.0-bug-1276077-elbati/+merge/204684
-- 
https://code.launchpad.net/~agilebg/account-payment/7.0-bug-1276077-elbati/+merge/204684
Your team Account Payment is requested to review the proposed merge of lp:~agilebg/account-payment/7.0-bug-1276077-elbati into lp:account-payment/7.0.
=== modified file 'account_voucher_cash_basis/__openerp__.py'
--- account_voucher_cash_basis/__openerp__.py	2013-05-15 19:15:17 +0000
+++ account_voucher_cash_basis/__openerp__.py	2014-02-04 13:44:40 +0000
@@ -48,6 +48,7 @@
     'init_xml': [],
     'data': [
         'company_view.xml',
+        'voucher_view.xml',
         ],
     'demo': [],
     'installable': True,

=== modified file 'account_voucher_cash_basis/account_voucher.py'
--- account_voucher_cash_basis/account_voucher.py	2013-06-17 09:26:01 +0000
+++ account_voucher_cash_basis/account_voucher.py	2014-02-04 13:44:40 +0000
@@ -25,11 +25,21 @@
 from openerp.tools.translate import _
 import openerp.addons.decimal_precision as dp
 
+
 class account_voucher(orm.Model):
     _inherit = "account.voucher"
     
     _columns = {
-        'line_total': fields.float('Lines Total', digits_compute=dp.get_precision('Account'), readonly=True),
+        'line_total': fields.float(
+            'Lines Total', digits_compute=dp.get_precision('Account'),
+            readonly=True),
+        # exclude_write_off field will be used by modules like
+        # account_vat_on_payment and l10n_it_withholding_tax
+        'exclude_write_off': fields.boolean(
+            'Exclude write-off from tax on payment',
+            help="""Select this if you want, when closing the invoice, the
+            tax to be computed
+            based on the invoice's totals instead of the paid amount"""),
         }
     
     def balance_move(self, cr, uid, move_id, context=None):
@@ -71,7 +81,7 @@
         res = 0.0
         for inv_move_line in invoice.move_id.line_id:
             if inv_move_line.account_id.type in ('receivable','payable'):
-                res += inv_move_line.debit or inv_move_line.credit # can both be presents?
+                res += inv_move_line.debit or inv_move_line.credit
         return res
         
     def get_invoice_total_currency(self, invoice):
@@ -150,6 +160,7 @@
                     'total'
                     ] = self.get_invoice_total(line.move_line_id.invoice)
         if res:
+            # we use line_total as it can be != writeoff_amount in case of multi currency
             write_off_per_invoice = voucher.line_total / len(res)
             if not voucher.company_id.allow_distributing_write_off and  len(res) > 1 and write_off_per_invoice:
                 raise orm.except_orm(_('Error'), _(

=== added file 'account_voucher_cash_basis/voucher_view.xml'
--- account_voucher_cash_basis/voucher_view.xml	1970-01-01 00:00:00 +0000
+++ account_voucher_cash_basis/voucher_view.xml	2014-02-04 13:44:40 +0000
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_vendor_payment_form" model="ir.ui.view">
+            <field name="name">view_vendor_payment_form</field>
+            <field name="model">account.voucher</field>
+            <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
+            <field name="arch" type="xml">
+                <field name="writeoff_acc_id" position="after">
+                    <field name="exclude_write_off"
+                        attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
+                </field>
+            </field>
+        </record>
+
+        <record id="view_vendor_receipt_dialog_form" model="ir.ui.view">
+            <field name="name">view_vendor_receipt_dialog_form</field>
+            <field name="model">account.voucher</field>
+            <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form"/>
+            <field name="arch" type="xml">
+                <field name="writeoff_acc_id" position="after">
+                    <field name="exclude_write_off"
+                        attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
+                </field>
+            </field>
+        </record>
+
+        <record id="view_vendor_receipt_form" model="ir.ui.view">
+            <field name="name">view_vendor_receipt_form</field>
+            <field name="model">account.voucher</field>
+            <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
+            <field name="arch" type="xml">
+                <field name="writeoff_acc_id" position="after">
+                    <field name="exclude_write_off"
+                        attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
+                </field>
+            </field>
+        </record>
+    </data>
+</openerp>


Follow ups