Skip to content

Commit

Permalink
[FIX] grap_change_product_pricelist_direct_print: Add sale descriptio…
Browse files Browse the repository at this point in the history
…n and labels on report
  • Loading branch information
legalsylvain committed Nov 15, 2024
1 parent 6b05ecc commit b6c790c
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 4 deletions.
1 change: 1 addition & 0 deletions grap_change_product_pricelist_direct_print/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import wizards
1 change: 1 addition & 0 deletions grap_change_product_pricelist_direct_print/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# OCA
"product_pricelist_direct_print",
# GRAP
"product_label",
"sale_eshop",
],
"data": [
Expand Down
29 changes: 27 additions & 2 deletions grap_change_product_pricelist_direct_print/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-21 10:00+0000\n"
"PO-Revision-Date: 2023-06-21 10:00+0000\n"
"POT-Creation-Date: 2024-11-15 16:03+0000\n"
"PO-Revision-Date: 2024-11-15 16:03+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,16 +20,41 @@ msgstr ""
msgid "(Per"
msgstr "(Par"

#. module: grap_change_product_pricelist_direct_print
#: model_terms:ir.ui.view,arch_db:grap_change_product_pricelist_direct_print.report_product_pricelist_document
msgid "<strong>Labels</strong>"
msgstr "<strong>Labels</strong>"

#. module: grap_change_product_pricelist_direct_print
#: model_terms:ir.ui.view,arch_db:grap_change_product_pricelist_direct_print.report_product_pricelist_document
msgid "<strong>Pack.</strong>"
msgstr "Cond."

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model,name:grap_change_product_pricelist_direct_print.model_product_product
msgid "Product"
msgstr "Article"

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model,name:grap_change_product_pricelist_direct_print.model_product_pricelist_print
msgid "Product Pricelist Print"
msgstr "Imprimer la liste de prix des produits"

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model.fields,field_description:grap_change_product_pricelist_direct_print.field_product_pricelist_print__show_description_sale
msgid "Show Description for Customers"
msgstr "Afficher la description pour les clients"

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model.fields,field_description:grap_change_product_pricelist_direct_print.field_product_pricelist_print__show_description_eshop
msgid "Show Eshop Description"
msgstr "Afficher la description eboutique"

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model.fields,field_description:grap_change_product_pricelist_direct_print.field_product_pricelist_print__show_labels
msgid "Show Labels"
msgstr "Afficher les labels"

#. module: grap_change_product_pricelist_direct_print
#: model:ir.model.fields,field_description:grap_change_product_pricelist_direct_print.field_product_pricelist_print__show_eshop_rounded_qty
msgid "Show Packaging"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_product
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2023-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class ProductProduct(models.Model):
_inherit = "product.product"

# TODO: Migration V16. This part could go in sale_eshop
# module
def get_eshop_description_without_paragraph(self):
self.ensure_one()
res = self.eshop_description
if res.startswith("<p>"):
res = res[3:]
if res.endswith("</p>"):
res = res[:-4]
return res
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,43 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

<template id="report_product_pricelist_document" inherit_id="product_pricelist_direct_print.report_product_pricelist_document">

<!-- Header -->
<xpath expr="//th[@t-if='o.show_standard_price']" position="before">
<th t-if="o.show_labels">
<strong>Labels</strong>
</th>
</xpath>

<xpath expr="//th[@t-if='o.show_product_uom']" position="before">
<th t-if="o.show_eshop_rounded_qty" class="text-right">
<strong>Pack.</strong>
</th>
</xpath>

<!-- Body -->
<xpath expr="//span[@t-field='product.display_name']" position="after">
<t t-if="o.show_description_eshop">
<t t-if="product.eshop_description">
<t t-raw="product.get_eshop_description_without_paragraph()"/>
</t>
</t>
<t t-if="o.show_description_sale">
<t t-if="product.description_sale">
<t t-if="not product.eshop_description"><br/></t>
<span style="font-style: italic; color:#333;" t-field="product.description_sale"/>
</t>
</t>
</xpath>

<xpath expr="//td[@t-if='o.show_standard_price']" position="before">
<th t-if="o.show_labels">
<t t-foreach="product.label_ids" t-as="label">
<img t-attf-src="data:image/*;base64,{{label.image}}"
style="width: 0.6cm; height: 0.6cm; margin: 0.02cm;"/>
</t>
</th>
</xpath>

<xpath expr="//td[@t-if='o.show_product_uom']" position="before">
<td t-if="o.show_eshop_rounded_qty" class="text-right">
<t t-if="product.eshop_rounded_qty">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import fields, models
from odoo import fields, models


class ProductPricelistPrint(models.TransientModel):
_inherit = "product.pricelist.print"

show_eshop_rounded_qty = fields.Boolean(string="Show Packaging")

show_labels = fields.Boolean(default=True, string="Show Labels")

show_description_sale = fields.Boolean(
default=True, string="Show Description for Customers"
)

show_description_eshop = fields.Boolean(
default=True, string="Show Eshop Description"
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="inherit_id" ref="product_pricelist_direct_print.view_product_pricelist_print"/>
<field name="arch" type="xml">
<field name="show_product_uom" position="after">
<field name="show_eshop_rounded_qty"/>
<field name="show_eshop_rounded_qty"/>
<field name="show_labels"/>
<field name="show_description_sale"/>
<field name="show_description_eshop"/>
</field>
</field>
</record>
Expand Down

0 comments on commit b6c790c

Please sign in to comment.