Skip to content

Commit

Permalink
[FIX] l10n_withholding_islr: Fixed workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent a983989 commit e59ad31
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
8 changes: 6 additions & 2 deletions l10n_ve_withholding_islr/model/islr_wh_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ def action_cancel(self, cr, uid, ids, context=None):
# if self.browse(cr,uid,ids)[0].type=='in_invoice':
# return True
self.pool.get('islr.wh.doc').write(
cr, uid, ids, {'automatic_income_wh': False})

cr, uid, ids, {'state': 'cancel', 'automatic_income_wh': False})
self.cancel_move(cr, uid, ids)
self.action_cancel_process(cr, uid, ids, context=context)
return True
Expand All @@ -520,7 +519,12 @@ def cancel_move(self, cr, uid, ids, *args):
def action_cancel_draft(self, cr, uid, ids, *args):
""" Back to draft status
"""
ids = isinstance(ids, (int, long)) and [ids] or ids
self.write(cr, uid, ids, {'state': 'draft'})
for iwd_id in ids:
# Deleting the existing instance of workflow for islr withholding
self.delete_workflow(cr, uid, [iwd_id])
self.create_workflow(cr, uid, [iwd_id])
return True

def action_move_create(self, cr, uid, ids, context=None):
Expand Down
32 changes: 19 additions & 13 deletions l10n_ve_withholding_islr/workflow/islr_wh_workflow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,31 @@

<record id="act_confirmed" model="workflow.activity">
<field name="wkf_id" ref="wh_islr_order"/>
<field name="action">action_confirm()</field>
<field name="kind">function</field>
<field name="name">confirmed</field>
</record>
<field name="kind">function</field>
<field name="action">action_confirm()</field>
</record>

<record id="act_done" model="workflow.activity">
<field name="wkf_id" ref="wh_islr_order"/>
<field name="kind">function</field>
<field name="name">done</field>
<field name="kind">function</field>
<field name="flow_stop">True</field>
<field name="action">action_done()</field>
</record>

<record id="act_draft" model="workflow.activity">
<field name="wkf_id" ref="wh_islr_order"/>
<field name="kind">function</field>
<field name="flow_start">True</field>
<field name="name">draft</field>
<field name="action">write({'state':'draft'})</field>
</record>

<record id="act_cancel" model="workflow.activity">
<field name="wkf_id" ref="wh_islr_order"/>
<field name="action">action_cancel()
action_cancel_process()
write({'state':'cancel'})</field>
<field name="kind">function</field>
<field name="name">cancel</field>
<field name="kind">function</field>
<field name="flow_stop">True</field>
<field name="action">action_cancel()</field>
</record>

<record id="trans_draft_cancel" model="workflow.transition">
Expand All @@ -51,13 +50,13 @@ write({'state':'cancel'})</field>
<field name="signal">act_confirm</field>
</record>

<record id="trans_draft_confirmed_2" model="workflow.transition">
<record id="trans_draft_confirmed_auto" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_confirmed"/>
<field name="condition">check_auto_wh_by_type() and check_income_wh()</field>
</record>

<record id="trans_confirmed_done_2" model="workflow.transition">
<record id="trans_confirmed_done_auto" model="workflow.transition">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_done"/>
<field name="condition">check_auto_wh()</field>
Expand All @@ -75,12 +74,19 @@ write({'state':'cancel'})</field>
<field name="signal">act_done</field>
</record>

<!-- TODO: if is necessary this transition, need create a middle state
between 'confirmed' and 'done', because you can't go back from a 'flow
stop' activity like 'done' unless delete the workflow and start again
in 'draft'
-->
<!--
<record id="trans_done_cancel" model="workflow.transition">
<field name="act_from" ref="act_done"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">act_cancel</field>
<field name="signal">act_cancel</field> # TODO: Duplicated signal name
<field name="condition">cancel_check()</field>
</record>
-->

<record id="trans_cancel_draft" model="workflow.transition">
<field name="act_from" ref="act_cancel"/>
Expand Down

0 comments on commit e59ad31

Please sign in to comment.