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/LICENSE/LICENSE | 166 ++++++++++++ sales_report_product_image/README.rst | 35 +++ sales_report_product_image/__init__.py | 3 + sales_report_product_image/__manifest__.py | 23 ++ sales_report_product_image/models/__init__.py | 3 + sales_report_product_image/models/sale_product.py | 29 +++ .../static/description/fb.jpg | Bin 0 -> 4632 bytes .../static/description/icon.png | Bin 0 -> 13176 bytes .../static/description/in.jpg | Bin 0 -> 8533 bytes .../static/description/index.html | 286 +++++++++++++++++++++ .../static/description/insta.jpg | Bin 0 -> 8005 bytes .../static/description/large1.png | Bin 0 -> 105419 bytes .../static/description/medium.png | Bin 0 -> 92099 bytes .../static/description/odooqa32.png | Bin 0 -> 1767 bytes .../static/description/serpent32.png | Bin 0 -> 1147 bytes .../static/description/serpent_logo.png | Bin 0 -> 9506 bytes .../static/description/small.png | Bin 0 -> 53295 bytes .../static/description/tick.png | Bin 0 -> 19433 bytes .../static/description/tree_pro_image.png | Bin 0 -> 59019 bytes .../static/description/twitter.jpg | Bin 0 -> 11155 bytes .../static/description/youtube.jpg | Bin 0 -> 15608 bytes sales_report_product_image/tests/__init__.py | 3 + .../tests/test_sales_report_product_image.py | 37 +++ .../views/report_saleorder.xml | 29 +++ .../views/sale_product_view.xml | 22 ++ 25 files changed, 636 insertions(+) create mode 100644 sales_report_product_image/LICENSE/LICENSE create mode 100644 sales_report_product_image/README.rst create mode 100644 sales_report_product_image/__init__.py create mode 100644 sales_report_product_image/__manifest__.py create mode 100644 sales_report_product_image/models/__init__.py create mode 100644 sales_report_product_image/models/sale_product.py create mode 100644 sales_report_product_image/static/description/fb.jpg create mode 100644 sales_report_product_image/static/description/icon.png create mode 100644 sales_report_product_image/static/description/in.jpg create mode 100644 sales_report_product_image/static/description/index.html create mode 100644 sales_report_product_image/static/description/insta.jpg create mode 100644 sales_report_product_image/static/description/large1.png create mode 100644 sales_report_product_image/static/description/medium.png create mode 100644 sales_report_product_image/static/description/odooqa32.png create mode 100644 sales_report_product_image/static/description/serpent32.png create mode 100644 sales_report_product_image/static/description/serpent_logo.png create mode 100644 sales_report_product_image/static/description/small.png create mode 100644 sales_report_product_image/static/description/tick.png create mode 100644 sales_report_product_image/static/description/tree_pro_image.png create mode 100644 sales_report_product_image/static/description/twitter.jpg create mode 100644 sales_report_product_image/static/description/youtube.jpg create mode 100644 sales_report_product_image/tests/__init__.py create mode 100644 sales_report_product_image/tests/test_sales_report_product_image.py create mode 100644 sales_report_product_image/views/report_saleorder.xml create mode 100644 sales_report_product_image/views/sale_product_view.xml diff --git a/sales_report_product_image/LICENSE/LICENSE b/sales_report_product_image/LICENSE/LICENSE new file mode 100644 index 0000000..84bb10a --- /dev/null +++ b/sales_report_product_image/LICENSE/LICENSE @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2019-TODAY Serpent Consulting Services Pvt. Ltd. (). + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/sales_report_product_image/README.rst b/sales_report_product_image/README.rst new file mode 100644 index 0000000..25db0a2 --- /dev/null +++ b/sales_report_product_image/README.rst @@ -0,0 +1,35 @@ + +====================== +Product Image for Sale +====================== + +* Product images for sale order/quotation and report. +* To display images of product in report, you need to tick print image and image size you want to display in report. + +======== +Features +======== + +Product Images In Quotation and Sale Order +Product Images in Big, Medium and Small +Product Images in Quotation and Sale Report +Option to Print Images in Report Or Not + +============ +Similar Apps +============ + +Product Image for Sale +Product Image +Sales Product Image +Sales Report Product Image +sales product image +sales product image in report +product image in report +image in sales report +serpent product image report +SCS product image option in report +product images for quotation +image in report +Print image option in odoo +image option in report diff --git a/sales_report_product_image/__init__.py b/sales_report_product_image/__init__.py new file mode 100644 index 0000000..a14d237 --- /dev/null +++ b/sales_report_product_image/__init__.py @@ -0,0 +1,3 @@ +# See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/sales_report_product_image/__manifest__.py b/sales_report_product_image/__manifest__.py new file mode 100644 index 0000000..e2de257 --- /dev/null +++ b/sales_report_product_image/__manifest__.py @@ -0,0 +1,23 @@ +# See LICENSE file for full copyright and licensing details. + +{ + # Module information + "name": "Product Image for Sale", + "version": "14.0.1.0.0", + "category": "Sales Management", + "sequence": "1", + "summary": """Product Image for Quatation/Sale Reports.""", + "description": """Product Image for Quatation/Sale Reports.""", + "license": "LGPL-3", + # Author + "author": "Serpent Consulting Services Pvt. Ltd.", + "website": "http://www.serpentcs.com", + "maintainer": "Serpent Consulting Services Pvt. Ltd.", + # Dependencies + "depends": ["sale_management"], + # Views + "data": ["views/sale_product_view.xml", "views/report_saleorder.xml"], + # Techical + "installable": True, + "auto_install": False, +} 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") diff --git a/sales_report_product_image/static/description/fb.jpg b/sales_report_product_image/static/description/fb.jpg new file mode 100644 index 0000000..8fa52d3 Binary files /dev/null and b/sales_report_product_image/static/description/fb.jpg differ diff --git a/sales_report_product_image/static/description/icon.png b/sales_report_product_image/static/description/icon.png new file mode 100644 index 0000000..7a4a5bb Binary files /dev/null and b/sales_report_product_image/static/description/icon.png differ diff --git a/sales_report_product_image/static/description/in.jpg b/sales_report_product_image/static/description/in.jpg new file mode 100644 index 0000000..d9b9a80 Binary files /dev/null and b/sales_report_product_image/static/description/in.jpg differ diff --git a/sales_report_product_image/static/description/index.html b/sales_report_product_image/static/description/index.html new file mode 100644 index 0000000..0a30218 --- /dev/null +++ b/sales_report_product_image/static/description/index.html @@ -0,0 +1,286 @@ +
+
+
+ +
+
+ +
+
+

