-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] product_multi_barcode_constraint_per_company
- Loading branch information
1 parent
ea2cf9d
commit 4951551
Showing
14 changed files
with
645 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# See https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#oca_dependencies-txt | ||
product-attribute https://github.com/OCA/product-attribute 14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
====================================== | ||
Product Barcode Constraint per Company | ||
====================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:8d6ef2af9f194f45c6e87e8557700e53e2499bf8a1f4100a37a610cd4172153a | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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--barcode-lightgray.png?logo=github | ||
:target: https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_barcode_constraint_per_company | ||
:alt: OCA/stock-logistics-barcode | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-14-0/stock-logistics-barcode-14-0-product_barcode_constraint_per_company | ||
: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-barcode&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module extend Odoo functionalities changing the constraint of the barcode | ||
on the ``product.product`` model. | ||
|
||
With this module, two products can have the same barcode, if there don't belong | ||
to the same company. | ||
|
||
This constraint was introduced in Odoo V9.0 in [that commit](https://github.com/odoo/odoo/commit/ede1071a09902e6eeb315cf51325a03f3991b3c3), and doesn't fit with some multi companies implementation where products are not shared. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
Due to some limitation of the framework, this module has to add a new stored field | ||
``tmpl_company_id`` on the ``product.product`` model related to the ``company_id`` | ||
of the related ``product.template``. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-barcode/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-barcode/issues/new?body=module:%20product_barcode_constraint_per_company%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 | ||
~~~~~~~ | ||
|
||
* GRAP | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Sylvain LE GAL <https://twitter.com/legalsylvain> | ||
* Sulivan Lominchar <slominchar@archeti.com> | ||
|
||
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-barcode <https://github.com/OCA/stock-logistics-barcode/tree/14.0/product_barcode_constraint_per_company>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from . import models | ||
|
||
from odoo.addons.product_barcode_constraint_per_company.tests.test_module import ( | ||
TestModule, | ||
) | ||
import unittest | ||
|
||
|
||
@unittest.skip | ||
def void(self): | ||
return | ||
|
||
|
||
TestModule.test_create_same_company = void |
19 changes: 19 additions & 0 deletions
19
product_multi_barcode_constraint_per_company/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2023 Cetmix OÜ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Product Multi Barcode Constraint per Company", | ||
"version": "14.0.1.0.0", | ||
"category": "Product", | ||
"summary": """This is a bridge module between "product_multi_barcode" and | ||
"product_barcode_constraint_per_company" """, | ||
"author": "Cetmix, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/stock-logistics-barcode", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"product_multi_barcode", | ||
"product_barcode_constraint_per_company", | ||
], | ||
"installable": True, | ||
"auto_install": True, | ||
} |
1 change: 1 addition & 0 deletions
1
product_multi_barcode_constraint_per_company/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_barcode |
21 changes: 21 additions & 0 deletions
21
product_multi_barcode_constraint_per_company/models/product_barcode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Cetmix OÜ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class ProductBarcode(models.Model): | ||
_inherit = "product.barcode" | ||
|
||
@api.constrains("name") | ||
def _check_duplicates(self): | ||
for record in self: | ||
barcodes = self.search( | ||
[("id", "!=", record.id), ("name", "=", record.name)] | ||
) | ||
if ( | ||
barcodes | ||
and barcodes[0].sudo().product_tmpl_id.company_id.id | ||
== record.product_tmpl_id.company_id.id | ||
): | ||
super()._check_duplicates() |
2 changes: 2 additions & 0 deletions
2
product_multi_barcode_constraint_per_company/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Cetmix <@cetmix.com> | ||
* Dessan Hemrayev <dessanhemrayev@gmail.com> |
1 change: 1 addition & 0 deletions
1
product_multi_barcode_constraint_per_company/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a bridge module between "product_barcode_constraint_per_company" and "product_multi_barcode" |
Binary file added
BIN
+9.23 KB
product_multi_barcode_constraint_per_company/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.