why xml files are not updated after modification in odoo11 - odoo-11

This is the actual code. Here i am adding filter for domain_force
<record id="sale_order_personal_rule" model="ir.rule">
<field name="name">Personal Orders</field>
<field ref="model_sale_order" name="model_id"/>
<field name="domain_force"></field>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
</record>
I'm trying to update xml file after adding filter for view as fallows.
<record id="sale_order_personal_rule" model="ir.rule">
<field name="name">Personal Orders</field>
<field ref="model_sale_order" name="model_id"/>
<field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field>
<field name="groups" eval="[(4, ref('sales_team.group_sale_salesman'))]"/>
</record>
I tried updating apps, upgrading module, and restarting server, But i didn't get solution to update view. Why its happening.

There is only one reason xml is not updated is that you put all this code in data noupdate=1.In no update=True it didnot update our data in an external id if that id is not present in our system it will create it if id is present it didnot update its attributes.

Related

odoo, how to create a correct xpath expression

I'm doing the odoo getting started tutorial. And I need to create a xpath expression. I need to inherit the base.view_users_form view and add page to display a list of properties.
This page should go after the preferences page, so I created this expresssion.
<record id="inherited_res_user_view_form" model="ir.ui.view">
<field name="name">res.users.extended.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[#name='preferences']" position="after">
<field name="property_ids"/>
</xpath>
</field>
</record>
and the error:
Element '<xpath expr="//page[#name='preferences']">' cannot be located in parent view
So I know my expression is incorrect, but I dont know what it should be.
I also don't know how I can find out. I read a bit about how it works, and I think I understand sufficiently. But I think I need to see the source code of base.view_users_form to find how they name their elements so that I can properly use xpath. But I can't find the source code also.
If you look carefully in the view_users_form code, you will see that the page is named references and not preferences.
Try the following XPath:
<xpath expr="//page[#name='references']" position="after">
<page string="Properties" name="property_ids">
<field name="property_ids"/>
</page>
</xpath>

Hide Create and Export All button but show Import button in Odoo13 tree view

By default Tree view in Odoo has Create, Import and Export All button showing on top.
How do I hide them based on User groups?
Also I should be able to hide Create button but without hiding Import button.
You can hide the buttons like so:
<tree create="false" edit="false" delete="false" duplicate="false">
To do this per user group, create an inherited view and specify the group in the inherit view like so:
<record model="ir.ui.view" id="view_model_name_tree_inherit">
<field name="name">model.name.tree.inherit</field>
<field name="model">model.name</field>
<field name="type">tree</field>
<field name="inherit_id" ref="module_name.tree_name" />
<field name="groups_id" eval="[(4, ref('module_name.group_name'))]"/>
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="create">false</attribute>
<attribute name="edit">false</attribute>
<attribute name="delete">false</attribute>
<attribute name="duplicate">false</attribute>
</tree>
</field>
</record>
Unfortunately the Create and Import buttons are both linked to the create attribute.
To disable the "Export" button, you will need to install a module as this is not supported on Odoo default. See this module
You can check following link for solution of your problem. web_disable_export_group
If you want to hide Export All button on the top-up header and next to the create method for some views only then follow below step.
<tree string="Account" export_xlsx="false" create="false">
But if you're using the web_disable_export_group and Did you uncheck the Export Button security group then for that user they are not able to see that Export All button for any views.Reference

Problem with adding a new field to the res partner model

I try to add a radio button to my vendor view, after installing my module there are no changes in my view.
I wish you can help me
1/ my file.py
# -*- coding: utf-8 -*-
from odoo import fields, models, api
class Vendor(models.Model):
_inherit = 'res.partner'
type = fields.selection([('internal', 'Internal'), ('external', 'External')], 'Type')
2/ My Xml file:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<data>
<field name="payment_term_id" position="after">
<field name="type" widget="radio"/>
</field>
</data>
</field>
</record>
</odoo>
Here is two possibility:
If you want to see field on res.partner form view, then change field name and upgrade res.partner form view.
type field is already introduce by Odoo base core module.
In these case, you can change your field from type to partner_type. And same with xml side.
If you want to see field on sale.order form view, then inherit sale.order object and upgrade it.
Afterwards, Upgrade your module and check output.
1/ remove the file of res.partner object from init file
2/ uninstall your module
3/ add the file of res.partner object to init file again
4/ restart the server and reinstall your module

odoo 9 - how to restrict one2many to not show a form view

I have a many2many, which is using the one2many widget.
I set mode="tree" and am using editable="bottom".
This works as expected in edit mode, however when in view mode - if the user clicks on a line it opens the line in a form view - how do i prevent this?
I either want nothing to happen, or to allow user to click on one of the _id items on the line.
Either way, clicking on the line should not open the record in a form view.
<field name="test_ids" widget="one2many" nolabel="1" mode="tree">
<tree editable="bottom">
<field name="partner_id"/>
<field name="another_field"/>
</tree>
</field>

TFS Work Item Type Definition System.AssignedTo Transition Error

I'm getting the following error when trying to change a custom work item's state through Visual Studio:
The field 'Assigned To' contains the value 'Seth Denburg <Project\SDenburg>' that is not in the list of supported values.
During the state transition the value from another field is copied to the System.AssignedTo field. This error stopping me from resolving a related work item during my check in through Visual Studio.
I've noticed the following alternatives allow me to successfully change the state which could help point to what the issue is:
Changing the work item's state in the web interface. No errors are displayed here.
Reentering the user's name in the field being copied from before the transition in Visual Studio.
Reentering the user's name in the System.AssignedTo field after the transition in Visual Studio.
Here is a subset of states, transitions, and fields from the custom work item type definition that I think are related to this issue:
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<ALLOWEXISTINGVALUE />
<VALIDUSER group="Project\Users" />
</FIELD>
<FIELD name="Lead" refname="Project.Tfs.Lead" type="String" reportable="dimension">
<ALLOWEXISTINGVALUE />
<DEFAULT from="value" value="Seth Denburg" />
<REQUIRED />
<VALIDUSER group="Project\TechnicalLeads" />
</FIELD>
<STATE value="Pending">
<FIELDS>
<FIELD refname="System.AssignedTo">
<VALIDUSER />
</FIELD>
</FIELDS>
</STATE>
<TRANSITION from="Active" to="Pending">
<REASONS>
<DEFAULTREASON value="Completed" />
</REASONS>
<FIELDS>
<FIELD refname="System.AssignedTo">
<COPY from="field" field="Project.Tfs.Lead" />
</FIELD>
<ACTIONS>
<ACTION value="Microsoft.VSTS.Actions.Checkin" />
</ACTIONS>
</TRANSITION>
The issue ended up being that the field Project.Tfs.Lead didn't have syncnamechanges="true". Here is what the field looked like after the change was made:
<FIELD name="Lead" refname="Project.Tfs.Lead" type="String" syncnamechanges="true" reportable="dimension">
<ALLOWEXISTINGVALUE />
<DEFAULT from="value" value="Seth Denburg" />
<REQUIRED />
<VALIDUSER group="Project\TechnicalLeads" />
</FIELD>
When making the change ensure that you use witadmin changefield like the following command because the field needs to be updated across work item type definitions. Importing an xml change won't work and will give you warning TF248017.
witadmin changefield /collection:https://project.com/tfs/projectCollection/ /n:Project.Tfs.Lead /syncnamechanges:true
Here's why this change was necessary from MSDN:
You must manually enable synchronization of any custom work item
fields that you have created in previous releases of Visual Studio
Team Foundation Server and that are used to assign person names that
reference Active Directory. You must enable synchronization for each
field for each team project collection that contains the custom
fields.
https://msdn.microsoft.com/en-us/library/dd286562(v=vs.100).aspx
Have created a test in myside, works well. The code of the custom work item type definition above seems missing a </FIELDS> of TRANSITION part.
Make sure the user Seth Denburg is in both group Project\TechnicalLeads and Project\Users.
You could also create a new team project in TFS2015 and use this custom work item type definition to see if the issue still exists. If not, the issue should related to the upgrade from TFS 2012 to 2015. Make sure you have Configure features after an upgrade.

Resources