Browse Source

[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)
pull/398/head
Alexandre Fayolle 5 years ago
committed by Iryna Vyshnevska
parent
commit
b5ac8af447
  1. 2
      agreement_sale/__manifest__.py
  2. 1
      agreement_sale/models/__init__.py
  3. 14
      agreement_sale/models/res_config_settings.py
  4. 6
      agreement_sale/models/sale.py
  5. 2
      agreement_sale/security/ir.model.access.csv
  6. 4
      agreement_sale/views/agreement.xml
  7. 48
      agreement_sale/views/res_config_settings.xml
  8. 19
      agreement_sale/views/sale_order.xml

2
agreement_sale/__manifest__.py

@ -17,6 +17,8 @@
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/agreement.xml', 'views/agreement.xml',
'views/sale_order.xml',
'views/res_config_settings.xml',
], ],
'development_status': 'Beta', 'development_status': 'Beta',
'maintainers': [ 'maintainers': [

1
agreement_sale/models/__init__.py

@ -1 +1,2 @@
from . import sale from . import sale
from . import res_config_settings

14
agreement_sale/models/res_config_settings.py

@ -0,0 +1,14 @@
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_use_agreement_type = fields.Boolean(
'Use agreement types',
implied_group='agreement.group_use_agreement_type'
)
group_use_agreement_template = fields.Boolean(
'Use agreement template',
implied_group='agreement.group_use_agreement_template'
)

6
agreement_sale/models/sale.py

@ -12,3 +12,9 @@ class SaleOrder(models.Model):
comodel_name='agreement', string='Agreement', ondelete='restrict', comodel_name='agreement', string='Agreement', ondelete='restrict',
track_visibility='onchange', readonly=True, copy=False, track_visibility='onchange', readonly=True, copy=False,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}) states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
agreement_type_id = fields.Many2one(
comodel_name="agreement.type", string="Agreement Type",
ondelete="restrict",
track_visibility='onchange', readonly=True, copy=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})

2
agreement_sale/security/ir.model.access.csv

@ -1,2 +1,4 @@
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
agreement.access_agreement_full,Full access on agreement grp,agreement.model_agreement,sales_team.group_sale_manager,1,1,1,1 agreement.access_agreement_full,Full access on agreement grp,agreement.model_agreement,sales_team.group_sale_manager,1,1,1,1
agreement_sale.access_agreement_type_full,Full access on agreement type grp,agreement.model_agreement_type,sales_team.group_sale_manager,1,1,1,1
agreement_sale.access_agreement_type_read,Read access on agreement grp,agreement.model_agreement_type,base.group_user,1,0,0,0

4
agreement_sale/views/agreement.xml

@ -2,7 +2,9 @@
<odoo> <odoo>
<menuitem id="agreement.agreement_menu" action="agreement.agreement_action"
<menuitem id="agreement.agreement_menu" action="agreement.agreement_action"
parent="sale.menu_sale_config" sequence="100"/> parent="sale.menu_sale_config" sequence="100"/>
<menuitem id="agreement.agreement_type_menu" action="agreement.agreement_type_action"
parent="sale.menu_sale_config" sequence="101" groups="agreement.group_use_agreement_type"/>
</odoo> </odoo>

48
agreement_sale/views/res_config_settings.xml

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.agreement</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="11"/>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='sale_management']" position="inside">
<h2>Agreements</h2>
<div class="row mt16 o_settings_container">
<div id="sales_settings_agreement_type_group"
class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_use_agreement_type"/>
</div>
<div class="o_setting_right_pane">
<label for="group_use_agreement_type"/>
<div class="text-muted">
Manage agreements by types
</div>
<div class="content-group" attrs="{'invisible': [('group_use_agreement_type','=',False)]}">
<div class="mt16">
<button name="%(agreement.agreement_type_action)d" icon="fa-arrow-right" type="action" string="Agreement types" class="btn-link"/>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6 o_setting_box"
id="sales_settings_agreement_template_group">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_use_agreement_template"/>
</div>
<div class="o_setting_right_pane">
<label for="group_use_agreement_template"/>
<div class="text-muted">
Have a special kind of agreements which act as templates
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

19
agreement_sale/views/sale_order.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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"/>
</field>
<field name="partner_id" position="after">
<field name="agreement_type_id"
groups="agreement.group_use_agreement_type"
/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save