mirror of
https://github.com/NaN-tic/oo_nan_prodlot_quality_control_input.git
synced 2023-12-14 07:22:52 +01:00
[IMP] nan_prodlot_quality_control_input: PEP8 formatting
This commit is contained in:
parent
725e587c82
commit
d87bbfc243
2 changed files with 42 additions and 42 deletions
|
@ -28,28 +28,28 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" : "Production Lot Quality Control - Input",
|
"name": "Production Lot Quality Control - Input",
|
||||||
"version" : "0.2",
|
"version": "1.0",
|
||||||
"author" : "NaN Projectes de Programari Lliure S.L.",
|
"author": "NaN Projectes de Programari Lliure S.L.",
|
||||||
"category" : "Generic Modules/Quality Control",
|
"category": "Generic Modules/Quality Control",
|
||||||
"website": "http://www.nan-tic.com",
|
"website": "http://www.nan-tic.com",
|
||||||
"description": """
|
"description": """
|
||||||
Module developed for Trod y Avia, S.L.
|
Module developed for Trod y Avia, S.L.
|
||||||
|
|
||||||
This module adds quality control to Production Lots on arrival (input
|
This module adds quality control to Production Lots on arrival (input
|
||||||
pickings).
|
pickings).
|
||||||
The idea is that the first test will be 'Generic' and check for things like
|
The idea is that the first test will be 'Generic' and check for things like
|
||||||
correct packaging. The second will be specific to the product in question.
|
correct packaging. The second will be specific to the product in question.
|
||||||
""",
|
""",
|
||||||
"depends" : [
|
"depends": [
|
||||||
'nan_prodlot_quality_control',
|
'nan_prodlot_quality_control',
|
||||||
'stock',
|
'stock',
|
||||||
],
|
],
|
||||||
"init_xml" : [],
|
"init_xml": [],
|
||||||
"update_xml" : [
|
"update_xml": [
|
||||||
'quality_control_data.xml',
|
'quality_control_data.xml',
|
||||||
],
|
],
|
||||||
"demo_xml" : [
|
"demo_xml": [
|
||||||
'prodlot_quality_control_input_demo.xml',
|
'prodlot_quality_control_input_demo.xml',
|
||||||
],
|
],
|
||||||
"test": [
|
"test": [
|
||||||
|
|
60
stock.py
60
stock.py
|
@ -29,72 +29,72 @@
|
||||||
|
|
||||||
from osv import osv
|
from osv import osv
|
||||||
|
|
||||||
|
|
||||||
class stock_move(osv.osv):
|
class stock_move(osv.osv):
|
||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
|
||||||
# stock.move
|
# stock.move
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
move_id = super(stock_move, self).create(cr, uid, vals, context)
|
move_id = super(stock_move, self).create(cr, uid, vals, context)
|
||||||
|
|
||||||
if 'input' in context.get('no_create_trigger_test',[]):
|
if 'input' in context.get('no_create_trigger_test', []):
|
||||||
return move_id
|
return move_id
|
||||||
|
|
||||||
input_trigger_id = self.pool.get('qc.trigger').search(cr, uid,
|
input_trigger_id = self.pool.get('qc.trigger').search(cr, uid, [
|
||||||
[('name','=','Input')], context=context)
|
('name', '=', 'Input'),
|
||||||
|
], context=context)
|
||||||
if not input_trigger_id:
|
if not input_trigger_id:
|
||||||
return move_id
|
return move_id
|
||||||
|
|
||||||
move = self.browse(cr, uid, move_id, context)
|
move = self.browse(cr, uid, move_id, context)
|
||||||
if (not move.picking_id or move.picking_id.type != 'in' or
|
if (not move.picking_id or move.picking_id.type != 'in' or
|
||||||
not move.prodlot_id):
|
not move.prodlot_id):
|
||||||
return move_id
|
return move_id
|
||||||
|
|
||||||
self.pool.get('stock.production.lot').create_qc_test_triggers(cr, uid,
|
self.pool.get('stock.production.lot').create_qc_test_triggers(cr, uid,
|
||||||
move.prodlot_id, input_trigger_id[0], True, context)
|
move.prodlot_id, input_trigger_id[0], True, context)
|
||||||
|
|
||||||
return move_id
|
return move_id
|
||||||
|
|
||||||
|
|
||||||
# stock.move
|
# stock.move
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
prodlot_proxy = self.pool.get('stock.production.lot')
|
prodlot_proxy = self.pool.get('stock.production.lot')
|
||||||
|
|
||||||
res = super(stock_move, self).write(cr, uid, ids, vals,
|
res = super(stock_move, self).write(cr, uid, ids, vals, context)
|
||||||
context)
|
|
||||||
|
|
||||||
# we will try to create 'test triggers' only when Lot and/or Picking is
|
# we will try to create 'test triggers' only when Lot and/or Picking is
|
||||||
# setted to Stock Move
|
# setted to Stock Move
|
||||||
if not 'prodlot_id' in vals and not 'picking_id' in vals:
|
if not 'prodlot_id' in vals and not 'picking_id' in vals:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
if 'input' in context.get('no_create_trigger_test',[]):
|
if 'input' in context.get('no_create_trigger_test', []):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
input_trigger_id = self.pool.get('qc.trigger').search(cr, uid,
|
input_trigger_id = self.pool.get('qc.trigger').search(cr, uid, [
|
||||||
[('name','=','Input')], context=context)
|
('name', '=', 'Input'),
|
||||||
|
], context=context)
|
||||||
if not input_trigger_id:
|
if not input_trigger_id:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
input_trigger_id = input_trigger_id[0]
|
input_trigger_id = input_trigger_id[0]
|
||||||
for move in self.browse(cr, uid, ids, context):
|
for move in self.browse(cr, uid, ids, context):
|
||||||
if (not move.picking_id or move.picking_id.type != 'in' or
|
if (not move.picking_id or move.picking_id.type != 'in' or
|
||||||
not move.prodlot_id):
|
not move.prodlot_id):
|
||||||
continue
|
continue
|
||||||
for test_trigger in move.prodlot_id.qc_test_trigger_ids:
|
for test_trigger in move.prodlot_id.qc_test_trigger_ids:
|
||||||
if test_trigger.trigger_id.id == input_trigger_id:
|
if test_trigger.trigger_id.id == input_trigger_id:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# If it comes here, the previous 'FOR' has not break =>
|
# If it comes here, the previous 'FOR' has not break =>
|
||||||
# no test trigger for 'input_trigger_id'
|
# no test trigger for 'input_trigger_id'
|
||||||
prodlot_proxy.create_qc_test_triggers(cr, uid, move.prodlot_id,
|
prodlot_proxy.create_qc_test_triggers(cr, uid, move.prodlot_id,
|
||||||
input_trigger_id, True, context)
|
input_trigger_id, True, context)
|
||||||
|
|
||||||
return res
|
return res
|
||||||
stock_move()
|
stock_move()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue