Files
pms/hotel/models/inherited_product_pricelist.py
2019-03-05 01:34:44 +01:00

30 lines
1.1 KiB
Python

# Copyright 2017 Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
class ProductPricelist(models.Model):
_inherit = 'product.pricelist'
is_staff = fields.Boolean('Is Staff')
is_daily_plan = fields.Boolean('Daily Pricing Plan', default=True,
help = "Check if the pricing plan is daily. "
"Note that only daily plans can be edited on "
"the Hotel Calendar Management.")
@api.multi
@api.depends('name')
def name_get(self):
pricelist_id = self.env['ir.default'].sudo().get(
'res.config.settings', 'default_pricelist_id')
if pricelist_id:
pricelist_id = int(pricelist_id)
org_names = super(ProductPricelist, self).name_get()
names = []
for name in org_names:
if name[0] == pricelist_id:
names.append((name[0], '%s (Default)' % name[1]))
else:
names.append((name[0], name[1]))
return names