Product Images For Sale

+
+
+

+ This module provide feature to show the images in Sales and Quotations order lines, also we can print all the ordered product's images in Quotation and Sales order Report. +

+
+
+
+
    +
  • +

    You can see the below image of sale order/quotation having product's image. +

    +
  • +
+
+ +
+
+
+
+
    +
  • +

    To display images of product in report, you need to tick print image and image size you want to display in report. +

    +
  • +
+
+ +
+
+
+
+
    +
  • +

    See the below image with small product size in report. +

    +
  • +
+
+ +
+
+
    +
  • +

    See the below image with medium product size in report. +

    +
  • +
+
+ +
+
+
+
+
    +
  • +

    See the below image with large product size in report. +

    +
  • +
+
+ +
+


+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Check out our various Odoo Services below + +
  +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Odoo Consulting Gap Analysis and BPR Odoo Implementation Integration with E-Commerce Odoo Technical Training
Offshore & Onsite Development Support and Maintenance Hire Dedicated Odoo Developer Payment Gateway Integrations Odoo Functional Training
Odoo Mobile App Development Odoo Manual Testing Odoo Automated Testing Integration with Shipping API Installation & Hosting
+
  +
+ Check out our various Odoo Based Products + +
  +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Restaurant Management Property Management Visa Agency Management Singapore Localization School, University Management
Construction Management Fleet Management Medical ERP Hotel Management Human Resource Management
Field Service Management Spa & Salon Management Ringcentral telephone integration Customer Relationship Talent Management
+
  +
+ For any questions, support and development contact us. + +
  +
+ + + + + + + + + + + + + + + + + +
(+91) 98793-54457, (+91) 90334-72982 + +91-79-2975-0867 contact@serpentcs.com www.serpentcs.com www.serpentcs.in www.odooqa.com
WhatsApp, Telegram or Call 24X7 Help! Send Mail Browse our Services Browse our Products QA Services
+
  +
