Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions sale_order_line_product_attribute_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

========================================
sale order line product attribute report
========================================

* In sale order, and sale order line new report "Sale line products attributes".
* For the line to be printed it must have one of these attributes:
"Bottom Graphic", "Top Graphic", "TALLA", "SHAPE".

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/sale-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Contributors
------------

* Ana Juaristi <[email protected]>
* Alfredo de la Fuente <[email protected]>
2 changes: 2 additions & 0 deletions sale_order_line_product_attribute_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .init_hook import pre_init_hook
23 changes: 23 additions & 0 deletions sale_order_line_product_attribute_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Order Line Product Attribute Report",
"version": "12.0.1.0.0",
"category": "Sales",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/sale-addons",
"depends": [
"sale",
"product_attribute_value_image"
],
"data": [
"data/layouts.xml",
"data/sale_order_line_product_attribute_report.xml",
"reports/sale_order_line_product_attribute_report.xml",
"views/sale_order_views.xml",
"views/sale_order_line_views.xml",
],
"installable": True,
"pre_init_hook": "pre_init_hook",
}
13 changes: 13 additions & 0 deletions sale_order_line_product_attribute_report/_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).


def _catch_top_bottom_graphic_info(sale_line):
top_graphic = "ZZZZZ"
bottom_graphic = "ZZZZZ"
for description_line in sale_line.name.split('\n'):
if description_line.startswith(f"Top Graphic"):
top_graphic = description_line.split(":", 1)[1].strip()
if description_line.startswith(f"Bottom Graphic"):
bottom_graphic = description_line.split(":", 1)[1].strip()
return top_graphic, bottom_graphic
26 changes: 26 additions & 0 deletions sale_order_line_product_attribute_report/data/layouts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="layout_sale_line_product_attribute_report">
<div class="article o_report_layout_standard" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
<t t-call="web.address_layout"/>
<t t-raw="0"/>
</div>
</template>

<template id="external_layout_sale_line_product_attribute_report">
<t t-if="not o" t-set="o" t-value="doc"/>
<t t-if="not company">
<!-- Multicompany -->
<t t-if="company_id">
<t t-set="company" t-value="company_id"/>
</t>
<t t-elif="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id.sudo()"/>
</t>
<t t-else="else">
<t t-set="company" t-value="res_company"/>
</t>
</t>
<t t-call="sale_order_line_product_attribute_report.layout_sale_line_product_attribute_report"><t t-raw="0"/></t>
</template>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="paperformat_sale_line_product_attribute_report" model="report.paperformat">
<field name="name">Sale line products attributes</field>
<field name="default" eval="False" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">0</field>
<field name="margin_bottom">0</field>
<field name="margin_left">0</field>
<field name="margin_right">0</field>
<field name="header_line" eval="False" />
<field name="header_spacing">00</field>
<field name="dpi">90</field>
</record>
</odoo>
48 changes: 48 additions & 0 deletions sale_order_line_product_attribute_report/i18n/en_US.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_line_product_attribute_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-15 08:23+0000\n"
"PO-Revision-Date: 2025-05-15 08:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__bottom_graphic
msgid "Botton Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__quantities_shapes
msgid "Quantities & Shapes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_order_product_attribute_report
msgid "Sale line products attributes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model,name:sale_order_line_product_attribute_report.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__top_graphic
msgid "Top Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__with_all_attributes
msgid "With All Attributes"
msgstr ""

48 changes: 48 additions & 0 deletions sale_order_line_product_attribute_report/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_line_product_attribute_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-15 08:24+0000\n"
"PO-Revision-Date: 2025-05-15 08:24+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__bottom_graphic
msgid "Botton Graphic"
msgstr "Gráfico interior"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__quantities_shapes
msgid "Quantities & Shapes"
msgstr "Cantidades y formas"

#. module: sale_order_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_order_product_attribute_report
msgid "Sale line products attributes"
msgstr "Atributos de los productos"

#. module: sale_order_line_product_attribute_report
#: model:ir.model,name:sale_order_line_product_attribute_report.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__top_graphic
msgid "Top Graphic"
msgstr "Gráfico superior"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__with_all_attributes
msgid "With All Attributes"
msgstr "Con todos los atributos"

48 changes: 48 additions & 0 deletions sale_order_line_product_attribute_report/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_line_product_attribute_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-15 08:24+0000\n"
"PO-Revision-Date: 2025-05-15 08:24+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__bottom_graphic
msgid "Botton Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__quantities_shapes
msgid "Quantities & Shapes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_order_product_attribute_report
msgid "Sale line products attributes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model,name:sale_order_line_product_attribute_report.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__top_graphic
msgid "Top Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__with_all_attributes
msgid "With All Attributes"
msgstr ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_line_product_attribute_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-15 08:23+0000\n"
"PO-Revision-Date: 2025-05-15 08:23+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__bottom_graphic
msgid "Botton Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__quantities_shapes
msgid "Quantities & Shapes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_line_product_attribute_report
#: model:ir.actions.report,name:sale_order_line_product_attribute_report.report_sale_order_product_attribute_report
msgid "Sale line products attributes"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model,name:sale_order_line_product_attribute_report.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__top_graphic
msgid "Top Graphic"
msgstr ""

#. module: sale_order_line_product_attribute_report
#: model:ir.model.fields,field_description:sale_order_line_product_attribute_report.field_sale_order_line__with_all_attributes
msgid "With All Attributes"
msgstr ""

47 changes: 47 additions & 0 deletions sale_order_line_product_attribute_report/init_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2025 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, SUPERUSER_ID
from ._common import _catch_top_bottom_graphic_info
import logging

try:
from openupgradelib import openupgrade
except Exception:
from odoo.tools import sql as openupgrade

_logger = logging.getLogger(__name__)


def pre_init_hook(cr):
env = api.Environment(cr, SUPERUSER_ID, {})
_logger.info("Pre-creating column top_graphic for table sale_order_line")
if not openupgrade.column_exists(cr, "sale_order_line", "top_graphic"):
cr.execute(
"""
ALTER TABLE sale_order_line
ADD COLUMN top_graphic varchar;
COMMENT ON COLUMN sale_order_line.top_graphic
IS 'Top Graphic';
"""
)
_logger.info("Pre-creating column bottom_graphic for table sale_order_line")
if not openupgrade.column_exists(cr, "sale_order_line", "bottom_graphic"):
cr.execute(
"""
ALTER TABLE sale_order_line
ADD COLUMN bottom_graphic varchar;
COMMENT ON COLUMN sale_order_line.bottom_graphic
IS 'Bottom Graphic';
"""
)
sale_lines = env["sale.order.line"].search([])
for sale_line in sale_lines:
top_graphic, bottom_graphic = _catch_top_bottom_graphic_info(sale_line)
top_graphic = top_graphic.replace("'", "''")
bottom_graphic = bottom_graphic.replace("'", "''")
cr.execute("""
UPDATE sale_order_line
SET top_graphic = '%s',
bottom_graphic = '%s'
WHERE id = %s;
""" % (top_graphic, bottom_graphic, sale_line.id))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order_line
Loading