Skip to Content
Menu
This question has been flagged
553 Views

I have created a selection field in lines model sample code below:

class model1 (model.Model)

     -name = "model1.model1"

selection_field = fields.Selection ( string = "Select Reason" , 
selection = [( 'returned' , 'Returned' ) , ( 'damage' , 'Damaged' ) , ( 'stolen' , 'Stolen' ) , ( 'broken' , 'Broken' ) , ] , required = True , store = True )
 

Then created another model

class InventoryProductStock (models.Model): 
_inherit = "product.template"
balance_stock = fields.Float ( 'Balance Stock' , digits = ( 12 , 2 ) , store = True , compute = '_amount_quantity' )



I want to affect that balance stock according to what is selected in model1 if is returned then I will increase the stock if is stolen then I will reduce the stock. 

Avatar
Discard