+
+ + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/sales_report_product_image/static/description/insta.jpg b/sales_report_product_image/static/description/insta.jpg new file mode 100644 index 0000000..c89a251 Binary files /dev/null and b/sales_report_product_image/static/description/insta.jpg differ diff --git a/sales_report_product_image/static/description/large1.png b/sales_report_product_image/static/description/large1.png new file mode 100644 index 0000000..7c1808d Binary files /dev/null and b/sales_report_product_image/static/description/large1.png differ diff --git a/sales_report_product_image/static/description/medium.png b/sales_report_product_image/static/description/medium.png new file mode 100644 index 0000000..2ac67be Binary files /dev/null and b/sales_report_product_image/static/description/medium.png differ diff --git a/sales_report_product_image/static/description/odooqa32.png b/sales_report_product_image/static/description/odooqa32.png new file mode 100644 index 0000000..b0db6c2 Binary files /dev/null and b/sales_report_product_image/static/description/odooqa32.png differ diff --git a/sales_report_product_image/static/description/serpent32.png b/sales_report_product_image/static/description/serpent32.png new file mode 100644 index 0000000..14612ca Binary files /dev/null and b/sales_report_product_image/static/description/serpent32.png differ diff --git a/sales_report_product_image/static/description/serpent_logo.png b/sales_report_product_image/static/description/serpent_logo.png new file mode 100644 index 0000000..68dacf8 Binary files /dev/null and b/sales_report_product_image/static/description/serpent_logo.png differ diff --git a/sales_report_product_image/static/description/small.png b/sales_report_product_image/static/description/small.png new file mode 100644 index 0000000..b0daf6c Binary files /dev/null and b/sales_report_product_image/static/description/small.png differ diff --git a/sales_report_product_image/static/description/tick.png b/sales_report_product_image/static/description/tick.png new file mode 100644 index 0000000..437dd61 Binary files /dev/null and b/sales_report_product_image/static/description/tick.png differ diff --git a/sales_report_product_image/static/description/tree_pro_image.png b/sales_report_product_image/static/description/tree_pro_image.png new file mode 100644 index 0000000..82b8de8 Binary files /dev/null and b/sales_report_product_image/static/description/tree_pro_image.png differ diff --git a/sales_report_product_image/static/description/twitter.jpg b/sales_report_product_image/static/description/twitter.jpg new file mode 100644 index 0000000..6d938f6 Binary files /dev/null and b/sales_report_product_image/static/description/twitter.jpg differ diff --git a/sales_report_product_image/static/description/youtube.jpg b/sales_report_product_image/static/description/youtube.jpg new file mode 100644 index 0000000..05382a7 Binary files /dev/null and b/sales_report_product_image/static/description/youtube.jpg differ diff --git a/sales_report_product_image/tests/__init__.py b/sales_report_product_image/tests/__init__.py new file mode 100644 index 0000000..86c9c33 --- /dev/null +++ b/sales_report_product_image/tests/__init__.py @@ -0,0 +1,3 @@ +# See LICENSE file for full copyright and licensing details. + +from . import test_sales_report_product_image diff --git a/sales_report_product_image/tests/test_sales_report_product_image.py b/sales_report_product_image/tests/test_sales_report_product_image.py new file mode 100644 index 0000000..b5e24af --- /dev/null +++ b/sales_report_product_image/tests/test_sales_report_product_image.py @@ -0,0 +1,37 @@ +# Copyright 2016-TODAY Serpent Consulting Services Pvt. Ltd. +# See LICENSE file for full copyright and licensing details. + +from odoo.tests import common + + +class SaleReportProductImageTestCase(common.TransactionCase): + + def setup(self): + super(SaleReportProductImageTestCase, self).setup() + + def test_sale_report_product(self): + self.product = self.env.ref("product.product_product_7") + self.partner = self.env.ref("base.res_partner_2") + + self.sale_order = self.env["sale.order"].create( + { + "partner_id": self.partner.id, + "partner_invoice_id": self.partner.id, + "partner_shipping_id": self.partner.id, + "pricelist_id": self.env.ref("product.list0").id, + "print_image": "True", + "image_sizes": "image_medium", + } + ) + self.sale_order_line = self.env["sale.order.line"].create( + { + "name": self.product and self.product.name or " ", + "product_id": self.product and self.product.id or False, + "product_uom_qty": 2, + "product_uom": self.product.uom_id.id, + "price_unit": self.product.list_price, + "order_id": self.sale_order.id, + "tax_id": False, + "image_small": self.product.image_1920, + } + ) 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 @@ + + + + + + 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 @@ + + + + + sale.order.form.sale.image + sale.order + + + + + + + + + + + + + + + + -- cgit v1.2.3