How to add a custom fields created in Employee Module to Leave Request Module in openerp 8? - odoo

I had created two new fields in for Employee Model via the database structure and modified the form view of employee model to display both the fields. They are displaying perfectly. Now I want to refer to these new fields in the Leave Request Module. I don't know how to display it. I tried adding it similarly like I did for Employee Model but it doesn't help. Could you help in achieving this?

what is the code you've got so far?
are you using xpath?
this might be the solulation for your problem.
<xpath expr="//field[#name='thenameofthefieldfromcurrentview']" position="after">
<field name="thenameofthefieldyouwanthere"/>
</xpath>

Related

Odoo11 - Restrict user assignment to project team members

I downloaded the .exe file of the community edition of odoo 11, installed it on a windows server and configured rules, that projects can only be seen by users who are assigned to the project as team members.
That works fine!
Now, in a task I want to restrict the options in the "assigned to" dropdown of a task: In the dropdown I want to see only users, who are actually assigned to that project. At the moment I can see all existing users and can assign the task to any of them.
In the form view I tried to restrict the list as follows by adding the domain attribute:
<field name="user_id" class="o_task_user_field" domain="('user_id','in', [project.members])" />
This gives an error on save.
Field 'project' used in attributes must be present in view but is missing
Update: 2. approach:
I tried to update the field user_id in model project.task and set the domain as follows:
('project_id.members','in', [user.id])
But I got the error (translated from german): you cannot make changes in a basic field!
How can I limit the options in the dropdown (without making code changes as I donĀ“t have the code forked from github)?
Any help appreciated!
Thanks
For this you just need to update one onchange and in that add domain. No need to add it from xml. There is by default onchange_projectmethod is there. In that you just inherit it and add one line..
result.update({'domain':{'user_id':[('project_ids','in',project_id)]}})

Extend list view and add custom styling [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am working with one2many list view and there is a state column in that i want to add custom css based on state of the object. Like if state is Completed make the text bold and background green somthing like that for other states. I tried but didn't found any way to add custom css or css classes based on condition. So i am now trying to extend list view in javascript and then i will loop through all rows and then add colors on them . Is this possible in Odoo ?
This can help if you want to change the entire row:
<field name="line_ids" >
<tree string="Lines" colors="red:state=='completed'" fonts="bold:state=='completed'">
<field name="name"/>
<field name="employee_id"/>
<field name="state"/>
</tree>
</field>
But if you want to change just one column maybe this post can help you: Bold in listview for many records
I hope I've helped.

Odoo switches pages when they become visible

I added additional pages (tabs) to a form view. Also I have a boolean field. For example.: lets say at view_partner_form when I click is a customer = True, additional page I added next to sales and purchases becomes visible. The problem is that odoo opens that pages that became visible. I don't want that, I consider it bug. I want to stay at Sales and Purchases.
If there is anyone with similar problems please share your solution.
Thanks!!!
You have a possibility to use the autofocus in the XML.
Example
<page autofocus="autofocus">
<field name="customer"/>
...
</page>

How to show download link for ir.attachment in Kanban card for Odoo 8?

I want to show the download link for ir.attachment in Kanban card (as in the form view), below the attachment name. Can anyone help me?
You can use the url widget.
<field name="url" widget="url"/>
Example

How to disable/remove the "Create", "Write" operations for users in a group, but only on some views

I have a special user group who is allowed to create new res.partner instances, but only if they go through a series of steps with custom views.
On the other hand, they have restricted view possibilities on res.partner.
Thus in CRUD terminology, these users have the Create right.
On the other hand, I don't want to provide them general create rights, but only if the follow their partner wizard view.
Still, they have the Read right as well on res.partner, thus I would like to present them with a link to the tree view without a Create button.
How can I set this up?
In your case you want to hide create button from tree view.
May be this will help you...
<tree create="false">
....
</tree>
create="flase", this will be hide your create button.
You can use this one in also your kanban view & form view.
Same way you can use edit="false" to hide your edit button, and also delete="false" for delete option.
<kanban create="false" edit="false">
....
</kanban>