Hello,
I'm beginner and didn't find how to do probably a simple thing in Odoo.
I have my class A with :
class PurchOrderLine(models.Model):
_inherit = 'purchase.order.line'
history = fields.Many2one('app.purch.order.line.copy', string='Historique')
@api.onchange('product_id')
def onchange_partner_id(self):
print 'oooooooooooooooooo \n'
history = dict()
for i in self.search([('product_id', '=', self.product_id.id)]):
history[i.date_order] = i.product_qty
print history
History gives me values according to a product id, so if I select the product id 1 on this line it returns values like this ['date_order of product 1' : 'product quantity'] , [ ...] , ...
I want to display a Many2one field that i put on another class :
class PurchOrderLineCopy(models.Model):
_name = 'app.purch.order.line.copy'
_rec_name = 'history'
history = fields.Char(string='Historique')
But I really don't know how to push values. I tried to use self.env['app.purch.order.line.copy'].create(history) but that's not the good solution.
Thx