Skip to content

Commit

Permalink
[MIG] Migration to V10
Browse files Browse the repository at this point in the history
  • Loading branch information
damendieta committed Nov 21, 2016
1 parent d69f578 commit ade7b38
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 26 deletions.
2 changes: 1 addition & 1 deletion l10n_ec_ote/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Este módulo agrega la información de provincias, cantones y parroquias del Ecu

Tested on version / Probado en la versión
=========================================
9.0c-20160726
10.0-20161103

Usage
=====
Expand Down
1 change: 0 additions & 1 deletion l10n_ec_ote/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
],
'data': [
'views/res_partner.xml',
'views/res_company.xml',
'data/res.country.state.csv',
'data/l10n_ec_ote.canton.csv',
'data/l10n_ec_ote.parish.csv',
Expand Down
1 change: 0 additions & 1 deletion l10n_ec_ote/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import ote
from . import res_partner
from . import res_company
2 changes: 1 addition & 1 deletion l10n_ec_ote/models/ote.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from openerp import models, fields
from odoo import models, fields


class Canton(models.Model):
Expand Down
5 changes: 2 additions & 3 deletions l10n_ec_ote/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from odoo import models, fields, api


class ResPartner(models.Model):
Expand All @@ -9,10 +9,9 @@ class ResPartner(models.Model):
@api.onchange("canton_id")
def _onchange_canton_id(self):
for r in self:
if not r.city:
if r.canton_id and not r.city:
r.city = r.canton_id.name.capitalize() or ''

country_id = fields.Many2one(default="base.ec", )
canton_id = fields.Many2one(
'l10n_ec_ote.canton', ondelete='restrict', string="Canton", )
parish_id = fields.Many2one(
Expand Down
87 changes: 68 additions & 19 deletions l10n_ec_ote/views/res_partner.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,82 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="partner_view_form_info" model="ir.ui.view">
<field name="name">partner.view.info.form.inherit</field>
<record id="partner_form_view_ec" model="ir.ui.view">
<field name="name">OTE view_partner_form inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='street2']" position="after">
<field name="country_id" class="oe_no_button" placeholder="Country"
options="{'no_quick_create':True,'no_create_edit':True}"/>
</xpath>
<xpath expr="//field[@name='city']" position="replace">
<field name="state_id" class="oe_no_button" placeholder="State"
<!-- partner view -->
<field name='country_id' position="replace">
<field name="city" placeholder="City" class="o_address_city"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
</field>
<field name="city" position="replace">
<field name="country_id" placeholder="Country" class="o_address_country"
options='{"no_open": True, "no_create": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
</field>
<field name="state_id" position="replace">
<field name="state_id" placeholder="State" options='{"no_open": True}'
domain="[('country_id', '=', country_id)]"
options="{'no_quick_create':True,'no_create_edit':True}"/>
</xpath>
<xpath expr="//field[@name='state_id']" position="replace">
<field name="canton_id"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'country_id': country_id, 'zip': zip}"/>
<field name="canton_id" placeholder="Canton"
domain="[('state_id', '=', state_id)]"
class="oe_no_button"
placeholder="Canton"
options="{'no_quick_create':True,'no_create_edit':True}"/>
</xpath>
<xpath expr="//field[@name='zip']" position="replace">
<field name="parish_id" class="oe_no_button" placeholder="Parish"
context="{'state_id': state_id}" options='{"no_open": True, "no_create": True}'/>
<field name="parish_id" class="o_address_state" placeholder="Parish"
domain="[('canton_id', '=', canton_id)]"
options="{'no_quick_create':True,'no_create_edit':True}"/>
context="{'canton_id': canton_id}" options='{"no_open": True, "no_create": True}'/>
</field>
<!-- contact view -->
<xpath expr="//div[@name='div_address']" position="replace">
<div class="o_address_format" name="div_address">
<field name="street" placeholder="Street..." class="o_address_street"/>
<field name="street2" placeholder="Street 2..." class="o_address_street"/>
<field name="country_id" placeholder="Country" class="o_address_country"
options='{"no_open": True, "no_create": True}'/>
<field name="state_id" placeholder="State" options='{"no_open": True}'
domain="[('country_id', '=', country_id)]"
context="{'country_id': country_id, 'zip': zip}"/>
<field name="canton_id" placeholder="Canton"
domain="[('state_id', '=', state_id)]"
context="{'state_id': state_id}" options='{"no_open": True, "no_create": True}'/>
<field name="parish_id" class="o_address_state" placeholder="Parish"
domain="[('canton_id', '=', canton_id)]"
context="{'canton_id': canton_id}" options='{"no_open": True, "no_create": True}'/>
<field name="zip" placeholder="ZIP" class="o_address_zip"/>
<field name="city" placeholder="City" class="o_address_city"/>
</div>
</xpath>
</field>
</record>
<record id="partner_address_form_view_ec" model="ir.ui.view">
<field name="name">OTE view_partner_address_form inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_address_form"/>
<field name="arch" type="xml">
<field name='country_id' position="replace">
<field name="city" placeholder="City" class="o_address_city"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
</field>
<field name="city" position="replace">
<field name="country_id" placeholder="Country" class="o_address_country"
options='{"no_open": True, "no_create": True}'
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
</field>
<field name="state_id" position="replace">
<field name="state_id" placeholder="State" options='{"no_open": True}'
domain="[('country_id', '=', country_id)]"
attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"
context="{'country_id': country_id, 'zip': zip}"/>
<field name="canton_id" placeholder="Canton"
domain="[('state_id', '=', state_id)]"
context="{'state_id': state_id}" options='{"no_open": True, "no_create": True}'/>
<field name="parish_id" class="o_address_state" placeholder="Parish"
domain="[('canton_id', '=', canton_id)]"
context="{'canton_id': canton_id}" options='{"no_open": True, "no_create": True}'/>
</field>
</field>
</record>
</data>
</odoo>

0 comments on commit ade7b38

Please sign in to comment.