mercredi 17 avril 2019

is there anyway in Odoo to use it for sell product in multi names but the same in inventory?

i'am working on a project to autoparts company i'am facing problem in selling a product that can be suitable for KIA and also for Hunday as example there is one product in stock but we need to display more than one , every one with different name but with the same QTY (quantity on Hand) any Idea ???

actually product name is computed field concatenate some fields strings (Item,car,model,year,origin,....)

class autopart(models.Model):
_inherit = 'product.template'

@api.multi
@api.depends('item', 'car', 'model', 'dsc', 'drc', 'year', 'org')
def compute_amount(self):
    for rec in self:
        rec.name = " ".join(
            [rec.item and rec.item.name or "", rec.car and rec.car.name or "", rec.model and rec.model.name or "",
             rec.dsc and rec.dsc.name or "", rec.drc and rec.drc.name or "", rec.org and rec.org.name or "",
             rec.year and rec.year.name or ""])
name = fields.Char(string="Name", required=False ,compute=compute_amount,)

Aucun commentaire:

Enregistrer un commentaire