Modify BOM and Route name when Process name is modified
This commit is contained in:
parent
af4e1ca1ae
commit
a4e1fa0cb5
|
@ -1,3 +1,5 @@
|
|||
* Modify BOM and Route name when Process name is modified
|
||||
|
||||
Version 3.4.0 - 2014-11-03
|
||||
|
||||
Version 3.4.0 - 2014-06-03
|
||||
|
|
|
@ -111,6 +111,39 @@ class Process(ModelSQL, ModelView):
|
|||
res += super(Process, cls).copy([process], default=local_default)
|
||||
return res
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
BOM = pool.get('production.bom')
|
||||
Route = pool.get('production.route')
|
||||
|
||||
bom_args = []
|
||||
route_args = []
|
||||
actions = iter(args)
|
||||
for processes, values in zip(actions, actions):
|
||||
if values.get('name'):
|
||||
new_values = {
|
||||
'name': values['name']
|
||||
}
|
||||
|
||||
if values.get('bom'):
|
||||
bom_args.extend(([BOM(values['bom'])], new_values))
|
||||
else:
|
||||
for process in processes:
|
||||
bom_args.extend(([process.bom], new_values))
|
||||
|
||||
if values.get('route'):
|
||||
route_args.extend(([Route(values['route'])], new_values))
|
||||
else:
|
||||
for process in processes:
|
||||
route_args.extend(([process.route], new_values))
|
||||
|
||||
super(Process, cls).write(*args)
|
||||
if bom_args:
|
||||
BOM.write(*bom_args)
|
||||
if route_args:
|
||||
Route.write(*route_args)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, processes):
|
||||
pool = Pool()
|
||||
|
|
Loading…
Reference in New Issue