Merge lp:~vauxoo/addons-vauxoo/7.0_onchange_compute_tax_fix-dev_luis into lp:addons-vauxoo/7.0

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 981
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0_onchange_compute_tax_fix-dev_luis
Merge into: lp:addons-vauxoo/7.0
Diff against target: 58 lines (+11/-6)
2 files modified
account_voucher_tax/account_voucher.py (+7/-5)
account_voucher_tax/account_voucher_tax_view.xml (+4/-1)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0_onchange_compute_tax_fix-dev_luis
Reviewer Review Type Date Requested Status
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+210463@code.launchpad.net

Description of the change

Se agrego el else del get para las lineas tanto de debit y credit del onchange de las lineas del voucher, para que cuando no esten estos elementos retorne una lista vacia.

To post a comment you must log in.
982. By Luis Torres - http://www.vauxoo.com

[FIX][account_voucher_tax]Repair the onchange_amount from account_voucher_line, for inerith the function

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_voucher_tax/account_voucher.py'
2--- account_voucher_tax/account_voucher.py 2014-03-06 19:39:27 +0000
3+++ account_voucher_tax/account_voucher.py 2014-03-11 21:03:40 +0000
4@@ -264,8 +264,8 @@
5 tax_lines = {}
6 lines_ids = []
7 if lines and lines.get('value', False):
8- lines_ids.extend(lines['value'].get('line_cr_ids'))
9- lines_ids.extend(lines['value'].get('line_dr_ids'))
10+ lines_ids.extend(lines['value'].get('line_cr_ids', []))
11+ lines_ids.extend(lines['value'].get('line_dr_ids', []))
12 for line in lines_ids:
13 factor = self.get_percent_pay_vs_invoice(cr, uid, line[\
14 'amount_original'], line['amount'], context=context)
15@@ -375,8 +375,8 @@
16 class account_voucher_line(osv.Model):
17 _inherit = 'account.voucher.line'
18
19- def onchange_amount(self, cr, uid, ids, amount, voucher_id, move_line_id,\
20- amount_original, context=None):
21+ def onchange_amount(self, cr, uid, ids, amount=False, amount_unreconciled=False, context=None, voucher_id=False,\
22+ move_line_id=False, amount_original=False):
23 if not context:
24 context = {}
25 currency_obj = self.pool.get('res.currency')
26@@ -398,7 +398,9 @@
27 context=context).currency_id.id
28 factor = voucher_obj.get_percent_pay_vs_invoice(cr, uid,\
29 amount_original, amount, context=context)
30- res = {'value' : {}}
31+ res = super(account_voucher_line, self).onchange_amount(cr, uid, ids, amount, amount_unreconciled)
32+ if not voucher_id and not move_line_id and not amount_original:
33+ return res
34 if amount > 0:
35 list_tax = []
36 move_id = move_obj.browse(cr, uid, move_line_id, context=context).\
37
38=== modified file 'account_voucher_tax/account_voucher_tax_view.xml'
39--- account_voucher_tax/account_voucher_tax_view.xml 2013-08-15 03:08:51 +0000
40+++ account_voucher_tax/account_voucher_tax_view.xml 2014-03-11 21:03:40 +0000
41@@ -101,7 +101,7 @@
42 <field name="inherit_id" ref="account_voucher.view_voucher_line_form"/>
43 <field name="arch" type="xml">
44 <xpath expr="//field[@name='amount']" position="replace">
45- <field name="amount" on_change="onchange_amount(amount, voucher_id, move_line_id, amount_original)"/>
46+ <field name="amount" on_change="onchange_amount(amount, amount_unreconciled, context, voucher_id, move_line_id, amount_original)"/>
47 </xpath>
48 <xpath expr="//field[@name='amount']" position="after">
49 <field name="voucher_id" invisible='1'/>
50@@ -112,6 +112,9 @@
51 <xpath expr="//field[@name='move_line_id']" position="after">
52 <field name="amount_original" invisible='1'/>
53 </xpath>
54+ <xpath expr="//field[@name='amount_original']" position="after">
55+ <field name="amount_unreconciled" invisible='1'/>
56+ </xpath>
57 </field>
58 </record>
59