diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index de9cebdd09b..2046d787ef3 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -820,10 +820,7 @@ class account_voucher(osv.osv): return vals def button_proforma_voucher(self, cr, uid, ids, context=None): - context = context or {} - wf_service = netsvc.LocalService("workflow") - for vid in ids: - wf_service.trg_validate(uid, 'account.voucher', vid, 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, ids) return {'type': 'ir.actions.act_window_close'} def proforma_voucher(self, cr, uid, ids, context=None): @@ -1506,7 +1503,6 @@ class account_bank_statement(osv.osv): def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None): voucher_obj = self.pool.get('account.voucher') - wf_service = netsvc.LocalService("workflow") move_line_obj = self.pool.get('account.move.line') bank_st_line_obj = self.pool.get('account.bank.statement.line') st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context) @@ -1514,7 +1510,7 @@ class account_bank_statement(osv.osv): voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) if st_line.voucher_id.state == 'cancel': voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context) - wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr) + voucher_obj.signal_proforma_voucher(cr, uid, [st_line.voucher_id.id]) v = voucher_obj.browse(cr, uid, st_line.voucher_id.id, context=context) bank_st_line_obj.write(cr, uid, [st_line_id], { diff --git a/addons/account_voucher/test/case1_usd_usd.yml b/addons/account_voucher/test/case1_usd_usd.yml index 0f4c2058fc7..fd1945691ba 100644 --- a/addons/account_voucher/test/case1_usd_usd.yml +++ b/addons/account_voucher/test/case1_usd_usd.yml @@ -182,10 +182,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my first voucher is valid - @@ -279,10 +277,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 1'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my second voucher is valid - diff --git a/addons/account_voucher/test/case2_suppl_usd_eur.yml b/addons/account_voucher/test/case2_suppl_usd_eur.yml index b32228032d3..91fb99f6360 100644 --- a/addons/account_voucher/test/case2_suppl_usd_eur.yml +++ b/addons/account_voucher/test/case2_suppl_usd_eur.yml @@ -161,10 +161,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 SUPPL USD/EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my voucher is valid - @@ -266,10 +264,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that my voucher state is posted - diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml index 275e4c58835..2afdc8ad31b 100644 --- a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml +++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml @@ -181,8 +181,7 @@ !python {model: account.voucher}: | import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my voucher is valid - @@ -256,8 +255,7 @@ !python {model: account.voucher}: | import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that my voucher state is posted - diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml index 667882e3a32..b049fc7692e 100644 --- a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml +++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml @@ -179,10 +179,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my voucher is valid - @@ -269,10 +267,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that my voucher state is posted - diff --git a/addons/account_voucher/test/case3_eur_eur.yml b/addons/account_voucher/test/case3_eur_eur.yml index f2f9461c31e..d0b18a5231b 100644 --- a/addons/account_voucher/test/case3_eur_eur.yml +++ b/addons/account_voucher/test/case3_eur_eur.yml @@ -141,10 +141,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 3'),('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my first voucher is valid - @@ -231,10 +229,8 @@ I confirm the voucher - !python {model: account.voucher}: | - import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 3'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my second voucher is valid - diff --git a/addons/account_voucher/test/case4_cad_chf.yml b/addons/account_voucher/test/case4_cad_chf.yml index bc33e387a85..e8fe4c8cf9b 100644 --- a/addons/account_voucher/test/case4_cad_chf.yml +++ b/addons/account_voucher/test/case4_cad_chf.yml @@ -143,8 +143,7 @@ !python {model: account.voucher}: | import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))]) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, voucher) - I check that the move of my voucher is valid - diff --git a/addons/account_voucher/test/sales_payment.yml b/addons/account_voucher/test/sales_payment.yml index b71e42add0b..e7ed61c2cb2 100644 --- a/addons/account_voucher/test/sales_payment.yml +++ b/addons/account_voucher/test/sales_payment.yml @@ -61,8 +61,7 @@ id = self.create(cr, uid, vals) voucher_id = self.browse(cr, uid, id) assert (voucher_id.state=='draft'), "Voucher is not in draft state" - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, [voucher_id.id]) - Finally i will Confirm the state of the invoice is paid diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index cf4bc5c46d3..af10777d98a 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -65,8 +65,7 @@ id = self.create(cr, uid, vals) voucher_id = self.browse(cr, uid, id) assert (voucher_id.state=='draft'), "Voucher is not in draft state" - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr) + self.signal_proforma_voucher(cr, uid, [voucher_id.id]) - I check that move lines are reconciled meaning voucher is paid -