fix: prevent edit for asset types, land types when app is mirror
This commit is contained in:
parent
3343524325
commit
2f84f76d89
4 changed files with 52 additions and 0 deletions
|
|
@ -78,6 +78,19 @@ class AssetTypeView(WuttaFarmMasterView):
|
|||
|
||||
return buttons
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
""" """
|
||||
wutta_config = config.registry.settings.get("wutta_config")
|
||||
app = wutta_config.get_app()
|
||||
|
||||
if app.is_farmos_mirror():
|
||||
cls.creatable = False
|
||||
cls.editable = False
|
||||
cls.deletable = False
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
def defaults(config, **kwargs):
|
||||
base = globals()
|
||||
|
|
|
|||
|
|
@ -129,6 +129,19 @@ class LandTypeView(AssetTypeMasterView):
|
|||
def get_row_action_url_view(self, land_asset, i):
|
||||
return self.request.route_url("land_assets.view", uuid=land_asset.uuid)
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
""" """
|
||||
wutta_config = config.registry.settings.get("wutta_config")
|
||||
app = wutta_config.get_app()
|
||||
|
||||
if app.is_farmos_mirror():
|
||||
cls.creatable = False
|
||||
cls.editable = False
|
||||
cls.deletable = False
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
class LandAssetView(AssetMasterView):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -128,6 +128,19 @@ class StructureTypeView(AssetTypeMasterView):
|
|||
def get_row_action_url_view(self, structure, i):
|
||||
return self.request.route_url("structure_assets.view", uuid=structure.uuid)
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
""" """
|
||||
wutta_config = config.registry.settings.get("wutta_config")
|
||||
app = wutta_config.get_app()
|
||||
|
||||
if app.is_farmos_mirror():
|
||||
cls.creatable = False
|
||||
cls.editable = False
|
||||
cls.deletable = False
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
class StructureAssetView(AssetMasterView):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -59,6 +59,19 @@ class MeasureView(WuttaFarmMasterView):
|
|||
# name
|
||||
g.set_link("name")
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
""" """
|
||||
wutta_config = config.registry.settings.get("wutta_config")
|
||||
app = wutta_config.get_app()
|
||||
|
||||
if app.is_farmos_mirror():
|
||||
cls.creatable = False
|
||||
cls.editable = False
|
||||
cls.deletable = False
|
||||
|
||||
cls._defaults(config)
|
||||
|
||||
|
||||
class UnitView(WuttaFarmMasterView):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue