mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] confused workflow trigger calls action_sent multiple times
This commit is contained in:
@@ -876,7 +876,9 @@ class payment_order(osv.osv):
|
||||
_('You can only combine payment orders of the same type')
|
||||
)
|
||||
# process manual payments
|
||||
self.action_sent(cr, uid, ids, context)
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for order_id in ids:
|
||||
wf_service.trg_validate(uid, 'payment.order', order_id, 'sent', cr)
|
||||
return result
|
||||
|
||||
def _write_payment_lines(self, cursor, uid, ids, **kwargs):
|
||||
@@ -909,9 +911,7 @@ class payment_order(osv.osv):
|
||||
Set both self and payment lines to state 'sent'.
|
||||
'''
|
||||
self._write_payment_lines(cursor, uid, ids, export_state='sent')
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in ids:
|
||||
wf_service.trg_validate(uid, 'payment.order', id, 'sent', cursor)
|
||||
self.write(cursor, uid, ids, {'state':'sent'})
|
||||
return True
|
||||
|
||||
def action_rejected(self, cursor, uid, ids, *args):
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
<record id="act_sent" model="workflow.activity">
|
||||
<field name="name">sent</field>
|
||||
<field name="wkf_id" ref="account_payment.wkf_payment_order"/>
|
||||
<field name="action">action_sent()
|
||||
write({'state':'sent'})</field>
|
||||
<field name="action">action_sent())</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
<!-- New activity for workflow payment order: rejected -->
|
||||
|
||||
@@ -23,6 +23,7 @@ import base64
|
||||
from datetime import datetime, date, timedelta
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
from account_banking import sepa
|
||||
import clieop
|
||||
|
||||
@@ -365,8 +366,9 @@ class banking_export_clieop_wizard(osv.osv_memory):
|
||||
clieop_file = clieop_obj.write(
|
||||
cursor, uid, clieop_export['file_id'].id, {'state':'sent'}
|
||||
)
|
||||
payment_order_obj.action_sent(
|
||||
cursor, uid, [x.id for x in clieop_export['payment_order_ids']])
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for order in clieop_export['payment_order_ids']:
|
||||
wf_service.trg_validate(uid, 'payment.order', order.id, 'sent', cursor)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
banking_export_clieop_wizard()
|
||||
|
||||
Reference in New Issue
Block a user