Coffee
This commit is contained in:
@@ -1106,6 +1106,16 @@ class CoffeeLineMixin:
|
||||
def on_change_with_active_coffee_compatibility(self, name=None):
|
||||
return self.get_active_coffee_compatibility(name)
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
attributes = super().view_attributes()
|
||||
if not coffee_compatibility_active():
|
||||
attributes += [
|
||||
('//page[@id="coffee_quality"]', 'states',
|
||||
{'invisible': True}),
|
||||
]
|
||||
return attributes
|
||||
|
||||
def get_coffee_quality_status(self, name=None):
|
||||
samples = self._coffee_samples()
|
||||
if not samples:
|
||||
|
||||
@@ -177,6 +177,7 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
cls.default_active_coffee_compatibility()))
|
||||
for values in vlist)
|
||||
cls._sync_coffee_menu_visibility(records, active=active)
|
||||
cls._clear_coffee_view_cache()
|
||||
return records
|
||||
|
||||
@classmethod
|
||||
@@ -190,6 +191,8 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
records = sum(args[::2], [])
|
||||
cls._sync_report_labels(records)
|
||||
cls._sync_coffee_menu_visibility(records, active=active)
|
||||
if active is not None:
|
||||
cls._clear_coffee_view_cache()
|
||||
|
||||
@classmethod
|
||||
def _sync_report_labels(cls, records):
|
||||
@@ -231,3 +234,7 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
if menus:
|
||||
with Transaction().set_user(0):
|
||||
Menu.write(menus, {'active': active})
|
||||
|
||||
@classmethod
|
||||
def _clear_coffee_view_cache(cls):
|
||||
ModelView._fields_view_get_cache.clear()
|
||||
|
||||
Reference in New Issue
Block a user