summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_pricelist.py
blob: 4ea2b9ef002c9be675f017b070ff7a4484427b76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from odoo import models, fields, api


class PurchasePricelist(models.Model):
    _name = 'purchase.pricelist'
    _rec_name = 'product_id'

    name = fields.Char(string='Name', compute="_compute_name")
    product_id = fields.Many2one('product.product', string="Product", required=True)
    vendor_id = fields.Many2one('res.partner', string="Vendor", required=True)
    product_price = fields.Float(string='Price', required=True)

    @api.depends('product_id', 'vendor_id')
    def _compute_name(self):
        self.name = self.vendor_id.name + ', ' + self.product_id.name