Browse Source

[IMP] use same UI as when saving a normal filter

pull/122/head
Holger Brunn 10 years ago
parent
commit
a7c29dfe49
  1. 5
      web_advanced_filters/i18n/nl.po
  2. 14
      web_advanced_filters/model/ir_filters.py
  3. 2
      web_advanced_filters/view/ir_filters.xml

5
web_advanced_filters/i18n/nl.po

@ -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"

14
web_advanced_filters/model/ir_filters.py

@ -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)

2
web_advanced_filters/view/ir_filters.xml

@ -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" />

Loading…
Cancel
Save