Browse Source

[MIG] agreement: Migration to 12.0

pull/287/head
ygol 6 years ago
parent
commit
9bc2b9fb62
  1. 3
      agreement/__init__.py
  2. 22
      agreement/__manifest__.py
  3. 69
      agreement/demo/demo.xml
  4. 130
      agreement/i18n/agreement.pot
  5. 3
      agreement/models/__init__.py
  6. 40
      agreement/models/agreement.py
  7. 17
      agreement/security/agreement_security.xml
  8. 2
      agreement/security/ir.model.access.csv
  9. 83
      agreement/views/agreement.xml

3
agreement/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import models

22
agreement/__manifest__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# 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,Odoo Community Association (OCA)",
'contributors': 'Yves Goldberg (Ygol InternetWork)',
'website': 'http://www.akretion.com',
'license': 'AGPL-3',
'depends': ['base'],
'data': [
'security/ir.model.access.csv',
'security/agreement_security.xml',
'views/agreement.xml',
],
'demo': ['demo/demo.xml'],
'installable': True,
}

69
agreement/demo/demo.xml

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="market1" model="agreement">
<field name="code">C2C-IT0042</field>
<field name="name">Hardware IT</field>
<field name="partner_id" ref="base.res_partner_12"/>
<field name="agreement_type">sale</field>
<field name="signature_date">2017-09-10</field>
<field name="start_date">2017-09-10</field>
<field name="end_date">2018-09-10</field>
</record>
<record id="market2" model="agreement">
<field name="code">C2C-IT0043</field>
<field name="name">Fiber access office Lausanne</field>
<field name="partner_id" ref="base.res_partner_12"/>
<field name="agreement_type">sale</field>
<field name="signature_date" eval="time.strftime('%Y-01-01')"/>
<field name="start_date" eval="time.strftime('%Y-01-01')"/>
<field name="end_date" eval="time.strftime('%Y-01-01')"/>
</record>
<record id="market3" model="agreement">
<field name="code">AGR-VETO001</field>
<field name="name">Vétérinaire</field>
<field name="partner_id" ref="base.res_partner_2"/>
<field name="agreement_type">sale</field>
<field name="signature_date">2017-08-01</field>
<field name="start_date">2017-08-01</field>
<field name="end_date">2018-08-01</field>
</record>
<record id="market4" model="agreement">
<field name="code">AGR-TEL001</field>
<field name="name">Wazo IPBX deployment and maintenance</field>
<field name="partner_id" ref="base.res_partner_2"/>
<field name="agreement_type">sale</field>
<field name="signature_date">2017-05-05</field>
<field name="start_date">2017-05-05</field>
<field name="end_date">2018-09-10</field>
</record>
<record id="market5" model="agreement">
<field name="code">BUY-VOIP012</field>
<field name="name">SIP Phones supply</field>
<field name="partner_id" ref="base.res_partner_1"/>
<field name="agreement_type">purchase</field>
<field name="signature_date" eval="time.strftime('%Y-01-01')"/>
<field name="start_date" eval="time.strftime('%Y-01-01')"/>
<field name="end_date" eval="time.strftime('%Y-01-01')"/>
</record>
<record id="market6" model="agreement">
<field name="code">BUY-VOIP013</field>
<field name="name">SIP-ISDN gateways</field>
<field name="partner_id" ref="base.res_partner_3"/>
<field name="agreement_type">purchase</field>
<field name="signature_date">2017-09-02</field>
</record>
</odoo>

130
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 ""

3
agreement/models/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import agreement

40
agreement/models/agreement.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# 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!'
)]

17
agreement/security/agreement_security.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="agreement_rule" model="ir.rule">
<field name="name">Agreement multi-company</field>
<field name="model_id" ref="model_agreement"/>
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>
</odoo>

2
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

83
agreement/views/agreement.xml

@ -0,0 +1,83 @@
<?xml version="1.0"?>
<!--
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="agreement_form" model="ir.ui.view">
<field name="name">agreement.form</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<form string="Agreement">
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<group name="left">
<field name="partner_id"/>
<field name="name"/>
<field name="signature_date"/>
</group>
<group name="right">
<field name="start_date"/>
<field name="end_date"/>
<field name="code"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
</form>
</field>
</record>
<record id="agreement_tree" model="ir.ui.view">
<field name="name">agreement.tree</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<tree string="Agreements">
<field name="partner_id"/>
<field name="code"/>
<field name="name"/>
<field name="signature_date"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="agreement_search" model="ir.ui.view">
<field name="name">agreement.search</field>
<field name="model">agreement</field>
<field name="arch" type="xml">
<search string="Search Agreements">
<field name="name" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]" string="Name or Number"/>
<field name="partner_id"/>
<separator/>
<filter name="inactive" string="Archived" domain="[('active', '=', False)]"/>
<group name="groupby">
<filter name="partner_groupby" string="Customer"
context="{'group_by': 'partner_id'}"/>
<filter name="signature_date_groupby" string="Signature Date"
context="{'group_by': 'signature_date'}"/>
</group>
</search>
</field>
</record>
<record id="agreement_action" model="ir.actions.act_window">
<field name="name">Agreements</field>
<field name="res_model">agreement</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="agreement_menu" action="agreement_action"
sequence="100"/>
</odoo>
Loading…
Cancel
Save