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
2 changes: 2 additions & 0 deletions sale_final_customer_address/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
*.pyc
36 changes: 36 additions & 0 deletions sale_final_customer_address/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. 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 Final Customer Address
===========================

* Adds a boolean field "Final customer" on delivery addresses (contacts with
type "Delivery Address").
* Adds a boolean field "Ship to final customer" on Sales Orders.
* When enabled, the shipping address field only shows delivery addresses with
"Final customer" enabled.
* When disabled, it only shows delivery addresses with "Final customer"
disabled.
* When creating a new delivery address from the Sales Order, the default value
for "Final customer" follows the Sales Order checkbox.

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 <anajuaristi@avanzosc.es>
* Eñaut Alberdi <enautavanzosc@gmail.com>
4 changes: 4 additions & 0 deletions sale_final_customer_address/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2026 Eñaut Alberdi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
20 changes: 20 additions & 0 deletions sale_final_customer_address/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2026 Eñaut Alberdi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Final Customer Address",
"version": "18.0.1.0.0",
"category": "Sales",
"summary": """Adds a final customer flag on delivery addresses and
filters sale order shipping addresses""",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/sale-addons",
"depends": [
"sale",
],
"data": [
"views/res_partner_views.xml",
"views/sale_order_views.xml",
],
"installable": True,
}
48 changes: 48 additions & 0 deletions sale_final_customer_address/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_final_customer_address
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-11 15:14+0000\n"
"PO-Revision-Date: 2026-02-11 15:14+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_final_customer_address
#: model:ir.model,name:sale_final_customer_address.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: sale_final_customer_address
#: model:ir.model.fields,help:sale_final_customer_address.field_sale_order__shipping_final_customer
msgid "Filters shipping addresses according to the final customer flag."
msgstr "Filtra las direcciones de envio segun el check de cliente final."

#. module: sale_final_customer_address
#: model:ir.model.fields,field_description:sale_final_customer_address.field_res_partner__final_customer
#: model:ir.model.fields,field_description:sale_final_customer_address.field_res_users__final_customer
msgid "Final customer"
msgstr "Cliente final"

#. module: sale_final_customer_address
#: model:ir.model.fields,help:sale_final_customer_address.field_res_partner__final_customer
#: model:ir.model.fields,help:sale_final_customer_address.field_res_users__final_customer
msgid "Marks delivery addresses that correspond to the final customer."
msgstr "Marca las direcciones de envio que corresponden a cliente final."

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

#. module: sale_final_customer_address
#: model:ir.model.fields,field_description:sale_final_customer_address.field_sale_order__shipping_final_customer
msgid "Ship to final customer"
msgstr "Direccion envio a cliente final"
48 changes: 48 additions & 0 deletions sale_final_customer_address/i18n/sale_final_customer_address.pot
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_final_customer_address
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-11 15:14+0000\n"
"PO-Revision-Date: 2026-02-11 15:14+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_final_customer_address
#: model:ir.model,name:sale_final_customer_address.model_res_partner
msgid "Contact"
msgstr ""

#. module: sale_final_customer_address
#: model:ir.model.fields,help:sale_final_customer_address.field_sale_order__shipping_final_customer
msgid "Filters shipping addresses according to the final customer flag."
msgstr ""

#. module: sale_final_customer_address
#: model:ir.model.fields,field_description:sale_final_customer_address.field_res_partner__final_customer
#: model:ir.model.fields,field_description:sale_final_customer_address.field_res_users__final_customer
msgid "Final customer"
msgstr ""

#. module: sale_final_customer_address
#: model:ir.model.fields,help:sale_final_customer_address.field_res_partner__final_customer
#: model:ir.model.fields,help:sale_final_customer_address.field_res_users__final_customer
msgid "Marks delivery addresses that correspond to the final customer."
msgstr ""

#. module: sale_final_customer_address
#: model:ir.model,name:sale_final_customer_address.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_final_customer_address
#: model:ir.model.fields,field_description:sale_final_customer_address.field_sale_order__shipping_final_customer
msgid "Ship to final customer"
msgstr ""
5 changes: 5 additions & 0 deletions sale_final_customer_address/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2026 Eñaut Alberdi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import res_partner
from . import sale_order
13 changes: 13 additions & 0 deletions sale_final_customer_address/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 Eñaut Alberdi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

final_customer = fields.Boolean(
string="Final customer",
default=False,
help="Marks delivery addresses that correspond to the final customer.",
)
13 changes: 13 additions & 0 deletions sale_final_customer_address/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 Eñaut Alberdi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


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

shipping_final_customer = fields.Boolean(
string="Ship to final customer",
default=False,
help="Filters shipping addresses according to the final customer flag.",
)
3 changes: 3 additions & 0 deletions sale_final_customer_address/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
36 changes: 36 additions & 0 deletions sale_final_customer_address/views/res_partner_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath
expr="//span[@name='address_name']/following-sibling::div[1]"
position="after"
>
<div class="o_row" invisible="type != 'delivery'">
<label for="final_customer" class="oe_inline me-2" />
<field name="final_customer" nolabel="1" class="oe_inline" />
</div>
</xpath>
<xpath expr="//field[@name='child_ids']/form/sheet/hr" position="after">
<group>
<field name="final_customer" invisible="type != 'delivery'" />
</group>
</xpath>
</field>
</record>

<record id="view_partner_address_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_address_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='div_type']" position="after">
<div class="o_row" invisible="type != 'delivery'">
<label for="final_customer" class="oe_inline me-2" />
<field name="final_customer" nolabel="1" class="oe_inline" />
</div>
</xpath>
</field>
</record>
</odoo>
21 changes: 21 additions & 0 deletions sale_final_customer_address/views/sale_order_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="view_order_form_final_customer" model="ir.ui.view">
<field name="name">sale.order.form.final.customer</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="partner_shipping_id" position="attributes">
<attribute
name="domain"
>[('final_customer', '=', shipping_final_customer), ('parent_id', '=', partner_id), ('type', '=', 'delivery')]</attribute>
<attribute
name="context"
>{'default_type': 'delivery', 'show_address': False, 'show_vat': False, 'default_parent_id': partner_id, 'default_final_customer': shipping_final_customer}</attribute>
</field>
<field name="partner_shipping_id" position="before">
<field name="shipping_final_customer" readonly="state == 'cancel' or locked" />
</field>
</field>
</record>
</odoo>