From 20533d3b27ad7429c4fc677a321f1504f0f60ef1 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 1 Dec 2023 16:14:05 +0700 Subject: add product image in sales and quotation --- sales_report_product_image/models/__init__.py | 3 +++ sales_report_product_image/models/sale_product.py | 29 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 sales_report_product_image/models/__init__.py create mode 100644 sales_report_product_image/models/sale_product.py (limited to 'sales_report_product_image/models') diff --git a/sales_report_product_image/models/__init__.py b/sales_report_product_image/models/__init__.py new file mode 100644 index 0000000..5aec2aa --- /dev/null +++ b/sales_report_product_image/models/__init__.py @@ -0,0 +1,3 @@ +# See LICENSE file for full copyright and licensing details. + +from . import sale_product diff --git a/sales_report_product_image/models/sale_product.py b/sales_report_product_image/models/sale_product.py new file mode 100644 index 0000000..cb7596c --- /dev/null +++ b/sales_report_product_image/models/sale_product.py @@ -0,0 +1,29 @@ +# See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + print_image = fields.Boolean( + "Print Image", + help="""If ticked, you can see the product image in + report of sale order/quotation""", + ) + image_sizes = fields.Selection( + [ + ("image", "Big sized Image"), + ("image_medium", "Medium Sized Image"), + ("image_small", "Small Sized Image"), + ], + "Image Sizes", + default="image_small", + help="Image size to be displayed in report", + ) + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + image_small = fields.Binary("Product Image", related="product_id.image_1920") -- cgit v1.2.3