Skip to content

Commit

Permalink
Merge pull request #2290 from OCA/18.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/sale-workflow (18.0)
  • Loading branch information
bt-admin authored Feb 27, 2025
2 parents 792d2ba + 389f91d commit 5bf9a63
Show file tree
Hide file tree
Showing 30 changed files with 1,294 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ addon | version | maintainers | summary
[sale_procurement_group_by_line](sale_procurement_group_by_line/) | 18.0.1.0.0 | | Base module for multiple procurement group by Sale order
[sale_sourced_by_line](sale_sourced_by_line/) | 18.0.1.0.0 | | Multiple warehouse source locations for Sale order
[sale_stock_cancel_restriction](sale_stock_cancel_restriction/) | 18.0.1.0.0 | | Sale Stock Cancel Restriction
[sale_stock_line_customer_ref](sale_stock_line_customer_ref/) | 18.0.1.0.0 | [![sebalix](https://github.com/sebalix.png?size=30px)](https://github.com/sebalix) | Allow you to add a customer reference on order lines propagaged to move operations.

[//]: # (end addons)

Expand Down
110 changes: 110 additions & 0 deletions sale_stock_line_customer_ref/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
==================================
Sale Stock Line Customer Reference
==================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:708a7e1b65e58df39f3722468a3278eadd89ebb888a7d7d805d857f4ed7b6140
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_stock_line_customer_ref
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_stock_line_customer_ref
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to add a customer reference on a sale order line.
Lines sharing the same product but different customer references won't
be merged together in stock transfers.

**Table of contents**

.. contents::
:local:

Usage
=====

By default the customer reference field is not displayed on the sale
order form, you have to enable it in the list of optional fields.

We want the customer ref on the package because the label should be
printed from there (like all other kind of existing labels). As we can't
get the right stock.move.line/stock.move easily from the package it is
easier to store the Customer Ref. of the move/move_line on the package
when this one is assigned to the move line. Also, a (destination)
package could contain different products (so different moves), and these
moves could have different Customer Ref., all of them will be concatened
in the package => ",
".join(customer_ref_of_all_moves_link_to_this_package)

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_stock_line_customer_ref%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Camptocamp

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

- Sébastien Alix <[email protected]>
- Simone Orsi <[email protected]>
- Do Anh Duy <[email protected]>

Other credits
-------------

The migration of this module from 14.0 to 18.0 was financially supported
by Camptocamp.

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-sebalix| image:: https://github.com/sebalix.png?size=40px
:target: https://github.com/sebalix
:alt: sebalix

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sebalix|

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_stock_line_customer_ref>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions sale_stock_line_customer_ref/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import pre_init_hook
28 changes: 28 additions & 0 deletions sale_stock_line_customer_ref/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Sale Stock Line Customer Reference",
"summary": (
"Allow you to add a customer reference on order lines "
"propagaged to move operations."
),
"version": "18.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["sebalix"],
"website": "https://github.com/OCA/sale-workflow",
"category": "Sales/Sales",
"depends": ["sale_stock"],
"data": [
"views/sale_order.xml",
"views/stock_picking.xml",
"views/stock_move.xml",
"views/stock_move_line.xml",
"views/stock_package_level.xml",
"views/stock_quant_package.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
"development_status": "Beta",
"pre_init_hook": "pre_init_hook",
}
34 changes: 34 additions & 0 deletions sale_stock_line_customer_ref/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

import logging

from odoo.tools import sql

logger = logging.getLogger(__name__)


def pre_init_hook(env):
"""Create table columns for computed fields to not get them computed by Odoo.
This is done to avoid MemoryError when installing the module on big databases.
Also it is useless to compute these fields which should be empty when installing
the module because no SO lines have a customer reference set.
"""
# Create columns
cr = env.cr
if not sql.column_exists(cr, "stock_move", "customer_ref_sale_line_id"):
sql.create_column(
cr,
"stock_move",
"customer_ref_sale_line_id",
"int4",
comment="Sale Line With Customer Ref",
)
if not sql.column_exists(cr, "stock_move", "customer_ref"):
sql.create_column(
cr,
"stock_move",
"customer_ref",
"VARCHAR",
)
97 changes: 97 additions & 0 deletions sale_stock_line_customer_ref/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_line_customer_ref
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-28 13:33+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move__customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move_line__customer_ref
msgid "Customer Ref"
msgstr "Ref. del Cliente"

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_sale_order_line__customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_quant_package__customer_ref
msgid "Customer Ref."
msgstr "Ref. del Cliente."

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_quant_package__customer_ref
msgid "Customer reference coming from the sale order line."
msgstr "Referencia del cliente procedente de la línea de pedidos de venta."

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_package_level__has_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_picking__has_customer_ref
msgid "Has Customer Ref"
msgstr "Tiene Ref de Cliente"

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_quant_package
msgid "Packages"
msgstr "Paquetes"

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Línea de Movimiento de Existencias)"

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move__customer_ref_sale_line_id
msgid "Sale Line With Customer Ref."
msgstr "Línea de Venta Con Ref. Cliente."

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de Orden de Venta"

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de Existencias"

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_package_level
msgid "Stock Package Level"
msgstr "Nivel del Paquete de Existencias"

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_package_level__has_customer_ref
msgid "Technical field to display 'Customer Ref' column in a package level."
msgstr ""
"Paquete de Existencias Campo técnico para mostrar la columna 'Ref. cliente' "
"en un nivel de paquete."

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_picking__has_customer_ref
msgid "Technical field to display 'Customer Ref' column on moves."
msgstr ""
"Campo técnico para mostrar la columna \" Ref cliente \" en los movimientos."

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_picking
msgid "Transfer"
msgstr "Transferencia"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Última Modificación el"
82 changes: 82 additions & 0 deletions sale_stock_line_customer_ref/i18n/sale_stock_line_customer_ref.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_line_customer_ref
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \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_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move__customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move_line__customer_ref
msgid "Customer Ref"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_sale_order_line__customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_quant_package__customer_ref
msgid "Customer Ref."
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_quant_package__customer_ref
msgid "Customer reference coming from the sale order line."
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_package_level__has_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_picking__has_customer_ref
msgid "Has Customer Ref"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_quant_package
msgid "Packages"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,field_description:sale_stock_line_customer_ref.field_stock_move__customer_ref_sale_line_id
msgid "Sale Line With Customer Ref."
msgstr ""

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

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_package_level
msgid "Stock Package Level"
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_package_level__has_customer_ref
msgid "Technical field to display 'Customer Ref' column in a package level."
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model.fields,help:sale_stock_line_customer_ref.field_stock_picking__has_customer_ref
msgid "Technical field to display 'Customer Ref' column on moves."
msgstr ""

#. module: sale_stock_line_customer_ref
#: model:ir.model,name:sale_stock_line_customer_ref.model_stock_picking
msgid "Transfer"
msgstr ""
6 changes: 6 additions & 0 deletions sale_stock_line_customer_ref/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import sale_order_line
from . import stock_move
from . import stock_move_line
from . import stock_package_level
from . import stock_picking
from . import stock_quant_package
15 changes: 15 additions & 0 deletions sale_stock_line_customer_ref/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import fields, models


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

customer_ref = fields.Char(string="Customer Ref.")

def _prepare_procurement_values(self, group_id=False):
values = super()._prepare_procurement_values(group_id)
values["customer_ref"] = self.customer_ref
return values
Loading

0 comments on commit 5bf9a63

Please sign in to comment.