Skip to content

Commit

Permalink
[ADD] Adding automated action for iva withholding to execute server a…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
egrivero committed Mar 17, 2016
1 parent c89720b commit 6b8d6ad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions l10n_ve_withholding_iva/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def create_new_wh_iva(self, ret_line_id):
'account_id': acc_id,
'partner_id': acc_part_id.id,
'period_id': inv_brw.period_id.id,
'wh_lines': [(4, ret_line_id)],
'wh_lines': [(4, ret_line_id.id)],
'fortnight': per_obj.find_fortnight(inv_brw.date_invoice)[1],
}
if inv_brw.company_id.propagate_invoice_date_to_vat_withholding:
Expand Down Expand Up @@ -242,7 +242,7 @@ def action_wh_iva_create(self):
# Create a New WH Doc and add line
ret_id = inv.create_new_wh_iva(ret_line_id)
if ret_id:
inv.write({'wh_iva_id': ret_id})
inv.write({'wh_iva_id': ret_id.id})
inv.wh_iva_id.compute_amount_wh()
return True

Expand Down
18 changes: 18 additions & 0 deletions l10n_ve_withholding_iva/workflow/wh_action_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,23 @@ object.action_wh_iva_create()</field>
<field name="child_ids" eval="[(4,ref(&quot;wh_iva_srv_act&quot;))]"/>
</record>
-->
<record id="filter_invoice_state_open_iva" model="ir.filters">
<field name="name">Invoice Open Withholding IVA</field>
<field name="model_id">account.invoice</field>
<field name="domain" eval="[('wh_iva_id', '=', False), ('state', '=', 'open')]"/>
<field name="context">{}</field>
<field name="user_id"></field>
</record>

<record id="wh_iva_act_rule" model="base.action.rule">
<field name="name">IVA Withholding Action Rule</field>
<field name="model_id" model="ir.model" search="[('model', '=', 'account.invoice')]"/>
<field name="active" eval="True"/>
<field name="sequence">1</field>
<field name="kind">on_write</field>
<field name="filter_id" ref="filter_invoice_state_open_iva"/>
<field name="server_action_ids"
eval="[(4, ref('wh_iva_srv_act')),]" />
</record>
</data>
</openerp>

0 comments on commit 6b8d6ad

Please sign in to comment.