I am creating the report which can be translated to current user language. so I tried the following code. Report is working but the language to translate is always the partner_id of model (stock.picking), But I want the report to be translated to current logged user lang.
report translation is as below:
<template id="report_print_recvng_wkst">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'wms_report.report_recvngwkst_document')"/>
</t>
</t>
</template>
I also tried putting user.lang , lang or env.user.lang, but I get the error that stock.picking do not have user.lang etc.
Also, is there a way to debug in xml file, I mean how can I see the env object in report
Default behavior is that, in report partner language is set, report is generated in partner's language (partner which is set there in record).
And if you want to update that scenario then you need to do such other thing like partner_id.lang should be replaced by request.env.user.partner_id.lang
<template id="report_print_recvng_wkst">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'request.env.user.partner_id.lang', 'wms_report.report_recvngwkst_document')"/>
</t>
</t>
</template>
Related
In Odoo 15 TAX report
Company name is exist there but VAT number is not.
I looked at the code I found that Comapny name is called by
<strong>Company:</strong><p t-esc="res_company.name"/>
I wanted to call TAX ID and Company_registry if the field is filled
So I tried
<t t-if="res_company.vat">
<strong>VAT No:</strong>
<t t-esc="res_company.vat"/>
</t>
<t t-if="res_company.company_registry">
<br/>
<strong>CR:</strong>
<t t-esc="res_company.company_registry"/>
</t>
Now it is working fine.
Thank you
How can I show BOM products information on Website(Odoo 10 CE), like product name, desctiption, qty etc
I tried following but it doesn't work
<t t-esc="mrp.bom.sudo().product_qty"/>
and
<t t-foreach="bom.product_id" t-as="product">
<t t-esc="product.product_qty">
</t>
</t>
But it is not working and giving Internal Server erorr and Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'product_id'
What is the right way to access BOM products on website?
Thanks
I am trying to filter the partner list on an odoo accounting report (Partner Ledger) located on Accounting-> Reporting -> Partner Ledger
I need to set default list to display only customer partner (customer_rank = 1),not all contacts as it is displaying right now.
Is there a way to filter that list?
I was trying to find the view displayed below, but I couldn't find any view to change the context or domain.
Also I tried through JS but I do not see any way to add domain on button (account_reports module).
<div class="col-12">
<t t-if="options.get('partner_ids') != None">
Partners:
<t t-set="res_partner_value">All</t>
<t t-foreach="options['selected_partner_ids']" t-as="partner_name">
<t t-set="res_partner_value" t-value="''"/>
<t t-esc="partner_name"/>
</t>
<t t-esc="res_partner_value"/>
</t>
</div>
I was able to find the solution:
There is a function on the js file, where you can pass a domain field when creating a widget:
name: fieldName,
relation: fieldInfo.modelName,
type: 'many2many',
domain: "[('customer_rank','=',1)]",
value: fieldInfo.value
After adding that, the partner list is filtered as expected.
I'm using odoo 9 , I want to extend a template.
See my code
<templates id="olims.cust_template" xml:space="preserve">
<t t-extend="web.UserMenu.about">
<t t-jquery=".container-fluid" t-operation="replace">
<div class="row">
-----my code here-----
</div>
</t>
</t>
</templates>
But there is no effect in About Menu, What's wrong with the code, any idea?
1 - Use <t t-extend="UserMenu.about"> to extend the template.
2 - Add web to depends in the manifest (__openerp__.py).
3 - Add 'qweb': ["static/src/xml/*.xml"], to the manifest.
Template inheritance is performed via the t-extend directive which takes the name of the template to alter as parameter.
You can find more at QWEB.
I wanted to put an extra field in odoo while signup procedure. If admin has created multi company then user gets options to choose the company during sign up.
Demo screen
can anyone pls help me how can I achieve this Dropdown menu for company options in signup form?
<option t-esc="nb"/></t>
and
<select></select>
have no idea how it works.
TIA
You need to inherit the module you wish to modify, in your case I think this is the "web" module. If you don't know how to inherit modules, I recommend going through Odoo's developer documentation.
Inherit AuthSignupHome class in auth_signup module to fetch multi company data and inherit auth_signup.signup template to include qweb web design to for dropdow with multi company data:
try below code:
Controller.py:
class AuthSignupHome(openerp.addons.auth_signup.controllers.main.AuthSignupHome):
company_ids = request.env["res.company"].sudo().search([])
print'company_ids',company_ids
qcontext['multi_company'] = company_ids
return request.render('auth_signup.signup', qcontext)
In xml:
<template id="inherit_fields" inherit_id="auth_signup.fields" name="Sign up">
<xpath expr="//div[#class='form-group field-login']" position="before">
<div class="selection">
<select>
<t t-foreach="multi_company" t-as="company">
<option><t t-esc="company.name"/></option>
</t>
</select>
</div>
</xpath>
</template>
I think it will help you..