Skip to content

Commit

Permalink
[16.0][ADD] sale_order_type_image: In type of sale order new field "S…
Browse files Browse the repository at this point in the history
…ale Type Image.
  • Loading branch information
alfredoavanzosc authored and anajuaristi committed Nov 8, 2024
1 parent 0175ca4 commit fb36d91
Show file tree
Hide file tree
Showing 14 changed files with 282 additions and 0 deletions.
32 changes: 32 additions & 0 deletions sale_order_type_image/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. 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 type image
=====================

* In type of sale order new field "Sale Type Image.
* When printing a sales order, picking, or customer invoice, if the sales order
type has an image defined, that image will be printed, otherwise the company
image will be printed.


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]>
1 change: 1 addition & 0 deletions sale_order_type_image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions sale_order_type_image/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Order Type Image",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/sale-addons",
"category": "Sales Management",
"depends": [
"sale_order_type",
],
"data": [
"data/layouts.xml",
"views/sale_order_type_views.xml",
],
"installable": True,
}
38 changes: 38 additions & 0 deletions sale_order_type_image/data/layouts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="external_layout_standard"
inherit_id="web.external_layout_boxed"
priority="100"
>
<img t-if="company.logo" position="replace">
<t
t-if="o._name == 'account.move' and o.move_type in ('out_invoice','out_refund') and o.sale_type_id.sale_type_image"
>
<img
t-att-src="image_data_uri(o.sale_type_id.sale_type_image)"
alt="Logo"
/>
</t>
<t
t-elif="o._name == 'stock.picking' and o.picking_type_id.code == 'outgoing' and o.group_id and o.group_id.sale_id and o.group_id.sale_id.type_id and o.group_id.sale_id.type_id.sale_type_image"
>
<img
t-att-src="image_data_uri(o.group_id.sale_id.type_id.sale_type_image)"
alt="Logo"
/>
</t>
<t t-elif="o._name == 'sale.order' and o.type_id.sale_type_image">
<img t-att-src="image_data_uri(o.type_id.sale_type_image)" alt="Logo" />
</t>
<t t-else="">
<img
t-if="company.logo"
t-att-src="image_data_uri(company.logo)"
alt="Logo"
/>
</t>

</img>
</template>
</odoo>
31 changes: 31 additions & 0 deletions sale_order_type_image/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_type_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-28 06:03+0000\n"
"PO-Revision-Date: 2024-10-28 06:03+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_type_image
#: model_terms:ir.ui.view,arch_db:sale_order_type_image.external_layout_standard
msgid "Logo"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model.fields,field_description:sale_order_type_image.field_sale_order_type__sale_type_image
msgid "Sale Type Image"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model,name:sale_order_type_image.model_sale_order_type
msgid "Type of sale order"
msgstr "Tipus de comanda de venda"
31 changes: 31 additions & 0 deletions sale_order_type_image/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_type_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-28 06:04+0000\n"
"PO-Revision-Date: 2024-10-28 06:04+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_type_image
#: model_terms:ir.ui.view,arch_db:sale_order_type_image.external_layout_standard
msgid "Logo"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model.fields,field_description:sale_order_type_image.field_sale_order_type__sale_type_image
msgid "Sale Type Image"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model,name:sale_order_type_image.model_sale_order_type
msgid "Type of sale order"
msgstr ""
31 changes: 31 additions & 0 deletions sale_order_type_image/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_type_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-28 06:04+0000\n"
"PO-Revision-Date: 2024-10-28 06:04+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_type_image
#: model_terms:ir.ui.view,arch_db:sale_order_type_image.external_layout_standard
msgid "Logo"
msgstr "Logo"

#. module: sale_order_type_image
#: model:ir.model.fields,field_description:sale_order_type_image.field_sale_order_type__sale_type_image
msgid "Sale Type Image"
msgstr "Imagen tipo venta"

#. module: sale_order_type_image
#: model:ir.model,name:sale_order_type_image.model_sale_order_type
msgid "Type of sale order"
msgstr "Tipo de pedido de venta"
31 changes: 31 additions & 0 deletions sale_order_type_image/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_type_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-28 06:04+0000\n"
"PO-Revision-Date: 2024-10-28 06:04+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_type_image
#: model_terms:ir.ui.view,arch_db:sale_order_type_image.external_layout_standard
msgid "Logo"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model.fields,field_description:sale_order_type_image.field_sale_order_type__sale_type_image
msgid "Sale Type Image"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model,name:sale_order_type_image.model_sale_order_type
msgid "Type of sale order"
msgstr "Type de bon de commande"
31 changes: 31 additions & 0 deletions sale_order_type_image/i18n/sale_order_type_image.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_type_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-28 06:03+0000\n"
"PO-Revision-Date: 2024-10-28 06:03+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_type_image
#: model_terms:ir.ui.view,arch_db:sale_order_type_image.external_layout_standard
msgid "Logo"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model.fields,field_description:sale_order_type_image.field_sale_order_type__sale_type_image
msgid "Sale Type Image"
msgstr ""

#. module: sale_order_type_image
#: model:ir.model,name:sale_order_type_image.model_sale_order_type
msgid "Type of sale order"
msgstr ""
1 change: 1 addition & 0 deletions sale_order_type_image/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order_type
9 changes: 9 additions & 0 deletions sale_order_type_image/models/sale_order_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class SaleOrderType(models.Model):
_inherit = "sale.order.type"

sale_type_image = fields.Binary(copy=False)
21 changes: 21 additions & 0 deletions sale_order_type_image/views/sale_order_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="sot_sale_order_type_form_view" model="ir.ui.view">
<field name="model">sale.order.type</field>
<field name="inherit_id" ref="sale_order_type.sot_sale_order_type_form_view" />
<field name="arch" type="xml">
<field name="description" position="before">
<group>
<group>
<field
name="sale_type_image"
widget="image"
class="oe_avatar"
/>
</group>
<group />
</group>
</field>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/sale_order_type_image/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit fb36d91

Please sign in to comment.