From b5a9ccbe11af41f0b11e4b07ea6e10eecce72d69 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 1 Feb 2013 12:17:40 +0530 Subject: [PATCH] [IMP] account: use the new signal_xxx methods instead of trg_validate and also update code with create_workflow and delete_workflow feature. bzr revid: tta@openerp.com-20130201064740-wxigbf179uf6dnnt --- addons/account/account_invoice.py | 10 +++------- addons/account/wizard/account_state_open.py | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 250a0446534..d7b2052305b 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -23,7 +23,6 @@ import time from lxml import etree import openerp.addons.decimal_precision as dp -from openerp import netsvc from openerp import pooler from openerp.osv import fields, osv, orm from openerp.tools.translate import _ @@ -80,11 +79,10 @@ class account_invoice(osv.osv): def _reconciled(self, cr, uid, ids, name, args, context=None): res = {} - wf_service = netsvc.LocalService("workflow") for inv in self.browse(cr, uid, ids, context=context): res[inv.id] = self.test_paid(cr, uid, [inv.id]) if not res[inv.id] and inv.state == 'paid': - wf_service.trg_validate(uid, 'account.invoice', inv.id, 'open_test', cr) + self.signal_open_test(cr, uid, [inv.id]) return res def _get_reference_type(self, cr, uid, context=None): @@ -638,10 +636,8 @@ class account_invoice(osv.osv): # go from canceled state to draft state def action_cancel_draft(self, cr, uid, ids, *args): self.write(cr, uid, ids, {'state':'draft'}) - wf_service = netsvc.LocalService("workflow") - for inv_id in ids: - wf_service.trg_delete(uid, 'account.invoice', inv_id, cr) - wf_service.trg_create(uid, 'account.invoice', inv_id, cr) + self.delete_workflow(cr, uid, ids) + self.create_workflow(cr, uid, ids) return True # Workflow stuff diff --git a/addons/account/wizard/account_state_open.py b/addons/account/wizard/account_state_open.py index b2cbdc4961b..5d0ae6b66bd 100644 --- a/addons/account/wizard/account_state_open.py +++ b/addons/account/wizard/account_state_open.py @@ -35,8 +35,7 @@ class account_state_open(osv.osv_memory): data_inv = obj_invoice.browse(cr, uid, context['active_ids'][0], context=context) if data_inv.reconciled: raise osv.except_osv(_('Warning!'), _('Invoice is already reconciled.')) - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.invoice', context['active_ids'][0], 'open_test', cr) + obj_invoice.signal_open_test(cr, uid, context['active_ids'][0]) return {'type': 'ir.actions.act_window_close'} account_state_open()