How to if-call VAT No in Odoo TAX report - odoo-15

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

Related

How to get Bill Of Material Products on Website

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

Filter Partners Accounting Report [Odoo12]

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.

How to extend template in odoo 9?

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.

How to add POS Restaurant notes for every items into POS Restaurant reciept?

I manage to change the template for POS receipt on /addons/point_of_sale/static/src/xml/pos.xml which lies within :
<t t-name="PosTicket">
But how to change the detail on PosTicket ?
<t t-name="PosTicket">
.....
<t t-esc="orderline.get_product().display_name"/>
???
I need to add the notes under the orderline.get_product().display_name. What should I write so it can show the notes?
I tried to add
<t t-esc="orderline.get_note()" />
But it seems doesn't work... Anybody know how to fix this?
PS:
I already read :
https://www.odoo.com/forum/help-1/question/how-to-alter-the-pos-receipt-37199
Odoo Point of Sale + Posbox : How to modify receipt
Odoo Point of Sale + Posbox : How to modify receipt
Adding notes to order items in restaurant POS
Seems I found the answer my self. It's :
<t t-esc="orderline.get_note()" />
After modify the pos.xml, logout and re-login n it will do the job... :)

odoo qweb report current user lang

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>