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.
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
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 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>
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..
I am currently working on my first Odoo (v8) template and want to check if a contact person has a specific title.
What currently works is:
Sehr geehrter <span t-field="o.partner_id.title"></span> <span t-field="o.partner_id.name"></span>
This outputs:
Sehr geehrter Herr Klaus Koffer
As you can see I use the german translation of the system.
My question is: How can I check for "Mister" and "Miss"? The following example does not work. Is there a way to get the internav values as they are obviously not "Mister".
<p t-if="o.partner_id.title == 'Mister'">
Thanks in advance.
You can refer our blog to know about qweb.
Just try it in your code.
t-if="o.partner_id.title.name == 'Mister'"
Because o.partner_id.title gives an object of res.partner.title model.
So, you have to user o.partner_id.title.name. that's it.
Just you can check the condition using <t> </t> Tag for add the condition in Qweb View.
Better way u should use the <t> Tag insted of <p> Tag
some thing like this
<t t-if="o.partner_id.title == 'Mister'">
Your login will add hear for Mister title
</t>
I hope this should helpful for you ..)