qweb

Expected singleton: hr.employee(1, 2)

那年仲夏 提交于 2019-12-06 16:40:44
Good Day! Everybody I have an error while loading the kanban view. I inherit the hr.employee Kanban xml and just add a condition if a certain documents expired, it will add a Expired Documents notification in kanban view, here is the xml code: <record model="ir.ui.view" id="hr_kanban_view_employees_recruitment_kanban"> <field name="name">HR - Employees Kanban Document Status</field> <field name="model">hr.employee</field> <field name="inherit_id" ref="hr.hr_kanban_view_employees"/> <field name="arch" type="xml"> <xpath expr="//templates" position="before"> <field name="employee_id"/> <field

Get images from db by fields.function on QWeb report - Odoo 8

余生长醉 提交于 2019-12-06 14:37:33
I want to print an image getting it by a fields.function for any image in my database. I am trying the following: def _get_image(self, cr, uid, ids, name, args, context=None): res = dict.fromkeys(ids) for record_browse in self.browse(cr, uid, ids): partner = self.pool.get('res.partner').browse(cr,uid,6,context=None).image res[record_browse.id] = base64.encodestring(partner) return res _columns = { 'image': fields.function(_get_image, string="Image", type="binary"), } but in qweb report I got: File "/opt/*/openerp/addons/base/ir/ir_qweb.py", line 791, in value_to_html raise ValueError("Non

How to add a watermark image to Qweb Reports in all PDF pages in Odoo?

别等时光非礼了梦想. 提交于 2019-12-06 06:10:09
I am creating qweb report and I want to add a image to the background in all pages but I am getting watermark in only the first page. What I have tried: <div style="position:absolute;text-align:center;z-index:-1;border:0;opacity:0.1;padding-top:50px;"> <img t-att-src="'data:image/png;base64,%s' %o.employee_id.company_id.watermark_img"/> </div> I have found the solution here Add this code for watermark in header of external layout. Its external id is report.external_layout_header : <style> .watermark { position: absolute; opacity: 0.25; z-index: 1000; transform: rotate(300deg); -webkit

Inherit field from one model to another model - Odoo v9 Community

拜拜、爱过 提交于 2019-12-04 20:33:55
I'm trying to add a field from a table, into another table, through a module. Specifically, trying to inherit a field from product.product , the price field, to add it into stock.move model. So, I've created a model into this new module I'm making. Like this: # -*- coding: utf-8 -*- from openerp import models, fields, api import openerp.addons.decimal_precision as dp class product(models.Model): _inherit = 'product.product' _rec_name = 'price_unidad' price_unidad = fields.One2many('product.product','price', string="Precio", readonly=True) class StockMove(models.Model): _inherit = 'stock.move'

How to update default header in PDF report (qWeb)?

本小妞迷上赌 提交于 2019-12-04 02:07:38
问题 I have a PDF report, using qWeb in Odoo (v8). My report has this line of code: <t t-call="report.external_layout"> This line I suppose is for inserting the predefined header in the PDF report. In Settings -> Companies, tab Report Configuration in respective company, there is something like this: <header> <pageTemplate> <frame id="first" x1="1.3cm" y1="3.0cm" height="21.7cm" width="19.0cm"/> <stylesheet> <!-- Set here the default font to use for all <para> tags --> <paraStyle name='Normal'

How to print images in Custom QWeb reports in Odoo?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 08:21:13
问题 I would like to display images which are uploaded by users in my custom Qweb reports. Which is the best way to do that? 回答1: If you want to show an image from the database you can just use the image widget like this: <span t-field="o.image_field_name" t-field-options='{"widget": "image"}'/> And if you want to show an image stored as a file: <img t-att-src="'/module_name/static/src/img/image_name.png'" /> Note : respect the order and the type of the quotes 回答2: For someone who lands here from

How to set PDF name in qWeb report, Odoo?

拜拜、爱过 提交于 2019-12-01 04:16:09
I'm making reports using qWeb in Odoo 8. Those generated PDF files are saved with a "default" name. I would like to set a specific name to every generated file (not after file was saved, but in "generation" time). Is that possible? If it is, how to do it? Thanks in advance. Jeroen Vet In Odoo 8 you can patch the method report_download of addons/report/controllers/main.py like below (between FIX START and END). It will then use the code for the attachment attribute in the report action definition. As the system will then always also save the file as an attachment in the database you can change

How to display an image in a QWeb report?

£可爱£侵袭症+ 提交于 2019-11-28 11:48:40
I extended the 'report.external_layout_footer' qweb view to display image. Below is my code in the file reports/external_layout.xml: <template id="report_footer_custom" inherit_id="report.external_layout_footer"> <xpath expr="//div[@class='footer']" position="replace"> <div class="footer"> <img t-att-src="'data:image/jpeg;base64,/var/www/cbl_openerp/openerp/cap_addons/cap_sale/img/footer.jpeg'"/> <ul class="list-inline"> <li>Page:</li> <li> <span class="page"/> </li> <li>/</li> <li> <span class="topage"/> </li> </ul> </div> </xpath> </template> And here is my openerp .py content : ... "depends

Odoo 9. How to override form widgets?

拈花ヽ惹草 提交于 2019-11-28 06:04:24
I work with odoo 9 . In the system exists render_value method for each type of field: /odoo/addons/web/static/src/js/views/form_widgets.js /odoo/addons/web/static/src/js/views/form_relational_widgets.js How I can use my custom method render_value (for example in FieldChar ) for all forms? And how I can use specific render_value for one form or one module? I created form_widgets.js in my module, but I not understand how properly override Field. odoo.define('my_module.form_widgets', function (require) { "use strict"; // what I should do here??? }); Can you provide small example? Thank in advance

How to display an image in a QWeb report?

陌路散爱 提交于 2019-11-27 03:49:55
问题 I extended the 'report.external_layout_footer' qweb view to display image. Below is my code in the file reports/external_layout.xml: <template id="report_footer_custom" inherit_id="report.external_layout_footer"> <xpath expr="//div[@class='footer']" position="replace"> <div class="footer"> <img t-att-src="'data:image/jpeg;base64,/var/www/cbl_openerp/openerp/cap_addons/cap_sale/img/footer.jpeg'"/> <ul class="list-inline"> <li>Page:</li> <li> <span class="page"/> </li> <li>/</li> <li> <span