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.
Related
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 am trying to add search input in Header Area in Odoo 10 Website. It works when visit /Shop page, but it gives Internal Error 500, on other pages.
My code in Main Layout is,
<t t-call="website_sale.search" />
Screenshot
How can I overcome this problem and make search option available from any page?
Not sure about v10, but in v14 you can remove a line in website_sale.search as a sort of quick workaround.
Comment or remove this line to avoid 500 error:
<t t-set="action" t-value="keep('/shop'+ ('/category/'+slug(category)) if category else None, search=0)"/>
It will probably look something like this in a module:
<template id="name_of_the_id" inherit_id="website_sale.search">
<xpath expr="//t/t/t[1]" position="replace">
</xpath>
</template>
In odoo 11, we have the choice between 4 layout when it comes to create invoices. When trying to modify one (not only the css but also the content), I started to modify the external_layout_clean, as a first test before writing my own.
The problem
here's what the QWeb looks like :
<?xml version="1.0"?>
<t t-name="web.external_layout_clean">
<div class="header o_clean_header">
<div class="row">
<<.... HEADER CONTENT ....>>
</div>
</div>
<div class="article o_report_layout_clean">
<t t-raw="0"/>
</div>
<div class="footer o_clean_footer">
<div class="row mt8">
<< .... FOOTER CONTENT .... >>
</div>
</div>
</t>
So modifying the header and the footer is easy. But the most important part, the body, does not appear here.
o_clean_footer can be found in o_clean_footer.less file, it's just some cssless. When you remove it from the code above, the style disappear. But when you remove the article class, everything disappear. So I don't know how, but this css class contain all the information.
The question
where to find the article class, especially the part that is the vector of datas?
Maybe we're just not meant to modify like that, then how should I modify it?
NB: In openerp, this was modified straight in a view, like for the header, I don't know how this works in odoo 11. I found some clue about odoo 10, but it seems like it was different
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..