[IMP] move some notions from agreement_legal to agreement

we move the is_template field definition and the agreement.type model from
the agreement_legal module to the agreement module.

The fields are not displayed by default, unless the feature is enabled through a
technical feature group, this is configurable in the agreement_sale module (because agreement
in itself has no UI, and agreement_legal enables the feature by default)
This commit is contained in:
Alexandre Fayolle
2019-09-27 09:41:19 +02:00
committed by Víctor Martínez
parent 8c84996ac4
commit 4c74fa2373
4 changed files with 16 additions and 29 deletions

View File

@@ -10,11 +10,6 @@ class Agreement(models.Model):
# General
name = fields.Char(string="Title", required=True)
is_template = fields.Boolean(
string="Is a Template?",
default=False,
copy=False,
help="Make this agreement a template.")
version = fields.Integer(
string="Version",
default=1,
@@ -170,10 +165,8 @@ class Agreement(models.Model):
string="Dynamic Parties",
help="Compute dynamic parties")
agreement_type_id = fields.Many2one(
"agreement.type",
string="Agreement Type",
track_visibility="onchange",
help="Select the type of agreement.")
)
agreement_subtype_id = fields.Many2one(
"agreement.subtype",
string="Agreement Sub-type",

View File

@@ -5,10 +5,9 @@ from odoo import fields, models
class AgreementType(models.Model):
_name = "agreement.type"
_inherit = "agreement.type"
_description = "Agreement Types"
name = fields.Char(string="Name", required=True)
agreement_subtypes_ids = fields.One2many(
"agreement.subtype",
"agreement_type_id",

View File

@@ -9,7 +9,7 @@
<record id="group_agreement_readonly" model="res.groups">
<field name="name">Read-Only Users</field>
<field name="category_id" ref="module_agreement_legal_category"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_user')), (4, ref('agreement.group_use_agreement_type')), (4, ref('agreement.group_use_agreement_template'))]"/>
</record>
<!-- User group -->

View File

@@ -5,33 +5,28 @@
<record model="ir.ui.view" id="partner_agreement_type_list_view">
<field name="name">Agreement Type List</field>
<field name="model">agreement.type</field>
<field name="inherit_id" ref="agreement.agreement_type_list_view"/>
<field name="arch" type="xml">
<tree string="Agreement Types" default_order='name'>
<field name="name" string="Type Name"/>
<field name="name" position="after">
<field name="agreement_subtypes_ids" string="Sub-Types"/>
</tree>
</field>
</field>
</field>
</record>
<!-- Agreement Type Form View -->
<record model="ir.ui.view" id="partner_agreement_type_form_view">
<field name="name">Agreement Type Form</field>
<field name="model">agreement.type</field>
<field name="inherit_id" ref="agreement.agreement_type_form_view"/>
<field name="arch" type="xml">
<form string="Agreement Type">
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
<field name="agreement_subtypes_ids"
nolabel="1">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</sheet>
</form>
<xpath expr="//sheet" position="inside">
<field name="agreement_subtypes_ids"
nolabel="1">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</xpath>
</field>
</record>