Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I need to add a few things to the Point of sale screen. In details, I need to add some custom HTML elements to ClientDetails widget. I know that the widget is defined in point_of_sale/static/src/xm/pos.xml, <t t-name="ClientDetails">. If I modify code there, changes will be made immediately. But I don't want to hack into the core. I want to write a custom module to modify (override) that widget.
I did read these:
and "template inheritance" in:
but still don't know how to do that.
It's not the same, those docs refers to qweb templates in other scenarios like reports and qweb, your situation involve qweb templates for js views and there are some diferences.
In your custom module you need to create an xml file for define the client qweb templates, new or extensions in a path below /static/ conventions use /static/src/xml/
In that file you need to define your templates definitions. For your case you could just copy and paste the original template to change it in place like:
next you need to register that file to be loaded in the __openerp__.py under the key 'qweb'.
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<img t-att-src='widget.partner_icon_url(partner.id)' />
<div class='client-name'><t t-esc='partner.name' /></div>
<div class='button edit'><i class='fa fa-pencil-square' /></div>
<div class='client-details-box clearfix'>
<span class='detail client-address'><t t-esc='partner.address' /></span>
<span class='detail client-email'><t t-esc='partner.email' /></span>
<span class='detail client-phone'><t t-esc='partner.phone' /></span>
<span class='detail client-phone empty'>N/A</span>
<span class='detail client-id'><t t-esc='partner.ean13'/></span>
<span class='detail client-id empty'>N/A</span>
<span class='label'>Tax ID</span>
<span class='detail vat'><t t-esc='partner.vat'/></span>
<span class='detail vat empty'>N/A</span>
This only will change the widget visually, if you need to change some other behavior you will need to do it using js widget inheritance.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/20/16, 11:26 PM|
|Seen: 875 times|
|Last updated: 6/20/16, 10:40 AM|