diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-07-22 09:55:08 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-07-22 09:55:08 +0700 |
| commit | e2d42ebca210467698f163558e6e4390dcecaae9 (patch) | |
| tree | b86fc1a2d5b30d04dfef6b7deef9424d06738503 /indoteknik_custom/models/product_template.py | |
| parent | 5d27587d8c84d74e4fa26f8aaf34843d0261b985 (diff) | |
add compute web price and stock vendor
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rw-r--r-- | indoteknik_custom/models/product_template.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index b2816d3f..61cf09e2 100644 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -17,3 +17,22 @@ class ProductTemplate(models.Model): x_lazada = fields.Text(string="Lazada") x_tokopedia = fields.Text(string="Tokopedia") +class ProductProduct(models.Model): + _inherit = "product.product" + web_price = fields.Float( + 'Web Price', compute='_compute_product_discount_price', + digits='Product Price', inverse='_set_product_lst_price', + help="Web Price with pricelist_id = 1") + qty_stock_vendor = fields.Float( + 'Qty Stock Vendor', compute='_compute_stock_vendor', + help="Stock Vendor") + + def _compute_product_discount_price(self): + for product in self: + product_pricelist_item = self.env['product.pricelist.item'].search([('pricelist_id', '=', 1),('product_id', '=', product.id)],limit=1) + product.web_price = product_pricelist_item.fixed_price + + def _compute_stock_vendor(self): + for product in self: + stock_vendor = self.env['stock.vendor'].search([('product_variant_id', '=', product.id)],limit=1) + product.qty_stock_vendor = stock_vendor.quantity+product.qty_available
\ No newline at end of file |
