[ADD] mrp_tag

This commit is contained in:
Jasmin Solanki
2022-04-11 13:18:31 +05:30
parent cf21bb169f
commit fed9936e17
15 changed files with 256 additions and 0 deletions

78
mrp_tag/README.rst Normal file
View File

@@ -0,0 +1,78 @@
=================
MRP Tags
=================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/14.0/mrp_tag
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-mrp_tag
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/142/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to add multiple tags to Manufacturing Orders
**Table of contents**
.. contents::
:local:
Usage
=====
To use this module, you need to go to Manufacture Order and select tag.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/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://github.com/OCA/manufacture/issues/new?body=module:%20mrp_tag%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
~~~~~~~
* ForgeFlow
Contributors
~~~~~~~~~~~~
* Jasmin Solanki <jasmin.solanki@forgeflow.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/manufacture <https://github.com/OCA/manufacture/tree/14.0/mrp_tag>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

3
mrp_tag/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models

21
mrp_tag/__manifest__.py Normal file
View File

@@ -0,0 +1,21 @@
# Copyright 2022 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "MRP Tags",
"summary": "Allows to add multiple tags to Manufacturing Orders",
"version": "14.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"category": "Purchases",
"depends": ["mrp"],
"data": [
"security/ir.model.access.csv",
"views/mrp_production_view.xml",
"views/mrp_tag_view.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
}

View File

@@ -0,0 +1,2 @@
from . import mrp_tag
from . import mrp_production

View File

@@ -0,0 +1,17 @@
# Copyright 2022 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class MrpProduction(models.Model):
_inherit = "mrp.production"
tag_ids = fields.Many2many(
comodel_name="mrp.tag",
relation="mrp_production_tag_rel",
column1="mrp_production_id",
column2="tag_id",
string="Tags",
)

22
mrp_tag/models/mrp_tag.py Normal file
View File

@@ -0,0 +1,22 @@
# Copyright 2022 ForgeFlow S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from random import randint
from odoo import fields, models
class MrpTag(models.Model):
_name = "mrp.tag"
_description = "mrp Tag"
def _get_default_color(self):
return randint(1, 11)
name = fields.Char("Tag Name", required=True, translate=True)
color = fields.Integer("Color", default=_get_default_color)
_sql_constraints = [
("tag_name_uniq", "unique (name)", "Tag name already exists !"),
]

View File

@@ -0,0 +1 @@
* Jasmin Solanki <jasmin.solanki@forgeflow.com>

View File

@@ -0,0 +1 @@
This module allows to add multiple tags to Manufacturing Orders

1
mrp_tag/readme/USAGE.rst Normal file
View File

@@ -0,0 +1 @@
To use this module, you need to go to Manufacture Order and select tag.

View File

@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_mrp_tag,mrp_tag,model_mrp_tag,base.group_user,1,0,0,0
access_mrp_tag_manager,mrp_tag_manager,model_mrp_tag,mrp.group_mrp_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_tag mrp_tag model_mrp_tag base.group_user 1 0 0 0
3 access_mrp_tag_manager mrp_tag_manager model_mrp_tag mrp.group_mrp_manager 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--Copyright 2022 ForgeFlow S.L.-->
<!--(http://www.forgeflow.com)-->
<!--License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).-->
<odoo>
<record id="mrp_production_form_view" model="ir.ui.view">
<field name="name">mrp.production.form</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field name="arch" type="xml">
<xpath
expr="//page[@name='miscellaneous']//field[@name='origin']"
position="after"
>
<field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color', 'no_create_edit': True}"
/>
</xpath>
</field>
</record>
<record id="mrp_production_tree_view" model="ir.ui.view">
<field name="name">mrp.production.tree</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_tree_view" />
<field name="arch" type="xml">
<field name="company_id" position="before">
<field
name="tag_ids"
optional="hide"
widget="many2many_tags"
options="{'color_field': 'color'}"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--Copyright 2022 ForgeFlow S.L.-->
<!--(http://www.forgeflow.com)-->
<!--License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).-->
<odoo>
<record id="mrp_tag_view_form" model="ir.ui.view">
<field name="name">mrp.tag.view.form</field>
<field name="model">mrp.tag</field>
<field name="arch" type="xml">
<form string="Tags">
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" />
</div>
<h1>
<field name="name" />
</h1>
</div>
<group>
<group>
<field name="color" required="True" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="mrp_tag_view_tree" model="ir.ui.view">
<field name="name">mrp.tag.view.tree</field>
<field name="model">mrp.tag</field>
<field name="arch" type="xml">
<tree string="Tags" editable="bottom">
<field name="name" />
<field name="color" widget="color_picker" />
</tree>
</field>
</record>
<record id="mrp_tag_action" model="ir.actions.act_window">
<field name="name">Tags</field>
<field name="res_model">mrp.tag</field>
<field name="view_id" ref="mrp_tag_view_tree" />
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create new tags for your manufacture order
</p>
</field>
</record>
<menuitem
id="menu_mrp_tag_config"
name="Tags"
parent="mrp.menu_mrp_configuration"
action="mrp_tag.mrp_tag_action"
sequence="3"
/>
</odoo>

View File

@@ -0,0 +1 @@
../../../../mrp_tag

6
setup/mrp_tag/setup.py Normal file
View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)