# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, Id
from trytond.model import (ModelSQL, ModelView)

class Template(metaclass=PoolMeta):
    __name__ = 'product.template'

    month = fields.One2Many('product.product.month', 'product', 
        "Period")

class Product(metaclass=PoolMeta):
    __name__ = 'product.product'

class Month(ModelView, ModelSQL):
    "Month"
    __name__ = 'product.month'
    _rec_name = 'month_name'
    month_name = fields.Char("Month")
    is_cotation = fields.Boolean("Cotation month")
    beg_date = fields.Date("Date from")
    end_date = fields.Date("Date end")
    description = fields.Char("Description")

class ProductMonth(ModelView, ModelSQL):
    "Product month"
    __name__ = 'product.product.month'
    product = fields.Many2One('product.product',"Product")
    month = fields.Many2One('product.month',"Month")
