Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to access uid in xml

xml
By
Jack
on 5/30/13, 5:19 AM 6,775 views

Hiiiii

Please Do me a favour..

Thanks

2

Keyur

--Keyur--
1165
| 4 4 8
Ahmedabad, India
--Keyur--

Odoo Expert

Keyur
On 5/30/13, 6:50 AM

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.

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

Jack
on 5/30/13, 7:58 AM

Check my updated answer.

Keyur
on 5/30/13, 8:34 AM
0
Jack
On 5/30/13, 6:53 AM

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.....

0

Andreas Maertens

--Andreas Maertens--
912
| 5 5 7
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
On 5/30/13, 6:25 AM

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?

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.....

Jack
on 5/30/13, 6:41 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/30/13, 5:19 AM
Seen: 6775 times
Last updated: 3/16/15, 8:10 AM