from odoo import api, fields, models


class ProductTemplate(models.Model):
    _inherit = "product.template"

    origin = fields.Char()
    code_balance = fields.Integer("Balance Code")
    ingredients = fields.Text()
    expiration_date = fields.Date("Expiration Date")
    to_print = fields.Boolean(tracking=True)

    @api.model
    def get_price_member(self):
        param_value = (
            self.env["ir.config_parameter"]
            .sudo()
            .get_param("report_label_supermarket.label_pricelist")
        )
        pricelist = self.env["product.pricelist"].browse(int(param_value))
        price = pricelist._get_product_price(self, 1)
        taxes = self.taxes_id.compute_all(price, quantity=1, product=self)
        return taxes["total_included"]

    @api.model
    def get_price_public(self):
        param_value = (
            self.env["ir.config_parameter"]
            .sudo()
            .get_param("report_label_supermarket.label_public_pricelist")
        )
        pricelist = self.env["product.pricelist"].browse(int(param_value))
        price = pricelist._get_product_price(self, 1)
        taxes = self.taxes_id.compute_all(price, quantity=1, product=self)
        return taxes["total_included"]
