diff --git a/hotel/models/inherited_product_pricelist.py b/hotel/models/inherited_product_pricelist.py index 095a19cfa..cae65df63 100644 --- a/hotel/models/inherited_product_pricelist.py +++ b/hotel/models/inherited_product_pricelist.py @@ -8,10 +8,10 @@ class ProductPricelist(models.Model): 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.") + pricelist_type = fields.Selection([ + ('daily', 'Daily Plan'), + ], string='Pricelist Type', default='daily') + @api.multi @api.depends('name') def name_get(self): diff --git a/hotel_channel_connector/models/product_pricelist/common.py b/hotel_channel_connector/models/product_pricelist/common.py index 3a2dfed17..f2257a721 100644 --- a/hotel_channel_connector/models/product_pricelist/common.py +++ b/hotel_channel_connector/models/product_pricelist/common.py @@ -82,9 +82,10 @@ class ProductPricelist(models.Model): inverse_name='odoo_id', string='Hotel Channel Connector Bindings') - is_virtual_plan = fields.Boolean("Is a Virtual Pricing Plan", compute='_compute_virtual_plan', - help="A virtual plan is based on another Pricelist " - "with a fixed or percentage variation.") + + pricelist_type = fields.Selection(selection_add=[ + ('virtual', 'Virtual Plan'), + ]) @api.depends('item_ids') def _compute_virtual_plan(self): @@ -137,8 +138,7 @@ class ProductPricelist(models.Model): action['context'] = { 'default_odoo_id': self.id, 'default_name': self.name, - 'default_is_daily_plan': self.is_daily_plan, - 'default_is_virtual_plan': self.is_virtual_plan, + 'default_pricelist_plan': self.pricelist_type, } return action @@ -160,7 +160,7 @@ class BindingProductPricelistListener(Component): if 'name' in fields: for binding in record.channel_bind_ids: binding.update_plan_name() - if 'item_ids' in fields and record.is_virtual_plan: + if 'item_ids' in fields and record.pricelist_type == 'virtual': for binding in record.channel_bind_ids: binding.modify_vplan() @@ -172,10 +172,10 @@ class ChannelBindingProductPricelistListener(Component): @skip_if(lambda self, record, **kwargs: self.no_connector_export(record)) def on_record_create(self, record, fields=None): - if record.is_virtual_plan: - record.create_vplan() - else: + if record.pricelist_type == 'daily': record.create_plan() + elif record.pricelist_type == 'virtual': + record.create_vplan() @skip_if(lambda self, record, **kwargs: self.no_connector_export(record)) def on_record_unlink(self, record, fields=None): diff --git a/hotel_channel_connector/views/channel_product_pricelist_views.xml b/hotel_channel_connector/views/channel_product_pricelist_views.xml index 0c01b053c..5c836ac70 100644 --- a/hotel_channel_connector/views/channel_product_pricelist_views.xml +++ b/hotel_channel_connector/views/channel_product_pricelist_views.xml @@ -13,8 +13,7 @@ - - + diff --git a/hotel_channel_connector/views/inherited_product_pricelist_views.xml b/hotel_channel_connector/views/inherited_product_pricelist_views.xml index c059a6bea..5f4394e36 100644 --- a/hotel_channel_connector/views/inherited_product_pricelist_views.xml +++ b/hotel_channel_connector/views/inherited_product_pricelist_views.xml @@ -23,8 +23,7 @@ - - +