Odoo - Remove internal reference from Sales Order report - odoo

I am using Odoo 10 and I dont want the Product Internal Reference(default_code) printing on the Sales order report. I only want to remove from the report so customer cannot see the Internal Reference.
I tried below I seen on another post but it didnt work.
<!-- remove internal reference form Sales report.-->
<template id="sale_order_fields_inherit_saleorder_document" inherit_id="sale.report_saleorder_document">
<strong><span t-field="l.product_id.name"/></strong>
</template>

Inherit the sale_order_document report and replace the l.name with product_id.name here is complete code:
<template id="sale_order_fields_inherit_saleorder_document"
inherit_id="sale.report_saleorder_document">
<xpath expr="//span[#t-field='l.name']" position="replace">
<span t-field="l.product_id.name"/>
</xpath>
</template>
you can try this one !!, may be it'll help you.!

Related

How to make Odoo website search in header?

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>

How to print order ref name in pos receipt odoo

I want to add order ref name in receipt.Check my image.
There are multiple ways i.e. by editing from front end, or by extending the template.
Option1: From Front end
Activating Developer Mode.
Then Technical
Then Reports.
Find your desire report and edit it.
Option2: Extending The Template
<template id="report_invoice_document_inherit321" inherit_id="external_id_of_template">
<xpath expr="YOUR_XPATH_WHERE_YOU_WANT_YOUR_OUTPUT" position="after">
</xpath>
</template>

Add xpath in Odoo qweb report

How in inherit qweb add new element after last paragraph in original report:
<p t-if="o.comment">
<strong>Comment:</strong>
<span t-field="o.comment"/>
</p>
//add after <p t-if="o.comment">
<xpath expr="??" position="after">
<p>new</p>
</xpath>
Make sure to inherit the template id as below and then after add your xpath. Hope this helps you.
<template id="report_saleorder_inherit" inherit_id="report.external_layout_footer">
<xpath expr="//p[#t-if='o.comment']" position="after">
<p>new</p>
</xpath>
</template>
You can find the last p-element in your report by using xpath like this:
<xpath expr="(//p)[position()=last()]" position="after">
The (//p) part finds all p-elements and the filter [position()=last()] selects the last of them.
I assumed that the p element is in your base report and the xpath-part is in your inherited report.
Please keep in mind that the p element exists only if your model had data in comment field. The xpath does not know if the last one is the comment or not. It just blindly takes the last one from report and in your example it does not appear in the report if the t-if="o.comment" is not true.
Hope this helped you.
Br,
Veikko

how can I add one more field "company name" in odoo while signup?

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..

qweb t-if in position attribures

I am developing a module in Odoo. I need to change the report of invoice to add some details.
I use xpath with position attribute and check if an affair is linked to hide the default table.
<template id="my_invoice" inherit_id="account.report_invoice_document">
<xpath expr="//div[#class='page']/table[#class='table table-condensed']" position="attributes">
<attribute t-if="o.affair_id" name="class">hidden</attribute>
</xpath>
</template>
This is not working. The default table is hidden in every invoices even if the invoice is not linked to an affair.
I do not understand because the condition works in my second template.
<template id="my_invoice2" inherit_id="account.report_invoice_document">
<xpath expr="//div[#class='page']/div[#class='row mt32 mb32']" position="after">
<t t-if="o.affair_id">
<!-- table with my additional detail -->
</t>
</xpath>
</template>
Sorry for my english. I am learning it.
try this one:
<attribute name="t-att-style">'display: none;' if o.affair_id else ''</attribute>
OR even this one also:
<attribute name="t-att-class">'hidden' if o.affair_id else ''</attribute>
it may help in your case.