Change constraint on stock_production_lot
- used name, ref - improve check in the wizard - add migration script - add sequence bzr revid: ced-b00db02e7b10a2056497f311eecf0f3e334019ee
This commit is contained in:
parent
b7e0c8b78d
commit
6ca115af57
|
@ -600,8 +600,9 @@ class stock_production_lot(osv.osv):
|
|||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'stock.lot.serial'),
|
||||
}
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)', 'The serial must be unique !'),
|
||||
('name_ref_uniq', 'unique (name, ref)', 'The serial/ref must be unique !'),
|
||||
]
|
||||
|
||||
stock_production_lot()
|
||||
|
||||
class stock_production_lot_revision(osv.osv):
|
||||
|
|
|
@ -41,6 +41,15 @@
|
|||
<field name="name">Stock production lots</field>
|
||||
<field name="code">stock.lot.serial</field>
|
||||
</record>
|
||||
<record model="ir.sequence" id="sequence_production_lots">
|
||||
<field name="name">Stock production sequence</field>
|
||||
<field name="code">stock.lot.serial</field>
|
||||
<field name="prefix">1234567890</field>
|
||||
<field name="padding">7</field>
|
||||
<field name="number_next">1</field>
|
||||
<field name="number_increment">1</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.sequence.type" id="sequence_type_tracking">
|
||||
<field name="name">Stock Lot Tracking</field>
|
||||
<field name="code">stock.lot.tracking</field>
|
||||
|
|
|
@ -57,14 +57,17 @@ fields = {
|
|||
def _track_lines(self, cr, uid, data, context):
|
||||
move_id = data['id']
|
||||
|
||||
prodlot_obj = pooler.get_pool(cr.dbname).get('stock.production.lot')
|
||||
move_obj = pooler.get_pool(cr.dbname).get('stock.move')
|
||||
sequence = pooler.get_pool(cr.dbname).get('ir.sequence').get(cr, uid, 'stock.lot.serial')
|
||||
production_obj = pooler.get_pool(cr.dbname).get('mrp.production')
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
prodlot_obj = pool.get('stock.production.lot')
|
||||
move_obj = pool.get('stock.move')
|
||||
production_obj = pool.get('mrp.production')
|
||||
ir_sequence_obj = pool.get('ir.sequence')
|
||||
|
||||
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
|
||||
if not sequence:
|
||||
raise wizard.except_wizard('Error!', 'No production sequence defined')
|
||||
if data['form']['tracking_prefix']:
|
||||
sequence=data['form']['tracking_prefix']+'/'+(sequence or '')
|
||||
if not sequence:
|
||||
raise wizard.except_wizard('Error !', 'No tracking prefix defined')
|
||||
|
||||
move = move_obj.browse(cr, uid, [move_id])[0]
|
||||
quantity=data['form']['quantity']
|
||||
|
|
Loading…
Reference in New Issue