Skip to content

Commit

Permalink
[MIG][13.0] agreemnt_sale + black
Browse files Browse the repository at this point in the history
  • Loading branch information
Iryna Vyshnevska authored and i-vyshnevska committed Mar 1, 2021
1 parent 875a4f7 commit 896f04b
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 65 deletions.
39 changes: 16 additions & 23 deletions agreement_sale/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Agreement Sale',
'summary': "Agreement on sales",
'version': '12.0.1.0.0',
'category': 'Contract',
'author': 'Akretion, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/oca/contract',
'license': 'AGPL-3',
'depends': [
'sale_management',
'agreement',
"name": "Agreement Sale",
"summary": "Agreement on sales",
"version": "13.0.1.0.0",
"category": "Contract",
"author": "Akretion, " "Odoo Community Association (OCA)",
"website": "https://github.com/oca/contract",
"license": "AGPL-3",
"depends": ["sale_management", "agreement"],
"data": [
"security/ir.model.access.csv",
"views/agreement.xml",
"views/sale_order.xml",
"views/res_config_settings.xml",
],
'data': [
'security/ir.model.access.csv',
'views/agreement.xml',
'views/sale_order.xml',
'views/res_config_settings.xml',
],
'development_status': 'Beta',
'maintainers': [
'alexis-via',
'bealdav',
],
'installable': True,
"development_status": "Beta",
"maintainers": ["alexis-via", "bealdav"],
"installable": True,
}
8 changes: 3 additions & 5 deletions agreement_sale/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
_inherit = "res.config.settings"

group_use_agreement_type = fields.Boolean(
'Use agreement types',
implied_group='agreement.group_use_agreement_type'
"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'
"Use agreement template", implied_group="agreement.group_use_agreement_template"
)
25 changes: 17 additions & 8 deletions agreement_sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import models, fields
from odoo import fields, models


class SaleOrder(models.Model):
_inherit = 'sale.order'
_inherit = "sale.order"

agreement_id = fields.Many2one(
comodel_name='agreement', string='Agreement', ondelete='restrict',
track_visibility='onchange', readonly=True, copy=False,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
comodel_name="agreement",
string="Agreement",
ondelete="restrict",
track_visibility="onchange",
readonly=True,
copy=False,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
)

agreement_type_id = fields.Many2one(
comodel_name="agreement.type", string="Agreement Type",
comodel_name="agreement.type",
string="Agreement Type",
ondelete="restrict",
track_visibility='onchange', readonly=True, copy=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
track_visibility="onchange",
readonly=True,
copy=True,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
)
22 changes: 14 additions & 8 deletions agreement_sale/views/agreement.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0"?>

<?xml version="1.0" ?>
<odoo>

<menuitem id="agreement.agreement_menu" action="agreement.agreement_action"
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"/>

<menuitem
id="agreement.agreement_menu"
action="agreement.agreement_action"
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>
40 changes: 26 additions & 14 deletions agreement_sale/views/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="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
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"/>
<field name="group_use_agreement_type" />
</div>
<div class="o_setting_right_pane">
<label for="group_use_agreement_type"/>
<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="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"/>
<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-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"/>
<field name="group_use_agreement_template" />
</div>
<div class="o_setting_right_pane">
<label for="group_use_agreement_template"/>
<label for="group_use_agreement_template" />
<div class="text-muted">
Have a special kind of agreements which act as templates
</div>
Expand Down
14 changes: 7 additions & 7 deletions agreement_sale/views/sale_order.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<?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="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="client_order_ref" position="after">
<field name="agreement_id"/>
<field name="agreement_id" />
</field>
<field name="partner_id" position="after">
<field name="agreement_type_id"
groups="agreement.group_use_agreement_type"
/>
<field
name="agreement_type_id"
groups="agreement.group_use_agreement_type"
/>
</field>
</field>
</record>

</odoo>
1 change: 1 addition & 0 deletions setup/agreement_sale/odoo/addons/agreement_sale
6 changes: 6 additions & 0 deletions setup/agreement_sale/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 896f04b

Please sign in to comment.