From acb1420fb972303f8452d09146d574a0122f96ea Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 7 Jul 2014 11:23:06 +0200 Subject: [PATCH] Revert "[IMP] addons: use the magic methods signal_XXX() instead of signal_workflow('XXX')" This reverts commit beea451e547e3f56c477459c6d0e6dbbb8d712bc. --- .../account/wizard/account_invoice_refund.py | 2 +- .../account/wizard/account_invoice_state.py | 4 ++-- addons/account/wizard/account_state_open.py | 2 +- .../account_anglo_saxon/test/anglo_saxon.yml | 6 ++--- .../test/anglo_saxon_avg_fifo.yml | 4 ++-- .../tests/test_account_followup.py | 2 +- addons/account_payment/account_payment.py | 2 +- addons/account_voucher/account_voucher.py | 2 +- addons/account_voucher/test/case1_usd_usd.yml | 4 ++-- .../test/case1_usd_usd_payment_rate.yml | 2 +- .../test/case2_suppl_usd_eur.yml | 4 ++-- .../test/case2_usd_eur_debtor_in_eur.yml | 4 ++-- .../test/case2_usd_eur_debtor_in_usd.yml | 4 ++-- addons/account_voucher/test/case3_eur_eur.yml | 4 ++-- addons/account_voucher/test/case4_cad_chf.yml | 2 +- addons/account_voucher/test/sales_payment.yml | 2 +- addons/account_voucher/test/sales_receipt.yml | 2 +- addons/hr_holidays/test/test_hr_holiday.yml | 2 +- .../hr_holidays/tests/test_holidays_flow.py | 20 ++++++++-------- addons/hr_payroll/hr_payroll.py | 4 ++-- .../test/hr_payroll_account.yml | 2 +- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- .../l10n_in_hr_payroll/l10n_in_hr_payroll.py | 4 ++-- addons/membership/membership_demo.yml | 2 +- addons/membership/test/test_membership.yml | 2 +- addons/mrp_operations/mrp_operations.py | 24 +++++++++---------- .../test/workcenter_operations.yml | 18 +++++++------- addons/mrp_repair/wizard/make_invoice.py | 2 +- addons/point_of_sale/point_of_sale.py | 2 +- addons/point_of_sale/wizard/pos_confirm.py | 2 +- addons/point_of_sale/wizard/pos_payment.py | 2 +- .../wizard/pos_session_opening.py | 2 +- .../purchase/test/process/rfq2order2done.yml | 2 +- .../purchase_requisition.py | 2 +- .../test/purchase_requisition.yml | 2 +- addons/sale/sale.py | 10 ++++---- addons/sale/test/cancel_order.yml | 2 +- addons/sale/test/manual_order_policy.yml | 2 +- 38 files changed, 81 insertions(+), 81 deletions(-) diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 883a3700d16..0d6d7391ccf 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -168,7 +168,7 @@ class account_invoice_refund(osv.osv_memory): to_reconcile_ids.setdefault(line.account_id.id, []).append(line.id) if line.reconcile_id: line.reconcile_id.unlink() - refund.signal_invoice_open() + refund.signal_workflow('invoice_open') refund = inv_obj.browse(cr, uid, refund_id[0], context=context) for tmpline in refund.move_id.line_id: if tmpline.account_id.id == inv.account_id.id: diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index dc2b74450e1..75b4802bd58 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -39,7 +39,7 @@ class account_invoice_confirm(osv.osv_memory): for record in proxy.browse(cr, uid, active_ids, context=context): if record.state not in ('draft', 'proforma', 'proforma2'): raise osv.except_osv(_('Warning!'), _("Selected invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state.")) - record.signal_invoice_open() + record.signal_workflow('invoice_open') return {'type': 'ir.actions.act_window_close'} @@ -62,7 +62,7 @@ class account_invoice_cancel(osv.osv_memory): for record in proxy.browse(cr, uid, active_ids, context=context): if record.state in ('cancel','paid'): raise osv.except_osv(_('Warning!'), _("Selected invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state.")) - record.signal_invoice_cancel() + record.signal_workflow('invoice_cancel') return {'type': 'ir.actions.act_window_close'} diff --git a/addons/account/wizard/account_state_open.py b/addons/account/wizard/account_state_open.py index 0c3acdb02d0..e622a1ea55b 100644 --- a/addons/account/wizard/account_state_open.py +++ b/addons/account/wizard/account_state_open.py @@ -36,7 +36,7 @@ class account_state_open(osv.osv_memory): invoice = proxy.browse(cr, uid, active_ids[0], context=context) if invoice.reconciled: raise osv.except_osv(_('Warning!'), _('Invoice is already reconciled.')) - invoice.signal_open_test() + invoice.signal_workflow('open_test') return {'type': 'ir.actions.act_window_close'} diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml index ddae4789d9a..c98de7c47db 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon.yml @@ -144,7 +144,7 @@ - !python {model: purchase.order}: | invoice_ids = [x.id for x in self.browse(cr, uid, ref("purchase_order_001")).invoice_ids] - self.pool.get('account.invoice').signal_invoice_open(cr, uid, invoice_ids) + self.pool.get('account.invoice').signal_workflow(cr, uid, invoice_ids, 'invoice_open') - I check the Stock Interim account (Received) is debited sucessfully when Invoice validated. - @@ -166,7 +166,7 @@ !python {model: purchase.order}: | po = self.browse(cr, uid, ref("purchase_order_001")) for invoice in po.invoice_ids: - invoice.signal_invoice_open() + invoice.signal_workflow('invoice_open') - I pay the invoice. - @@ -252,7 +252,7 @@ !python {model: stock.picking}: | move_name = self.pool.get('stock.picking').browse(cr, uid, ref('stock_picking_out001')).name account_invoice = self.pool.get('account.invoice').search(cr, uid, [('origin', '=', move_name)]) - self.pool.get('account.invoice').signal_invoice_open(cr, uid, account_invoice) + self.pool.get('account.invoice').signal_workflow(cr, uid, account_invoice, 'invoice_open') - I check Income Account is Credited sucessfully when Invoice validated. - diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml index 8d7dac9e543..03442260295 100644 --- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml +++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml @@ -154,7 +154,7 @@ invoice_ids = [x.id for x in self.browse(cr, uid, ref("purchase_order_001_fifo")).invoice_ids] line_ids = self.pool.get('account.invoice.line').search(cr, uid, [('invoice_id', 'in', invoice_ids)]) self.pool.get('account.invoice.line').write(cr, uid, line_ids, {'price_unit': 10}) - self.pool.get('account.invoice').signal_invoice_open(cr, uid, invoice_ids) + self.pool.get('account.invoice').signal_workflow(cr, uid, invoice_ids, 'invoice_open') - I check the Stock Interim account (Received) is debited sucessfully when Invoice validated. - @@ -257,7 +257,7 @@ account_invoice_line = self.pool.get('account.invoice.line').search(cr, uid, [('invoice_id', 'in', account_invoice)]) self.pool.get('account.invoice.line').write(cr, uid, account_invoice_line, {'invoice_line_tax_id': [(6, 0, [])]}) self.pool.get('account.invoice').button_reset_taxes(cr, uid, account_invoice) - self.pool.get('account.invoice').signal_invoice_open(cr, uid, account_invoice) + self.pool.get('account.invoice').signal_workflow(cr, uid, account_invoice, 'invoice_open') - I check Income Account is Credited sucessfully when Invoice validated. - diff --git a/addons/account_followup/tests/test_account_followup.py b/addons/account_followup/tests/test_account_followup.py index 10dfe5ba88e..697fb433362 100644 --- a/addons/account_followup/tests/test_account_followup.py +++ b/addons/account_followup/tests/test_account_followup.py @@ -42,7 +42,7 @@ class TestAccountFollowup(TransactionCase): 'quantity': 5, 'price_unit':200 })]}) - self.registry('account.invoice').signal_invoice_open(cr, uid, [self.invoice_id]) + self.registry('account.invoice').signal_workflow(cr, uid, [self.invoice_id], 'invoice_open') self.voucher = self.registry("account.voucher") diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index b7bbabcb776..de72960a9c6 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -132,7 +132,7 @@ class payment_order(osv.osv): def set_done(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'date_done': time.strftime('%Y-%m-%d')}) - self.signal_done(cr, uid, ids) + self.signal_workflow(cr, uid, ids, 'done') return True def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 7e1fe32282d..275e002695e 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -926,7 +926,7 @@ class account_voucher(osv.osv): return vals def button_proforma_voucher(self, cr, uid, ids, context=None): - self.signal_proforma_voucher(cr, uid, ids) + self.signal_workflow(cr, uid, ids, 'proforma_voucher') return {'type': 'ir.actions.act_window_close'} def proforma_voucher(self, cr, uid, ids, context=None): diff --git a/addons/account_voucher/test/case1_usd_usd.yml b/addons/account_voucher/test/case1_usd_usd.yml index 44269104370..84ae118ab16 100644 --- a/addons/account_voucher/test/case1_usd_usd.yml +++ b/addons/account_voucher/test/case1_usd_usd.yml @@ -182,7 +182,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my first voucher is valid - @@ -276,7 +276,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 1'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my second voucher is valid - diff --git a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml index 037fc1497ec..c0aa617783c 100644 --- a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml +++ b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml @@ -191,7 +191,7 @@ - !python {model: account.voucher}: | voucher = ref('account_voucher_1_case1_payment_rate') - self.signal_proforma_voucher(cr, uid, [voucher]) + self.signal_workflow(cr, uid, [voucher], 'proforma_voucher') - I check that the move of my first 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 c13bfcbd5d4..836bee35d30 100644 --- a/addons/account_voucher/test/case2_suppl_usd_eur.yml +++ b/addons/account_voucher/test/case2_suppl_usd_eur.yml @@ -161,7 +161,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 SUPPL USD/EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my voucher is valid - @@ -263,7 +263,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_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 f523e312933..45c86eb7ad0 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 @@ -182,7 +182,7 @@ !python {model: account.voucher}: | from openerp import netsvc voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my voucher is valid - @@ -257,7 +257,7 @@ !python {model: account.voucher}: | from openerp import netsvc voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR EUR'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_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 52c416e06cc..f353cd8c6fc 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,7 +179,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 2 USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my voucher is valid - @@ -266,7 +266,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 2 SUPPL USD/EUR DR USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_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 54a8ed074ff..064b79ed305 100644 --- a/addons/account_voucher/test/case3_eur_eur.yml +++ b/addons/account_voucher/test/case3_eur_eur.yml @@ -141,7 +141,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 3'),('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_voucher') - I check that the move of my first voucher is valid - @@ -228,7 +228,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'Second payment: Case 3'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_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 d8136f15bd4..476a22c3f15 100644 --- a/addons/account_voucher/test/case4_cad_chf.yml +++ b/addons/account_voucher/test/case4_cad_chf.yml @@ -144,7 +144,7 @@ - !python {model: account.voucher}: | voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))]) - self.signal_proforma_voucher(cr, uid, voucher) + self.signal_workflow(cr, uid, voucher, 'proforma_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 6d1015ec80d..7bd0e18a5c4 100644 --- a/addons/account_voucher/test/sales_payment.yml +++ b/addons/account_voucher/test/sales_payment.yml @@ -68,7 +68,7 @@ voucher_id = self.browse(cr, uid, id) assert (voucher_id.writeoff_amount == 0.0), "Writeoff amount is not 0.0" assert (voucher_id.state=='draft'), "Voucher is not in draft state" - voucher_id.signal_proforma_voucher() + voucher_id.signal_workflow('proforma_voucher') - 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 3a84e054a53..9bae2c3549b 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -69,7 +69,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" - voucher_id.signal_proforma_voucher() + voucher_id.signal_workflow('proforma_voucher') - I check that move lines are reconciled meaning voucher is paid - diff --git a/addons/hr_holidays/test/test_hr_holiday.yml b/addons/hr_holidays/test/test_hr_holiday.yml index 7bedd3302e8..1c00692c1f7 100644 --- a/addons/hr_holidays/test/test_hr_holiday.yml +++ b/addons/hr_holidays/test/test_hr_holiday.yml @@ -19,7 +19,7 @@ - !python {model: hr.holidays}: | self.holidays_reset(cr, uid, [ref('hr_holidays_employee1_cl')]) - self.signal_confirm(cr, uid, [ref('hr_holidays_employee1_cl')]) + self.signal_workflow(cr, uid, [ref('hr_holidays_employee1_cl')], 'confirm') - I validate the holiday request by clicking on "To Approve" button. - diff --git a/addons/hr_holidays/tests/test_holidays_flow.py b/addons/hr_holidays/tests/test_holidays_flow.py index 1f042ed75ba..96ab20f6ae5 100644 --- a/addons/hr_holidays/tests/test_holidays_flow.py +++ b/addons/hr_holidays/tests/test_holidays_flow.py @@ -97,12 +97,12 @@ class TestHolidaysFlow(TestHrHolidaysBase): self.assertEqual(hol1.state, 'confirm', 'hr_holidays: newly created leave request should be in confirm state') # Employee validates its leave request -> should not work - self.hr_holidays.signal_validate(cr, self.user_employee_id, [hol1_id]) + self.hr_holidays.signal_workflow(cr, self.user_employee_id, [hol1_id], 'validate') hol1.refresh() self.assertEqual(hol1.state, 'confirm', 'hr_holidays: employee should not be able to validate its own leave request') # HrUser validates the employee leave request - self.hr_holidays.signal_validate(cr, self.user_hrmanager_id, [hol1_id]) + self.hr_holidays.signal_workflow(cr, self.user_hrmanager_id, [hol1_id], 'validate') hol1.refresh() self.assertEqual(hol1.state, 'validate', 'hr_holidays: validates leave request should be in validate state') @@ -144,8 +144,8 @@ class TestHolidaysFlow(TestHrHolidaysBase): 'number_of_days_temp': 2, }) # HrUser validates the allocation request - self.hr_holidays.signal_validate(cr, self.user_hruser_id, [aloc1_id]) - self.hr_holidays.signal_second_validate(cr, self.user_hruser_id, [aloc1_id]) + self.hr_holidays.signal_workflow(cr, self.user_hruser_id, [aloc1_id], 'validate') + self.hr_holidays.signal_workflow(cr, self.user_hruser_id, [aloc1_id], 'second_validate') # Checks Employee has effectively some days left hol_status_2 = self.hr_holidays_status.browse(cr, self.user_employee_id, self.holidays_status_2) _check_holidays_status(hol_status_2, 2.0, 0.0, 2.0, 2.0) @@ -165,13 +165,13 @@ class TestHolidaysFlow(TestHrHolidaysBase): _check_holidays_status(hol_status_2, 2.0, 0.0, 2.0, 1.0) # HrUser validates the first step - self.hr_holidays.signal_validate(cr, self.user_hruser_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hruser_id, [hol2_id], 'validate') hol2.refresh() self.assertEqual(hol2.state, 'validate1', 'hr_holidays: first validation should lead to validate1 state') # HrUser validates the second step - self.hr_holidays.signal_second_validate(cr, self.user_hruser_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hruser_id, [hol2_id], 'second_validate') hol2.refresh() self.assertEqual(hol2.state, 'validate', 'hr_holidays: second validation should lead to validate state') @@ -180,7 +180,7 @@ class TestHolidaysFlow(TestHrHolidaysBase): _check_holidays_status(hol_status_2, 2.0, 1.0, 1.0, 1.0) # HrManager finds an error: he refuses the leave request - self.hr_holidays.signal_refuse(cr, self.user_hrmanager_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hrmanager_id, [hol2_id], 'refuse') hol2.refresh() self.assertEqual(hol2.state, 'refuse', 'hr_holidays: refuse should lead to refuse state') @@ -189,12 +189,12 @@ class TestHolidaysFlow(TestHrHolidaysBase): _check_holidays_status(hol_status_2, 2.0, 0.0, 2.0, 2.0) # Annoyed, HrUser tries to fix its error and tries to reset the leave request -> does not work, only HrManager - self.hr_holidays.signal_reset(cr, self.user_hruser_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hruser_id, [hol2_id], 'reset') self.assertEqual(hol2.state, 'refuse', 'hr_holidays: hr_user should not be able to reset a refused leave request') # HrManager resets the request - self.hr_holidays.signal_reset(cr, self.user_hrmanager_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hrmanager_id, [hol2_id], 'reset') hol2.refresh() self.assertEqual(hol2.state, 'draft', 'hr_holidays: resetting should lead to draft state') @@ -206,4 +206,4 @@ class TestHolidaysFlow(TestHrHolidaysBase): 'number_of_days_temp': 4, }) with self.assertRaises(except_orm): - self.hr_holidays.signal_confirm(cr, self.user_hrmanager_id, [hol2_id]) + self.hr_holidays.signal_workflow(cr, self.user_hrmanager_id, [hol2_id], 'confirm') diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index eead78e21ba..4dea994a130 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -323,8 +323,8 @@ class hr_payslip(osv.osv): for payslip in self.browse(cr, uid, ids, context=context): id_copy = self.copy(cr, uid, payslip.id, {'credit_note': True, 'name': _('Refund: ')+payslip.name}, context=context) self.compute_sheet(cr, uid, [id_copy], context=context) - self.signal_hr_verify_sheet(cr, uid, [id_copy]) - self.signal_process_sheet(cr, uid, [id_copy]) + self.signal_workflow(cr, uid, [id_copy], 'hr_verify_sheet') + self.signal_workflow(cr, uid, [id_copy], 'process_sheet') form_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_form') form_res = form_id and form_id[1] or False diff --git a/addons/hr_payroll_account/test/hr_payroll_account.yml b/addons/hr_payroll_account/test/hr_payroll_account.yml index c637b5f319a..0dda2f6d04b 100644 --- a/addons/hr_payroll_account/test/hr_payroll_account.yml +++ b/addons/hr_payroll_account/test/hr_payroll_account.yml @@ -104,7 +104,7 @@ - !python {model: hr.payslip}: | self.cancel_sheet(cr, uid, [ref("hr_payslip_0")], None) - self.signal_draft(cr, uid, [ref("hr_payslip_0")]) + self.signal_workflow(cr, uid, [ref("hr_payslip_0")], 'draft') - Then I click on the "Confirm" button. - diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index e872b54a843..a2845171212 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -123,7 +123,7 @@ class hr_timesheet_sheet(osv.osv): self.check_employee_attendance_state(cr, uid, sheet.id, context=context) di = sheet.user_id.company_id.timesheet_max_difference if (abs(sheet.total_difference) < di) or not di: - sheet.signal_confirm() + sheet.signal_workflow('confirm') else: raise osv.except_osv(_('Warning!'), _('Please verify that the total difference of the sheet is lower than %.2f.') %(di,)) return True diff --git a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py index 7b4e62a1081..0af3535bfd0 100644 --- a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py +++ b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py @@ -192,8 +192,8 @@ class hr_payslip_run(osv.osv): slip_ids = [] for slip_id in run.slip_ids: # TODO is it necessary to interleave the calls ? - payslip_pool.signal_hr_verify_sheet(cr, uid, [slip_id.id]) - payslip_pool.signal_process_sheet(cr, uid, [slip_id.id]) + payslip_pool.signal_workflow(cr, uid, [slip_id.id], 'hr_verify_sheet') + payslip_pool.signal_workflow(cr, uid, [slip_id.id], 'process_sheet') slip_ids.append(slip_id.id) for slip in payslip_pool.browse(cr, uid, slip_ids, context=context): diff --git a/addons/membership/membership_demo.yml b/addons/membership/membership_demo.yml index e21d70f0fd5..439666a4716 100644 --- a/addons/membership/membership_demo.yml +++ b/addons/membership/membership_demo.yml @@ -4,7 +4,7 @@ !python {model: res.partner}: | invoice_ids = self.create_membership_invoice(cr, uid, [ref("base.res_partner_1"),ref("base.res_partner_14"),ref("base.res_partner_24"),ref("base.res_partner_19"),ref("base.res_partner_8"),ref("base.res_partner_5"),ref("base.res_partner_21"),ref("base.res_partner_6"),ref("base.res_partner_16"),ref("base.res_partner_10")], product_id=ref("membership_1"), datas={"amount":80.00}) invoice_pool = self.pool.get('account.invoice') - invoice_pool.signal_invoice_open(cr, uid, invoice_ids) + invoice_pool.signal_workflow(cr, uid, invoice_ids, 'invoice_open') for id in invoice_ids[-4:]: pay = invoice_pool.pay_and_reconcile(cr, uid, [id], diff --git a/addons/membership/test/test_membership.yml b/addons/membership/test/test_membership.yml index 87273de5323..49c4f645877 100644 --- a/addons/membership/test/test_membership.yml +++ b/addons/membership/test/test_membership.yml @@ -40,7 +40,7 @@ membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids) assert membership_lines, 'Membership is not registrated.' membership_line = membership_lines[0] - membership_line.account_invoice_id.signal_invoice_open() + membership_line.account_invoice_id.signal_workflow('invoice_open') - | I'm checking "Current membership state" of "Seagate". It is an "Invoiced Member" or not. diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index afcc40d39c2..c14b755070d 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -113,9 +113,9 @@ class mrp_production_workcenter_line(osv.osv): if action == 'start': if prod_obj.state =='confirmed': prod_obj_pool.force_production(cr, uid, [prod_obj.id]) - prod_obj_pool.signal_button_produce(cr, uid, [prod_obj.id]) + prod_obj_pool.signal_workflow(cr, uid, [prod_obj.id], 'button_produce') elif prod_obj.state =='ready': - prod_obj_pool.signal_button_produce(cr, uid, [prod_obj.id]) + prod_obj_pool.signal_workflow(cr, uid, [prod_obj.id], 'button_produce') elif prod_obj.state =='in_production': return else: @@ -128,7 +128,7 @@ class mrp_production_workcenter_line(osv.osv): for production in prod_obj_pool.browse(cr, uid, [prod_obj.id], context= None): if production.move_lines or production.move_created_ids: prod_obj_pool.action_produce(cr,uid, production.id, production.product_qty, 'consume_produce', context = None) - prod_obj_pool.signal_button_produce_done(cr, uid, [oper_obj.production_id.id]) + prod_obj_pool.signal_workflow(cr, uid, [oper_obj.production_id.id], 'button_produce_done') return def write(self, cr, uid, ids, vals, context=None, update=True): @@ -216,8 +216,8 @@ class mrp_production(osv.osv): workcenter_pool = self.pool.get('mrp.production.workcenter.line') for workcenter_line in obj.workcenter_lines: if workcenter_line.state == 'draft': - workcenter_line.signal_button_start_working() - workcenter_line.signal_button_done() + workcenter_line.signal_workflow('button_start_working') + workcenter_line.signal_workflow('button_done') return super(mrp_production,self).action_production_end(cr, uid, ids) def action_in_production(self, cr, uid, ids): @@ -227,7 +227,7 @@ class mrp_production(osv.osv): workcenter_pool = self.pool.get('mrp.production.workcenter.line') for prod in self.browse(cr, uid, ids): if prod.workcenter_lines: - workcenter_pool.signal_button_start_working(cr, uid, [prod.workcenter_lines[0].id]) + workcenter_pool.signal_workflow(cr, uid, [prod.workcenter_lines[0].id], 'button_start_working') return super(mrp_production,self).action_in_production(cr, uid, ids) def action_cancel(self, cr, uid, ids, context=None): @@ -236,7 +236,7 @@ class mrp_production(osv.osv): """ workcenter_pool = self.pool.get('mrp.production.workcenter.line') obj = self.browse(cr, uid, ids,context=context)[0] - workcenter_pool.signal_button_cancel(cr, uid, [record.id for record in obj.workcenter_lines]) + workcenter_pool.signal_workflow(cr, uid, [record.id for record in obj.workcenter_lines], 'button_cancel') return super(mrp_production,self).action_cancel(cr,uid,ids,context=context) def _compute_planned_workcenter(self, cr, uid, ids, context=None, mini=False): @@ -494,24 +494,24 @@ class mrp_operations_operation(osv.osv): wc_op_id.append(workcenter_pool.create(cr,uid,{'production_id':vals['production_id'],'name':production_obj.product_id.name,'workcenter_id':vals['workcenter_id']})) if code.start_stop=='start': workcenter_pool.action_start_working(cr,uid,wc_op_id) - workcenter_pool.signal_button_start_working(cr, uid, [wc_op_id[0]]) + workcenter_pool.signal_workflow(cr, uid, [wc_op_id[0]], 'button_start_working') if code.start_stop=='done': workcenter_pool.action_done(cr,uid,wc_op_id) - workcenter_pool.signal_button_done(cr, uid, [wc_op_id[0]]) + workcenter_pool.signal_workflow(cr, uid, [wc_op_id[0]], 'button_done') self.pool.get('mrp.production').write(cr,uid,vals['production_id'],{'date_finished':datetime.now().strftime('%Y-%m-%d %H:%M:%S')}) if code.start_stop=='pause': workcenter_pool.action_pause(cr,uid,wc_op_id) - workcenter_pool.signal_button_pause(cr, uid, [wc_op_id[0]]) + workcenter_pool.signal_workflow(cr, uid, [wc_op_id[0]], 'button_pause') if code.start_stop=='resume': workcenter_pool.action_resume(cr,uid,wc_op_id) - workcenter_pool.signal_button_resume(cr, uid, [wc_op_id[0]]) + workcenter_pool.signal_workflow(cr, uid, [wc_op_id[0]], 'button_resume') if code.start_stop=='cancel': workcenter_pool.action_cancel(cr,uid,wc_op_id) - workcenter_pool.signal_button_cancel(cr, uid, [wc_op_id[0]]) + workcenter_pool.signal_workflow(cr, uid, [wc_op_id[0]], 'button_cancel') if not self.check_operation(cr, uid, vals): return diff --git a/addons/mrp_operations/test/workcenter_operations.yml b/addons/mrp_operations/test/workcenter_operations.yml index fe96ca0221c..a31c3fb05d2 100644 --- a/addons/mrp_operations/test/workcenter_operations.yml +++ b/addons/mrp_operations/test/workcenter_operations.yml @@ -58,47 +58,47 @@ - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_start_working() + order.workcenter_lines[0].signal_workflow('button_start_working') - Now I pause first work operation due to technical fault of work center. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_pause() + order.workcenter_lines[0].signal_workflow('button_pause') - I resume first work operation. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_resume() + order.workcenter_lines[0].signal_workflow('button_resume') - I cancel first work operation. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_cancel() + order.workcenter_lines[0].signal_workflow('button_cancel') - I reset first work operation and start after resolving techninal fault of work center. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_draft() - order.workcenter_lines[0].signal_button_start_working() + order.workcenter_lines[0].signal_workflow('button_draft') + order.workcenter_lines[0].signal_workflow('button_start_working') - I close first work operation as this work center completed its process. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) - order.workcenter_lines[0].signal_button_done() + order.workcenter_lines[0].signal_workflow('button_done') - Now I close other operations one by one which are in start state. - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context) for work_line in order.workcenter_lines[1:]: - work_line.signal_button_start_working() - work_line.signal_button_done() + work_line.signal_workflow('button_start_working') + work_line.signal_workflow('button_done') - I check that the production order is now done. diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index f9c84cb7bdb..e23d6a549a0 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -49,7 +49,7 @@ class make_invoice(osv.osv_memory): # We have to trigger the workflow of the given repairs, otherwise they remain 'to be invoiced'. # Note that the signal 'action_invoice_create' will trigger another call to the method 'action_invoice_create', # but that second call will not do anything, since the repairs are already invoiced. - order_obj.signal_action_invoice_create(cr, uid, context['active_ids']) + order_obj.signal_workflow(cr, uid, context['active_ids'], 'action_invoice_create') form_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') form_id = form_res and form_res[1] or False diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 1a787ec1dfc..1eec3cb48d4 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -408,7 +408,7 @@ class pos_session(osv.osv): ids = [ids] this_record = self.browse(cr, uid, ids[0], context=context) - this_record.signal_open() + this_record.signal_workflow('open') context.update(active_id=this_record.id) diff --git a/addons/point_of_sale/wizard/pos_confirm.py b/addons/point_of_sale/wizard/pos_confirm.py index ff4b3f1bef5..909463fa996 100644 --- a/addons/point_of_sale/wizard/pos_confirm.py +++ b/addons/point_of_sale/wizard/pos_confirm.py @@ -36,7 +36,7 @@ class pos_confirm(osv.osv_memory): todo = False break if todo: - order.signal_done() + order.signal_workflow('done') # Check if there is orders to reconcile their invoices ids = order_obj.search(cr, uid, [('state','=','invoiced'),('invoice_id.state','=','open')], context=context) diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index d4c2a3d03cc..efd2682bc30 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -65,7 +65,7 @@ class pos_make_payment(osv.osv_memory): order_obj.add_payment(cr, uid, active_id, data, context=context) if order_obj.test_paid(cr, uid, [active_id]): - order_obj.signal_paid(cr, uid, [active_id]) + order_obj.signal_workflow(cr, uid, [active_id], 'paid') return {'type' : 'ir.actions.act_window_close' } return self.launch_payment(cr, uid, ids, context=context) diff --git a/addons/point_of_sale/wizard/pos_session_opening.py b/addons/point_of_sale/wizard/pos_session_opening.py index 8076cbf4be8..5389fb3e1a0 100644 --- a/addons/point_of_sale/wizard/pos_session_opening.py +++ b/addons/point_of_sale/wizard/pos_session_opening.py @@ -35,7 +35,7 @@ class pos_session_opening(osv.osv_memory): def open_existing_session_cb_close(self, cr, uid, ids, context=None): wizard = self.browse(cr, uid, ids[0], context=context) - wizard.pos_session_id.signal_cashbox_control() + wizard.pos_session_id.signal_workflow('cashbox_control') return self.open_session_cb(cr, uid, ids, context) def open_session_cb(self, cr, uid, ids, context=None): diff --git a/addons/purchase/test/process/rfq2order2done.yml b/addons/purchase/test/process/rfq2order2done.yml index c032e873fd0..bf48e3369d2 100644 --- a/addons/purchase/test/process/rfq2order2done.yml +++ b/addons/purchase/test/process/rfq2order2done.yml @@ -59,7 +59,7 @@ - !python {model: purchase.order}: | for invoice in self.browse(cr, uid, ref('purchase_order_1'), context=context).invoice_ids: - invoice.signal_invoice_open() + invoice.signal_workflow('invoice_open') - I check that purchase order is invoiced. - diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index d84a25a6a8b..a4908f23687 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -339,7 +339,7 @@ class purchase_order(osv.osv): proc_ids = proc_obj.search(cr, uid, [('purchase_id', '=', order.id)]) if proc_ids and po.state == 'confirmed': proc_obj.write(cr, uid, proc_ids, {'purchase_id': po.id}) - order.signal_purchase_cancel() + order.signal_workflow('purchase_cancel') po.requisition_id.tender_done(context=context) return res diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 7cb2682cac3..af5aade2833 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -79,7 +79,7 @@ - !python {model: purchase.order}: | purchase = self.browse(cr, uid, ref('rfq2'), context=context) - purchase.signal_purchase_confirm() + purchase.signal_workflow('purchase_confirm') - I check status of requisition after confirmed best RFQ. diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 9b4210910a6..8881e917269 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -434,7 +434,7 @@ class sale_order(osv.osv): This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow ''' assert len(ids) == 1, 'This option should only be used for a single id at a time' - self.signal_quotation_sent(cr, uid, ids) + self.signal_workflow(cr, uid, ids, 'quotation_sent') return self.pool['report'].get_action(cr, uid, ids, 'sale.report_saleorder', context=context) def manual_invoice(self, cr, uid, ids, context=None): @@ -445,7 +445,7 @@ class sale_order(osv.osv): # create invoices through the sales orders' workflow inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids) - self.signal_manual_invoice(cr, uid, ids) + self.signal_workflow(cr, uid, ids, 'manual_invoice') inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids) # determine newly created invoices new_inv_ids = list(inv_ids1 - inv_ids0) @@ -580,7 +580,7 @@ class sale_order(osv.osv): raise osv.except_osv( _('Cannot cancel this sales order!'), _('First cancel all invoices attached to this sales order.')) - inv.signal_invoice_cancel() + inv.signal_workflow('invoice_cancel') sale_order_line_obj.write(cr, uid, [l.id for l in sale.order_line], {'state': 'cancel'}) self.write(cr, uid, ids, {'state': 'cancel'}) @@ -588,7 +588,7 @@ class sale_order(osv.osv): def action_button_confirm(self, cr, uid, ids, context=None): assert len(ids) == 1, 'This option should only be used for a single id at a time.' - self.signal_order_confirm(cr, uid, ids) + self.signal_workflow(cr, uid, ids, 'order_confirm') # redisplay the record as a sales order view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'view_order_form') @@ -1205,7 +1205,7 @@ class mail_compose_message(osv.Model): context = context or {} if context.get('default_model') == 'sale.order' and context.get('default_res_id') and context.get('mark_so_as_sent'): context = dict(context, mail_post_autofollow=True) - self.pool.get('sale.order').signal_quotation_sent(cr, uid, [context['default_res_id']]) + self.pool.get('sale.order').signal_workflow(cr, uid, [context['default_res_id']], 'quotation_sent') return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context) diff --git a/addons/sale/test/cancel_order.yml b/addons/sale/test/cancel_order.yml index 1615531385b..268e1cee960 100644 --- a/addons/sale/test/cancel_order.yml +++ b/addons/sale/test/cancel_order.yml @@ -58,7 +58,7 @@ !python {model: sale.order}: | invoice_ids = self.browse(cr, uid, ref("sale_order_8")).invoice_ids for invoice in invoice_ids: - invoice.signal_invoice_cancel() + invoice.signal_workflow('invoice_cancel') - I check order status in "Invoice Exception" and related invoice is in cancel state. - diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index ab00b5f080d..d2a1ff0195f 100644 --- a/addons/sale/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -44,7 +44,7 @@ so = self.browse(cr, uid, ref("sale_order_2")) account_invoice_obj = self.pool.get('account.invoice') for invoice in so.invoice_ids: - invoice.signal_invoice_open() + invoice.signal_workflow('invoice_open') - I pay the invoice. -