I have two model and code is given below
class SellProduct (models.Model):
_name = 'sell.product'
_rec_name = 'product_seq'
# def product (self): # name = self.env ['product.create']. search ([]) # print (name ) product_seq = fields.Many2one ( comodel_name = "product.create" , string = "Product ID" , required = False ,) product_name = fields.Char ( related = 'product_seq.product_name' , string = "Product Name" ,required = False ,)
sell_product_quantity = fields.Integer ( string = "Product Quantity" , required = True ,)
gold_price_new = fields.Integer ( string = "Total Price" , compute = 'compute_price' , store = True ,)
payment = fields.Integer ( string = "Payment" )
due_amount = fields.Integer (string = "Due" , compute = 'due_compute' , store = True )
company_id = fields.Many2one ( 'res.company' , 'Company' , required = True , index = True ,
default = lambda self: self.env.company .id)
currency_id = fields.Many2one ( "res.currency" , string = "Currency" , readonly = True ,
default = lambdaself: self.env.company.currency_id.id, required = True )
sell_line = fields.Many2one ( comodel_name = "product.create" , string = "Sell Line" , required = False ,)
class ProductCreate (models.Model):
_name = 'product.create'
_inherit = [ 'mail.thread' , 'mail.activity.mixin' ,]
_rec_name = 'product_seq'
@ api.depends ( 'create_sell_line' , 'create_sell_line. sell_product_quantity ' ) def update_value ( self ): for rec in self : rec.product_quantity_new = rec.create_sell_line.sell_product_quantity product_seq = fields.Char ( string = ' PID ' ,required =
True , copy = False ,
randomly = True , index = True ,
default = lambda self: _ ( 'New' ))
product_name = fields.Char ( string = "Product Name" )
product_image = fields.Binary ( string = "Product Image " )
product_quantity_new = fields.Integer ( compute = 'update_value' )
product_quantity = fields.Integer ( string = "Product Quantity" ,)
gold_quality = fields.Selection ( string = "Gold Quality" , selection = [( '18k' , '18K' ), ( '21k' , '21K' ), ( '22k' , '22K' )],
required = True ,)
gold_rate = fields.Integer ( string = "Gold Rate" )
gold_weight = fields.Float ( string = "Weight / Gram" , required = True )
making_cost = fields.Integer ( string = " Making Cost")
gold_price = fields.Integer ( string = "Sub-total Price" , compute = 'compute_sub_total_price' , store = True )
tax = fields.Integer ( string = "Tax" , )
tax_cal = fields.Integer ( string = "tax Calculation" , compute = 'compute_tax' , store = True )
total_cost = fields.Integer ( string= "Total Price" , compute = 'compute_total_price' , store = True )
create_sell_line = fields.One2many ( comodel_name = "sell.product" , inverse_name = "sell_line" , string = "create sell line" ,
required = False ,)
Fom sell.product model, sell_product_quantity field's value will be store product.create model's prouct_quantity_new field
How to solve this problem?