This question has been flagged
3 Replies
18611 Views

Hiiiii

Please Do me a favour..

Thanks

Avatar
Discard
Best Answer

Hi Jack, there are two ways to use uid in xml:

(1) You can use uid in xml by domain

Here is the example,

<search>
    <filter string="My Entries" domain="[('user_id','=',uid)]" icon="terp-personal"/>
</search>

Or you can refer addons modules,

Here is the link for version 6.0 example and version 7.0 example

(2) You can pass uid as context in action

<record id="my_action" model="ir.actions.act_window">
    <field name="name">My Action</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">my.model</field>
    <field name="view_type">form</field>
    <field name="context">{"search_default_user_id":uid}</field>
    <field name="view_id" ref="my_tree_view"/>
</record>

You can hide Confirm Sale button by assigning group to them. And assign only those users to that group to whom you want to show confirm sale button.

<button name="order_confirm" states="draft" string="Confirm Order" groups="your_module.your_group"/>

So it will show to only those users which are assigned to your_group.

First make user in your xml file

Like this:

    <record id="your_module.captain_jack" model="res.users">
        <field name="login">jakes</field>
        <field name="password">captainjake007</field>
        <field name="name">Jakes Sparrow</field>
        <field name="signature">Captain Jakes Sparrow</field>
    </record>

So now user is created. Now make a group and assign this user to your new group

Like this:

    <record model="res.groups" id="your_group">
        <field name="name">Group of Pirates</field>
        <field name="users" eval="[(4,ref('your_module.captain_jack'))]"/>
    </record>

Thanks.

Avatar
Discard
Author

hiiiiiiii.................how we can make groups?

Check my updated answer.

Best Answer

Some more informations would be great.

You may need to add a function to your model to get the uid. What are you trying to do?

Avatar
Discard
Author

I want to remove the "Confirm Sale" button from the sales order for some user.....For this i want the uid to acces in xml by which i can put "attrs" for "Confirm Sale" button.....

Author Best Answer

I want to remove the "Confirm Sale" button from the sales order for some user.....For this i want the uid to acces in xml by which i can put "attrs" for "Confirm Sale" button.....

Avatar
Discard