Skip to content

Commit

Permalink
[ADD] stock_quant_serial_partner_location
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-RB committed Nov 11, 2024
1 parent a783e0b commit 877470b
Show file tree
Hide file tree
Showing 13 changed files with 658 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_quant_serial_partner_location/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,
)
81 changes: 81 additions & 0 deletions stock_quant_serial_partner_location/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
===================================
Stock Quant Serial Partner Location
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ade723b4acbefda91c50a020d20fcda1d3937716584b077db7e42ddc6593ba04
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/14.0/stock_quant_serial_partner_location
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-stock_quant_serial_partner_location
: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/stock-logistics-workflow&target_branch=14.0
:alt: Try me on Runboat

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

This module removes the check on serial number quants when the location is type customer or vendor.
It is useful to specific situation, when you sell products to one company and then the same one provides a
dropship service. When you try to send to the final customer the same serial number the error will pop up.
This module blocks the raise and allows you to send it in that situation.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-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/stock-logistics-workflow/issues/new?body=module:%20stock_quant_serial_partner_location%0Aversion:%2014.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
~~~~~~~

* Binhex

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

* `Binhex <https://www.binhex.cloud/>`_:

* Christian Ramos

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/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/14.0/stock_quant_serial_partner_location>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_quant_serial_partner_location/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions stock_quant_serial_partner_location/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Stock Quant Serial Partner Location",
"summary": """This module remove the serial number quants amount
restriction error when in a Partner location""",
"version": "14.0.0.1.0",
"development_status": "Beta",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Binhex, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"stock",
],
}
1 change: 1 addition & 0 deletions stock_quant_serial_partner_location/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_quant
28 changes: 28 additions & 0 deletions stock_quant_serial_partner_location/models/stock_quant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Binhex
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models
from odoo.exceptions import ValidationError
from odoo.tools.float_utils import float_compare


class StockQuant(models.Model):
_inherit = "stock.quant"

@api.constrains("quantity")
def check_quantity(self):
try:
super().check_quantity()
except ValidationError as ve:
for quant in self:
if (
quant.location_id.usage not in ["inventory", "supplier", "customer"]
and quant.lot_id
and quant.product_id.tracking == "serial"
and float_compare(
abs(quant.quantity),
1,
precision_rounding=quant.product_uom_id.rounding,
)
> 0
):
raise ve
3 changes: 3 additions & 0 deletions stock_quant_serial_partner_location/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Binhex <https://www.binhex.cloud/>`_:

* Christian Ramos
4 changes: 4 additions & 0 deletions stock_quant_serial_partner_location/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module removes the check on serial number quants when the location is type customer or vendor.
It is useful to specific situation, when you sell products to one company and then the same one provides a
dropship service. When you try to send to the final customer the same serial number the error will pop up.
This module blocks the raise and allows you to send it in that situation.
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 877470b

Please sign in to comment.