Browse Source

[ADD] agreement_maintenance

pull/206/head
Bhavesh Odedra 6 years ago
committed by Maxime Chambreuil
parent
commit
2481c8d4f3
  1. 5
      agreement/models/res_config_settings.py
  2. 16
      agreement/security/ir.model.access.csv
  3. 2
      agreement/views/agreement.xml
  4. 15
      agreement/views/menu.xml
  5. 14
      agreement/views/res_config_settings.xml
  6. 129
      agreement_maintenance/README.rst
  7. 4
      agreement_maintenance/__init__.py
  8. 29
      agreement_maintenance/__manifest__.py
  9. 7
      agreement_maintenance/models/__init__.py
  10. 15
      agreement_maintenance/models/agreement.py
  11. 40
      agreement_maintenance/models/agreement_serviceprofile.py
  12. 14
      agreement_maintenance/models/product_template.py
  13. 6
      agreement_maintenance/readme/CONFIGURE.rst
  14. 4
      agreement_maintenance/readme/CONTRIBUTORS.rst
  15. 4
      agreement_maintenance/readme/CREDITS.rst
  16. 1
      agreement_maintenance/readme/DESCRIPTION.rst
  17. 7
      agreement_maintenance/readme/USAGE.rst
  18. 3
      agreement_maintenance/security/ir.model.access.csv
  19. BIN
      agreement_maintenance/static/description/icon.png
  20. 27
      agreement_maintenance/views/agreement.xml
  21. 63
      agreement_maintenance/views/agreement_serviceprofile.xml
  22. 11
      agreement_maintenance/views/menu.xml
  23. 17
      agreement_maintenance/views/product.xml
  24. 1
      oca_dependencies.txt

5
agreement/models/res_config_settings.py

@ -1,8 +1,11 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators # Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
module_agreement_maintenance = fields.Boolean(
string='Manage maintenance agreements and contracts')

16
agreement/security/ir.model.access.csv

@ -1,17 +1,17 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_agreement_allusers,agreement all users,model_agreement,agreement.group_agreement_user,1,1,1,0 access_agreement_allusers,agreement all users,model_agreement,agreement.group_agreement_user,1,1,1,0
access_agreement_allusers,agreement all users,model_agreement,agreement.group_agreement_manager,1,1,1,1
access_agreement_manager,agreement manager,model_agreement,agreement.group_agreement_manager,1,1,1,1
access_agreement_section_allusers,section all users,model_agreement_section,agreement.group_agreement_user,1,1,1,0 access_agreement_section_allusers,section all users,model_agreement_section,agreement.group_agreement_user,1,1,1,0
access_agreement_section_allusers,section all users,model_agreement_section,agreement.group_agreement_manager,1,1,1,1
access_agreement_section_manager,section manager,model_agreement_section,agreement.group_agreement_manager,1,1,1,1
access_agreement_clause_allusers,clause all users,model_agreement_clause,agreement.group_agreement_user,1,1,1,0 access_agreement_clause_allusers,clause all users,model_agreement_clause,agreement.group_agreement_user,1,1,1,0
access_agreement_clause_allusers,clause all users,model_agreement_clause,agreement.group_agreement_manager,1,1,1,1
access_agreement_clause_manager,clause manager,model_agreement_clause,agreement.group_agreement_manager,1,1,1,1
access_agreement_stage_allusers,stage all users,model_agreement_stage,agreement.group_agreement_user,1,0,0,0 access_agreement_stage_allusers,stage all users,model_agreement_stage,agreement.group_agreement_user,1,0,0,0
access_agreement_stage_allusers,stage all users,model_agreement_stage,agreement.group_agreement_manager,1,1,1,1
access_agreement_stage_manager,stage manager,model_agreement_stage,agreement.group_agreement_manager,1,1,1,1
access_agreement_type_allusers,type all users,model_agreement_type,agreement.group_agreement_user,1,0,0,0 access_agreement_type_allusers,type all users,model_agreement_type,agreement.group_agreement_user,1,0,0,0
access_agreement_type_allusers,type all users,model_agreement_type,agreement.group_agreement_manager,1,1,1,1
access_agreement_type_manager,type manager,model_agreement_type,agreement.group_agreement_manager,1,1,1,1
access_agreement_subtype_allusers,subtype all users,model_agreement_subtype,agreement.group_agreement_user,1,0,0,0 access_agreement_subtype_allusers,subtype all users,model_agreement_subtype,agreement.group_agreement_user,1,0,0,0
access_agreement_subtype_allusers,subtype all users,model_agreement_subtype,agreement.group_agreement_manager,1,1,1,1
access_agreement_subtype_manager,subtype manager,model_agreement_subtype,agreement.group_agreement_manager,1,1,1,1
access_agreement_renewaltype_allusers,renewaltype all users,model_agreement_renewaltype,agreement.group_agreement_user,1,0,0,0 access_agreement_renewaltype_allusers,renewaltype all users,model_agreement_renewaltype,agreement.group_agreement_user,1,0,0,0
access_agreement_renewaltype_allusers,renewaltype all users,model_agreement_renewaltype,agreement.group_agreement_manager,1,1,1,1
access_agreement_renewaltype_manager,renewaltype manager,model_agreement_renewaltype,agreement.group_agreement_manager,1,1,1,1
access_agreement_increasetype_allusers,increasetype all users,model_agreement_increasetype,agreement.group_agreement_user,1,0,0,0 access_agreement_increasetype_allusers,increasetype all users,model_agreement_increasetype,agreement.group_agreement_user,1,0,0,0
access_agreement_increasetype_allusers,increasetype all users,model_agreement_increasetype,agreement.group_agreement_manager,1,1,1,1
access_agreement_increasetype_manager,increasetype manager,model_agreement_increasetype,agreement.group_agreement_manager,1,1,1,1

