diff --git a/agreement_mrp/README.rst b/agreement_mrp/README.rst new file mode 100644 index 00000000..21cd7854 --- /dev/null +++ b/agreement_mrp/README.rst @@ -0,0 +1,21 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. diff --git a/agreement_mrp/__init__.py b/agreement_mrp/__init__.py new file mode 100644 index 00000000..631bd489 --- /dev/null +++ b/agreement_mrp/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/agreement_mrp/__manifest__.py b/agreement_mrp/__manifest__.py new file mode 100644 index 00000000..1dc9802e --- /dev/null +++ b/agreement_mrp/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Agreement - MRP', + 'summary': 'Link manufacturing orders to an agreement', + 'version': '11.0.0.0.1', + 'category': 'Contract', + 'author': 'Open Source Integrators, ' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/contract', + 'depends': [ + 'agreement', + 'mrp', + ], + 'data': [ + 'views/agreement_view.xml', + 'views/mrp_view.xml', + ], + 'installable': True, + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': [ + 'smangukiya', + 'max3903', + ], +} diff --git a/agreement_mrp/models/__init__.py b/agreement_mrp/models/__init__.py new file mode 100644 index 00000000..147713f6 --- /dev/null +++ b/agreement_mrp/models/__init__.py @@ -0,0 +1,7 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import ( + mrp, + agreement, +) diff --git a/agreement_mrp/models/agreement.py b/agreement_mrp/models/agreement.py new file mode 100644 index 00000000..09425d2b --- /dev/null +++ b/agreement_mrp/models/agreement.py @@ -0,0 +1,20 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class Agreement(models.Model): + _inherit = "agreement" + + mo_count = fields.Integer('# MOs', compute='_compute_mo_count') + + @api.multi + def _compute_mo_count(self): + data = self.env['mrp.production'].read_group( + [('agreement_id', 'in', self.ids)], + ['agreement_id'], ['agreement_id']) + count_data = dict((item['agreement_id'][0], + item['agreement_id_count']) for item in data) + for agreement in self: + agreement.mo_count = count_data.get(agreement.id, 0) diff --git a/agreement_mrp/models/mrp.py b/agreement_mrp/models/mrp.py new file mode 100644 index 00000000..beb4d92c --- /dev/null +++ b/agreement_mrp/models/mrp.py @@ -0,0 +1,12 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MRPProduction(models.Model): + _inherit = "mrp.production" + + agreement_id = fields.Many2one('agreement', 'Agreement') + serviceprofile_id = fields.Many2one('agreement.serviceprofile', + 'Service Profile') diff --git a/agreement_mrp/readme/CONTRIBUTORS.rst b/agreement_mrp/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..a76235f8 --- /dev/null +++ b/agreement_mrp/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sandip Mangukiya diff --git a/agreement_mrp/readme/CREDITS.rst b/agreement_mrp/readme/CREDITS.rst new file mode 100644 index 00000000..0eff0acf --- /dev/null +++ b/agreement_mrp/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/agreement_mrp/readme/DESCRIPTION.rst b/agreement_mrp/readme/DESCRIPTION.rst new file mode 100644 index 00000000..5debb039 --- /dev/null +++ b/agreement_mrp/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +Odoo Agreement App does not provide an easy way to access manufacturing orders +related to an agreement. Some organizations needs to have a quick access to the +production orders to track the performance of an agreement. + +This module allows you to link a manufacturing order to an agreement and +adds a smart button on the agreement to look at the list of related MOs. diff --git a/agreement_mrp/readme/INSTALL.rst b/agreement_mrp/readme/INSTALL.rst new file mode 100644 index 00000000..c85327b9 --- /dev/null +++ b/agreement_mrp/readme/INSTALL.rst @@ -0,0 +1,5 @@ +To install Field Service and have the mapping features, +you need to install agreement and mrp + +Please refer to the installation instructions available at: +https://github.com/OCA/contract/agreement_mrp diff --git a/agreement_mrp/readme/ROADMAP.rst b/agreement_mrp/readme/ROADMAP.rst new file mode 100644 index 00000000..339c72be --- /dev/null +++ b/agreement_mrp/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +The roadmap of the Field Service application is documented on +`Github `_. diff --git a/agreement_mrp/readme/USAGE.rst b/agreement_mrp/readme/USAGE.rst new file mode 100644 index 00000000..86eca654 --- /dev/null +++ b/agreement_mrp/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +* Go to Manufacturing > Manufacturing Orders +* Select or create a manufacturing order and set the agreement +* Go to Agreement > Agreements +* Open the previous agreement and click on the smart button "Manufacturing Orders" to see the list of related MO diff --git a/agreement_mrp/static/description/icon.png b/agreement_mrp/static/description/icon.png new file mode 100644 index 00000000..23ce9313 Binary files /dev/null and b/agreement_mrp/static/description/icon.png differ diff --git a/agreement_mrp/views/agreement_view.xml b/agreement_mrp/views/agreement_view.xml new file mode 100644 index 00000000..f357ee6d --- /dev/null +++ b/agreement_mrp/views/agreement_view.xml @@ -0,0 +1,34 @@ + + + + + Manufacture Orders + ir.actions.act_window + mrp.production + form + tree,form + [('agreement_id', '=', active_id)] + +

+ Create MOs +

+
+
+ + + agreement.form.mrp + agreement + + + + + + + + +
diff --git a/agreement_mrp/views/mrp_view.xml b/agreement_mrp/views/mrp_view.xml new file mode 100644 index 00000000..5c2f3e78 --- /dev/null +++ b/agreement_mrp/views/mrp_view.xml @@ -0,0 +1,28 @@ + + + + + mrp.production.form.agreement + mrp.production + + + + + + + + + + + + mrp.production.select.agreement + mrp.production + + + + + + + + +