# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

import logging

from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError

from odoo.addons import decimal_precision as dp


_logger = logging.getLogger(__name__)


class ProductIngredientsLines(models.Model):
    _name = "product.ingredients.lines"
    _description = "Product Ingredients Lines"

    ingredient_id = fields.Many2one('product.ingredients', 'Ingredients')
    product_id = fields.Many2one('product.template', 'Product')
    sequence = fields.Integer("Sequence")

class ProductIngredients(models.Model):
    _name = "product.ingredients"
    _description = "Product Ingredients"

    _sql_constraints = [
        ('id_iconic_uniq', 'unique(id_iconic)', "iconic ID must be unique!"),
    ]

    id_iconic = fields.Char("ID iconic", copy=False)
    name = fields.Char('Name', translate=True, required=True)
    description = fields.Text('Description', translate=True)
    slug = fields.Char("slug")