2
agreement/views/agreement.xml

@ -155,7 +155,7 @@
</group> </group>
</page> </page>
<page name="products" string="Products/Services"> <page name="products" string="Products/Services">
<group>
<group string="Products/Services">
<field name="product_ids" nolabel="1"/> <field name="product_ids" nolabel="1"/>
</group> </group>
</page> </page>

15
agreement/views/menu.xml

@ -41,23 +41,24 @@
id="agreement_masterdata" id="agreement_masterdata"
parent="agreement_root" parent="agreement_root"
sequence="30"/> sequence="30"/>
<menuitem
name="Parts"
id="agreement_parts"
sequence="10"
parent="agreement_masterdata"/>
<menuitem <menuitem
name="Clauses" name="Clauses"
id="agreement_clauses" id="agreement_clauses"
parent="agreement_masterdata" parent="agreement_masterdata"
sequence="20"
sequence="10"
action="partner_agreement_action_clause"/> action="partner_agreement_action_clause"/>
<menuitem <menuitem
name="Sections" name="Sections"
id="agreement_sections" id="agreement_sections"
parent="agreement_masterdata" parent="agreement_masterdata"
sequence="30"
sequence="20"
action="partner_agreement_action_section"/> action="partner_agreement_action_section"/>
<menuitem
name="Products"
id="agreement_products"
sequence="30"
parent="agreement_masterdata"
action="product.product_template_action"/>
<!-- Reporting --> <!-- Reporting -->
<menuitem <menuitem

14
agreement/views/res_config_settings.xml

@ -13,6 +13,20 @@
string="Agreements" string="Agreements"
data-key="agreement" data-key="agreement"
groups="agreement.group_agreement_manager"> groups="agreement.group_agreement_manager">
<h2>Advanced Features</h2>
<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_maintenance"/>
</div>
<div class="o_setting_right_pane">
<label string="Maintenance"/>
<div class="text-muted">
Manage maintenance agreements and contracts
</div>
</div>
</div>
</div>
</div> </div>
</xpath> </xpath>
</field> </field>

129
agreement_maintenance/README.rst

