[FIX] *: do not call deprecated method LocalService()
bzr revid: chs@openerp.com-20131121120611-06h1pki3460tzj1s
This commit is contained in:
parent
fb44c859e2
commit
6f67143908
|
@ -26,7 +26,7 @@ from operator import itemgetter
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
from openerp.osv import fields, osv, orm
|
from openerp.osv import fields, osv, orm
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
|
@ -932,11 +932,10 @@ class account_move_line(osv.osv):
|
||||||
'line_id': map(lambda x: (4, x, False), ids),
|
'line_id': map(lambda x: (4, x, False), ids),
|
||||||
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
||||||
})
|
})
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
||||||
# because of the way the line_id are defined: (4, x, False)
|
# because of the way the line_id are defined: (4, x, False)
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
|
workflow.trg_trigger(uid, 'account.move.line', id, cr)
|
||||||
|
|
||||||
if lines and lines[0]:
|
if lines and lines[0]:
|
||||||
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
|
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
|
# Copyright (C) 2004-2013 OpenERP SA (<http://openerp.com>).
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -32,6 +32,7 @@ import re
|
||||||
from openerp.addons.decimal_precision import decimal_precision as dp
|
from openerp.addons.decimal_precision import decimal_precision as dp
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
from openerp.report import render_report
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
_intervalTypes = {
|
_intervalTypes = {
|
||||||
|
@ -461,8 +462,7 @@ class marketing_campaign_activity(osv.osv):
|
||||||
|
|
||||||
#dead code
|
#dead code
|
||||||
def _process_wi_report(self, cr, uid, activity, workitem, context=None):
|
def _process_wi_report(self, cr, uid, activity, workitem, context=None):
|
||||||
service = netsvc.LocalService('report.%s'%activity.report_id.report_name)
|
report_data, format = render_report(cr, uid, [], activity.report_id.report_name, {}, context=context)
|
||||||
(report_data, format) = service.create(cr, uid, [], {}, {})
|
|
||||||
attach_vals = {
|
attach_vals = {
|
||||||
'name': '%s_%s_%s'%(activity.report_id.report_name,
|
'name': '%s_%s_%s'%(activity.report_id.report_name,
|
||||||
activity.name,workitem.partner_id.name),
|
activity.name,workitem.partner_id.name),
|
||||||
|
|
|
@ -110,8 +110,16 @@
|
||||||
I print a Barcode Report of Operation line.
|
I print a Barcode Report of Operation line.
|
||||||
-
|
-
|
||||||
!python {model: mrp_operations.operation.code}: |
|
!python {model: mrp_operations.operation.code}: |
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
(data, format) = netsvc.LocalService('report.mrp.code.barcode').create(cr, uid, [ref('mrp_operations.mrp_op_1'),ref('mrp_operations.mrp_op_2'),ref('mrp_operations.mrp_op_3'),ref('mrp_operations.mrp_op_4'),ref('mrp_operations.mrp_op_5')], {}, {})
|
from openerp.report import render_report
|
||||||
|
ids = [
|
||||||
|
ref('mrp_operations.mrp_op_1'),
|
||||||
|
ref('mrp_operations.mrp_op_2'),
|
||||||
|
ref('mrp_operations.mrp_op_3'),
|
||||||
|
ref('mrp_operations.mrp_op_4'),
|
||||||
|
ref('mrp_operations.mrp_op_5')
|
||||||
|
]
|
||||||
|
data, format = render_report(cr, uid, ids, 'mrp.code.barcode', {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
|
||||||
|
|
||||||
|
@ -119,7 +127,9 @@
|
||||||
I print Workcenter's Barcode Report.
|
I print Workcenter's Barcode Report.
|
||||||
-
|
-
|
||||||
!python {model: mrp.workcenter}: |
|
!python {model: mrp.workcenter}: |
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
(data, format) = netsvc.LocalService('report.mrp.wc.barcode').create(cr, uid, [ref('mrp.mrp_workcenter_0'),ref('mrp.mrp_workcenter_1')], {}, {})
|
from openerp.report import render_report
|
||||||
|
ids = [ref('mrp.mrp_workcenter_0'), ref('mrp.mrp_workcenter_1')]
|
||||||
|
data, format = render_report(cr, uid, ids, 'mrp.wc.barcode', {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -747,7 +747,6 @@ class pos_order(osv.osv):
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
stock_picking_obj = self.pool.get('stock.picking')
|
stock_picking_obj = self.pool.get('stock.picking')
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for order in self.browse(cr, uid, ids, context=context):
|
for order in self.browse(cr, uid, ids, context=context):
|
||||||
stock_picking_obj.signal_button_cancel(cr, uid, [order.picking_id.id])
|
stock_picking_obj.signal_button_cancel(cr, uid, [order.picking_id.id])
|
||||||
if stock_picking_obj.browse(cr, uid, order.picking_id.id, context=context).state <> 'cancel':
|
if stock_picking_obj.browse(cr, uid, order.picking_id.id, context=context).state <> 'cancel':
|
||||||
|
|
|
@ -24,7 +24,7 @@ import time
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
|
|
||||||
# Procurement
|
# Procurement
|
||||||
|
@ -441,9 +441,8 @@ class procurement_order(osv.osv):
|
||||||
if len(to_assign):
|
if len(to_assign):
|
||||||
move_obj.write(cr, uid, to_assign, {'state': 'assigned'})
|
move_obj.write(cr, uid, to_assign, {'state': 'assigned'})
|
||||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
|
workflow.trg_trigger(uid, 'procurement.order', id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def action_check_finished(self, cr, uid, ids):
|
def action_check_finished(self, cr, uid, ids):
|
||||||
|
@ -477,9 +476,8 @@ class procurement_order(osv.osv):
|
||||||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||||
move_obj.action_done(cr, uid, [procurement.move_id.id])
|
move_obj.action_done(cr, uid, [procurement.move_id.id])
|
||||||
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
|
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
|
workflow.trg_trigger(uid, 'procurement.order', id, cr)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
class StockPicking(osv.osv):
|
class StockPicking(osv.osv):
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
|
|
||||||
|
|
||||||
class ProjectTaskStageMrp(osv.Model):
|
class ProjectTaskStageMrp(osv.Model):
|
||||||
|
@ -48,10 +48,9 @@ class project_task(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _validate_subflows(self, cr, uid, ids, context=None):
|
def _validate_subflows(self, cr, uid, ids, context=None):
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for task in self.browse(cr, uid, ids):
|
for task in self.browse(cr, uid, ids):
|
||||||
if task.procurement_id:
|
if task.procurement_id:
|
||||||
wf_service.trg_write(uid, 'procurement.order', task.procurement_id.id, cr)
|
workflow.trg_write(uid, 'procurement.order', task.procurement_id.id, cr)
|
||||||
|
|
||||||
def write(self, cr, uid, ids, values, context=None):
|
def write(self, cr, uid, ids, values, context=None):
|
||||||
""" When closing tasks, validate subflows. """
|
""" When closing tasks, validate subflows. """
|
||||||
|
|
|
@ -13,7 +13,9 @@
|
||||||
-
|
-
|
||||||
!python {model: purchase.order}: |
|
!python {model: purchase.order}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
(data, format) = netsvc.LocalService('report.purchase.order').create(cr, uid, [ref('purchase.purchase_order_1'),ref('purchase.purchase_order_2')], {}, {})
|
from openerp.report import render_report
|
||||||
|
ids = [ref('purchase.purchase_order_1'), ref('purchase.purchase_order_2')]
|
||||||
|
data, format = render_report(cr, uid, ids, 'purchase.order', {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'purchase-purchase_order_report'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'purchase-purchase_order_report'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
-
|
-
|
||||||
!python {model: ir.actions.report.xml}: |
|
!python {model: ir.actions.report.xml}: |
|
||||||
import os
|
import os
|
||||||
from openerp import netsvc, tools
|
from openerp import tools
|
||||||
|
from openerp.report import render_report
|
||||||
ids = self.pool['ir.actions.report.xml'].search(cr, uid, [], {})
|
ids = self.pool['ir.actions.report.xml'].search(cr, uid, [], {})
|
||||||
(data, format) = netsvc.LocalService('report.webkit.ir.actions.report.xml').create(cr, uid, ids, {}, {})
|
data, format = render_report(cr, uid, ids, 'webkit.ir.actions.report.xml', {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'report_webkit_demo_report.'+format), 'wb+').write(data)
|
||||||
|
|
|
@ -26,7 +26,7 @@ from openerp.osv import fields, osv
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare
|
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
|
|
||||||
class sale_order(osv.osv):
|
class sale_order(osv.osv):
|
||||||
_name = "sale.order"
|
_name = "sale.order"
|
||||||
|
@ -791,9 +791,8 @@ class sale_order_line(osv.osv):
|
||||||
sales.add(line.order_id.id)
|
sales.add(line.order_id.id)
|
||||||
create_ids.append(inv_id)
|
create_ids.append(inv_id)
|
||||||
# Trigger workflow events
|
# Trigger workflow events
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for sale_id in sales:
|
for sale_id in sales:
|
||||||
wf_service.trg_write(uid, 'sale.order', sale_id, cr)
|
workflow.trg_write(uid, 'sale.order', sale_id, cr)
|
||||||
return create_ids
|
return create_ids
|
||||||
|
|
||||||
def button_cancel(self, cr, uid, ids, context=None):
|
def button_cancel(self, cr, uid, ids, context=None):
|
||||||
|
@ -806,10 +805,9 @@ class sale_order_line(osv.osv):
|
||||||
return self.write(cr, uid, ids, {'state': 'confirmed'})
|
return self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||||
|
|
||||||
def button_done(self, cr, uid, ids, context=None):
|
def button_done(self, cr, uid, ids, context=None):
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
res = self.write(cr, uid, ids, {'state': 'done'})
|
res = self.write(cr, uid, ids, {'state': 'done'})
|
||||||
for line in self.browse(cr, uid, ids, context=context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
wf_service.trg_write(uid, 'sale.order', line.order_id.id, cr)
|
workflow.trg_write(uid, 'sale.order', line.order_id.id, cr)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def uos_change(self, cr, uid, ids, product_uos, product_uos_qty=0, product_id=None):
|
def uos_change(self, cr, uid, ids, product_uos, product_uos_qty=0, product_id=None):
|
||||||
|
@ -1001,9 +999,8 @@ class account_invoice(osv.Model):
|
||||||
if len(invoice_ids) == len(ids):
|
if len(invoice_ids) == len(ids):
|
||||||
#Cancel invoice(s) first before deleting them so that if any sale order is associated with them
|
#Cancel invoice(s) first before deleting them so that if any sale order is associated with them
|
||||||
#it will trigger the workflow to put the sale order in an 'invoice exception' state
|
#it will trigger the workflow to put the sale order in an 'invoice exception' state
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
workflow.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||||
return super(account_invoice, self).unlink(cr, uid, ids, context=context)
|
return super(account_invoice, self).unlink(cr, uid, ids, context=context)
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
|
|
||||||
class sale_order_line_make_invoice(osv.osv_memory):
|
class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
_name = "sale.order.line.make.invoice"
|
_name = "sale.order.line.make.invoice"
|
||||||
|
@ -81,7 +81,6 @@ class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
|
|
||||||
sales_order_line_obj = self.pool.get('sale.order.line')
|
sales_order_line_obj = self.pool.get('sale.order.line')
|
||||||
sales_order_obj = self.pool.get('sale.order')
|
sales_order_obj = self.pool.get('sale.order')
|
||||||
wf_service = netsvc.LocalService('workflow')
|
|
||||||
for line in sales_order_line_obj.browse(cr, uid, context.get('active_ids', []), context=context):
|
for line in sales_order_line_obj.browse(cr, uid, context.get('active_ids', []), context=context):
|
||||||
if (not line.invoiced) and (line.state not in ('draft', 'cancel')):
|
if (not line.invoiced) and (line.state not in ('draft', 'cancel')):
|
||||||
if not line.order_id in invoices:
|
if not line.order_id in invoices:
|
||||||
|
@ -101,7 +100,7 @@ class sale_order_line_make_invoice(osv.osv_memory):
|
||||||
flag = False
|
flag = False
|
||||||
break
|
break
|
||||||
if flag:
|
if flag:
|
||||||
wf_service.trg_validate(uid, 'sale.order', order.id, 'manual_invoice', cr)
|
workflow.trg_validate(uid, 'sale.order', order.id, 'manual_invoice', cr)
|
||||||
sales_order_obj.write(cr, uid, [order.id], {'state': 'progress'})
|
sales_order_obj.write(cr, uid, [order.id], {'state': 'progress'})
|
||||||
|
|
||||||
if not invoices:
|
if not invoices:
|
||||||
|
|
|
@ -27,7 +27,7 @@ from itertools import groupby
|
||||||
|
|
||||||
from openerp.osv import fields, osv, orm
|
from openerp.osv import fields, osv, orm
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.tools import float_compare, DEFAULT_SERVER_DATETIME_FORMAT
|
from openerp.tools import float_compare, DEFAULT_SERVER_DATETIME_FORMAT
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
|
@ -786,11 +786,10 @@ class stock_picking(osv.osv):
|
||||||
""" Changes state of picking to available if moves are confirmed or waiting.
|
""" Changes state of picking to available if moves are confirmed or waiting.
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for pick in self.browse(cr, uid, ids):
|
for pick in self.browse(cr, uid, ids):
|
||||||
move_ids = [x.id for x in pick.move_lines if x.state in ['confirmed','waiting']]
|
move_ids = [x.id for x in pick.move_lines if x.state in ['confirmed','waiting']]
|
||||||
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
workflow.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def draft_force_assign(self, cr, uid, ids, *args):
|
def draft_force_assign(self, cr, uid, ids, *args):
|
||||||
|
@ -807,23 +806,21 @@ class stock_picking(osv.osv):
|
||||||
""" Validates picking directly from draft state.
|
""" Validates picking directly from draft state.
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
self.draft_force_assign(cr, uid, ids)
|
self.draft_force_assign(cr, uid, ids)
|
||||||
for pick in self.browse(cr, uid, ids, context=context):
|
for pick in self.browse(cr, uid, ids, context=context):
|
||||||
move_ids = [x.id for x in pick.move_lines]
|
move_ids = [x.id for x in pick.move_lines]
|
||||||
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
workflow.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
return self.action_process(
|
return self.action_process(
|
||||||
cr, uid, ids, context=context)
|
cr, uid, ids, context=context)
|
||||||
def cancel_assign(self, cr, uid, ids, *args):
|
def cancel_assign(self, cr, uid, ids, *args):
|
||||||
""" Cancels picking and moves.
|
""" Cancels picking and moves.
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for pick in self.browse(cr, uid, ids):
|
for pick in self.browse(cr, uid, ids):
|
||||||
move_ids = [x.id for x in pick.move_lines]
|
move_ids = [x.id for x in pick.move_lines]
|
||||||
self.pool.get('stock.move').cancel_assign(cr, uid, move_ids)
|
self.pool.get('stock.move').cancel_assign(cr, uid, move_ids)
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
workflow.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def action_assign_wkf(self, cr, uid, ids, context=None):
|
def action_assign_wkf(self, cr, uid, ids, context=None):
|
||||||
|
@ -1238,7 +1235,6 @@ class stock_picking(osv.osv):
|
||||||
currency_obj = self.pool.get('res.currency')
|
currency_obj = self.pool.get('res.currency')
|
||||||
uom_obj = self.pool.get('product.uom')
|
uom_obj = self.pool.get('product.uom')
|
||||||
sequence_obj = self.pool.get('ir.sequence')
|
sequence_obj = self.pool.get('ir.sequence')
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
for pick in self.browse(cr, uid, ids, context=context):
|
for pick in self.browse(cr, uid, ids, context=context):
|
||||||
new_picking = None
|
new_picking = None
|
||||||
complete, too_many, too_few = [], [], []
|
complete, too_many, too_few = [], [], []
|
||||||
|
@ -1364,7 +1360,7 @@ class stock_picking(osv.osv):
|
||||||
self.write(cr, uid, [pick.id], {'backorder_id': new_picking})
|
self.write(cr, uid, [pick.id], {'backorder_id': new_picking})
|
||||||
self.action_move(cr, uid, [new_picking], context=context)
|
self.action_move(cr, uid, [new_picking], context=context)
|
||||||
self.signal_button_done(cr, uid, [new_picking])
|
self.signal_button_done(cr, uid, [new_picking])
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
workflow.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||||
delivered_pack_id = new_picking
|
delivered_pack_id = new_picking
|
||||||
back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name
|
back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name
|
||||||
self.message_post(cr, uid, ids, body=_("Back order <em>%s</em> has been <b>created</b>.") % (back_order_name), context=context)
|
self.message_post(cr, uid, ids, body=_("Back order <em>%s</em> has been <b>created</b>.") % (back_order_name), context=context)
|
||||||
|
@ -2140,10 +2136,9 @@ class stock_move(osv.osv):
|
||||||
@return: True
|
@return: True
|
||||||
"""
|
"""
|
||||||
self.write(cr, uid, ids, {'state': 'assigned'})
|
self.write(cr, uid, ids, {'state': 'assigned'})
|
||||||
wf_service = netsvc.LocalService('workflow')
|
|
||||||
for move in self.browse(cr, uid, ids, context):
|
for move in self.browse(cr, uid, ids, context):
|
||||||
if move.picking_id:
|
if move.picking_id:
|
||||||
wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
workflow.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def cancel_assign(self, cr, uid, ids, context=None):
|
def cancel_assign(self, cr, uid, ids, context=None):
|
||||||
|
@ -2155,10 +2150,9 @@ class stock_move(osv.osv):
|
||||||
# fix for bug lp:707031
|
# fix for bug lp:707031
|
||||||
# called write of related picking because changing move availability does
|
# called write of related picking because changing move availability does
|
||||||
# not trigger workflow of picking in order to change the state of picking
|
# not trigger workflow of picking in order to change the state of picking
|
||||||
wf_service = netsvc.LocalService('workflow')
|
|
||||||
for move in self.browse(cr, uid, ids, context):
|
for move in self.browse(cr, uid, ids, context):
|
||||||
if move.picking_id:
|
if move.picking_id:
|
||||||
wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
workflow.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -2205,8 +2199,7 @@ class stock_move(osv.osv):
|
||||||
|
|
||||||
if count:
|
if count:
|
||||||
for pick_id in pickings:
|
for pick_id in pickings:
|
||||||
wf_service = netsvc.LocalService("workflow")
|
workflow.trg_write(uid, 'stock.picking', pick_id, cr)
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick_id, cr)
|
|
||||||
return count
|
return count
|
||||||
|
|
||||||
def setlast_tracking(self, cr, uid, ids, context=None):
|
def setlast_tracking(self, cr, uid, ids, context=None):
|
||||||
|
@ -2233,7 +2226,6 @@ class stock_move(osv.osv):
|
||||||
return True
|
return True
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
pickings = set()
|
pickings = set()
|
||||||
for move in self.browse(cr, uid, ids, context=context):
|
for move in self.browse(cr, uid, ids, context=context):
|
||||||
if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
|
if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
|
||||||
|
@ -2242,7 +2234,7 @@ class stock_move(osv.osv):
|
||||||
if move.move_dest_id and move.move_dest_id.state == 'waiting':
|
if move.move_dest_id and move.move_dest_id.state == 'waiting':
|
||||||
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
|
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
|
||||||
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
|
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
|
||||||
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
|
workflow.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
|
||||||
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
|
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
|
||||||
if not context.get('call_unlink',False):
|
if not context.get('call_unlink',False):
|
||||||
for pick in self.pool.get('stock.picking').browse(cr, uid, list(pickings), context=context):
|
for pick in self.pool.get('stock.picking').browse(cr, uid, list(pickings), context=context):
|
||||||
|
@ -2250,7 +2242,7 @@ class stock_move(osv.osv):
|
||||||
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
|
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
|
||||||
|
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'stock.move', id, cr)
|
workflow.trg_trigger(uid, 'stock.move', id, cr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _get_accounting_data_for_valuation(self, cr, uid, move, context=None):
|
def _get_accounting_data_for_valuation(self, cr, uid, move, context=None):
|
||||||
|
@ -2378,7 +2370,6 @@ class stock_move(osv.osv):
|
||||||
"""
|
"""
|
||||||
picking_ids = []
|
picking_ids = []
|
||||||
move_ids = []
|
move_ids = []
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
|
@ -2406,7 +2397,7 @@ class stock_move(osv.osv):
|
||||||
if move.move_dest_id.state in ('waiting', 'confirmed'):
|
if move.move_dest_id.state in ('waiting', 'confirmed'):
|
||||||
self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
|
self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
|
||||||
if move.move_dest_id.picking_id:
|
if move.move_dest_id.picking_id:
|
||||||
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
|
workflow.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
|
||||||
if move.move_dest_id.auto_validate:
|
if move.move_dest_id.auto_validate:
|
||||||
self.action_done(cr, uid, [move.move_dest_id.id], context=context)
|
self.action_done(cr, uid, [move.move_dest_id.id], context=context)
|
||||||
|
|
||||||
|
@ -2419,10 +2410,10 @@ class stock_move(osv.osv):
|
||||||
|
|
||||||
self.write(cr, uid, move_ids, {'state': 'done', 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
|
self.write(cr, uid, move_ids, {'state': 'done', 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
|
||||||
for id in move_ids:
|
for id in move_ids:
|
||||||
wf_service.trg_trigger(uid, 'stock.move', id, cr)
|
workflow.trg_trigger(uid, 'stock.move', id, cr)
|
||||||
|
|
||||||
for pick_id in picking_ids:
|
for pick_id in picking_ids:
|
||||||
wf_service.trg_write(uid, 'stock.picking', pick_id, cr)
|
workflow.trg_write(uid, 'stock.picking', pick_id, cr)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue