Browse Source

[ADD] agreement_mrp

pull/245/head
Sandip Mangukiya 6 years ago
committed by Maxime Chambreuil
parent
commit
089dbda9b3
  1. 2
      agreement/models/res_config_settings.py
  2. 13
      agreement/views/res_config_settings.xml
  3. 21
      agreement_mrp/README.rst
  4. 4
      agreement_mrp/__init__.py
  5. 27
      agreement_mrp/__manifest__.py
  6. 7
      agreement_mrp/models/__init__.py
  7. 20
      agreement_mrp/models/agreement.py
  8. 12
      agreement_mrp/models/mrp.py
  9. 1
      agreement_mrp/readme/CONTRIBUTORS.rst
  10. 3
      agreement_mrp/readme/CREDITS.rst
  11. 6
      agreement_mrp/readme/DESCRIPTION.rst
  12. 5
      agreement_mrp/readme/INSTALL.rst
  13. 2
      agreement_mrp/readme/ROADMAP.rst
  14. 6
      agreement_mrp/readme/USAGE.rst
  15. BIN
      agreement_mrp/static/description/icon.png
  16. 34
      agreement_mrp/views/agreement_view.xml
  17. 28
      agreement_mrp/views/mrp_view.xml

2
agreement/models/res_config_settings.py

@ -9,3 +9,5 @@ class ResConfigSettings(models.TransientModel):
module_agreement_maintenance = fields.Boolean( module_agreement_maintenance = fields.Boolean(
string='Manage maintenance agreements and contracts') string='Manage maintenance agreements and contracts')
module_agreement_mrp = fields.Boolean(
string='Link your manufacturing orders to an agreement.')

13
agreement/views/res_config_settings.xml

@ -46,6 +46,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="module_agreement_mrp"/>
</div>
<div class="o_setting_right_pane">
<label string="MRP"/>
<div class="text-muted">
Link your manufacturing orders to an agreement
</div>
</div>
</div>
</div>
</div> </div>
</xpath> </xpath>
</field> </field>

21
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.

4
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

27
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',
],
}

7
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,
)

20
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)

12
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')

1
agreement_mrp/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>

3
agreement_mrp/readme/CREDITS.rst

@ -0,0 +1,3 @@
The development of this module has been financially supported by:
* Open Source Integrators <https://opensourceintegrators.com>

6
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.

5
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

2
agreement_mrp/readme/ROADMAP.rst

@ -0,0 +1,2 @@
The roadmap of the Field Service application is documented on
`Github <https://github.com/OCA/contract/issues/221>`_.

6
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

BIN
agreement_mrp/static/description/icon.png

After

Width: 64  |  Height: 64  |  Size: 6.6 KiB

34
agreement_mrp/views/agreement_view.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.actions.act_window" id="action_mrp_production_agreement_specific">
<field name="name">Manufacture Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create MOs
</p>
</field>
</record>
<record id="partner_agreement_form_view" model="ir.ui.view">
<field name="name">agreement.form.mrp</field>
<field name="model">agreement</field>
<field name="inherit_id" ref="agreement.partner_agreement_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(action_mrp_production_agreement_specific)d" type="action" attrs="{'invisible': [('mo_count', '=', 0)]}" class="oe_stat_button" icon="fa-wrench">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="mo_count" widget="statinfo" nolabel="1"/></span>
<span class="o_stat_text">MOs</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>

28
agreement_mrp/views/mrp_view.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="mrp_production_form_view_agreement" model="ir.ui.view">
<field name="name">mrp.production.form.agreement</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='bom_id']" position="after">
<field name="agreement_id"/>
<field name="serviceprofile_id" domain="[('agreement_id', '=', agreement_id)]"/>
</xpath>
</field>
</record>
<!-- Inherit mrp production search view-->
<record id="view_mrp_production_filter_agreement" model="ir.ui.view">
<field name="name">mrp.production.select.agreement</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<filter string="Service Profile" domain="[]" context="{'group_by':'serviceprofile_id'}"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save