I need to send data in a one2many field of a form to a a one2many field of a wizard [opens on a button click].. the wizard contains a one2many field of same format.. How to acheive this??
Parent CLass
class wrhouse(models.Model): wproductlist = fields.One2many(comodel_name="productlist1", inverse_name="ppp", string="Product List") @api.multi def Submittopm(self): result = { 'view_type': 'form', 'view_mode': 'form', 'res_model': 'submitquantwiz', 'name': 'Enter Quantity of Stock Needed', 'type': 'ir.actions.act_window', 'target': 'new', } return result
class productlist1(models.Model) _name = "productlist1" ppp = fields.Char(String="hai") _rec_name = "productname" productname = fields.Char(string="Product Name") reqquantity = fields.Char(string="Required Quantity") quantav = fields.Char(string="Product Available", onchange="pro_quantity") maxdate = fields.Date(string="Deadline Date")
Wizard Class
class wrhousesub(models.TransientModel): _name = 'submitquantwiz' No = fields.One2many(comodel_name="id",inverse_name="quant",string="Products") class wr(models.Model): _name = "id" # p = fields.Char(string="ff") products = fields.Many2one(comodel_name='productlist1',string="Product") quant = fields.Char(string="Quntities")
@jignesh mehta :
i cant chnage the productname to many2one because it is written from another class using create function
Ok. Then search product before append in line.