diff --git a/pos_restaurant_floor_facility/__manifest__.py b/pos_restaurant_floor_facility/__manifest__.py index d087d3d69..cb29d9152 100644 --- a/pos_restaurant_floor_facility/__manifest__.py +++ b/pos_restaurant_floor_facility/__manifest__.py @@ -22,7 +22,7 @@ ############################################################################## { 'name': 'Floor Wise Charge in Restaurant', - 'version': '10.0.1.0.0', + 'version': '10.0.2.0.0', 'summary': """Product Price Change Based on Floor of POS Restaurant.""", 'description': """Module adds the facility charge of floor with each products in POS restaurant""", 'author': 'Cybrosys Techno Solutions', diff --git a/pos_restaurant_floor_facility/models/pos_restaurant_extra_facility.py b/pos_restaurant_floor_facility/models/pos_restaurant_extra_facility.py index eca871610..0bc13b9c9 100644 --- a/pos_restaurant_floor_facility/models/pos_restaurant_extra_facility.py +++ b/pos_restaurant_floor_facility/models/pos_restaurant_extra_facility.py @@ -28,14 +28,16 @@ class FacilityRestaurant(models.Model): _inherit = "restaurant.floor" rest_floor_facility = fields.One2many('restaurant.floor.line', 'ref_field', string='Floor Facility') - facility_service_percentage = fields.Float(string="Active Facility Charge %", readonly=True) + facility_service_percentage = fields.Float(compute='onchange_rest_facility', string="Active Facility Charge %") - @api.onchange('rest_floor_facility') - def onchange_facility(self): + @api.multi + @api.depends('rest_floor_facility') + def onchange_rest_facility(self): sum_of_percentage = 0.0 - for records in self.rest_floor_facility: - sum_of_percentage += records.line_percentage - self.facility_service_percentage = sum_of_percentage + if self.rest_floor_facility: + for records in self.rest_floor_facility: + sum_of_percentage += records.line_percentage + self.facility_service_percentage = sum_of_percentage class FacilityRestaurantLines(models.Model):