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

Proposed by Lorenzo Battistini on 2014-02-04
Status: Merged
Merged at revision: 114
Proposed branch: lp:~agilebg/account-payment/7.0-bug-1276077-elbati
Merge into: lp:~account-payment-team/account-payment/7.0
Diff against target: 101 lines (+55/-2)
3 files modified
account_voucher_cash_basis/__openerp__.py (+1/-0)
account_voucher_cash_basis/account_voucher.py (+13/-2)
account_voucher_cash_basis/voucher_view.xml (+41/-0)
To merge this branch: bzr merge lp:~agilebg/account-payment/7.0-bug-1276077-elbati
Reviewer Review Type Date Requested Status
Ana Juaristi Olalde code review Approve on 2014-06-16
Omar (Pexego) code review Approve on 2014-06-06
Yannick Vaucher @ Camptocamp code review, no tests 2014-02-04 Approve on 2014-02-20
Nicola Malcontenti - Agile BG 2014-06-03 Pending
Alex Comba - Agile BG 2014-06-03 Pending
Review via email: mp+204684@code.launchpad.net
To post a comment you must log in.

LGTM

review: Approve (code review, no tests)
Omar (Pexego) (omar7r) wrote :

LGTM

review: Approve (code review)
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher_cash_basis/__openerp__.py'
2--- account_voucher_cash_basis/__openerp__.py 2013-05-15 19:15:17 +0000
3+++ account_voucher_cash_basis/__openerp__.py 2014-02-04 13:44:40 +0000
4@@ -48,6 +48,7 @@
5 'init_xml': [],
6 'data': [
7 'company_view.xml',
8+ 'voucher_view.xml',
9 ],
10 'demo': [],
11 'installable': True,
12
13=== modified file 'account_voucher_cash_basis/account_voucher.py'
14--- account_voucher_cash_basis/account_voucher.py 2013-06-17 09:26:01 +0000
15+++ account_voucher_cash_basis/account_voucher.py 2014-02-04 13:44:40 +0000
16@@ -25,11 +25,21 @@
17 from openerp.tools.translate import _
18 import openerp.addons.decimal_precision as dp
19
20+
21 class account_voucher(orm.Model):
22 _inherit = "account.voucher"
23
24 _columns = {
25- 'line_total': fields.float('Lines Total', digits_compute=dp.get_precision('Account'), readonly=True),
26+ 'line_total': fields.float(
27+ 'Lines Total', digits_compute=dp.get_precision('Account'),
28+ readonly=True),
29+ # exclude_write_off field will be used by modules like
30+ # account_vat_on_payment and l10n_it_withholding_tax
31+ 'exclude_write_off': fields.boolean(
32+ 'Exclude write-off from tax on payment',
33+ help="""Select this if you want, when closing the invoice, the
34+ tax to be computed
35+ based on the invoice's totals instead of the paid amount"""),
36 }
37
38 def balance_move(self, cr, uid, move_id, context=None):
39@@ -71,7 +81,7 @@
40 res = 0.0
41 for inv_move_line in invoice.move_id.line_id:
42 if inv_move_line.account_id.type in ('receivable','payable'):
43- res += inv_move_line.debit or inv_move_line.credit # can both be presents?
44+ res += inv_move_line.debit or inv_move_line.credit
45 return res
46
47 def get_invoice_total_currency(self, invoice):
48@@ -150,6 +160,7 @@
49 'total'
50 ] = self.get_invoice_total(line.move_line_id.invoice)
51 if res:
52+ # we use line_total as it can be != writeoff_amount in case of multi currency
53 write_off_per_invoice = voucher.line_total / len(res)
54 if not voucher.company_id.allow_distributing_write_off and len(res) > 1 and write_off_per_invoice:
55 raise orm.except_orm(_('Error'), _(
56
57=== added file 'account_voucher_cash_basis/voucher_view.xml'
58--- account_voucher_cash_basis/voucher_view.xml 1970-01-01 00:00:00 +0000
59+++ account_voucher_cash_basis/voucher_view.xml 2014-02-04 13:44:40 +0000
60@@ -0,0 +1,41 @@
61+<?xml version="1.0" encoding="utf-8"?>
62+<openerp>
63+ <data>
64+
65+ <record id="view_vendor_payment_form" model="ir.ui.view">
66+ <field name="name">view_vendor_payment_form</field>
67+ <field name="model">account.voucher</field>
68+ <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
69+ <field name="arch" type="xml">
70+ <field name="writeoff_acc_id" position="after">
71+ <field name="exclude_write_off"
72+ attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
73+ </field>
74+ </field>
75+ </record>
76+
77+ <record id="view_vendor_receipt_dialog_form" model="ir.ui.view">
78+ <field name="name">view_vendor_receipt_dialog_form</field>
79+ <field name="model">account.voucher</field>
80+ <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form"/>
81+ <field name="arch" type="xml">
82+ <field name="writeoff_acc_id" position="after">
83+ <field name="exclude_write_off"
84+ attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
85+ </field>
86+ </field>
87+ </record>
88+
89+ <record id="view_vendor_receipt_form" model="ir.ui.view">
90+ <field name="name">view_vendor_receipt_form</field>
91+ <field name="model">account.voucher</field>
92+ <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
93+ <field name="arch" type="xml">
94+ <field name="writeoff_acc_id" position="after">
95+ <field name="exclude_write_off"
96+ attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"></field>
97+ </field>
98+ </field>
99+ </record>
100+ </data>
101+</openerp>