I have a one2many field in product form to keep unique serial numbers of the product. All serial numbers are linked to a location. This location can belong to any warehouse and can be at nth number in hierarchy.
While creating a sale order , after selecting product in sale order line. I need to select available serial numbers of the selected product in sale order sub line. Here I need a domain such a way that only serial number should be shown in sale order sub line which exist in the selected shop's warehouse.
I need to apply domain on 'unique_code' in 'sale_granite_line' class class structure is given below.
How to return domain on the same? Any help would be appreciated. Thank You.
class sale_order_line(osv.osv):
_inherit="sale.order.line"
_columns={
'sub_order_lines':fields.one2many('sale.granite.line','sale_line_id','Size'),
}
class sale_granite_line(osv.osv):
_name='sale.granite.line'
_columns={
'sale_line_id':fields.many2one('sale.order.line'),
'unique_code':fields.many2one('product.serial.lines','Code',required=True),
}
class product_product(osv.osv):
_inherit="product.product"
_columns={
'product_serial_lines':fields.one2many('product.serial.lines','product_id','Product Serial Lines'),
}
class product_serial_lines(osv.osv):
_name='product.serial.lines'
_columns={
'name':fields.char('Serial No'),
'product_id':fields.many2one('product.product','Product',ondelete="cascade"),
'product_location':fields.many2one('stock.location','Location',required=True,ondelete="cascade"),
}