Browse Source

[MIG] Migration partner_contact_birthdate partner_contact_gender part… (#315)

[MIG] Migration partner_contact_birthdate partner_contact_gender partner_contact_personal_information_page to v10
pull/334/head
invitu 8 years ago
committed by Pedro M. Baeza
parent
commit
57df5ab983
  1. 1
      partner_contact_birthdate/__init__.py
  2. 10
      partner_contact_birthdate/__manifest__.py
  3. 5
      partner_contact_birthdate/data/res_partner.yml
  4. 10
      partner_contact_birthdate/hooks.py
  5. 9
      partner_contact_birthdate/models/res_partner.py
  6. 26
      partner_contact_birthdate/views/res_partner.xml
  7. 8
      partner_contact_gender/__manifest__.py
  8. 5
      partner_contact_gender/hooks.py
  9. 8
      partner_contact_gender/i18n/fr.po
  10. 2
      partner_contact_gender/models/res_partner.py
  11. 28
      partner_contact_gender/views/res_partner.xml
  12. 4
      partner_contact_personal_information_page/__manifest__.py
  13. 8
      partner_contact_personal_information_page/views/res_partner.xml

1
partner_contact_birthdate/__init__.py

@ -2,3 +2,4 @@
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
from .hooks import post_init_hook

10
partner_contact_birthdate/__manifest__.py

@ -4,16 +4,18 @@
{
"name": "Contact's birthdate",
"version": "9.0.1.0.0",
"author": "Jairo Llopis,"
"version": "10.0.1.0.0",
"author": "Tecnativa,"
"Odoo Community Association (OCA)",
"category": "Customer Relationship Management",
"website": "https://odoo-community.org/",
"website": "https://www.tecnativa.com/",
"depends": [
"partner_contact_personal_information_page",
],
"data": [
"views/res_partner.xml",
],
'installable': False,
"post_init_hook": "post_init_hook",
"license": "AGPL-3",
'installable': True,
}

5
partner_contact_birthdate/data/res_partner.yml

@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
- !function {model: res.partner, name: _birthdate_install}

10
partner_contact_birthdate/hooks.py

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo import SUPERUSER_ID
from odoo.api import Environment
def post_init_hook(cr, pool):
env = Environment(cr, SUPERUSER_ID, {})
env['res.partner'].search(
[('birthdate', "!=", False)])._birthdate_inverse()

9
partner_contact_birthdate/models/res_partner.py

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
from odoo import _, api, fields, models
import logging
_logger = logging.getLogger(__name__)
class Partner(models.Model):
class ResPartner(models.Model):
"""Partner with birth date in date format."""
_inherit = "res.partner"
@ -36,8 +36,3 @@ class Partner(models.Model):
_logger.warn(
_("Could not convert '{0.birthdate}' to date in "
"res.partner {0.id} ({0.name}). Skipping.").format(self))
@api.model
def _birthdate_install(self):
"""Export all old birthdates to the new format."""
self.search([('birthdate', "!=", False)])._inverse_birthdate()

26
partner_contact_birthdate/views/res_partner.xml

@ -3,18 +3,16 @@
© 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. -->
<odoo>
<record id="view_personal_information_birthdate_date" model="ir.ui.view">
<field name="name">Birthdate Date field</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//group[@name='personal_information_group']">
<field name="birthdate_date"/>
</xpath>
</data>
</field>
</record>
<record id="view_personal_information_birthdate_date" model="ir.ui.view">
<field name="name">Birthdate Date field</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//group[@name='personal_information_group']">
<field name="birthdate_date"/>
</xpath>
</data>
</field>
</record>
</odoo>

8
partner_contact_gender/__manifest__.py

@ -5,17 +5,17 @@
{
"name": "Contact gender",
"summary": "Add gender field to contacts",
"version": "9.0.1.1.0",
"version": "10.0.1.1.0",
"category": "Customer Relationship Management",
"website": "https://odoo-community.org/",
"author": "Grupo ESOC, Odoo Community Association (OCA)",
"website": "https://www.tecnativa.com/",
"author": "Grupo ESOC, Tecnativa, Odoo Community Association (OCA)",
"contributors": [
'Jairo Llopis <j.llopis@grupoesoc.es>',
'Richard deMeester <richard@willowit.com.au>',
],
"license": "AGPL-3",
'application': False,
'installable': False,
'installable': True,
'auto_install': False,
"depends": [
"partner_contact_personal_information_page",

5
partner_contact_gender/hooks.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, SUPERUSER_ID
from odoo import api, SUPERUSER_ID
def post_init_hook(cr, pool):
@ -9,8 +9,7 @@ def post_init_hook(cr, pool):
gender_mappings = {
'female': env.ref('base.res_partner_title_madam') +
env.ref('base.res_partner_title_miss'),
'male': env.ref('base.res_partner_title_sir') +
env.ref('base.res_partner_title_mister'),
'male': env.ref('base.res_partner_title_mister')
}
for gender, titles in gender_mappings.iteritems():
env['res.partner'].with_context(active_test=False).search([

8
partner_contact_gender/i18n/fr.po

@ -20,22 +20,22 @@ msgstr ""
#. module: partner_contact_gender
#: selection:res.partner,gender:0
msgid "Female"
msgstr ""
msgstr "Femme"
#. module: partner_contact_gender
#: model:ir.model.fields,field_description:partner_contact_gender.field_res_partner_gender
msgid "Gender"
msgstr ""
msgstr "Genre"
#. module: partner_contact_gender
#: selection:res.partner,gender:0
msgid "Male"
msgstr ""
msgstr "Homme"
#. module: partner_contact_gender
#: selection:res.partner,gender:0
msgid "Other"
msgstr ""
msgstr "Autre"
#. module: partner_contact_gender
#: model:ir.model,name:partner_contact_gender.model_res_partner

2
partner_contact_gender/models/res_partner.py

@ -2,7 +2,7 @@
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
from odoo import fields, models
class ResPartner(models.Model):

28
partner_contact_gender/views/res_partner.xml

@ -1,19 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_personal_information_gender" model="ir.ui.view">
<field name="name">Partner gender: personal info</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']">
<field name='gender'/>
</xpath>
</data>
</field>
</record>
</data>
<record id="view_personal_information_gender" model="ir.ui.view">
<field name="name">Partner gender: personal info</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']">
<field name='gender'/>
</xpath>
</data>
</field>
</record>
</odoo>

4
partner_contact_personal_information_page/__manifest__.py

@ -4,7 +4,7 @@
{
"name": "Personal information page for contacts",
"summary": "Add a page to contacts form to put personal information",
"version": "9.0.1.0.0",
"version": "10.0.1.0.0",
"category": "Customer Relationship Management",
"website": "https://odoo-community.org/",
"author": "Odoo Community Association (OCA)",
@ -17,7 +17,7 @@
],
"license": "AGPL-3",
'application': False,
'installable': False,
'installable': True,
'auto_install': False,
"depends": [
"base"

8
partner_contact_personal_information_page/views/res_partner.xml

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Declared the same in every module that may need it -->
<record id="personal_information" model="ir.ui.view">
<field name="name">Personal information page for contacts form</field>
@ -12,14 +10,12 @@
<data>
<xpath expr="//page[@name='internal_notes']" position="after">
<page name="personal_information_page"
string="Personal Information"
attrs="{'invisible': [('is_company','=',True)]}">
string="Personal Information"
attrs="{'invisible': [('is_company','=',True)]}">
<group name="personal_information_group"/>
</page>
</xpath>
</data>
</field>
</record>
</data>
</odoo>
Loading…
Cancel
Save