Skip to content

Commit

Permalink
Merge PR #2607 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Aug 30, 2023
2 parents ffdaa2e + d153c7b commit 3d39d30
Show file tree
Hide file tree
Showing 15 changed files with 720 additions and 0 deletions.
74 changes: 74 additions & 0 deletions sale_stock_line_sequence/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
==============================
Sale Stock Order Line Sequence
==============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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:/OCA/sale-workflow/tree/13.0/sale_stock_line_sequence
: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-13-0/sale-workflow-13-0-sale_stock_line_sequence
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/167/13.0
:alt: Try me on Runbot

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

Glue module between Sale Order Line Sequence and Stock Picking Line Sequence that assigns sequence correctly to the move associated with the sale order line it references when there are sections or notes in the sale order.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https:/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 smashing it by providing a detailed and welcomed
`feedback <https:/OCA/sale-workflow/issues/new?body=module:%20sale_stock_line_sequence%0Aversion:%2013.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
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* ForgeFlow S.L. <[email protected]>
* Oriol Miranda <[email protected]>

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.

This module is part of the `OCA/sale-workflow <https:/OCA/sale-workflow/tree/13.0/sale_stock_line_sequence>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_stock_line_sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
20 changes: 20 additions & 0 deletions sale_stock_line_sequence/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Sale Stock Order Line Sequence",
"summary": "Glue Module for Sale Order Line Sequence and Stock Picking Line Sequence",
"version": "14.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Sales",
"website": "https:/OCA/sale-workflow",
"license": "AGPL-3",
"depends": [
"sale_stock",
"sale_order_line_sequence",
"stock_picking_line_sequence",
],
"data": [],
"installable": True,
"auto_install": True,
}
19 changes: 19 additions & 0 deletions sale_stock_line_sequence/i18n/sale_stock_line_sequence.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_line_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.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_sequence
#: model:ir.model,name:sale_stock_line_sequence.model_sale_order
msgid "Sales Order"
msgstr ""
2 changes: 2 additions & 0 deletions sale_stock_line_sequence/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import sale_order
from . import stock_move
33 changes: 33 additions & 0 deletions sale_stock_line_sequence/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


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

def _update_moves_sequence(self):
for order in self:
if any(
[
ptype in ["product", "consu"]
for ptype in order.order_line.mapped("product_id.type")
]
):
for picking in order.picking_ids:
for move in picking.move_lines:
if move.sale_line_id.display_type:
continue
move.write({"sequence": move.sale_line_id.visible_sequence})

def action_confirm(self):
res = super().action_confirm()
self._update_moves_sequence()
return res

def write(self, line_values):
res = super(SaleOrder, self).write(line_values)
if "order_line" in line_values:
self._update_moves_sequence()
return res
19 changes: 19 additions & 0 deletions sale_stock_line_sequence/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Forgeflow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import _, api, models
from odoo.exceptions import UserError


class StockMove(models.Model):
_inherit = "stock.move"

@api.onchange("sequence")
def _onchange_sequence(self):
if self.sale_line_id:
raise UserError(
_(
"Not allowed to change the sequence of moves from the picking, "
"you can do it from the SO."
)
)
2 changes: 2 additions & 0 deletions sale_stock_line_sequence/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* ForgeFlow S.L. <[email protected]>
* Oriol Miranda <[email protected]>
1 change: 1 addition & 0 deletions sale_stock_line_sequence/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Glue module between Sale Order Line Sequence and Stock Picking Line Sequence that assigns sequence correctly to the move associated with the sale order line. It does not take into account the sections and notes in the sale order.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3d39d30

Please sign in to comment.