Browse Source

[IMP] let user decide if a filter is private when saving it

for filter combinations, inherit user_id from the filter we combine it
with
pull/122/head
Holger Brunn 10 years ago
parent
commit
173ade0fd4
  1. 2
      web_advanced_filters/static/src/js/web_advanced_filters.js
  2. 1
      web_advanced_filters/view/ir_filters.xml
  3. 4
      web_advanced_filters/wizard/ir_filters_combine_with_existing.py

2
web_advanced_filters/static/src/js/web_advanced_filters.js

@ -171,6 +171,7 @@ openerp.web_advanced_filters = function(instance)
default_model_id: self.dataset._model.name, default_model_id: self.dataset._model.name,
default_domain: JSON.stringify(search.domain), default_domain: JSON.stringify(search.domain),
default_context: JSON.stringify(ctx), default_context: JSON.stringify(ctx),
default_user_id: JSON.stringify(false),
form_view_ref: 'web_advanced_filters.form_ir_filters_save_new', form_view_ref: 'web_advanced_filters.form_ir_filters_save_new',
}, },
}, },
@ -201,6 +202,7 @@ openerp.web_advanced_filters = function(instance)
] ]
), ),
default_context: JSON.stringify({}), default_context: JSON.stringify({}),
default_user_id: JSON.stringify(false),
form_view_ref: 'web_advanced_filters.form_ir_filters_save_new', form_view_ref: 'web_advanced_filters.form_ir_filters_save_new',
}, },
}, },

1
web_advanced_filters/view/ir_filters.xml

@ -37,6 +37,7 @@
<group> <group>
<field name="name" /> <field name="name" />
<field name="is_default"/> <field name="is_default"/>
<field name="user_id" domain="[('id', '=', uid)]" widget="selection" />
</group> </group>
<footer> <footer>
<button class="oe_highlight" type="object" name="button_save" string="Save" /> <button class="oe_highlight" type="object" name="button_save" string="Save" />

4
web_advanced_filters/wizard/ir_filters_combine_with_existing.py

@ -62,7 +62,7 @@ class IrFiltersCombineWithExisting(TransientModel):
'domain': str(domain), 'domain': str(domain),
'context': this.context, 'context': this.context,
'model_id': this.model, 'model_id': this.model,
'user_id': uid,
'user_id': this.filter_id.user_id.id or False,
})], })],
}) })
elif this.action == 'complement': elif this.action == 'complement':
@ -81,7 +81,7 @@ class IrFiltersCombineWithExisting(TransientModel):
'domain': str(domain), 'domain': str(domain),
'context': this.context, 'context': this.context,
'model_id': this.model, 'model_id': this.model,
'user_id': uid,
'user_id': this.filter_id.user_id.id or False,
})], })],
}) })

Loading…
Cancel
Save