跳至內容
選單
此問題已被標幟

class ProductTemplate(models.Model):

    _inherit = 'product.template'
    x_brand_name = fields.Char(string='Brand Name')
    x_est_location = fields.Char(string='EST Location')
    x_merchant_id = fields.Many2one('res.partner', string='Merchant Name')
    x_merchant_reference = fields.Char(string='Merchant Reference')
    current_location = fields.Char(string="Current Location", compute="_compute_current_location")
    lot_ids = fields.Many2one(string="lot", comodel_name='stock.production.lot', related="location_id.lot_id", store=True)

     def _compute_current_location(self): ...


 My goal is to add an attribute 'lot_ids' to this model, but this attribute is related to either 'stock.quant' or 'stock.production.lot'. I know that 'lot_id' is a Many2one field, but I'm not sure exactly how to implement this.

Can anyone guide me through this issue? Thanks in advance.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 23
2197
1
10月 22
2909
2
4月 23
6196
2
9月 21
3125
3
12月 19
5786