Merge lp:~therp-nl/ocb-addons/7.0-lp941817-autocompute_taxes_on_proforma into lp:ocb-addons

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 9180
Proposed branch: lp:~therp-nl/ocb-addons/7.0-lp941817-autocompute_taxes_on_proforma
Merge into: lp:ocb-addons
Diff against target: 61 lines (+20/-3)
3 files modified
account/account_invoice.py (+17/-0)
account/account_invoice_view.xml (+2/-2)
account/account_invoice_workflow.xml (+1/-1)
To merge this branch: bzr merge lp:~therp-nl/ocb-addons/7.0-lp941817-autocompute_taxes_on_proforma
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review, no test Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+159696@code.launchpad.net

Commit message

[FIX] lp:941817, taxes not computed automatically on proforma

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2013-04-04 15:59:27 +0000
3+++ account/account_invoice.py 2013-04-18 18:36:32 +0000
4@@ -1066,6 +1066,23 @@
5 (ref, move_id))
6 return True
7
8+ def action_proforma(self, cr, uid, ids, context=None):
9+ """
10+ Check if all taxes are present with the correct base amount
11+ on creating a proforma invoice. This leaves room for manual
12+ corrections of the tax amount.
13+ """
14+ if not ids:
15+ return True
16+ if isinstance(ids, (int, long)):
17+ ids = [ids]
18+ ait_obj = self.pool.get('account.invoice.tax')
19+ for inv in self.browse(cr, uid, ids, context=context):
20+ compute_taxes = ait_obj.compute(cr, uid, inv.id, context=context)
21+ self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
22+ return self.write(
23+ cr, uid, ids, {'state': 'proforma2'}, context=context)
24+
25 def action_cancel(self, cr, uid, ids, context=None):
26 if context is None:
27 context = {}
28
29=== modified file 'account/account_invoice_view.xml'
30--- account/account_invoice_view.xml 2013-03-13 12:43:17 +0000
31+++ account/account_invoice_view.xml 2013-04-18 18:36:32 +0000
32@@ -214,7 +214,7 @@
33 <field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
34 <div>
35 <label for="amount_tax"/>
36- <button name="button_reset_taxes" states="draft,proforma2"
37+ <button name="button_reset_taxes" states="draft"
38 string="(update)" class="oe_link oe_edit_only"
39 type="object" help="Recompute taxes and total"/>
40 </div>
41@@ -369,7 +369,7 @@
42 <field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
43 <div>
44 <label for="amount_tax"/>
45- <button name="button_reset_taxes" states="draft,proforma2"
46+ <button name="button_reset_taxes" states="draft"
47 string="(update)" class="oe_link oe_edit_only"
48 type="object" help="Recompute taxes and total"/>
49 </div>
50
51=== modified file 'account/account_invoice_workflow.xml'
52--- account/account_invoice_workflow.xml 2012-05-25 15:17:40 +0000
53+++ account/account_invoice_workflow.xml 2013-04-18 18:36:32 +0000
54@@ -17,7 +17,7 @@
55 <record id="act_proforma2" model="workflow.activity">
56 <field name="wkf_id" ref="wkf"/>
57 <field name="name">proforma2</field>
58- <field name="action">write({'state':'proforma2'})</field>
59+ <field name="action">action_proforma()</field>
60 <field name="kind">function</field>
61 </record>
62