credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #03890
Re: [Question #181045]: How to access 'user' object from domain in action record
Question #181045 on OpenERP Server changed:
https://answers.launchpad.net/openobject-server/+question/181045
Status: Answered => Solved
Chertykov Denis confirmed that the question is solved:
Thanks for reply.
This is an example.
Look to USER_PARTNER_IDS and USER_PAYMENT_MODE_IDS.
Part of example.xml:
<record id="action_income_payment_line_tree" model="ir.actions.act_window">
<field name="name">Входящие платежи</field>
<field name="res_model">payment.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="limit">300</field>
<field name="context">{"search_default_today":1}</field>
<field name="domain">[('partner_id','in','USER_PARTNER_IDS')]</field>
<field name="search_view_id" ref="view_payment_line_search"/>
</record>
<record id="action_outgoing_payment_line_tree" model="ir.actions.act_window">
<field name="name">Исходящие платежи</field>
<field name="res_model">payment.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="limit">300</field>
<field name="context">{"search_default_today":1}</field>
<field name="domain">[('payment_mode','in','USER_PAYMENT_MODE_IDS')]</field>
<field name="search_view_id" ref="view_payment_line_search"/>
</record>
Part of example.py:
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False, xtra=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
new_args = []
for arg in args:
if type(arg) is not tuple:
new_args += arg
continue
if arg[2] == 'USER_PARTNER_IDS':
new_args += [(arg[0], arg[1], [p.id for p in user.partner_ids])]
elif arg[2] == 'USER_PAYMENT_MODE_IDS':
new_args += [(arg[0], arg[1], [m.id for m in user.payment_mode_ids])]
else:
new_args += [arg]
return super(payment_line, self).search(cr, uid, new_args, offset, limit, order, context, count)
--
You received this question notification because you are a member of
OpenERP Framework Experts, which is an answer contact for OpenERP
Server.