[Merged] lp:~openerp-dev/openobject-addons/trunk-methflow-thu.
bzr revid: tta@openerp.com-20130131115949-nxayb30f65wxv6sr
This commit is contained in:
@@ -44,8 +44,7 @@ class TestAccountFollowup(TransactionCase):
|
||||
'quantity': 5,
|
||||
'price_unit':200
|
||||
})]})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.invoice', self.invoice_id, 'invoice_open', cr)
|
||||
self.registry('account.invoice').signal_invoice_open(cr, uid, [self.invoice_id])
|
||||
|
||||
self.voucher = self.registry("account.voucher")
|
||||
|
||||
|
||||
@@ -135,9 +135,8 @@ class payment_order(osv.osv):
|
||||
return True
|
||||
|
||||
def set_done(self, cr, uid, ids, *args):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self.write(cr, uid, ids, {'date_done': time.strftime('%Y-%m-%d')})
|
||||
wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr)
|
||||
self.signal_done(cr, uid, [ids[0]])
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
|
||||
@@ -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], {
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
-
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
import datetime
|
||||
import time
|
||||
from itertools import groupby
|
||||
from operator import itemgetter
|
||||
from operator import attrgetter, itemgetter
|
||||
|
||||
import math
|
||||
from openerp import netsvc
|
||||
@@ -370,11 +370,11 @@ class hr_holidays(osv.osv):
|
||||
'employee_id': emp.id
|
||||
}
|
||||
leave_ids.append(self.create(cr, uid, vals, context=None))
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for leave_id in leave_ids:
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'confirm', cr)
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr)
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'second_validate', cr)
|
||||
# TODO is it necessary to interleave the calls?
|
||||
self.signal_confirm(cr, uid, [leave_id])
|
||||
self.signal_validate(cr, uid, [leave_id])
|
||||
self.signal_second_validate(cr, uid, [leave_id])
|
||||
return True
|
||||
|
||||
def holidays_confirm(self, cr, uid, ids, context=None):
|
||||
@@ -404,9 +404,7 @@ class hr_holidays(osv.osv):
|
||||
meeting_obj.unlink(cr, uid, [record.meeting_id.id])
|
||||
|
||||
# If a category that created several holidays, cancel all related
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for request in record.linked_request_ids or []:
|
||||
wf_service.trg_validate(uid, 'hr.holidays', request.id, 'refuse', cr)
|
||||
self.signal_refuse(cr, uid, map(attrgetter('id'), record.linked_request_ids or []))
|
||||
|
||||
self._remove_resource_leave(cr, uid, ids, context=context)
|
||||
return True
|
||||
@@ -478,10 +476,9 @@ class hr_employee(osv.osv):
|
||||
leave_id = holiday_obj.create(cr, uid, {'name': _('Leave Request for %s') % employee.name, 'employee_id': employee.id, 'holiday_status_id': status_id, 'type': 'remove', 'holiday_type': 'employee', 'number_of_days_temp': abs(diff)}, context=context)
|
||||
else:
|
||||
return False
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'confirm', cr)
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr)
|
||||
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'second_validate', cr)
|
||||
holidays_obj.signal_confirm(cr, uid, [leave_id])
|
||||
holidays_obj.signal_validate(cr, uid, [leave_id])
|
||||
holidays_obj.signal_second_validate(cr, uid, [leave_id])
|
||||
return True
|
||||
|
||||
def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
-
|
||||
!python {model: hr.holidays}: |
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self.set_to_draft(cr, uid, [ref('hr_holidays_employee1_cl')])
|
||||
wf_service.trg_validate(uid, 'hr.holidays', ref('hr_holidays_employee1_cl'), 'confirm', cr)
|
||||
self.signal_confirm(cr, uid, [ref('hr_holidays_employee1_cl')])
|
||||
-
|
||||
I validate the holiday request by clicking on "To Approve" button.
|
||||
-
|
||||
|
||||
@@ -198,8 +198,9 @@ class hr_payslip_run(osv.osv):
|
||||
advice_id = advice_pool.create(cr, uid, advice_data, context=context)
|
||||
slip_ids = []
|
||||
for slip_id in run.slip_ids:
|
||||
wf_service.trg_validate(uid, 'hr.payslip', slip_id.id, 'hr_verify_sheet', cr)
|
||||
wf_service.trg_validate(uid, 'hr.payslip', slip_id.id, 'process_sheet', cr)
|
||||
# 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])
|
||||
slip_ids.append(slip_id.id)
|
||||
|
||||
for slip in payslip_pool.browse(cr, uid, slip_ids, context=context):
|
||||
|
||||
@@ -159,7 +159,7 @@ class lunch_order(osv.Model):
|
||||
def specific_function(cr, uid, ids, context=None):
|
||||
return self.add_preference(cr, uid, ids, pref_id, context=context)
|
||||
return specific_function
|
||||
return super(lunch_order,self).__getattr__(self,attr)
|
||||
return super(lunch_order, self).__getattr__(attr)
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
|
||||
@@ -118,16 +118,15 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
@param action: Action to perform.
|
||||
@return: Nothing
|
||||
"""
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
prod_obj_pool = self.pool.get('mrp.production')
|
||||
oper_obj = self.browse(cr, uid, ids)[0]
|
||||
prod_obj = oper_obj.production_id
|
||||
if action == 'start':
|
||||
if prod_obj.state =='confirmed':
|
||||
prod_obj_pool.force_production(cr, uid, [prod_obj.id])
|
||||
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
|
||||
prod_obj_pool.signal_button_produce(cr, uid, [prod_obj.id])
|
||||
elif prod_obj.state =='ready':
|
||||
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
|
||||
prod_obj_pool.signal_button_produce(cr, uid, [prod_obj.id])
|
||||
elif prod_obj.state =='in_production':
|
||||
return
|
||||
else:
|
||||
@@ -143,7 +142,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)
|
||||
wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr)
|
||||
prod_obj_pool.signal_button_produce_done(cr, uid, [oper_obj.production_id.id])
|
||||
return
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, update=True):
|
||||
@@ -228,23 +227,21 @@ class mrp_production(osv.osv):
|
||||
@return: Super method
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
workcenter_pool = self.pool.get('mrp.production.workcenter.line')
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
if workcenter_line.state == 'draft':
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_done', cr)
|
||||
workcenter_pool.signal_button_start_working(cr, uid, [workcenter_line.id])
|
||||
workcenter_pool.signal_button_done(cr, uid, [workcenter_line.id])
|
||||
return super(mrp_production,self).action_production_end(cr, uid, ids)
|
||||
|
||||
def action_in_production(self, cr, uid, ids):
|
||||
""" Changes state to In Production and writes starting date.
|
||||
@return: True
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
workcenter_pool = self.pool.get('mrp.production.workcenter.line')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for prod in self.browse(cr, uid, ids):
|
||||
if prod.workcenter_lines:
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', prod.workcenter_lines[0].id, 'button_start_working', cr)
|
||||
workcenter_pool.signal_button_start_working(cr, uid, [prod.workcenter_lines[0].id])
|
||||
return super(mrp_production,self).action_in_production(cr, uid, ids)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
@@ -252,9 +249,8 @@ class mrp_production(osv.osv):
|
||||
@return: Super method
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids,context=context)[0]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_cancel', cr)
|
||||
workcenter_pool.signal_button_cancel(cr, uid, [workcenter_line.id])
|
||||
return super(mrp_production,self).action_cancel(cr,uid,ids,context=context)
|
||||
|
||||
def _compute_planned_workcenter(self, cr, uid, ids, context=None, mini=False):
|
||||
@@ -503,35 +499,35 @@ class mrp_operations_operation(osv.osv):
|
||||
return super(mrp_operations_operation, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
workcenter_pool = self.pool.get('mrp.production.workcenter.line')
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
|
||||
code=self.pool.get('mrp_operations.operation.code').browse(cr, uid, code_ids, context=context)[0]
|
||||
wc_op_id=self.pool.get('mrp.production.workcenter.line').search(cr,uid,[('workcenter_id','=',vals['workcenter_id']),('production_id','=',vals['production_id'])])
|
||||
wc_op_id=workcenter_pool.search(cr,uid,[('workcenter_id','=',vals['workcenter_id']),('production_id','=',vals['production_id'])])
|
||||
if code.start_stop in ('start','done','pause','cancel','resume'):
|
||||
if not wc_op_id:
|
||||
production_obj=self.pool.get('mrp.production').browse(cr, uid, vals['production_id'], context=context)
|
||||
wc_op_id.append(self.pool.get('mrp.production.workcenter.line').create(cr,uid,{'production_id':vals['production_id'],'name':production_obj.product_id.name,'workcenter_id':vals['workcenter_id']}))
|
||||
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':
|
||||
self.pool.get('mrp.production.workcenter.line').action_start_working(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_start_working', cr)
|
||||
|
||||
workcenter_pool.action_start_working(cr,uid,wc_op_id)
|
||||
workcenter_pool.signal_button_start_working(cr, uid, [wc_op_id[0]])
|
||||
|
||||
if code.start_stop=='done':
|
||||
self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_done', cr)
|
||||
workcenter_pool.action_done(cr,uid,wc_op_id)
|
||||
workcenter_pool.signal_button_done(cr, uid, [wc_op_id[0]])
|
||||
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':
|
||||
self.pool.get('mrp.production.workcenter.line').action_pause(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_pause', cr)
|
||||
workcenter_pool.action_pause(cr,uid,wc_op_id)
|
||||
workcenter_pool.signal_button_pause(cr, uid, [wc_op_id[0]])
|
||||
|
||||
if code.start_stop=='resume':
|
||||
self.pool.get('mrp.production.workcenter.line').action_resume(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_resume', cr)
|
||||
workcenter_pool.action_resume(cr,uid,wc_op_id)
|
||||
workcenter_pool.signal_button_resume(cr, uid, [wc_op_id[0]])
|
||||
|
||||
if code.start_stop=='cancel':
|
||||
self.pool.get('mrp.production.workcenter.line').action_cancel(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_cancel', cr)
|
||||
workcenter_pool.action_cancel(cr,uid,wc_op_id)
|
||||
workcenter_pool.signal_button_cancel(cr, uid, [wc_op_id[0]])
|
||||
|
||||
if not self.check_operation(cr, uid, vals):
|
||||
return
|
||||
|
||||
@@ -39,62 +39,48 @@
|
||||
Production start on first work center, so I start work operation on first work center.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_start_working(cr, uid, [order.workcenter_lines[0].id])
|
||||
-
|
||||
Now I pause first work operation due to technical fault of work center.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_pause', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_pause(cr, uid, [order.workcenter_lines[0].id])
|
||||
-
|
||||
I resume first work operation.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_resume', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_resume(cr, uid, [order.workcenter_lines[0].id])
|
||||
|
||||
-
|
||||
I cancel first work operation.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_cancel', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_cancel(cr, uid, [order.workcenter_lines[0].id])
|
||||
-
|
||||
I reset first work operation and start after resolving techninal fault of work center.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_draft', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_start_working', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_draft(cr, uid, [order.workcenter_lines[0].id])
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_start_working(cr, uid, [order.workcenter_lines[0].id])
|
||||
-
|
||||
I close first work operation as this work center completed its process.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', order.workcenter_lines[0].id, 'button_done', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_done(cr, uid, [order.workcenter_lines[0].id])
|
||||
-
|
||||
Now I close other operations one by one which are in start state.
|
||||
-
|
||||
!python {model: mrp.production}: |
|
||||
import netsvc
|
||||
order = self.browse(cr, uid, ref("mrp.mrp_production_1"), context=context)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for work_line in order.workcenter_lines[1:]:
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_start_working', cr)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', work_line.id, 'button_done', cr)
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_start_working(cr, uid, [work_line.id])
|
||||
self.pool.get('mrp.production.workcenter.line').signal_button_done(cr, uid, [work_line.id])
|
||||
|
||||
-
|
||||
I check that the production order is now done.
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from operator import attrgetter
|
||||
import time
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp import netsvc
|
||||
import time
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
# Procurement
|
||||
@@ -42,7 +44,6 @@ class mrp_property_group(osv.osv):
|
||||
'name': fields.char('Property Group', size=64, required=True),
|
||||
'description': fields.text('Description'),
|
||||
}
|
||||
mrp_property_group()
|
||||
|
||||
class mrp_property(osv.osv):
|
||||
"""
|
||||
@@ -59,7 +60,6 @@ class mrp_property(osv.osv):
|
||||
_defaults = {
|
||||
'composition': lambda *a: 'min',
|
||||
}
|
||||
mrp_property()
|
||||
|
||||
class StockMove(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
@@ -72,7 +72,6 @@ class StockMove(osv.osv):
|
||||
default['procurements'] = []
|
||||
return super(StockMove, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
StockMove()
|
||||
|
||||
class procurement_order(osv.osv):
|
||||
"""
|
||||
@@ -456,15 +455,13 @@ class procurement_order(osv.osv):
|
||||
|
||||
class StockPicking(osv.osv):
|
||||
_inherit = 'stock.picking'
|
||||
def test_finished(self, cursor, user, ids):
|
||||
def test_finished(self, cr, uid, ids):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
res = super(StockPicking, self).test_finished(cursor, user, ids)
|
||||
for picking in self.browse(cursor, user, ids):
|
||||
res = super(StockPicking, self).test_finished(cr, uid, ids)
|
||||
for picking in self.browse(cr, uid, ids):
|
||||
for move in picking.move_lines:
|
||||
if move.state == 'done' and move.procurements:
|
||||
for procurement in move.procurements:
|
||||
wf_service.trg_validate(user, 'procurement.order',
|
||||
procurement.id, 'button_check', cursor)
|
||||
self.pool.get('procurement.order').signal_button_check(cr, uid, map(attrgetter('id'), move.procurements))
|
||||
return res
|
||||
|
||||
class stock_warehouse_orderpoint(osv.osv):
|
||||
|
||||
@@ -62,8 +62,7 @@ class procurement_order(osv.osv):
|
||||
procurement_obj = self.pool.get('procurement.order')
|
||||
if not ids:
|
||||
ids = procurement_obj.search(cr, uid, [('state', '=', 'exception')], order="date_planned")
|
||||
for id in ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
|
||||
self.signal_button_restart(cr, uid, ids)
|
||||
if use_new_cursor:
|
||||
cr.commit()
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
|
||||
@@ -78,7 +77,7 @@ class procurement_order(osv.osv):
|
||||
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_order')], offset=offset, limit=500, order='priority, date_planned', context=context)
|
||||
for proc in procurement_obj.browse(cr, uid, ids, context=context):
|
||||
if maxdate >= proc.date_planned:
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
|
||||
self.signal_button_check(cr, uid, [proc.id])
|
||||
else:
|
||||
offset += 1
|
||||
report_later += 1
|
||||
@@ -100,7 +99,7 @@ class procurement_order(osv.osv):
|
||||
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
|
||||
for proc in procurement_obj.browse(cr, uid, ids):
|
||||
if maxdate >= proc.date_planned:
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
|
||||
self.signal_button_check(cr, uid, [proc.id])
|
||||
report_ids.append(proc.id)
|
||||
else:
|
||||
report_later += 1
|
||||
@@ -178,8 +177,8 @@ class procurement_order(osv.osv):
|
||||
proc_id = proc_obj.create(cr, uid,
|
||||
self._prepare_automatic_op_procurement(cr, uid, product, warehouse, location_id, context=context),
|
||||
context=context)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
|
||||
self.signal_button_confirm(cr, uid, [proc_id])
|
||||
self.signal_button_check(cr, uid, [proc_id])
|
||||
return True
|
||||
|
||||
def _get_orderpoint_date_planned(self, cr, uid, orderpoint, start_date, context=None):
|
||||
@@ -254,7 +253,7 @@ class procurement_order(osv.osv):
|
||||
to_generate = qty
|
||||
for proc_data in procure_datas:
|
||||
if to_generate >= proc_data['product_qty']:
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_data['id'], 'button_confirm', cr)
|
||||
self.signal_button_confirm(cr, uid, [proc_data['id']])
|
||||
procurement_obj.write(cr, uid, [proc_data['id']], {'origin': op.name}, context=context)
|
||||
to_generate -= proc_data['product_qty']
|
||||
if not to_generate:
|
||||
@@ -265,10 +264,8 @@ class procurement_order(osv.osv):
|
||||
proc_id = procurement_obj.create(cr, uid,
|
||||
self._prepare_orderpoint_procurement(cr, uid, op, qty, context=context),
|
||||
context=context)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id,
|
||||
'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id,
|
||||
'button_check', cr)
|
||||
self.signal_button_confirm(cr, uid, [proc_id])
|
||||
self.signal_button_check(cr, uid, [proc_id])
|
||||
orderpoint_obj.write(cr, uid, [op.id],
|
||||
{'procurement_id': proc_id}, context=context)
|
||||
offset += len(ids)
|
||||
@@ -279,6 +276,4 @@ class procurement_order(osv.osv):
|
||||
cr.close()
|
||||
return {}
|
||||
|
||||
procurement_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+18
-24
@@ -22,6 +22,7 @@
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from operator import attrgetter
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import netsvc
|
||||
@@ -260,9 +261,7 @@ class purchase_order(osv.osv):
|
||||
raise osv.except_osv(_('Invalid Action!'), _('In order to delete a purchase order, you must cancel it first.'))
|
||||
|
||||
# automatically sending subflow.delete upon deletion
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in unlink_ids:
|
||||
wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr)
|
||||
self.signal_purchase_cancel(cr, uid, unlink_ids)
|
||||
|
||||
return super(purchase_order, self).unlink(cr, uid, unlink_ids, context=context)
|
||||
|
||||
@@ -439,8 +438,7 @@ class purchase_order(osv.osv):
|
||||
This function prints the request for quotation 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'
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'purchase.order', ids[0], 'send_rfq', cr)
|
||||
self.signal_send_rfq(cr, uid, ids)
|
||||
datas = {
|
||||
'model': 'purchase.order',
|
||||
'ids': ids,
|
||||
@@ -489,8 +487,8 @@ class purchase_order(osv.osv):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for p_id in ids:
|
||||
# Deleting the existing instance of workflow for PO
|
||||
wf_service.trg_delete(uid, 'purchase.order', p_id, cr)
|
||||
wf_service.trg_create(uid, 'purchase.order', p_id, cr)
|
||||
self.delete_workflow(cr, uid, [p_id]) # TODO is it necessary to interleave the calls?
|
||||
self.create_workflow(cr, uid, [p_id])
|
||||
return True
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, context=None):
|
||||
@@ -571,26 +569,24 @@ class purchase_order(osv.osv):
|
||||
return False
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for purchase in self.browse(cr, uid, ids, context=context):
|
||||
for pick in purchase.picking_ids:
|
||||
if pick.state not in ('draft','cancel'):
|
||||
raise osv.except_osv(
|
||||
_('Unable to cancel this purchase order.'),
|
||||
_('First cancel all receptions related to this purchase order.'))
|
||||
for pick in purchase.picking_ids:
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
|
||||
self.pool.get('stock.picking') \
|
||||
.signal_button_cancel(cr, uid, map(attrgetter('id'), purchase.picking_ids))
|
||||
for inv in purchase.invoice_ids:
|
||||
if inv and inv.state not in ('cancel','draft'):
|
||||
raise osv.except_osv(
|
||||
_('Unable to cancel this purchase order.'),
|
||||
_('You must first cancel all receptions related to this purchase order.'))
|
||||
if inv:
|
||||
wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
|
||||
self.pool.get('account.invoice') \
|
||||
.signal_invoice_cancel(cr, uid, map(attrgetter('id'), purchase.invoice_ids))
|
||||
self.write(cr,uid,ids,{'state':'cancel'})
|
||||
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
wf_service.trg_validate(uid, 'purchase.order', id, 'purchase_cancel', cr)
|
||||
self.signal_purchase_cancel(cr, uid, ids)
|
||||
return True
|
||||
|
||||
def _prepare_order_picking(self, cr, uid, order, context=None):
|
||||
@@ -648,11 +644,11 @@ class purchase_order(osv.osv):
|
||||
will be added. A new picking will be created if omitted.
|
||||
:return: list of IDs of pickings used/created for the given order lines (usually just one)
|
||||
"""
|
||||
stock_picking = self.pool.get('stock.picking')
|
||||
if not picking_id:
|
||||
picking_id = self.pool.get('stock.picking').create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
|
||||
picking_id = stock_picking.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
|
||||
todo_moves = []
|
||||
stock_move = self.pool.get('stock.move')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_line in order_lines:
|
||||
if not order_line.product_id:
|
||||
continue
|
||||
@@ -663,7 +659,7 @@ class purchase_order(osv.osv):
|
||||
todo_moves.append(move)
|
||||
stock_move.action_confirm(cr, uid, todo_moves)
|
||||
stock_move.force_assign(cr, uid, todo_moves)
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
stock_picking.signal_button_confirm(cr, uid, [picking_id])
|
||||
return [picking_id]
|
||||
|
||||
def action_picking_create(self, cr, uid, ids, context=None):
|
||||
@@ -714,7 +710,6 @@ class purchase_order(osv.osv):
|
||||
|
||||
"""
|
||||
#TOFIX: merged order line should be unlink
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
def make_key(br, fields):
|
||||
list_key = []
|
||||
for field in fields:
|
||||
@@ -782,6 +777,7 @@ class purchase_order(osv.osv):
|
||||
|
||||
allorders = []
|
||||
orders_info = {}
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_key, (order_data, old_ids) in new_orders.iteritems():
|
||||
# skip merges with only one order
|
||||
if len(old_ids) < 2:
|
||||
@@ -801,8 +797,8 @@ class purchase_order(osv.osv):
|
||||
|
||||
# make triggers pointing to the old orders point to the new order
|
||||
for old_id in old_ids:
|
||||
wf_service.trg_redirect(uid, 'purchase.order', old_id, neworder_id, cr)
|
||||
wf_service.trg_validate(uid, 'purchase.order', old_id, 'purchase_cancel', cr)
|
||||
self.redirect_workflow(cr, uid, [(old_id, neworder_id)])
|
||||
self.signal_purchase_cancel(cr, uid, [old_id]) # TODO Is it necessary to interleave the calls?
|
||||
return orders_info
|
||||
|
||||
|
||||
@@ -1169,8 +1165,7 @@ class mail_mail(osv.Model):
|
||||
|
||||
def _postprocess_sent_message(self, cr, uid, mail, context=None):
|
||||
if mail.model == 'purchase.order':
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'purchase.order', mail.res_id, 'send_rfq', cr)
|
||||
self.pool.get('purchase.order').signal_send_rfq(cr, uid, [mail.res_id])
|
||||
return super(mail_mail, self)._postprocess_sent_message(cr, uid, mail=mail, context=context)
|
||||
|
||||
|
||||
@@ -1192,8 +1187,7 @@ class mail_compose_message(osv.Model):
|
||||
context = context or {}
|
||||
if context.get('default_model') == 'purchase.order' and context.get('default_res_id'):
|
||||
context = dict(context, mail_post_autofollow=True)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'purchase.order', context['default_res_id'], 'send_rfq', cr)
|
||||
self.pool.get('purchase.order').signal_send_rfq(cr, uid, [context['default_res_id']])
|
||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -62,8 +62,7 @@
|
||||
import netsvc
|
||||
invoice_ids = [x.id for x in self.browse(cr, uid, ref("purchase_order_1")).invoice_ids]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for invoice in invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice', invoice, 'invoice_open', cr)
|
||||
self.pool.get('account.invoice').signal_invoice_open(cr, uid, invoice_ids)
|
||||
-
|
||||
I check that purchase order is invoiced.
|
||||
-
|
||||
|
||||
+8
-14
@@ -759,10 +759,9 @@ class stock_picking(osv.osv):
|
||||
""" Changes state of picking to available if all moves are confirmed.
|
||||
@return: True
|
||||
"""
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in self.browse(cr, uid, ids):
|
||||
if pick.state == 'draft':
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_confirm', cr)
|
||||
self.signal_button_confirm(cr, uid, [pick.id])
|
||||
move_ids = [x.id for x in pick.move_lines if x.state == 'confirmed']
|
||||
if not move_ids:
|
||||
raise osv.except_osv(_('Warning!'),_('Not enough stock, unable to reserve the products.'))
|
||||
@@ -784,12 +783,10 @@ class stock_picking(osv.osv):
|
||||
""" Confirms picking directly from draft state.
|
||||
@return: True
|
||||
"""
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for pick in self.browse(cr, uid, ids):
|
||||
if not pick.move_lines:
|
||||
raise osv.except_osv(_('Error!'),_('You cannot process picking without stock moves.'))
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id,
|
||||
'button_confirm', cr)
|
||||
self.signal_button_confirm(cr, uid, [pick.id])
|
||||
return True
|
||||
|
||||
def draft_validate(self, cr, uid, ids, context=None):
|
||||
@@ -1345,18 +1342,18 @@ class stock_picking(osv.osv):
|
||||
|
||||
# At first we confirm the new picking (if necessary)
|
||||
if new_picking:
|
||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
||||
self.signal_button_confirm(cr, uid, [new_picking])
|
||||
# Then we finish the good picking
|
||||
self.write(cr, uid, [pick.id], {'backorder_id': new_picking})
|
||||
self.action_move(cr, uid, [new_picking], context=context)
|
||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr)
|
||||
self.signal_button_done(cr, uid, [new_picking])
|
||||
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
|
||||
delivered_pack_id = new_picking
|
||||
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)
|
||||
else:
|
||||
self.action_move(cr, uid, [pick.id], context=context)
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
|
||||
self.signal_button_done(cr, uid, [pick.id])
|
||||
delivered_pack_id = pick.id
|
||||
|
||||
delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context)
|
||||
@@ -2037,7 +2034,6 @@ class stock_move(osv.osv):
|
||||
res_obj = self.pool.get('res.company')
|
||||
location_obj = self.pool.get('stock.location')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
new_moves = []
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -2073,7 +2069,7 @@ class stock_move(osv.osv):
|
||||
})
|
||||
new_moves.append(self.browse(cr, uid, [new_id])[0])
|
||||
if pickid:
|
||||
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
|
||||
self.signal_button_confirm(cr, uid, [pickid])
|
||||
if new_moves:
|
||||
new_moves += self.create_chained_picking(cr, uid, new_moves, context)
|
||||
return new_moves
|
||||
@@ -2195,6 +2191,7 @@ class stock_move(osv.osv):
|
||||
return True
|
||||
if context is None:
|
||||
context = {}
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pickings = set()
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
|
||||
@@ -2203,7 +2200,6 @@ class stock_move(osv.osv):
|
||||
if move.move_dest_id and move.move_dest_id.state == 'waiting':
|
||||
self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'})
|
||||
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
|
||||
self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
|
||||
if not context.get('call_unlink',False):
|
||||
@@ -2211,7 +2207,6 @@ class stock_move(osv.osv):
|
||||
if all(move.state == 'cancel' for move in pick.move_lines):
|
||||
self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'stock.move', id, cr)
|
||||
return True
|
||||
@@ -2633,7 +2628,6 @@ class stock_move(osv.osv):
|
||||
product_obj = self.pool.get('product.product')
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -2734,7 +2728,7 @@ class stock_move(osv.osv):
|
||||
res = cr.fetchall()
|
||||
if len(res) == len(move.picking_id.move_lines):
|
||||
picking_obj.action_move(cr, uid, [move.picking_id.id])
|
||||
wf_service.trg_validate(uid, 'stock.picking', move.picking_id.id, 'button_done', cr)
|
||||
picking_obj.signal_button_done(cr, uid, [move.picking_id.id])
|
||||
|
||||
return [move.id for move in complete]
|
||||
|
||||
|
||||
@@ -151,7 +151,6 @@ class stock_return_picking(osv.osv_memory):
|
||||
data_obj = self.pool.get('stock.return.picking.memory')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
model_obj = self.pool.get('ir.model.data')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
pick = pick_obj.browse(cr, uid, record_id, context=context)
|
||||
data = self.read(cr, uid, ids[0], context=context)
|
||||
date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
@@ -206,7 +205,7 @@ class stock_return_picking(osv.osv_memory):
|
||||
|
||||
if set_invoice_state_to_none:
|
||||
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'}, context=context)
|
||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
||||
pick_obj.signal_button_confirm(cr, uid, [new_picking])
|
||||
pick_obj.force_assign(cr, uid, [new_picking], context)
|
||||
# Update view id in context, lp:702939
|
||||
model_list = {
|
||||
|
||||
@@ -49,7 +49,6 @@ class procurement_order(osv.osv):
|
||||
proc_obj = self.pool.get('procurement.order')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for proc in proc_obj.browse(cr, uid, ids, context=context):
|
||||
line = None
|
||||
for line in proc.product_id.flow_pull_ids:
|
||||
@@ -109,9 +108,8 @@ class procurement_order(osv.osv):
|
||||
'procure_method': line.procure_method,
|
||||
'move_id': move_id,
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
|
||||
self.pool.get('stock.picking').signal_button_confirm(cr, uid, [picking_id])
|
||||
self.signal_button_confirm(cr, uid, [proc_id])
|
||||
if proc.move_id:
|
||||
move_obj.write(cr, uid, [proc.move_id.id],
|
||||
{'location_id':proc.location_id.id})
|
||||
@@ -119,9 +117,8 @@ class procurement_order(osv.osv):
|
||||
self.write(cr, uid, [proc.id], {'state':'running', 'message': msg})
|
||||
self.message_post(cr, uid, [proc.id], body=msg, context=context)
|
||||
# trigger direct processing (the new procurement shares the same planned date as the original one, which is already being processed)
|
||||
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
|
||||
self.signal_button_check(cr, uid, [proc_id]) # TODO is it necessary to interleave the calls?
|
||||
return False
|
||||
|
||||
procurement_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user