mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] use same UI as when saving a normal filter
This commit is contained in:
@@ -60,6 +60,11 @@ msgstr "Testen %s"
|
||||
msgid "or"
|
||||
msgstr "or"
|
||||
|
||||
#. module: web_advanced_filters
|
||||
#: field:ir.filters,save_as_public:0
|
||||
msgid "Share with all users"
|
||||
msgstr "Deel met alle gebruikers"
|
||||
|
||||
#. module: web_advanced_filters
|
||||
#: field:ir.filters,complement_filter_ids:0
|
||||
msgid "Remove result of filters"
|
||||
|
||||
@@ -164,11 +164,18 @@ class IrFilters(Model):
|
||||
_evaluate_get, type='boolean', multi='evaluate',
|
||||
string='Always evaluate this filter before using it',
|
||||
help='This is necessary if this filter contains x2many fields with'
|
||||
'_auto_join activated')
|
||||
'_auto_join activated'),
|
||||
'save_as_public': fields.function(
|
||||
lambda self, cr, uid, ids, *args, **kwargs:
|
||||
dict((i, False) for i in ids),
|
||||
fnct_inv=lambda *args, **kwargs: None,
|
||||
type='boolean',
|
||||
string='Share with all users'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': True,
|
||||
'save_as_public': False,
|
||||
}
|
||||
|
||||
def _evaluate(self, cr, uid, ids, context=None):
|
||||
@@ -245,3 +252,8 @@ class IrFilters(Model):
|
||||
"update ir_module_module set state='to remove' where "
|
||||
"name='advanced_filters' and state not in "
|
||||
"('uninstalled', 'to remove')")
|
||||
|
||||
def create(self, cr, uid, values, context=None):
|
||||
values.setdefault(
|
||||
'user_id', False if values.get('save_as_public') else uid)
|
||||
return super(IrFilters, self).create(cr, uid, values, context=context)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="is_default"/>
|
||||
<field name="user_id" domain="[('id', '=', uid)]" widget="selection" />
|
||||
<field name="save_as_public" />
|
||||
</group>
|
||||
<footer>
|
||||
<button class="oe_highlight" type="object" name="button_save" string="Save" />
|
||||
|
||||
Reference in New Issue
Block a user