diff --git a/agreement/__init__.py b/agreement/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/agreement/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/agreement/__manifest__.py b/agreement/__manifest__.py new file mode 100644 index 00000000..96638f92 --- /dev/null +++ b/agreement/__manifest__.py @@ -0,0 +1,27 @@ +# © 2017 Akretion (Alexis de Lattre ) +# 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', + ], + 'demo': ['demo/demo.xml'], + 'development_status': 'Beta', + 'maintainers': [ + 'ygol', + 'alexis-via', + ], + 'installable': True, +} diff --git a/agreement/demo/demo.xml b/agreement/demo/demo.xml new file mode 100644 index 00000000..5cc58077 --- /dev/null +++ b/agreement/demo/demo.xml @@ -0,0 +1,63 @@ + + + + + + + + C2C-IT0042 + Hardware IT + + 2017-09-10 + 2017-09-10 + 2018-09-10 + + + + C2C-IT0043 + Fiber access office Lausanne + + + + + + + + AGR-VETO001 + Vétérinaire + + 2017-08-01 + 2017-08-01 + 2018-08-01 + + + + AGR-TEL001 + Wazo IPBX deployment and maintenance + + 2017-05-05 + 2017-05-05 + 2018-09-10 + + + + BUY-VOIP012 + SIP Phones supply + + + + + + + + BUY-VOIP013 + SIP-ISDN gateways + + 2017-09-02 + + + + diff --git a/agreement/i18n/agreement.pot b/agreement/i18n/agreement.pot new file mode 100644 index 00000000..3aebba64 --- /dev/null +++ b/agreement/i18n/agreement.pot @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * agreement +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-01-12 13:27+0000\n" +"PO-Revision-Date: 2019-01-12 13:27+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__active +msgid "Active" +msgstr "" + +#. module: agreement +#: model:ir.model,name:agreement.model_agreement +#: model_terms:ir.ui.view,arch_db:agreement.agreement_form +msgid "Agreement" +msgstr "" + +#. module: agreement +#: model:ir.actions.act_window,name:agreement.agreement_action +#: model:ir.ui.menu,name:agreement.agreement_menu +#: model_terms:ir.ui.view,arch_db:agreement.agreement_tree +msgid "Agreements" +msgstr "" + +#. module: agreement +#: model_terms:ir.ui.view,arch_db:agreement.agreement_search +msgid "Archived" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__code +msgid "Code" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__company_id +msgid "Company" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__create_uid +msgid "Created by" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__create_date +msgid "Created on" +msgstr "" + +#. module: agreement +#: model_terms:ir.ui.view,arch_db:agreement.agreement_search +msgid "Customer" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__display_name +msgid "Display Name" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__end_date +msgid "End Date" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__id +msgid "ID" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement____last_update +msgid "Last Modified on" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__write_date +msgid "Last Updated on" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__name +msgid "Name" +msgstr "" + +#. module: agreement +#: model_terms:ir.ui.view,arch_db:agreement.agreement_search +msgid "Name or Number" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__partner_id +msgid "Partner" +msgstr "" + +#. module: agreement +#: model_terms:ir.ui.view,arch_db:agreement.agreement_search +msgid "Search Agreements" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__signature_date +#: model_terms:ir.ui.view,arch_db:agreement.agreement_search +msgid "Signature Date" +msgstr "" + +#. module: agreement +#: model:ir.model.fields,field_description:agreement.field_agreement__start_date +msgid "Start Date" +msgstr "" + +#. module: agreement +#: sql_constraint:agreement:0 +msgid "This agreement code already exists for this partner!" +msgstr "" diff --git a/agreement/models/__init__.py b/agreement/models/__init__.py new file mode 100644 index 00000000..51f4021f --- /dev/null +++ b/agreement/models/__init__.py @@ -0,0 +1 @@ +from . import agreement diff --git a/agreement/models/agreement.py b/agreement/models/agreement.py new file mode 100644 index 00000000..dc975526 --- /dev/null +++ b/agreement/models/agreement.py @@ -0,0 +1,39 @@ +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import models, fields + + +class Agreement(models.Model): + _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', required=True, + domain=[('parent_id', '=', False)]) + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env['res.company']._company_default_get( + 'agreement')) + active = fields.Boolean(default=True) + signature_date = fields.Date() + start_date = fields.Date() + end_date = fields.Date() + + def name_get(self): + res = [] + for agr in self: + name = agr.name + if agr.code: + name = u'[%s] %s' % (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!' + )] diff --git a/agreement/readme/CONTRIBUTORS.rst b/agreement/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..bc3bbf22 --- /dev/null +++ b/agreement/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Yves Goldberg diff --git a/agreement/readme/DESCRIPTION.rst b/agreement/readme/DESCRIPTION.rst new file mode 100644 index 00000000..c58e0465 --- /dev/null +++ b/agreement/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +This module adds an *Agreement* object with the following properties: + +* code, +* name, +* link to a partner, +* signature date. +* start date. +* end date. diff --git a/agreement/security/agreement_security.xml b/agreement/security/agreement_security.xml new file mode 100644 index 00000000..d645ef6d --- /dev/null +++ b/agreement/security/agreement_security.xml @@ -0,0 +1,17 @@ + + + + + + + + Agreement multi-company + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + + diff --git a/agreement/security/ir.model.access.csv b/agreement/security/ir.model.access.csv new file mode 100644 index 00000000..d3d9063c --- /dev/null +++ b/agreement/security/ir.model.access.csv @@ -0,0 +1,2 @@ +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 diff --git a/agreement/views/agreement.xml b/agreement/views/agreement.xml new file mode 100644 index 00000000..15f284ce --- /dev/null +++ b/agreement/views/agreement.xml @@ -0,0 +1,86 @@ + + + + + + + + agreement.form + agreement + +
+
+ +
+ + + + + + + + + + + + + + + + +
+
+
+ + + agreement.tree + agreement + + + + + + + + + + + + + + + agreement.search + agreement + + + + + + + + + + + + + + + + Agreements + agreement + tree,form + + + + +