From 6ca2b6ff3819906d55bc4a27cc9491943843da1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 11 Feb 2009 14:55:35 +0100 Subject: [PATCH] Remove LocalService --- invoice.py | 9 ++++----- purchase.py | 6 ++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/invoice.py b/invoice.py index 5cbb37ede0..e72246b40d 100644 --- a/invoice.py +++ b/invoice.py @@ -2,14 +2,13 @@ #of this repository contains the full copyright notices and license terms. from trytond.osv import fields, OSV -from trytond.netsvc import LocalService class Invoice(OSV): _name = 'account.invoice' def write(self, cursor, user, ids, vals, context=None): - workflow_service = LocalService('workflow') + invoice_line_obj = self.pool.get('account.invoice.line') purchase_obj = self.pool.get('purchase.purchase') res = super(Invoice, self).write(cursor, user, ids, vals, context=context) @@ -21,9 +20,9 @@ class Invoice(OSV): ], context=context) for purchase in purchase_obj.browse(cursor, user, purchase_ids, context=context): - for invoice_line in purchase.invoice_lines: - workflow_service.trg_trigger(user, 'account.invoice.line', - invoice_line.id, cursor, context=context) + invoice_line_obj.workflow_trigger_trigger(cursor, user, + [x.id for x in purchase.invoice_lines], + context=context) return res Invoice() diff --git a/purchase.py b/purchase.py index fb53a0ad6e..66519b2c06 100644 --- a/purchase.py +++ b/purchase.py @@ -2,7 +2,6 @@ #of this repository contains the full copyright notices and license terms. from trytond.osv import fields, OSV -from trytond.netsvc import LocalService class Purchase(OSV): @@ -42,9 +41,8 @@ class Purchase(OSV): 'invoices': [('unlink', res)], 'invoice_lines': [('add', line_ids)], }, context=context) - workflow_service = LocalService('workflow') - workflow_service.trg_validate(user, 'account.invoice', - res, 'cancel', cursor, context=context) + invoice_obj.workflow_trigger_validate(cursor, 0, res, + 'cancel', context=context) invoice_obj.delete(cursor, 0, res, context=context) res = None return res