mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] - Add contract tags
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
'depends': ['base', 'account', 'product'],
|
'depends': ['base', 'account', 'product'],
|
||||||
"external_dependencies": {"python": ["dateutil"]},
|
"external_dependencies": {"python": ["dateutil"]},
|
||||||
'data': [
|
'data': [
|
||||||
|
'security/contract_tag.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/contract_security.xml',
|
'security/contract_security.xml',
|
||||||
'report/report_contract.xml',
|
'report/report_contract.xml',
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ from . import contract_line
|
|||||||
from . import account_invoice
|
from . import account_invoice
|
||||||
from . import account_invoice_line
|
from . import account_invoice_line
|
||||||
from . import res_partner
|
from . import res_partner
|
||||||
|
from . import contract_tag
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ class ContractContract(models.Model):
|
|||||||
string='Commercial Entity',
|
string='Commercial Entity',
|
||||||
index=True
|
index=True
|
||||||
)
|
)
|
||||||
|
tag_ids = fields.Many2many(comodel_name="contract.tag", string="Tags")
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _inverse_partner_id(self):
|
def _inverse_partner_id(self):
|
||||||
|
|||||||
17
contract/models/contract_tag.py
Normal file
17
contract/models/contract_tag.py
Normal file
@@ -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
contract/security/contract_tag.xml
Normal file
23
contract/security/contract_tag.xml
Normal file
@@ -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>
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
<field name="contract_type" invisible="1"
|
<field name="contract_type" invisible="1"
|
||||||
required="1"/>
|
required="1"/>
|
||||||
<field name="fiscal_position_id"/>
|
<field name="fiscal_position_id"/>
|
||||||
|
<field name="tag_ids" widget="many2many_tags"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user