@ -0,0 +1,129 @@
==========
Agreements
==========
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/11.0/agreement
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-agreement
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/110/11.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows you to manage agreements, letter of intent and contract content.
The module is meant to be used by the legal team of a company and to allow them
to define sections, clauses and templates with their respective content that can
be dynamic.
Based on the template, an agreement can be created and the pdf document generated.
The agreement would go through a workflow to finally become a contract with the
customer signature.
**Table of contents**
.. contents::
:local:
Configuration
=============
To configure this module:
* Go to Agreement > Configuration > Templates
* Create a new template with sections and clauses and their respective content
* Go to Agreement > Configuration > Stages
* Create and reorder stages to match your process
Usage
=====
To use this module:
* Go to Agreement > Agrements
* Create a new agreement
* Select a template
* Follow the process to get the required approval
* Send the invitation to the customer to review and sign the agreement
Known issues / Roadmap
======================
* Split the module to remove the dependencies on sale and account and provide
the same feature in extra modules (agreement_sale, agreement_account,
agreement_purchase)
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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/contract/issues/new?body=module:%20agreement%0Aversion:%2011.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
~~~~~~~
* Pavlov Media
* Open Source Integrators
Contributors
~~~~~~~~~~~~
* Patrick Wilson <pwilson@pavlovmedia.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Wolfgang Hall <whall@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
Other credits
~~~~~~~~~~~~~
The development of this module has been financially supported by:
* Pavlov Media
* Open Source Integrators
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.
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
:target: https://github.com/max3903
:alt: max3903
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-max3903|
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/11.0/agreement>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

4
agreement_maintenance/__init__.py

@ -0,0 +1,4 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

29
agreement_maintenance/__manifest__.py

@ -0,0 +1,29 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Maintenance Agreements',
'summary': 'Manage maintenance agreements and contracts',
'author': 'Pavlov Media, '
'Open Source Integrators, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/contract',
'category': 'Partner',
'license': 'AGPL-3',
'version': '11.0.0.0.1',
'depends': [
'agreement',
'maintenance',
'fieldservice',
],
'data': [
'security/ir.model.access.csv',
'views/agreement.xml',
'views/agreement_serviceprofile.xml',
'views/product.xml',
'views/menu.xml',
],
'application': False,
'development_status': 'Beta',
'maintainers': ['max3903'],
}

7
agreement_maintenance/models/__init__.py

@ -0,0 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import (
agreement,
product_template,
agreement_serviceprofile,
)

15
agreement_maintenance/models/agreement.py

@ -0,0 +1,15 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class Agreement(models.Model):
_inherit = 'agreement'
serviceprofile_ids = fields.One2many(
'agreement.serviceprofile',
'agreement_id',
string="Service Profile",
copy=True
)

40
agreement_maintenance/models/agreement_serviceprofile.py

@ -0,0 +1,40 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
PROFILE_TYPE = [
('equipment', 'Equipment'),
('product', 'Product')
]
class AgreementServiceProfile(models.Model):
_name = 'agreement.serviceprofile'
name = fields.Char(string="Name", required=True)
profile_type = fields.Selection(
PROFILE_TYPE,
string="Profile Type")
description = fields.Text(string="Description")
equipment_id = fields.Many2one(
'maintenance.equipment',
string="Equipment")
product_id = fields.Many2one(
'product.product',
string="Product",
domain=[('serviceprofile_ok', '=', True)])
equipment_category_id = fields.Many2one(
'maintenance.equipment.category',
related='equipment_id.category_id',
string="Equipment Category",
readonly=1)
agreement_id = fields.Many2one(
'agreement',
string="Agreement",
ondelete="cascade",
required=True)
fsm_location_id = fields.Many2one(
'fsm.location',
string="Service Location")

14
agreement_maintenance/models/product_template.py

@ -0,0 +1,14 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
class Product(models.Model):
_inherit = 'product.template'
serviceprofile_ok = fields.Boolean(
string='Include on Service Profile',
default=False,
help="Specify if the product can be selected in a service profile line"
)

6
agreement_maintenance/readme/CONFIGURE.rst

@ -0,0 +1,6 @@
To configure this module:
* Go to Agreement > Configuration > Templates
* Create a new template with sections and clauses and their respective content
* Go to Agreement > Configuration > Stages
* Create and reorder stages to match your process

4
agreement_maintenance/readme/CONTRIBUTORS.rst

@ -0,0 +1,4 @@
* Patrick Wilson <pwilson@pavlovmedia.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Wolfgang Hall <whall@opensourceintegrators.com>
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>

4
agreement_maintenance/readme/CREDITS.rst

