Rodney Elpidio Enciso Arias 6 rokov pred
commit
a91ba55d9a

+ 23 - 0
__init__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
+#                            (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from . import models

BIN
__init__.pyc


+ 38 - 0
__openerp__.py

@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
+#                            (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+{
+    'name': 'Product image for sale reports',
+    'author': 'Serpent Consulting Services Pvt. Ltd.,\
+             Odoo Community Association (OCA)',
+    'category': 'Sales Management',
+    'website': 'http://www.serpentcs.com',
+    'version': '8.0.1.0.0',
+    'sequence': 1,
+    'depends': ['sale_layout', 'web_tree_image'],
+    'data': [
+        'views/sale_product_view.xml',
+        'views/report_saleorder.xml',
+    ],
+    'installable': True,
+    'auto_install': False
+}

+ 23 - 0
models/__init__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd
+#                            (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from . import sale_product

BIN
models/__init__.pyc


+ 43 - 0
models/sale_product.py

@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
+#                            (<http://www.serpentcs.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>
+#
+##############################################################################
+
+from openerp import models, fields
+
+
+class sale_order(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 sale_order_line(models.Model):
+    _inherit = 'sale.order.line'
+
+    image_medium = fields.Binary('Product Image',
+                                related='product_id.image_medium')

BIN
models/sale_product.pyc


BIN
static/description/icon.png


+ 86 - 0
static/description/index.html

@@ -0,0 +1,86 @@
+<html>
+    <body>
+        <section class="oe_container oe_dark">
+            <div class="oe_row">
+                <div class="oe_row">
+                    <h2 class="oe_slogan">Product images for sale order/quotation and report</h2>
+                </div>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        This module is developed to see the product images in tree view and report.
+                        Make sure to install the <a href='https://apps.openerp.com/apps/modules/8.0/web_tree_image/'>web_tree_image</a> Module from OCA.
+                    </p>
+                </div>
+            </div>
+        </section>
+
+        <section class='oe_container oe_dark'>
+            <div class='oe_row'>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        You can see the below image of sale order/quotation having product's image.
+                    </p>
+                </div>
+                <div class="oe_demo oe_picture oe_screenshot">
+                    <img src="tree_pro_image.png">
+                </div>
+            </div>
+        </section>
+
+        <section class='oe_container oe_dark'>
+            <div class='oe_row'>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        To display images of product in report, you need to tick print image and image size you want to display in report.
+                    </p>
+                </div>
+                <div class="oe_demo oe_picture oe_screenshot">
+                    <img src="tick.png">
+                </div>
+            </div>
+        </section>
+
+        <section class='oe_container oe_dark'>
+            <div class='oe_row'>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        See the below image with small product size in report.
+                    </p>
+                </div>
+                <div class="oe_demo oe_picture oe_screenshot">
+                    <img src="small.png">
+                </div>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        See the below image with medium product size in report.
+                    </p>
+                </div>
+                <div class="oe_demo oe_picture oe_screenshot">
+                    <img src="medium.png">
+                </div>
+            </div>
+        </section>
+
+        <section class='oe_container oe_dark'>
+            <div class='oe_row'>
+                <div style="margin: 16px 8%;">
+                    <p class='oe_mt32'>
+                        See the below image with large product size in report.
+                    </p>
+                </div>
+                <div class="oe_demo oe_picture oe_screenshot">
+                    <img src="large1.png">
+                </div>
+            </div>
+        </section>
+        <div align='center'>
+	<a href='http://www.serpentcs.com/serpentcs-serpentcs-offers-for-odoo-services' target='_blank'>
+		<img width='120' src="http://www.serpentcs.com/wp-content/uploads/2015/12/special-offers.png">
+	</a>
+    <a href='http://www.serpentcs.com/serpentcs-serpentcs-offers-for-odoo-services' target='_blank'>
+	SerpentCS Anniversary Offers for Odoo Services!
+	</a>     
+</div>
+
+    </body>
+</html>

BIN
static/description/large1.png


BIN
static/description/medium.png


BIN
static/description/small.png


BIN
static/description/tick.png


BIN
static/description/tree_pro_image.png


+ 31 - 0
views/report_saleorder.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <template id="report_saleorder_document_inherit" inherit_id="sale.report_saleorder_document">
+            <xpath expr="//table[@class='table table-condensed']/thead/tr/th[1]" position="before">
+                <t t-if="o.print_image and o.image_sizes in ('image', 'image_medium', 'image_small') ">
+                    <th>
+                        Product Image
+                    </th>
+                </t>
+            </xpath>
+            <xpath expr="//table/t/t[2]/tr/td[1]" position="before">
+                <t t-if="o.image_sizes == 'image' and o.print_image ">
+                    <td>
+                        <span t-field="l.product_id.image" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>
+                    </td>
+                </t>
+                <t t-if="o.image_sizes == 'image_medium' and o.print_image ">
+                    <td>
+                        <span t-field="l.product_id.image_medium" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>
+                    </td>
+                </t>
+                <t t-if="o.image_sizes == 'image_small' and o.print_image ">
+                    <td>
+                        <span t-field="l.product_id.image_small" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>
+                    </td>
+                </t>
+            </xpath>
+        </template>
+    </data>
+</openerp>

+ 26 - 0
views/sale_product_view.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <!-- Inherited sale order form view -->
+        <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="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/field[@name='product_id']" position="after">
+                    <field name="image_medium" widget="image" string="Imagen"/>
+                </xpath>
+
+                <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_id']" position="after">
+                    <field name="image_medium" widget="image" string="Imagen"/>
+                </xpath>
+                <field name="client_order_ref" position="after">
+                    <field name="print_image"/>
+                    <field name="image_sizes"/>
+                </field>
+
+            </field>
+         </record>
+    </data>
+</openerp>