diff --git a/agreement/__manifest__.py b/agreement/__manifest__.py index f340688f..48a506a3 100644 --- a/agreement/__manifest__.py +++ b/agreement/__manifest__.py @@ -2,27 +2,24 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Agreement', - 'summary': "Adds an agreement object", - 'version': '12.0.1.0.0', - 'category': 'Contract', - 'author': 'Akretion, ' - 'Yves Goldberg (Ygol Internetwork), ' - 'Odoo Community Association (OCA)', - 'website': 'https://github.com/oca/contract', - 'license': 'AGPL-3', - 'depends': ['base'], - 'data': [ - 'security/ir.model.access.csv', - 'security/agreement_security.xml', - 'views/agreement.xml', - 'views/agreement_type.xml', - ], - 'demo': ['demo/demo.xml'], - 'development_status': 'Beta', - 'maintainers': [ - 'ygol', - 'alexis-via', + "name": "Agreement", + "summary": "Adds an agreement object", + "version": "13.0.1.0.0", + "category": "Contract", + "author": "Akretion, " + "Yves Goldberg (Ygol Internetwork), " + "Odoo Community Association (OCA)", + "website": "https://github.com/oca/contract", + "license": "AGPL-3", + "depends": ["base"], + "data": [ + "security/ir.model.access.csv", + "security/agreement_security.xml", + "views/agreement.xml", + "views/agreement_type.xml", ], - 'installable': True, + "demo": ["demo/demo.xml"], + "development_status": "Beta", + "maintainers": ["ygol", "alexis-via"], + "installable": True, } diff --git a/agreement/models/agreement.py b/agreement/models/agreement.py index 68bb8e17..4d0ec765 100644 --- a/agreement/models/agreement.py +++ b/agreement/models/agreement.py @@ -2,32 +2,35 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, fields +from odoo import fields, models class Agreement(models.Model): - _name = 'agreement' - _description = 'Agreement' + _name = "agreement" + _description = "Agreement" code = fields.Char(required=True, copy=False) name = fields.Char(required=True) partner_id = fields.Many2one( - 'res.partner', string='Partner', ondelete='restrict', - domain=[('parent_id', '=', False)]) + "res.partner", + string="Partner", + ondelete="restrict", + domain=[("parent_id", "=", False)], + ) company_id = fields.Many2one( - 'res.company', string='Company', - default=lambda self: self.env['res.company']._company_default_get()) + "res.company", + string="Company", + default=lambda self: self.env["res.company"]._company_default_get(), + ) is_template = fields.Boolean( string="Is a Template?", default=False, copy=False, help="Set if the agreement is a template. " - "Template agreements don't require a partner." + "Template agreements don't require a partner.", ) agreement_type_id = fields.Many2one( - 'agreement.type', - string="Agreement Type", - help="Select the type of agreement", + "agreement.type", string="Agreement Type", help="Select the type of agreement" ) active = fields.Boolean(default=True) signature_date = fields.Date() @@ -39,12 +42,14 @@ class Agreement(models.Model): for agr in self: name = agr.name if agr.code: - name = '[%s] %s' % (agr.code, agr.name) + name = "[{}] {}".format(agr.code, agr.name) res.append((agr.id, name)) return res - _sql_constraints = [( - 'code_partner_company_unique', - 'unique(code, partner_id, company_id)', - 'This agreement code already exists for this partner!' - )] + _sql_constraints = [ + ( + "code_partner_company_unique", + "unique(code, partner_id, company_id)", + "This agreement code already exists for this partner!", + ) + ] diff --git a/agreement/security/ir.model.access.csv b/agreement/security/ir.model.access.csv index 3184640e..9296e554 100644 --- a/agreement/security/ir.model.access.csv +++ b/agreement/security/ir.model.access.csv @@ -1,3 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_agreement_read,Read access on agreement to Employees,model_agreement,base.group_user,1,0,0,0 access_agreement_full,Full access on agreement grp,model_agreement,base.group_no_one,1,1,1,1 +access_agreement_type_user,access_agreement_type_user,model_agreement_type,base.group_user,1,0,0,0 +access_agreement_type_manager,access_agreement_type_manager,model_agreement_type,base.group_no_one,1,1,1,1