@ -0,0 +1,4 @@
The development of this module has been financially supported by:
* Pavlov Media
* Open Source Integrators

1
agreement_maintenance/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This module allows you to manage maintenance agreements and contracts.

7
agreement_maintenance/readme/USAGE.rst

@ -0,0 +1,7 @@
To use this module:
* Go to Agreement > Agrements
* Create a new agreement
* Select a template
* Follow the process to get the required approval
* Send the invitation to the customer to review and sign the agreement

3
agreement_maintenance/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_agreement_serviceprofile_allusers,serviceprofile all users,model_agreement_serviceprofile,agreement.group_agreement_user,1,0,0,0
access_agreement_serviceprofile_manager,serviceprofile manager,model_agreement_serviceprofile,agreement.group_agreement_manager,1,1,1,1

BIN
agreement_maintenance/static/description/icon.png

After

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

27
agreement_maintenance/views/agreement.xml

@ -0,0 +1,27 @@
<?xml version="1.0"?>
<odoo>
<!-- Agreement Form View -->
<record model="ir.ui.view" id="agreement_form_view">
<field name="name">Agreement Form</field>
<field name="model">agreement</field>
<field name="inherit_id" ref="agreement.partner_agreement_form_view"/>
<field name="arch" type="xml">
<xpath expr="//notebook/page[@name='products']/group"
position="after">
<group string="Service Profiles">
<field name="serviceprofile_ids" nolabel="1">
<tree>
<field name="name"/>
<field name="profile_type"/>
<field name="equipment_id"/>
<field name="product_id"/>
<field name="fsm_location_id"/>
</tree>
</field>
</group>
</xpath>
</field>
</record>
</odoo>

63
agreement_maintenance/views/agreement_serviceprofile.xml

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<odoo>
<!-- Agreement Service Profile List View-->
<record model="ir.ui.view" id="agreement_serviceprofile_list_view">
<field name="name">Agreement Service Profile List</field>
<field name="model">agreement.serviceprofile</field>
<field name="arch" type="xml">
<tree string="Service Profiles"
create="false" edit="false">
<field name="name"/>
<field name="profile_type"/>
<field name="equipment_id"/>
<field name="product_id"/>
<field name="fsm_location_id"/>
<field name="agreement_id"/>
</tree>
</field>
</record>
<!-- Agreement Service Profile Form View -->
<record model="ir.ui.view" id="agreement_serviceprofile_form_view">
<field name="name">Agreement Service Profile Form</field>
<field name="model">agreement.serviceprofile</field>
<field name="arch" type="xml">
<form string="Service Profile"
create="false" edit="false">
<sheet>
<div class="oe_title">
<h1>
<field name="name" placeholder="Name"/>
</h1>
</div>
<group>
<group>
<field name="profile_type"/>
<field name="equipment_id"
attrs="{'invisible': [('profile_type', '!=', 'equipment')]}"/>
<field name="equipment_category_id"
attrs="{'invisible': [('profile_type', '!=', 'equipment')]}"/>
<field name="product_id"
attrs="{'invisible': [('profile_type', '!=', 'product')]}"/>
</group>
<group>
<field name="fsm_location_id"/>
</group>
</group>
<group string="Description">
<field name="description" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- Actions opening views on models -->
<record model="ir.actions.act_window" id="agreement_action_serviceprofile">
<field name="name">Agreement Service Profile</field>
<field name="res_model">agreement.serviceprofile</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>

11
agreement_maintenance/views/menu.xml

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<odoo>
<!-- Master Data -->
<menuitem name="Service Profiles"
id="agreement_service_profiles"
sequence="30"
parent="agreement.agreement_masterdata"
action="agreement_action_serviceprofile"/>
</odoo>

17
agreement_maintenance/views/product.xml

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="product_template_serviceprofile_form_view">
<field name="name">product.template.common.serviceprofile.ok.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<div name="options" position="inside">
<div>
<field name="serviceprofile_ok"/>
<label for="serviceprofile_ok"/>
</div>
</div>
</field>
</record>
</odoo>

1
oca_dependencies.txt

@ -1 +1,2 @@
bank-payment bank-payment
field-service
Loading…
Cancel
Save