[FIX] mrp repair for quants
bzr revid: fp@openerp.com-20130803065054-w2w3s2dafgvvebtm
This commit is contained in:
parent
f1745f9a46
commit
60015d481a
|
@ -25,6 +25,8 @@ from dateutil.relativedelta import relativedelta
|
|||
from openerp.tools.translate import _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
# TODO: replace move_id by quant_id everywhere
|
||||
|
||||
class mrp_repair(osv.osv):
|
||||
_name = 'mrp.repair'
|
||||
_inherit = 'mail.thread'
|
||||
|
@ -119,7 +121,6 @@ class mrp_repair(osv.osv):
|
|||
'partner_id' : fields.many2one('res.partner', 'Partner', select=True, help='Choose partner for whom the order will be invoiced and delivered.', states={'confirmed':[('readonly',True)]}),
|
||||
'address_id': fields.many2one('res.partner', 'Delivery Address', domain="[('parent_id','=',partner_id)]", states={'confirmed':[('readonly',True)]}),
|
||||
'default_address_id': fields.function(_get_default_address, type="many2one", relation="res.partner"),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number', select=True, states={'draft':[('readonly',False)]},domain="[('product_id','=',product_id)]"),
|
||||
'state': fields.selection([
|
||||
('draft','Quotation'),
|
||||
('cancel','Cancelled'),
|
||||
|
@ -203,7 +204,6 @@ class mrp_repair(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
return {'value': {
|
||||
'prodlot_id': False,
|
||||
'move_id': False,
|
||||
'guarantee_limit' :False,
|
||||
'location_id': False,
|
||||
|
@ -219,7 +219,7 @@ class mrp_repair(osv.osv):
|
|||
@return: Dictionary of values.
|
||||
"""
|
||||
data = {}
|
||||
data['value'] = {'guarantee_limit': False, 'location_id': False, 'prodlot_id': False, 'partner_id': False}
|
||||
data['value'] = {'guarantee_limit': False, 'location_id': False, 'partner_id': False}
|
||||
if not prod_id:
|
||||
return data
|
||||
if move_id:
|
||||
|
@ -229,7 +229,6 @@ class mrp_repair(osv.osv):
|
|||
data['value']['guarantee_limit'] = limit.strftime('%Y-%m-%d')
|
||||
data['value']['location_id'] = move.location_dest_id.id
|
||||
data['value']['location_dest_id'] = move.location_dest_id.id
|
||||
data['value']['prodlot_id'] = move.prodlot_id.id
|
||||
if move.partner_id:
|
||||
data['value']['partner_id'] = move.partner_id.id
|
||||
else:
|
||||
|
@ -285,7 +284,6 @@ class mrp_repair(osv.osv):
|
|||
|
||||
if not lot:
|
||||
return data
|
||||
move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot)])
|
||||
|
||||
if not len(move_ids):
|
||||
return data
|
||||
|
@ -329,7 +327,7 @@ class mrp_repair(osv.osv):
|
|||
else:
|
||||
self.write(cr, uid, [o.id], {'state': 'confirmed'})
|
||||
for line in o.operations:
|
||||
if line.product_id.track_production and not line.prodlot_id:
|
||||
if line.product_id.track_production:
|
||||
raise osv.except_osv(_('Warning!'), _("Serial number is required for operation line with product '%s'") % (line.product_id.name))
|
||||
mrp_line_obj.write(cr, uid, [l.id for l in o.operations], {'state': 'confirmed'})
|
||||
return True
|
||||
|
@ -516,7 +514,6 @@ class mrp_repair(osv.osv):
|
|||
'location_id': move.location_id.id,
|
||||
'location_dest_id': move.location_dest_id.id,
|
||||
'tracking_id': False,
|
||||
'prodlot_id': move.prodlot_id and move.prodlot_id.id or False,
|
||||
'state': 'done',
|
||||
})
|
||||
repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id, 'state': 'done'}, context=context)
|
||||
|
@ -537,7 +534,6 @@ class mrp_repair(osv.osv):
|
|||
'picking_id': picking,
|
||||
'product_id': repair.product_id.id,
|
||||
'product_uom': repair.product_id.uom_id.id,
|
||||
'prodlot_id': repair.prodlot_id and repair.prodlot_id.id or False,
|
||||
'partner_id': repair.address_id and repair.address_id.id or False,
|
||||
'location_id': repair.location_id.id,
|
||||
'location_dest_id': repair.location_dest_id.id,
|
||||
|
@ -639,7 +635,6 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
|||
'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'),
|
||||
'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product Unit of Measure'), required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number',domain="[('product_id','=',product_id)]"),
|
||||
'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, select=True),
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
<field name="address_id" groups="sale.group_delivery_invoice_address"/>
|
||||
<field name="move_id" on_change="onchange_move_id(product_id, move_id)" context="{'default_product_id':product_id}"/>
|
||||
<field name="location_id" attrs="{'required':[('deliver_bool','=', True)]}" groups="stock.group_locations"/>
|
||||
<field name="prodlot_id" on_change="onchange_lot_id(prodlot_id,product_id)" groups="stock.group_production_lot" string="Serial Number"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="guarantee_limit"/>
|
||||
|
@ -78,7 +77,6 @@
|
|||
<field name="to_invoice"/>
|
||||
<field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/>
|
||||
<field name="invoiced"/>
|
||||
<field name='prodlot_id' groups="stock.group_production_lot" string="Serial Number"/>
|
||||
<field name="location_id" groups="stock.group_locations"/>
|
||||
<field name="location_dest_id" groups="stock.group_locations"/>
|
||||
</group>
|
||||
|
@ -95,7 +93,6 @@
|
|||
<field name="type" on_change="onchange_operation_type(type,parent.guarantee_limit,parent.company_id,context)"/>
|
||||
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
|
||||
<field name='name'/>
|
||||
<field name="prodlot_id" groups="stock.group_production_lot" string="Serial Number"/>
|
||||
<field name="location_id" groups="stock.group_locations"/>
|
||||
<field name="location_dest_id" groups="stock.group_locations"/>
|
||||
<field name="product_uom_qty" string="Quantity"/>
|
||||
|
|
Loading…
Reference in New Issue