I have successfully imported several product templates into Odoo (version 8) and used External IDs for this. Now I want to import product description translations into ir.translation and want to use these External IDs. I guess, I have to put in field "Record ID" a reference to the product template - but this field unfortunately doesn't support External IDs in import screen.
How can I import translations for product templates with external IDs in an elegant way?
If I understood you well (you want to translate the field description of a product.template record which was introduced by XML code in a module you did before), you can try this and tell me if it works:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="whatever_you_want" model="ir.translation">
<field name="name">product.template,description</field>
<field name="type">model</field>
<field name="res_id" ref="the_module_which_introduced_xml_records.the_xml_id_of_the_record_you_want_to_translate"/>
<field name="lang">de_DE</field> <!-- The code of the language you want to translate to -->
<field name="src">Your product template description</field>
<field name="value">Your translation (in this case to German)</field>
</record>
</data>
</openerp>
Related
We need to update (CRUD) SharePoint Online list items from a stand alone application outside of SharePoint from an external company.
This application uses Soap/XML calls to call SP.
The (external) application has been able to connect and update an On-Premises SharePoint 2010 list with no problems, but now we are migrating to SharePoint Online.
The external application can connect to and view list items but always throws an error when we try to update an item in the list on SharePoint Online
Here is the (redacted) Soap request body and response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
<soapenv:Header/>
<soapenv:Body>
<soap:UpdateListItems>
<soap:listName>XXXXXX GUID</soap:listName>
<soap:updates>
<Batch OnError="Continue" ListVersion="1" ViewName="XXX GUID CUT">
<Method ID="1" Cmd="Update">
<Field Name="ID">1002</Field>
<Field Name="Received">1</Field>
<Field Name="COMSBarcode">RL101150</Field>
<Field Name="DateReceived">2020-03-03</Field>
<Field Name="ReceivedBy">andras boros</Field>
<Field Name="DefectsFaults" />
<Field Name="Description">This is Box 20/1</Field>
</Method>
<Method ID="2" Cmd="Update">
<Field Name="ID">1003</Field>
<Field Name="Received">1</Field>
<Field Name="COMSBarcode">RL101151</Field>
<Field Name="DateReceived">2020-03-03</Field>
<Field Name="ReceivedBy">andras boros</Field>
<Field Name="DefectsFaults" />
<Field Name="Description">This is Box 20/2</Field>
</Method>
<Method ID="3" Cmd="Update">
<Field Name="ID">1004</Field>
<Field Name="Received">1</Field>
<Field Name="COMSBarcode">RL101152</Field>
<Field Name="DateReceived">2020-03-03</Field>
<Field Name="ReceivedBy">andras boros</Field>
<Field Name="DefectsFaults" />
<Field Name="Description">This is Box20/3</Field>
</Method>
</Batch>
</soap:updates>
</soap:UpdateListItems>
</soapenv:Body>
</soapenv:Envelope>
4:02
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<UpdateListItemsResult>
<Results>
<Result ID="1,Update">
<ErrorCode>0x81020026</ErrorCode>
<ErrorText>The list that is referenced here no longer exists.</ErrorText>
<z:row ows_Title="I changed it online (Andras Boros)" ows_T_x002d_Code="X91" ows_BoxNo="20.0000000000000"
{TL:DR}
ows_SMTotalFileCount="1002;#0" xmlns:z="#RowsetSchema"/>
</Result>
{TL:DR}
</Results>
</UpdateListItemsResult>
</UpdateListItemsResponse>
</Body>
</soap:envelope/>
Is it possible to update SharePoint Online list items from a standalone webapp in a completely different doamin?
And how would we go about handling authentication.
Any help on this would be much appreciated.
The issue was caused because the URL & WSDL were for the top site SharePoint, rather than the specific sub-site.
Once we provided the sub-site url/wsdl the external app started working correctly
The error "The List That is Referenced Here no Longer Exists" is thrown when you try to reference the wrong subsite when you create the web reference to Lists.asmx web service.
"If your site URL is http://my_share_point_site, the list.asmx can be found at http://my_share_point_site/sites/main/_vti_bin/lists.asmx?WSDL and use that URL to reference the API and some things might work.
When we attempt to update a list found under some sub_site, your updates will silently fail. You have to reference http://my_share_point_site/sites/main/sub_site/_vti_bin/lists.asmx?WSDL for updates to your list."
Here is a blog post about the issue:
SharePoint: The List That is Referenced Here no Longer Exists
Here is a thread about calling lists.asmx in SharePoint Online which we also found helpful:
How to call (_vti_bin) SOAP web service in SharePoint Online 2013 from dot net web application
Also, outside of SharePoint Online, it's suggested to use SharePoint Online CSOM instead of Lists.asmx, Lists.asmx is the old way mainly for SharePoint 2010:
How To Read Various Objects Using SharePoint Online Client Side Object Model (CSOM)
Complete basic operations using SharePoint client library code
I am using anglo saxon accounting method in my accounting and I use average pricing as my costing method in inventory. But I am struggling with the vendor stock returning process because after validating the return, stock interim account values are not as I expected. I want to return the stock to the vendor to the price of what bought but it returned to the current price.
https://www.odoo.com/documentation/user/12.0/accounting/others/inventory/avg_price_valuation.html
As the above link says, Odoo can cater stock returns to their purchase price (see section: “Further thoughts on anglo saxon mode”). But I run the same test case on my server (Odoo 12) as well as the Odoo demo server, but it returns to the current price.
Is there any specific configuration for enabling this process or am I doing something wrong?
all you need to do is inherit view_company_form view and add anglo_saxon_accounting field
<record id="view_company_form_inherit" model="ir.ui.view">
<field name="name">res.company.form.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='rml_header1']" position="after">
<separator string=""/>
<group >
<field name="anglo_saxon_accounting" />
</group>
</xpath>
</field>
</record>
I need to import customers data with tags into res.partner with an XML when installing a custom module.
"Customers" data is stored in res.partner and "Tags" data is stored in res.partner.category, they have a relationship Many2many through res_partner_res_partner_category_rel.
I'm calling two XML files in the __manifest__.py:
The first one populates successfully res.partner.category:
<?xml version="1.0"?>
<odoo>
<record model="res.partner.category" id="res_partner_category_1">
<field name="name">Heavy metal</field>
<field name="active">1</field>
</record>
</odoo>
The second one inserts the partner data:
<?xml version="1.0"?>
<odoo>
<record model="res.partner" id="res_partner_predata_1">
<field name="name">Iron Maiden</field>
</record>
</odoo>
All I need is to insert this res.partner registry with the "Heavy metal" Tag with the installation of a custom module like this:
This is how it would look:
I will deeply appreciate any help.
I found the answer in the Odoo demo data:
When I created the category Heavy metal I assigned the id res_partner_predata_1, then I only have to add the next line (the one after the comment) to the res_partner registry like this:
<?xml version="1.0"?>
<odoo>
<record model="res.partner" id="res_partner_predata_1">
<field name="name">Iron Maiden</field>
<--! This line will add the category-->
<field eval="[(6, 0, [ref('module_name.res_partner_category_1')])]" name="category_id"/>
</record>
</odoo>
I faced the same question with odoo 14. In my case your solution did not work completely. Instead of:
<field eval="[(6, 0, [ref('module_name.res_partner_category_1')])]" name="category_id"/>
I had to set:
<field name="category_id" eval="[(6,0,[ref('res_partner_category_1')])]"/>
Is there any way to create test instance with parameter using the REST API on QC 11 ?
I have a test in my test plan with some parameters, or just one for the exercise :
I want to create using the rest API :
A test set in my test lab
A test instance in this test set
A test run of my test (the one in the plan) in this test instance
And be able to set the value of my parameters
I have manage to do the first 3 points. But I can not find how to set the parameter value for my instance. If I create the tests manually it is asked during the add of the test in the instance. And I can find the parameters in the Execution Settings in the Test Instance detail :
I have search in the documentation, but didn't find anything about how to set/use theses parameters. I have made GET on every objects, but didn't find them. I also try some urls like :
/test-instances/25378/test-parameters
/test-instances/25378/execution-settings
/test-instances/25378/exec-settings
But they always return 404.
Is there any way to set these parameters values ?
I had same troubles and here is my solution.
You can query your test parameters as:
/tests/{id}/test-parameters
And your test instance parameters, which are effectively actual values for those in your test instance, with:
/test-instances/{id}/step-parameters
For parameter values created via UI it returns like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Entities TotalResults="1">
<Entity Type="step-parameter">
<ChildrenCount>
<Value>0</Value>
</ChildrenCount>
<Fields>
<Field Name="origin-test">
<Value>-1</Value>
</Field>
<Field Name="vc-user-name">
<Value></Value>
</Field>
<Field Name="id">
<Value>21</Value>
</Field>
<Field Name="parent-id">
<Value>46</Value>
</Field>
<Field Name="used-by-owner-type">
<Value>test-instance</Value>
</Field>
<Field Name="actual-value">
<Value><html><body>
<div align="left">
<font face="Arial"><span style="font-size:8pt">AAA</span></font>
</div>
</body></html></Value>
</Field>
<Field Name="key">
<Value></Value>
</Field>
<Field Name="used-by-owner-id">
<Value>34</Value>
</Field>
</Fields>
<RelatedEntities/>
</Entity>
</Entities>
Where used-by-owner-id is id of the test-instance and parent-id is id of test parameter of the test.
Actual value for this case is AAA wrapped up with html tags.
You can create step parameters like this using normal POST to url:
/step-parameters
Note: Don't use same nested url for creation as you use for retrieval. You'll not be able to create parameters with such a combination of parameters you need.
API documentation really sucks, but you can get ideas how to retrieve or create things you need by requesting entity schema with
/customization/entities
I have installed the built in OpenERP 6.1 module crm.
As a result, I now have res.lead active and visible at "Sales->Opportunities".
I'd like to edit this object / view to show the partner's billing address.
Since I want to do this on the Opporunities form, there is already a partner_id.
Copying another module, I defined my new module like this:
class crm_lead(osv.osv):
_name = _inherit = 'crm.lead'
_columns = {
'billing_address_id': fields.many2one('res.partner.address', 'Partner Billing Address', domain="[('partner_id','=',partner_id),('type','in',['invoice', 'default'])]"),
}
And I changed my update_xml to:
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunity form (inherit)</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<data>
<separator string="Details" position="replace" />
<field name="description" position="replace">
<group colspan="2" col="4">
<separator colspan="4" string="Billing" />
<field widget="one2many_list" mode="form,tree" name="billing_address_id" colspan="4" nolabel="1" />
</group>
<group colspan="2" col="4">
<separator colspan="4" string="Details" />
<field name="description" nolabel="1" colspan="4" />
</group>
</field>
</data>
</field>
</record>
The problem is that the related object shows all the related fields (as I'd guess would be expected). In particular, it shows the partner_id and company fields, which I'd like to hide since they should default to / inherit from this opportunity (or the linked partner).
How can I hide these fields? I can't simply add a bunch of 'related' fields, as there is potentially more than one billing address.
Thanks for the help!
Edit: To be clearer, an opportunity should only have a single chosen billing address, chosen from the partner's invoice / default addresses. It should be displayed inline to allow easy editing.
There are a couple of ways to specify the view for related fields like this. You can use the context like this:
<field
name="order_line"
colspan="4"
nolabel="1"
context="{'form_view_ref': 'module.view_id', 'tree_view_ref': 'model.view_id'}"/>
You can also specify the whole view for the child record as a subview within the parent view like this:
<!-- <=== order_line is a one2many field -->
<field name="order_line" colspan="4" nolabel="1">
<form>
<field name="qty"/>
...
</form>
<tree>
<field name="qty"/>
...
</tree>
</field>
OK, I was a bit confused because you put a one2many widget on a many2one field.
If you want to control how a one2many field is displayed, use the subview or context methods I mentioned in my other answer.
If you want to control how a many2one field is displayed, you might be able to use related fields that pull fields from the record you selected, but I doubt it. Read-only might work, but I don't think it makes sense to edit multiple related fields and be able to change the selected record. You might be able to hack together some function fields with a store function that lets you write back to the related record, but it seems like it would really confuse your users.
On any OE Relation field you can define the Intenal View like :
<field name="" mode="tree,form">
<!--Internal tree view for your Relation field model-->
<tree>
</tree>
<!--Internal Form view for your Relation field model-->
<form>
</form>
</field>
Example Under Addons 1 Click to Example 2 Click to See Example
Hope this will help you,.
Now if yo uwan to shoe specific detail on your m2o file then we have some optional way also where you have to over the def name_get of your relational model, namge get look like :
name_get(cr, user, ids, context=None)
Returns the preferred display value (text representation) for the records with
the given ids. By default this will be the value of the name column, unless the
model implements a custom behavior. Can sometimes be seen as the inverse function
of name_search(), but it is not guaranteed to be.
Rtype : list(tuple)
Return : list of pairs (id,text_repr) for all records with the given ids.
So here in this method you can decide what string you want to show your relational field.
Example
This will fix your problem partially i guess.