Skip to content

Commit

Permalink
[FIX] lp:941817, taxes not computed automatically on proforma
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 2, 2014
1 parent 8be383b commit 38b14bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions addons/account/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,23 @@ def action_number(self, cr, uid, ids, context=None):
(ref, move_id))
return True

def action_proforma(self, cr, uid, ids, context=None):
"""
Check if all taxes are present with the correct base amount
on creating a proforma invoice. This leaves room for manual
corrections of the tax amount.
"""
if not ids:
return True
if isinstance(ids, (int, long)):
ids = [ids]
ait_obj = self.pool.get('account.invoice.tax')
for inv in self.browse(cr, uid, ids, context=context):
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=context)
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
return self.write(
cr, uid, ids, {'state': 'proforma2'}, context=context)

def action_cancel(self, cr, uid, ids, context=None):
if context is None:
context = {}
Expand Down
4 changes: 2 additions & 2 deletions addons/account/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<div>
<label for="amount_tax"/>
<button name="button_reset_taxes" states="draft,proforma2"
<button name="button_reset_taxes" states="draft"
string="(update)" class="oe_link oe_edit_only"
type="object" help="Recompute taxes and total"/>
</div>
Expand Down Expand Up @@ -372,7 +372,7 @@
<field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<div>
<label for="amount_tax"/>
<button name="button_reset_taxes" states="draft,proforma2"
<button name="button_reset_taxes" states="draft"
string="(update)" class="oe_link oe_edit_only"
type="object" help="Recompute taxes and total"/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addons/account/account_invoice_workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<record id="act_proforma2" model="workflow.activity">
<field name="wkf_id" ref="wkf"/>
<field name="name">proforma2</field>
<field name="action">write({'state':'proforma2'})</field>
<field name="action">action_proforma()</field>
<field name="kind">function</field>
</record>

Expand Down

0 comments on commit 38b14bc

Please sign in to comment.