Skip to content

Commit

Permalink
[ADD] product_brand_report: new module for print brand in reports
Browse files Browse the repository at this point in the history
closes #566

Signed-off-by: Bruno Zanotti <bz@adhoc.com.ar>
  • Loading branch information
lef-adhoc committed Jan 4, 2024
1 parent bd49b93 commit a719c79
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 0 deletions.
75 changes: 75 additions & 0 deletions product_brand_report/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.. |company| replace:: ADHOC SA

.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
:alt: ADHOC SA
:target: https://www.adhoc.com.ar

.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png

.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

====================
Product Brand Report
====================

* This module incorporates the possibility of displaying the products brand in the Quotations, Sale Orders and Invoices.


Installation
============

To install this module, you need to:

#. Just install this module.


Configuration
=============

#. To configure this module, you need to:

1. Install the module
2. Go to Settings - Invoicing and check the option "Show product brand on invoices"
3. Go to Settings - Sales and check the option "Show product brand on quotations & sale orders"


Usage
=====

To use this module, you need to:

#. No usage needed.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: http://runbot.adhoc.com.ar/

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

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

Credits
=======

Images
------

* |company| |icon|

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

Maintainer
----------

|company_logo|

This module is maintained by the |company|.

To contribute to this module, please visit https://www.adhoc.com.ar.
5 changes: 5 additions & 0 deletions product_brand_report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import models
40 changes: 40 additions & 0 deletions product_brand_report/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Product Brand Report',
'version': "16.0.1.0.0",
'category': 'Product',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'depends': [
'product_brand',
],
'demo': [
],
'data': [
'reports/report_saleorder_document.xml',
'reports/report_invoice_document.xml',
'views/res_config_settings_view.xml'
],
'installable': True,
'auto_install': False,
'application': False,
}
51 changes: 51 additions & 0 deletions product_brand_report/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_brand_report
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-03 21:18+0000\n"
"PO-Revision-Date: 2024-01-03 21:18+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: product_brand_report
#: model_terms:ir.ui.view,arch_db:product_brand_report.report_invoice_document
#: model_terms:ir.ui.view,arch_db:product_brand_report.report_saleorder
msgid "Brand"
msgstr "Marca"

#. module: product_brand_report
#: model:ir.model,name:product_brand_report.model_res_config_settings
msgid "Config Settings"
msgstr "Opciones de configuración"

#. module: product_brand_report
#: model:ir.model,name:product_brand_report.model_account_move
msgid "Journal Entry"
msgstr "Asiento contable"

#. module: product_brand_report
#: model:ir.model,name:product_brand_report.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"

#. module: product_brand_report
#: model:ir.model.fields,field_description:product_brand_report.field_account_bank_statement_line__show_brand
#: model:ir.model.fields,field_description:product_brand_report.field_account_move__show_brand
#: model:ir.model.fields,field_description:product_brand_report.field_account_payment__show_brand
#: model:ir.model.fields,field_description:product_brand_report.field_res_config_settings__show_brand_invoice_report
msgid "Show product brand on invoices"
msgstr "Mostrar marca de productos en facturas"

#. module: product_brand_report
#: model:ir.model.fields,field_description:product_brand_report.field_res_config_settings__show_brand_sales_report
#: model:ir.model.fields,field_description:product_brand_report.field_sale_order__show_brand
msgid "Show product brand on quotations & sale orders"
msgstr "Mostrar marca de productos en presupuestos y órdenes de venta"
5 changes: 5 additions & 0 deletions product_brand_report/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import res_config_settings
18 changes: 18 additions & 0 deletions product_brand_report/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

show_brand_invoice_report = fields.Boolean(
"Show product brand on invoices",
config_parameter='product_brand_report.show_brand_invoice_report'
)
show_brand_sales_report = fields.Boolean(
"Show product brand on quotations & sale orders",
config_parameter='product_brand_report.show_brand_sales_report'
)
12 changes: 12 additions & 0 deletions product_brand_report/reports/report_invoice_document.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//th[@name='th_description']" position="after">
<th class="text-center" t-if="o.env['ir.config_parameter'].sudo().get_param('product_brand_report.show_brand_invoice_report')">Brand</th>
</xpath>
<xpath expr="//td[@name='account_invoice_line_name']" position="after">
<td name="td_product_brand" class="text-center" t-if="o.env['ir.config_parameter'].sudo().get_param('product_brand_report.show_brand_invoice_report')">
<span t-field="line.product_id.product_brand_id.display_name" />
</td>
</xpath>
</template>
</odoo>
12 changes: 12 additions & 0 deletions product_brand_report/reports/report_saleorder_document.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<odoo>
<template id="report_saleorder" inherit_id="sale.report_saleorder_document">
<xpath expr="//th[@name='th_description']" position="after">
<th class="text-center" t-if="doc.env['ir.config_parameter'].sudo().get_param('product_brand_report.show_brand_sales_report')">Brand</th>
</xpath>
<xpath expr="//td[@name='td_name']" position="after">
<td name="td_product_brand" class="text-center" t-if="doc.env['ir.config_parameter'].sudo().get_param('product_brand_report.show_brand_sales_report')">
<span t-field="line.product_id.product_brand_id.display_name" />
</td>
</xpath>
</template>
</odoo>
38 changes: 38 additions & 0 deletions product_brand_report/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="res_config_settings_view_form_sale" model="ir.ui.view">
<field name="name">res.config.settings.form.inherit.sale</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='sale_management']/div[3]" position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="show_brand_sales_report"/>
</div>
<div class="o_setting_right_pane">
<label for="show_brand_sales_report"/>
</div>
</div>
</xpath>
</field>
</record>

<record id="res_config_settings_view_form_account" model="ir.ui.view">
<field name="name">res.config.settings.form.inherit.account</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='invoicing_settings']" position="inside">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="show_brand_invoice_report"/>
</div>
<div class="o_setting_right_pane">
<label for="show_brand_invoice_report"/>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

0 comments on commit a719c79

Please sign in to comment.