diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-12-01 16:14:05 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-12-01 16:14:05 +0700 |
| commit | 20533d3b27ad7429c4fc677a321f1504f0f60ef1 (patch) | |
| tree | 9f42246c33b3ddb457e5c9c059be5bc04a163b6e /sales_report_product_image/views | |
| parent | 60fa89e3ecac883b6ccafd95d021d55d99a34085 (diff) | |
add product image in sales and quotation
Diffstat (limited to 'sales_report_product_image/views')
| -rw-r--r-- | sales_report_product_image/views/report_saleorder.xml | 29 | ||||
| -rw-r--r-- | sales_report_product_image/views/sale_product_view.xml | 22 |
2 files changed, 51 insertions, 0 deletions
diff --git a/sales_report_product_image/views/report_saleorder.xml b/sales_report_product_image/views/report_saleorder.xml new file mode 100644 index 0000000..8bec945 --- /dev/null +++ b/sales_report_product_image/views/report_saleorder.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + + <template id="report_saleorder_document_inherit" inherit_id="sale.report_saleorder_document"> + <xpath expr="//table[hasclass('o_main_table')]/thead/tr/th[1]" position="before"> + <t t-if="doc.print_image and doc.image_sizes in ('image', 'image_medium', 'image_small') "> + <th style="width:15%;">Product Image</th> + </t> + </xpath> + <xpath expr="//table/tbody[hasclass('sale_tbody')]/t[2]/tr/t/td[1]" position="before"> + <t t-if="doc.image_sizes == 'image' and doc.print_image "> + <td class="text-center"> + <img t-if="line.product_id.image_1920" t-attf-src="data:image/*;base64,{{line.product_id.image_1920}}" style="resize:both;width:95%;height:auto"/> + </td> + </t> + <t t-if="doc.image_sizes == 'image_medium' and doc.print_image"> + <td class="text-center"> + <img t-if="line.product_id.image_1920" t-attf-src="data:image/*;base64,{{line.product_id.image_1920}}" style="resize:both;width:70%;height:auto"/> + </td> + </t> + <t t-if="doc.image_sizes == 'image_small' and doc.print_image "> + <td class="text-center"> + <img t-if="line.product_id.image_1920" t-attf-src="data:image/*;base64,{{line.product_id.image_1920}}" style="resize:both;width:50%;height:auto"/> + </td> + </t> + </xpath> + </template> + +</odoo> diff --git a/sales_report_product_image/views/sale_product_view.xml b/sales_report_product_image/views/sale_product_view.xml new file mode 100644 index 0000000..3dce6fe --- /dev/null +++ b/sales_report_product_image/views/sale_product_view.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<odoo> + + <record id="view_order_image_form_inherit" model="ir.ui.view"> + <field name="name">sale.order.form.sale.image</field> + <field name="model">sale.order</field> + <field name="inherit_id" ref="sale.view_order_form"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="before"> + <field name="image_small" widget="image" optional="hide"/> + </xpath> + <xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="before"> + <field name="image_small" widget="image" height="50" optional="hide"/> + </xpath> + <field name="medium_id" position="after"> + <field name="print_image"/> + <field name="image_sizes" attrs="{'required': [('print_image', '!=', False)]}"/> + </field> + </field> + </record> + +</odoo> |
