mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] Apply typo and pypi conformity from Alex
This commit is contained in:
committed by
Joël Grand-Guillaume
parent
281df93081
commit
47b8868164
@@ -23,37 +23,37 @@ from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
#class stock_fill_inventory(osv.osv_memory):
|
||||
# _inherit = "stock.fill.inventory"
|
||||
# _inherit = "stock.fill.inventory"
|
||||
# def fill_inventory(self, cr, uid, ids, context=None):
|
||||
# res = super(stock_fill_inventory, self).fill_inventory(cr, uid, ids, context=context)
|
||||
# res = super(stock_fill_inventory, self).fill_inventory(cr, uid, ids, context=context)
|
||||
# stock_inventory_obj = self.pool.get('stock.inventory')
|
||||
# fill_inventory = self.browse(cr, uid, ids[0], context=context)
|
||||
# if stock_inventory_obj.browse(cr, uid, context.get('active_id', False), context).location_id:
|
||||
# stock_inventory_obj.write(cr, uid, context.get('active_id', False), {'location_id': fill_inventory.location_id.id})
|
||||
# return res
|
||||
# return res
|
||||
#stock_fill_inventory()
|
||||
|
||||
class stock_inventory(osv.osv):
|
||||
_inherit = "stock.inventory"
|
||||
|
||||
|
||||
_columns = {
|
||||
'type': fields.selection([('normal', 'Inventory'),('move', 'Location Move')], 'Type'),
|
||||
'location_id': fields.many2one('stock.location', 'Location'),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Destination Location'),
|
||||
'comments':fields.text('Comments'),
|
||||
}
|
||||
|
||||
|
||||
def get_sequence(self, cr , uid, context):
|
||||
if context.get('type', False) == 'move':
|
||||
return self.pool.get('ir.sequence').get(cr, uid, 'stock.inventory.move') or '/'
|
||||
else:
|
||||
return self.pool.get('ir.sequence').get(cr, uid, 'stock.inventory') or '/'
|
||||
|
||||
|
||||
_defaults = {
|
||||
'type': lambda *a: 'normal',
|
||||
'name': lambda x, y, z, c: x.get_sequence(y,z,c),
|
||||
}
|
||||
|
||||
|
||||
def move_stock(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -83,12 +83,12 @@ class stock_inventory(osv.osv):
|
||||
self.log(cr, uid, inv.id, message)
|
||||
self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]})
|
||||
return True
|
||||
|
||||
|
||||
def fill_inventory(self, cr, uid, ids, context=False):
|
||||
res = {}
|
||||
stock_fill_inventory_obj = self.pool.get('stock.fill.inventory')
|
||||
inventory_data = self.browse(cr, uid, ids[0], context)
|
||||
if context.get('type',[]) == 'move':
|
||||
if context.get('type',[]) == 'move':
|
||||
set_stock_zero = False
|
||||
else:
|
||||
set_stock_zero = True
|
||||
@@ -100,8 +100,8 @@ class stock_inventory(osv.osv):
|
||||
context_temp = context
|
||||
context_temp['active_ids'] = [inventory_data.id]
|
||||
context_temp['active_id'] = inventory_data.id
|
||||
stock_fill_inventory_obj.fill_inventory(cr, uid, [fill_inventory_id], context_temp)
|
||||
|
||||
stock_fill_inventory_obj.fill_inventory(cr, uid, [fill_inventory_id], context_temp)
|
||||
|
||||
|
||||
if context.get('type',[]) == 'move':
|
||||
act = {}
|
||||
@@ -110,7 +110,7 @@ class stock_inventory(osv.osv):
|
||||
# model_id = mod_obj.search(cr, uid, [('name', '=', 'move_stock_acquisition_link_2')])[0]
|
||||
# act_id = mod_obj.read(cr, uid, model_id, ['res_id'])['res_id']
|
||||
# act = act_obj.read(cr, uid, act_id)
|
||||
else:
|
||||
else:
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
model_id = mod_obj.search(cr, uid, [('name', '=', 'inventory_acquisition_link_1')])[0]
|
||||
@@ -121,31 +121,31 @@ class stock_inventory(osv.osv):
|
||||
context['default_name'] = inventory_data.name
|
||||
act['context'] = context
|
||||
return act
|
||||
|
||||
|
||||
|
||||
|
||||
stock_inventory()
|
||||
|
||||
class stock_move(osv.osv):
|
||||
|
||||
_inherit = 'stock.move'
|
||||
|
||||
|
||||
_inherit = 'stock.move'
|
||||
|
||||
# def _check_move(self, cr, uid, ids, context=None):
|
||||
# """ Checks if the given production lot belong to a pack
|
||||
# Return false if the production lot is in a pack
|
||||
# """
|
||||
# production_lot_obj = self.pool.get('stock.production.lot')
|
||||
#
|
||||
# for move in self.browse(cr, uid, ids, context=context):
|
||||
# if move.prodlot_id:
|
||||
# if self.search(cr, uid, [('prodlot_id', '=', move.prodlot_id.id), ('state','not in',('cancel','done')), ('id', '!=', move.id)]):
|
||||
#
|
||||
# for move in self.browse(cr, uid, ids, context=context):
|
||||
# if move.prodlot_id:
|
||||
# if self.search(cr, uid, [('prodlot_id', '=', move.prodlot_id.id), ('state','not in',('cancel','done')), ('id', '!=', move.id)]):
|
||||
# if move.prodlot_id.tracking_id:
|
||||
# return False
|
||||
# return True
|
||||
|
||||
|
||||
_columns = {
|
||||
'pack_history_id': fields.many2one('stock.tracking.history', 'History pack'),
|
||||
}
|
||||
|
||||
|
||||
# _constraints =[
|
||||
# (_check_move, 'You try to assign a move to a lot which is already in a pack', ['prodlot_id'])
|
||||
# ]
|
||||
@@ -161,8 +161,8 @@ class stock_move(osv.osv):
|
||||
# if context == None:
|
||||
# context = {}
|
||||
# ''' process '''
|
||||
# for move in self.browse(cr, uid, ids, context=context):
|
||||
# if move.prodlot_id:
|
||||
# for move in self.browse(cr, uid, ids, context=context):
|
||||
# if move.prodlot_id:
|
||||
# if move.prodlot_id.tracking_id:
|
||||
# move_packaging_obj.move_pack(cr, uid, move.prodlot_id.tracking_id, context)
|
||||
# return {}
|
||||
@@ -171,7 +171,7 @@ stock_move()
|
||||
|
||||
class stock_inventory_line(osv.osv):
|
||||
_inherit = "stock.inventory.line"
|
||||
|
||||
|
||||
_columns = {
|
||||
'date': fields.datetime('Date'),
|
||||
'note': fields.text('Notes'),
|
||||
@@ -179,4 +179,4 @@ class stock_inventory_line(osv.osv):
|
||||
|
||||
stock_inventory_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -23,7 +23,7 @@ from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class stock_tracking(osv.osv):
|
||||
|
||||
|
||||
_inherit = 'stock.tracking'
|
||||
|
||||
_columns = {
|
||||
@@ -32,24 +32,24 @@ class stock_tracking(osv.osv):
|
||||
'to_add': fields.one2many('stock.scan.to.validate', 'tracking_id', 'To add', domain=[('type','=','in')]),
|
||||
'to_remove': fields.one2many('stock.scan.to.validate', 'tracking_id', 'To validate', domain=[('type','=','out')]),
|
||||
}
|
||||
|
||||
|
||||
def add_validation(self, cr, uid, ids, barcode_ids, context=None):
|
||||
|
||||
|
||||
barcode_obj = self.pool.get('tr.barcode')
|
||||
tracking_obj = self.pool.get('stock.tracking')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
product_obj = self.pool.get('product.product')
|
||||
history_obj = self.pool.get('stock.tracking.history')
|
||||
validate_obj = self.pool.get('stock.scan.to.validate')
|
||||
|
||||
|
||||
if context == None:
|
||||
context = {}
|
||||
if barcode_ids:
|
||||
if barcode_ids:
|
||||
for obj in self.browse(cr, uid, ids):
|
||||
barcode = barcode_obj.browse(cr, uid, barcode_ids[0])
|
||||
model = barcode.res_model
|
||||
res_id = barcode.res_id
|
||||
|
||||
|
||||
if model == 'stock.tracking':
|
||||
'''Pack Case'''
|
||||
pack = tracking_obj.browse(cr, uid, res_id)
|
||||
@@ -59,7 +59,7 @@ class stock_tracking(osv.osv):
|
||||
history_obj.create(cr, uid, {'type': 'pack_in',
|
||||
'tracking_id': res_id,
|
||||
'parent_id': obj.id,
|
||||
})
|
||||
})
|
||||
tracking_obj.write(cr, uid, pack.id, {'location_id': obj.location_id and obj.location_id.id or False,})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
for move_data in pack.move_ids:
|
||||
@@ -93,15 +93,15 @@ class stock_tracking(osv.osv):
|
||||
'location_dest_id': obj.location_id.id,
|
||||
})
|
||||
move_obj.write(cr, uid, new_move_id, {'tracking_id': obj.id})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
else:
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
else:
|
||||
move_obj.write(cr, uid, move_ids, {'tracking_id': obj.id})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
elif model == 'product.product':
|
||||
'''Product Case'''
|
||||
pack = tracking_obj.browse(cr, uid, obj.id)
|
||||
product_data = product_obj.browse(cr, uid,res_id)
|
||||
'''Product Case'''
|
||||
pack = tracking_obj.browse(cr, uid, obj.id)
|
||||
product_data = product_obj.browse(cr, uid,res_id)
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'name': product_data.name,
|
||||
'product_id': product_data.id,
|
||||
@@ -110,16 +110,16 @@ class stock_tracking(osv.osv):
|
||||
'location_dest_id': pack.location_id.id,
|
||||
'tracking_id': obj.id,
|
||||
'state': 'draft',
|
||||
})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
'''Call for a function who will display serial code list and product list in the pack layout'''
|
||||
})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
'''Call for a function who will display serial code list and product list in the pack layout'''
|
||||
tracking_obj.get_products(cr, uid, ids, context=None)
|
||||
tracking_obj.get_serials(cr, uid, ids, context=None)
|
||||
tracking_obj.get_serials(cr, uid, ids, context=None)
|
||||
else:
|
||||
raise osv.except_osv(_('Warning!'),_('Barcode Not found!'))
|
||||
return {}
|
||||
|
||||
|
||||
def remove_validation(self, cr, uid, ids, barcode_ids, context=None):
|
||||
barcode_obj = self.pool.get('tr.barcode')
|
||||
tracking_obj = self.pool.get('stock.tracking')
|
||||
@@ -127,7 +127,7 @@ class stock_tracking(osv.osv):
|
||||
product_obj = self.pool.get('product.product')
|
||||
history_obj = self.pool.get('stock.tracking.history')
|
||||
validate_obj = self.pool.get('stock.scan.to.validate')
|
||||
|
||||
|
||||
if context == None:
|
||||
context = {}
|
||||
if barcode_ids:
|
||||
@@ -140,42 +140,42 @@ class stock_tracking(osv.osv):
|
||||
pack = tracking_obj.browse(cr, uid, res_id)
|
||||
tracking_obj.write(cr, uid, res_id, {'parent_id': False})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
elif model == 'stock.production.lot':
|
||||
elif model == 'stock.production.lot':
|
||||
pack = tracking_obj.browse(cr, uid, obj.id)
|
||||
move_ids = move_obj.search(cr, uid, [
|
||||
('prodlot_id', '=', res_id),
|
||||
], limit=1)
|
||||
if move_ids:
|
||||
move_obj.write(cr, uid, move_ids, {'tracking_id': False})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
elif model == 'product.product':
|
||||
pack = tracking_obj.browse(cr, uid, obj.id)
|
||||
pack = tracking_obj.browse(cr, uid, obj.id)
|
||||
product_data = product_obj.browse(cr, uid,res_id)
|
||||
move_ids = move_obj.search(cr, uid, [
|
||||
('product_id', '=', product_data.id),
|
||||
], limit=1)
|
||||
], limit=1)
|
||||
if move_ids:
|
||||
move_obj.write(cr, uid, move_ids, {'tracking_id': False})
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
tracking_obj.write(cr, uid, obj.id, {'modified': True})
|
||||
|
||||
'''Call for a function who will display serial code list and product list in the pack layout'''
|
||||
tracking_obj.get_serials(cr, uid, ids, context=None)
|
||||
tracking_obj.get_products(cr, uid, ids, context=None)
|
||||
tracking_obj.get_products(cr, uid, ids, context=None)
|
||||
else:
|
||||
raise osv.except_osv(_('Warning!'),_('Barcode Not found!'))
|
||||
return {}
|
||||
return {}
|
||||
|
||||
stock_tracking()
|
||||
|
||||
class stock_scan_to_validate(osv.osv):
|
||||
|
||||
|
||||
_name = 'stock.scan.to.validate'
|
||||
_columns = {
|
||||
'tracking_id': fields.many2one('stock.tracking', 'Parent', readonly=True),
|
||||
'type': fields.selection([('in','To add'),('out','To remove')], 'Type', readonly=True),
|
||||
'barcode_id': fields.many2one('tr.barcode', 'Barcode', readonly=True),
|
||||
}
|
||||
|
||||
|
||||
_sql_constraints = [
|
||||
('tracking_barcode_unique', 'unique (tracking_id,barcode_id)', 'This barcode is already in the list to add or to remove !')
|
||||
]
|
||||
@@ -183,21 +183,21 @@ class stock_scan_to_validate(osv.osv):
|
||||
stock_scan_to_validate()
|
||||
|
||||
class stock_tracking_history(osv.osv):
|
||||
|
||||
|
||||
_inherit = "stock.tracking.history"
|
||||
|
||||
|
||||
def _get_types(self, cr, uid, context={}):
|
||||
res = super(stock_tracking_history, self)._get_types(cr, uid, context)
|
||||
if not res:
|
||||
res = []
|
||||
res = res + [('pack_in','Add parent'),('pack_out','Unlink parent')]
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'type': fields.selection(_get_types, 'Type'),
|
||||
'parent_id': fields.many2one('stock.tracking', 'Parent pack'),
|
||||
}
|
||||
|
||||
|
||||
stock_tracking_history()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -41,9 +41,9 @@ class one2many_special(fields.one2many):
|
||||
return res
|
||||
|
||||
class stock_tracking(osv.osv):
|
||||
|
||||
|
||||
_inherit = 'stock.tracking'
|
||||
|
||||
|
||||
def hierarchy_ids(self, tracking):
|
||||
result_list = [tracking]
|
||||
for child in tracking.child_ids:
|
||||
@@ -87,22 +87,22 @@ class stock_tracking(osv.osv):
|
||||
'serial_ids': fields.one2many('serial.stock.tracking', 'tracking_id', 'Products', readonly=True),
|
||||
'child_serial_ids': fields.function(_get_child_serials, method=True, type='one2many', obj='serial.stock.tracking', string='Child Serials'),
|
||||
}
|
||||
|
||||
|
||||
def _check_parent_id(self, cr, uid, ids, context=None):
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
if lines[0].parent_id:
|
||||
if lines[0].ul_id.capacity_index > lines[0].parent_id.ul_id.capacity_index:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
_constraints = [(_check_parent_id, 'Bad parent type selection. Please try again.',['parent_id'] ),]
|
||||
|
||||
|
||||
_defaults = {
|
||||
'state': 'open',
|
||||
'location_id': lambda x, y, z, c: c and c.get('location_id') or False,
|
||||
}
|
||||
|
||||
|
||||
def reset_open(self, cr, uid, ids, context=None):
|
||||
pack_ids = self.browse(cr, uid, ids, context)
|
||||
for pack in pack_ids:
|
||||
@@ -121,7 +121,7 @@ class stock_tracking(osv.osv):
|
||||
if allowed:
|
||||
self.write(cr, uid, [pack.id], {'state': 'open'})
|
||||
return True
|
||||
|
||||
|
||||
def set_close(self, cr, uid, ids, context=None):
|
||||
pack_ids = self.browse(cr, uid, ids, context)
|
||||
for pack in pack_ids:
|
||||
@@ -134,7 +134,7 @@ class stock_tracking(osv.osv):
|
||||
# if allowed:
|
||||
# self.write(cr, uid, [pack.id], {'state': 'close'})
|
||||
return True
|
||||
|
||||
|
||||
def get_products(self, cr, uid, ids, context=None):
|
||||
pack_ids = self.browse(cr, uid, ids, context)
|
||||
stock_track = self.pool.get('product.stock.tracking')
|
||||
@@ -153,7 +153,7 @@ class stock_tracking(osv.osv):
|
||||
for product in product_list.keys():
|
||||
stock_track.create(cr, uid, {'product_id': product, 'quantity': product_list[product], 'tracking_id': child.id})
|
||||
return True
|
||||
|
||||
|
||||
def get_serials(self, cr, uid, ids, context=None):
|
||||
pack_ids = self.browse(cr, uid, ids, context)
|
||||
serial_track = self.pool.get('serial.stock.tracking')
|
||||
@@ -179,7 +179,7 @@ class stock_tracking(osv.osv):
|
||||
stock_tracking()
|
||||
|
||||
class product_ul(osv.osv):
|
||||
_inherit = "product.ul"
|
||||
_inherit = "product.ul"
|
||||
_description = "Shipping Unit"
|
||||
_columns = {
|
||||
'capacity_index': fields.integer('Capacity index'),
|
||||
@@ -188,7 +188,7 @@ class product_ul(osv.osv):
|
||||
product_ul()
|
||||
|
||||
class product_stock_tracking(osv.osv):
|
||||
|
||||
|
||||
_name = 'product.stock.tracking'
|
||||
|
||||
_columns = {
|
||||
@@ -197,13 +197,13 @@ class product_stock_tracking(osv.osv):
|
||||
'tracking_id': fields.many2one('stock.tracking', 'Tracking'),
|
||||
# 'tracking_history_id': fields.many2one('stock.tracking.history', 'Tracking History'),
|
||||
}
|
||||
|
||||
|
||||
product_stock_tracking()
|
||||
|
||||
class serial_stock_tracking(osv.osv):
|
||||
|
||||
|
||||
_name = 'serial.stock.tracking'
|
||||
|
||||
|
||||
_order = 'tracking_id,serial_id'
|
||||
|
||||
_columns = {
|
||||
@@ -213,24 +213,24 @@ class serial_stock_tracking(osv.osv):
|
||||
'tracking_id': fields.many2one('stock.tracking', 'Tracking'),
|
||||
# 'tracking_history_id': fields.many2one('stock.tracking.history', 'Tracking History'),
|
||||
}
|
||||
|
||||
|
||||
serial_stock_tracking()
|
||||
|
||||
class stock_tracking_history(osv.osv):
|
||||
|
||||
_name = "stock.tracking.history"
|
||||
|
||||
|
||||
def _get_types(self, cr, uid, context={}):
|
||||
# res = [('pack_in','Add parent'),('pack_out','Unlink parent'),('move','Move')]
|
||||
res = []
|
||||
return res
|
||||
|
||||
|
||||
# def hierarchy_ids(self, tracking):
|
||||
# result_list = [tracking]
|
||||
# for child in tracking.child_ids:
|
||||
# result_list.extend(self.hierarchy_ids(child))
|
||||
# return result_list
|
||||
#
|
||||
#
|
||||
# def _get_child_products(self, cr, uid, ids, field_name, arg, context=None):
|
||||
# packs = self.browse(cr, uid, ids)
|
||||
# res = {}
|
||||
@@ -241,7 +241,7 @@ class stock_tracking_history(osv.osv):
|
||||
# for prod in child.product_ids:
|
||||
# res[pack.id].append(prod.id)
|
||||
# return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'tracking_id': fields.many2one('stock.tracking', 'Pack', required=True),
|
||||
'type': fields.selection(_get_types, 'Type'),
|
||||
@@ -250,29 +250,29 @@ class stock_tracking_history(osv.osv):
|
||||
# 'parent_hist_id': fields.many2one('stock.tracking.history', 'Parent history pack'),
|
||||
# 'child_ids': fields.one2many('stock.tracking.history', 'parent_hist_id', 'Child history pack'),
|
||||
}
|
||||
|
||||
|
||||
_rec_name = "tracking_id"
|
||||
|
||||
|
||||
stock_tracking_history()
|
||||
|
||||
'''Add a field in order to store the current pack in a production lot'''
|
||||
class stock_production_lot(osv.osv):
|
||||
_inherit = 'stock.production.lot'
|
||||
_inherit = 'stock.production.lot'
|
||||
_columns = {
|
||||
'tracking_id': fields.many2one('stock.tracking', 'pack'),
|
||||
}
|
||||
|
||||
|
||||
stock_production_lot()
|
||||
|
||||
class product_category(osv.osv):
|
||||
_inherit = 'product.category'
|
||||
class product_category(osv.osv):
|
||||
_inherit = 'product.category'
|
||||
_columns = {
|
||||
'tracked': fields.boolean('Need a serial code ?'),
|
||||
}
|
||||
}
|
||||
product_category()
|
||||
|
||||
class stock_inventory(osv.osv):
|
||||
_inherit = 'stock.inventory'
|
||||
_inherit = 'stock.inventory'
|
||||
_defaults = {
|
||||
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.inventory') or '/'
|
||||
}
|
||||
@@ -281,11 +281,11 @@ stock_inventory()
|
||||
class stock_move(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
_columns = {
|
||||
'move_ori_id': fields.many2one('stock.move', 'Origin Move', select=True),
|
||||
'move_ori_id': fields.many2one('stock.move', 'Origin Move', select=True),
|
||||
# 'cancel_cascade': fields.boolean('Cancel Cascade', help='If checked, when this move is cancelled, cancel the linked move too')
|
||||
}
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
result = super(stock_move,self).write(cr, uid, ids, vals, context)
|
||||
if not isinstance(ids, list):
|
||||
ids = [ids]
|
||||
@@ -295,9 +295,9 @@ class stock_move(osv.osv):
|
||||
if state == 'done' and move_ori_id:
|
||||
self.write(cr, uid, [move_ori_id.id], {'state':'done'}, context)
|
||||
return result
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
production_lot_obj = self.pool.get('stock.production.lot')
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
production_lot_obj = self.pool.get('stock.production.lot')
|
||||
stock_tracking_obj = self.pool.get('stock.tracking')
|
||||
if vals.get('prodlot_id',False):
|
||||
production_lot_data = production_lot_obj.browse(cr, uid, vals['prodlot_id'])
|
||||
@@ -307,9 +307,9 @@ class stock_move(osv.osv):
|
||||
if last_production_lot_move.tracking_id:
|
||||
ids = [last_production_lot_move.tracking_id.id]
|
||||
stock_tracking_obj.reset_open(cr, uid, ids, context=None)
|
||||
|
||||
|
||||
return super(stock_move,self).create(cr, uid, vals, context)
|
||||
|
||||
|
||||
stock_move()
|
||||
|
||||
class split_in_production_lot(osv.osv_memory):
|
||||
@@ -320,11 +320,11 @@ class split_in_production_lot(osv.osv_memory):
|
||||
_defaults = {
|
||||
'use_exist': lambda *a: True,
|
||||
}
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
res = super(split_in_production_lot, self).default_get(cr, uid, fields, context)
|
||||
res.update({'use_exist': True})
|
||||
return res
|
||||
|
||||
|
||||
split_in_production_lot()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -74,7 +74,7 @@ class stock_tracking(osv.osv):
|
||||
new_pack_data = self.browse(cr, uid, new_pack_id, context)
|
||||
'''loop on each move form the old pack to the new pack'''
|
||||
for pack_move in pack.current_move_ids:
|
||||
''''stock move creation'''
|
||||
'''stock move creation'''
|
||||
barcode_name = pack_move.prodlot_id.name
|
||||
barcode_data = barcode_obj.search(cr, uid,[('code', '=', barcode_name)], limit=1)
|
||||
move_id = stock_move_obj.create(cr, uid, {
|
||||
@@ -130,4 +130,4 @@ class stock_tracking_history(osv.osv):
|
||||
|
||||
stock_tracking_history()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user