mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
Merge pull request #255 from ursais/11.0-add-agreement-sale
[ADD] agreement_sale
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
'data/ir_sequence.xml',
|
||||
'data/module_category.xml',
|
||||
'data/agreement_stage.xml',
|
||||
'data/agreement_type.xml',
|
||||
'security/res_groups.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'report/agreement.xml',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="agreement_stage_new" model="agreement.stage">
|
||||
|
||||
16
agreement/data/agreement_type.xml
Normal file
16
agreement/data/agreement_type.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="agreement_type_agreement" model="agreement.type">
|
||||
<field name="name">Agreement</field>
|
||||
</record>
|
||||
|
||||
<record id="agreement_type_contract" model="agreement.type">
|
||||
<field name="name">Contract</field>
|
||||
</record>
|
||||
|
||||
<record id="agreement_type_loi" model="agreement.type">
|
||||
<field name="name">Letter of Intent</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -17,6 +17,10 @@ class ResConfigSettings(models.TransientModel):
|
||||
string='Link your repair orders to an agreement.')
|
||||
module_agreement_rma = fields.Boolean(
|
||||
string='Link your RMAs to an agreement.')
|
||||
module_agreement_sale = fields.Boolean(
|
||||
string='Create an agreement when the sale order is confirmed.')
|
||||
module_agreement_sale_subscription = fields.Boolean(
|
||||
string='Link your subscriptions to an agreement.')
|
||||
module_agreement_stock = fields.Boolean(
|
||||
string='Link your pickings to an agreement.')
|
||||
module_fieldservice_agreement = fields.Boolean(
|
||||
|
||||
@@ -121,8 +121,8 @@
|
||||
</group>
|
||||
<group name="term_information">
|
||||
<group name="termdates_left" string="Term Dates">
|
||||
<field name="start_date" required="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
|
||||
<field name="end_date" required="True" attrs="{'required': [('is_template', '=', False)], 'readonly':[('is_template', '=', True)]}"/>
|
||||
<field name="start_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/>
|
||||
<field name="end_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/>
|
||||
<field name="expiration_notice"/>
|
||||
<field name="change_notice"/>
|
||||
<field name="notification_address_id" domain="['|', ('parent_id', '=', partner_id), ('parent_id', '=', company_partner_id)]"/>
|
||||
@@ -388,6 +388,7 @@
|
||||
<field name="name">Templates</field>
|
||||
<field name="res_model">agreement</field>
|
||||
<field name="domain">[('is_template', '=', True)]</field>
|
||||
<field name="context">[('is_template', '=', True)]</field>
|
||||
<field name="view_mode">tree,kanban,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -34,6 +34,29 @@
|
||||
</div>
|
||||
<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_sale"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Sales"/>
|
||||
<div class="text-muted">
|
||||
Create an agreement when the sales order is confirmed
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box"
|
||||
attrs="{'invisible': [('module_agreement_sale', '!=', True)]}">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_agreement_sale_subscription"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Sale Subscriptions"/>
|
||||
<div class="text-muted">
|
||||
Link your subscriptions to an agreement
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_fieldservice_agreement"/>
|
||||
|
||||
130
agreement_sale/README.rst
Normal file
130
agreement_sale/README.rst
Normal file
@@ -0,0 +1,130 @@
|
||||
==========
|
||||
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>
|
||||
* Sandip Mangukiya <smangukiya@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.
|
||||
3
agreement_sale/__init__.py
Normal file
3
agreement_sale/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from . import models
|
||||
26
agreement_sale/__manifest__.py
Normal file
26
agreement_sale/__manifest__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
{
|
||||
'name': 'Agreement - Sale',
|
||||
'summary': 'Create an agreement when the sales order is confirmed',
|
||||
'version': '11.0.0.0.1',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
|
||||
'category': 'Agreement',
|
||||
'website': 'https://github.com/OCA/contract',
|
||||
'depends': [
|
||||
'agreement',
|
||||
'sale',
|
||||
],
|
||||
'data': [
|
||||
'views/agreement.xml',
|
||||
'views/sale_order.xml'
|
||||
],
|
||||
'installable': True,
|
||||
'development_status': 'Beta',
|
||||
'maintainers': [
|
||||
'osi-scampbell',
|
||||
'max3903',
|
||||
],
|
||||
}
|
||||
6
agreement_sale/models/__init__.py
Normal file
6
agreement_sale/models/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from . import (
|
||||
sale_order,
|
||||
agreement,
|
||||
)
|
||||
10
agreement_sale/models/agreement.py
Normal file
10
agreement_sale/models/agreement.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Agreement(models.Model):
|
||||
_inherit = 'agreement'
|
||||
|
||||
sale_id = fields.Many2one('sale.order', string='Sales Order')
|
||||
49
agreement_sale/models/sale_order.py
Normal file
49
agreement_sale/models/sale_order.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# Copyright (C) 2018 - TODAY, Open Source Integrators
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
agreement_template_id = fields.Many2one(
|
||||
'agreement',
|
||||
string="Agreement Template",
|
||||
domain="[('is_template', '=', True)]")
|
||||
agreement_id = fields.Many2one('agreement', string="Agreement")
|
||||
|
||||
@api.multi
|
||||
def _action_confirm(self):
|
||||
res = super(SaleOrder, self)._action_confirm()
|
||||
for order in self:
|
||||
if order.agreement_template_id:
|
||||
order.agreement_id = order.agreement_template_id.copy(default={
|
||||
'name': order.name,
|
||||
'is_template': False,
|
||||
'sale_id': order.id,
|
||||
'partner_id': order.partner_id.id,
|
||||
'analytic_account_id':
|
||||
order.analytic_account_id and
|
||||
order.analytic_account_id.id or False,
|
||||
})
|
||||
for line in self.order_line:
|
||||
# Create agreement line
|
||||
self.env['agreement.line'].create({
|
||||
'product_id': line.product_id.id,
|
||||
'name': line.name,
|
||||
'agreement_id': order.agreement_id.id,
|
||||
'qty': line.product_uom_qty,
|
||||
'sale_line_id': line.id,
|
||||
'uom_id': line.product_uom.id
|
||||
})
|
||||
# If the product sold has a BOM, create a service profile
|
||||
bom = self.env['mrp.bom'].search(
|
||||
[('product_tmpl_id', '=',
|
||||
line.product_id.product_tmpl_id.id)])
|
||||
if bom:
|
||||
self.env['agreement.serviceprofile'].create({
|
||||
'name': line.name,
|
||||
'agreement_id': order.agreement_id.id,
|
||||
})
|
||||
return res
|
||||
6
agreement_sale/readme/CONFIGURE.rst
Normal file
6
agreement_sale/readme/CONFIGURE.rst
Normal file
@@ -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
|
||||
2
agreement_sale/readme/CONTRIBUTORS.rst
Normal file
2
agreement_sale/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,2 @@
|
||||
* Steven Campbell <scampbell@opensourceintegrators.com>
|
||||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
|
||||
4
agreement_sale/readme/CREDITS.rst
Normal file
4
agreement_sale/readme/CREDITS.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
The development of this module has been financially supported by:
|
||||
|
||||
* Pavlov Media
|
||||
* Open Source Integrators
|
||||
5
agreement_sale/readme/DESCRIPTION.rst
Normal file
5
agreement_sale/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
Odoo Sales App does not support the management of legal content for agreements
|
||||
and contracts. It's also not integrated with the Agreement App.
|
||||
|
||||
This module is for companies that needs their customer to sign an agreement
|
||||
with all the legal information based on the selected agreement template.
|
||||
1
agreement_sale/readme/ROADMAP.rst
Normal file
1
agreement_sale/readme/ROADMAP.rst
Normal file
@@ -0,0 +1 @@
|
||||
The roadmap is documented on https://github.com/OCA/contract/issues.
|
||||
14
agreement_sale/readme/USAGE.rst
Normal file
14
agreement_sale/readme/USAGE.rst
Normal file
@@ -0,0 +1,14 @@
|
||||
To use this module:
|
||||
|
||||
* Go to Sales
|
||||
* Create or select a quotation
|
||||
* Set the agreement template and add some products
|
||||
* Confirm the quotation. An agreement is created and linked to the sales order:
|
||||
|
||||
* the agreement template is copied into an agreement with a copy of the
|
||||
sections, clauses, recitals and appendices
|
||||
* all the sales order lines are added as agreement lines
|
||||
* the products on the SO with BOM are added as service profile on the agreement
|
||||
* the customer information is set from the sales order
|
||||
* the eventual analytic account linked to the sales order is set on the agreement
|
||||
* the agreement is linked to the sales order and vice versa
|
||||
BIN
agreement_sale/static/description/icon.png
Normal file
BIN
agreement_sale/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
25
agreement_sale/views/agreement.xml
Normal file
25
agreement_sale/views/agreement.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<!-- Copyright 2018 Open Source Integrators
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||
|
||||
<!-- Agreement Form View -->
|
||||
<record id="agreement_sale_form_view" model="ir.ui.view">
|
||||
<field name="name">agreement.form.view</field>
|
||||
<field name="model">agreement</field>
|
||||
<field name="inherit_id" ref="agreement.partner_agreement_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<page name="signature" position="after">
|
||||
<page name="sales" string="Sales">
|
||||
<group>
|
||||
<group id="sale_left">
|
||||
<field name="sale_id" readonly="1"/>
|
||||
</group>
|
||||
<group id="sale-right"/>
|
||||
</group>
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
23
agreement_sale/views/sale_order.xml
Normal file
23
agreement_sale/views/sale_order.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<!-- Copyright 2018 Open Source Integrators
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
|
||||
|
||||
<!-- Agreement Form View -->
|
||||
<record id="sale_order_agreement_form_view" model="ir.ui.view">
|
||||
<field name="name">sale.order.agreement.form.view</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="client_order_ref" position="after">
|
||||
<field name="agreement_id"
|
||||
readonly="1"
|
||||
attrs="{'invisible': [('agreement_id', '=', False)]}"/>
|
||||
</field>
|
||||
<field name="partner_id" position="after">
|
||||
<field name="agreement_template_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user