Skip to content

Commit

Permalink
Merge PR #402 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by sbidoul
  • Loading branch information
OCA-git-bot committed Dec 22, 2019
2 parents 7694b30 + 3b79dea commit 51d8ccd
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions contract/__manifest__.py
Expand Up @@ -20,6 +20,7 @@
'depends': ['base', 'account', 'product'],
"external_dependencies": {"python": ["dateutil"]},
'data': [
'security/contract_tag.xml',
'security/ir.model.access.csv',
'security/contract_security.xml',
'report/report_contract.xml',
Expand Down
1 change: 1 addition & 0 deletions contract/models/__init__.py
Expand Up @@ -9,3 +9,4 @@
from . import account_invoice
from . import account_invoice_line
from . import res_partner
from . import contract_tag
1 change: 1 addition & 0 deletions contract/models/contract.py
Expand Up @@ -91,6 +91,7 @@ class ContractContract(models.Model):
string='Commercial Entity',
index=True
)
tag_ids = fields.Many2many(comodel_name="contract.tag", string="Tags")

@api.multi
def _inverse_partner_id(self):
Expand Down
17 changes: 17 additions & 0 deletions contract/models/contract_tag.py
@@ -0,0 +1,17 @@
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ContractTag(models.Model):

_name = 'contract.tag'
_description = 'Contract Tag'

name = fields.Char(requirment=True)
company_id = fields.Many2one(
'res.company',
string='Company',
default=lambda self: self.env.user.company_id,
)
23 changes: 23 additions & 0 deletions contract/security/contract_tag.xml
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>

<record model="ir.model.access" id="contract_tag_access">
<field name="name">contract.tag access</field>
<field name="model_id" ref="model_contract_tag"/>
<field name="group_id" ref="account.group_account_invoice"/>
<field name="perm_read" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>

<record id="contract_tag_multi_company_rule" model="ir.rule">
<field name="name">Contract tag multi-company</field>
<field name="model_id" ref="model_contract_tag"/>
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>

</odoo>
1 change: 1 addition & 0 deletions contract/views/contract.xml
Expand Up @@ -55,6 +55,7 @@
<field name="contract_type" invisible="1"
required="1"/>
<field name="fiscal_position_id"/>
<field name="tag_ids" widget="many2many_tags"/>
</group>
</group>

Expand Down

0 comments on commit 51d8ccd

Please sign in to comment.