-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][4234][ADD] mrp_production_product_category_restriction (#70)
--------- Co-authored-by: Yoshi Tashiro <tashiro@quartile.co>
- Loading branch information
1 parent
5663b54
commit 58518ee
Showing
12 changed files
with
601 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
=========================================== | ||
Mrp Production Product Category Restriction | ||
=========================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:7d38e94fa3c25f235e4e4292b80ad742305be1bc3e9c6f3f2a1df5593a11a602 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-qrtl%2Faxls--custom-lightgray.png?logo=github | ||
:target: https://github.com/qrtl/axls-custom/tree/16.0/mrp_production_product_category_restriction | ||
:alt: qrtl/axls-custom | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module prevents the manufacturing of products through Manufacturing | ||
Orders (MO) if the product's category has the 'product_ok' field | ||
disabled. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/qrtl/axls-custom/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/qrtl/axls-custom/issues/new?body=module:%20mrp_production_product_category_restriction%0Aversion:%2016.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 | ||
------- | ||
|
||
* Quartile Limited | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is part of the `qrtl/axls-custom <https://github.com/qrtl/axls-custom/tree/16.0/mrp_production_product_category_restriction>`_ project on GitHub. | ||
|
||
You are welcome to 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 @@ | ||
from . import models |
15 changes: 15 additions & 0 deletions
15
mrp_production_product_category_restriction/__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,15 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Mrp Production Product Category Restriction", | ||
"version": "16.0.1.0.0", | ||
"author": "Quartile Limited", | ||
"website": "https://www.quartile.co", | ||
"category": "MRP", | ||
"license": "AGPL-3", | ||
"depends": ["mrp"], | ||
"data": [ | ||
"views/product_category_views.xml", | ||
], | ||
"installable": True, | ||
} |
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,46 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_production_product_category_restriction | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-02-22 14:53+0000\n" | ||
"PO-Revision-Date: 2024-02-22 14:53+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: mrp_production_product_category_restriction | ||
#. odoo-python | ||
#: code:addons/mrp_production_product_category_restriction/models/mrp_production.py:0 | ||
#, python-format | ||
msgid "" | ||
"%s is not allowed to be produced according to the product category setting." | ||
msgstr "プロダクトカテゴリ設定によると %s は製造対象ではありません。" | ||
|
||
#. module: mrp_production_product_category_restriction | ||
#: model:ir.model.fields,field_description:mrp_production_product_category_restriction.field_product_category__produce_ok | ||
msgid "Can be Manufactured" | ||
msgstr "製造可" | ||
|
||
#. module: mrp_production_product_category_restriction | ||
#: model:ir.model.fields,help:mrp_production_product_category_restriction.field_product_category__produce_ok | ||
msgid "" | ||
"If disabled, products with this category will be disallowed to be " | ||
"manufactured." | ||
msgstr "選択されていないカテゴリのプロダクトは製造できません。" | ||
|
||
#. module: mrp_production_product_category_restriction | ||
#: model:ir.model,name:mrp_production_product_category_restriction.model_product_category | ||
msgid "Product Category" | ||
msgstr "プロダクトカテゴリ" | ||
|
||
#. module: mrp_production_product_category_restriction | ||
#: model:ir.model,name:mrp_production_product_category_restriction.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "製造オーダ" |
2 changes: 2 additions & 0 deletions
2
mrp_production_product_category_restriction/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,2 @@ | ||
from . import product_category | ||
from . import mrp_production |
22 changes: 22 additions & 0 deletions
22
mrp_production_product_category_restriction/models/mrp_production.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,22 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class MrpProduction(models.Model): | ||
_inherit = "mrp.production" | ||
|
||
def action_confirm(self): | ||
for production in self: | ||
product = production.product_id | ||
if not product.categ_id.produce_ok: | ||
raise UserError( | ||
_( | ||
"%s is not allowed to be produced according to " | ||
"the product category setting.", | ||
product.name, | ||
) | ||
) | ||
return super().action_confirm() |
14 changes: 14 additions & 0 deletions
14
mrp_production_product_category_restriction/models/product_category.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,14 @@ | ||
# Copyright 2024 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ProductCategory(models.Model): | ||
_inherit = "product.category" | ||
|
||
produce_ok = fields.Boolean( | ||
"Can be Manufactured", | ||
help="If disabled, products with this category will be disallowed to be " | ||
"manufactured.", | ||
) |
3 changes: 3 additions & 0 deletions
3
mrp_production_product_category_restriction/readme/DESCRIPTION.md
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,3 @@ | ||
This module prevents the manufacturing of products through Manufacturing | ||
Orders (MO) if the product's category has the 'product_ok' field | ||
disabled. |
Oops, something went wrong.