openerp-l10n-ar-localization team mailing list archive
-
openerp-l10n-ar-localization team
-
Mailing list archive
-
Message #00000
[Merge] lp:~damiansoriano/openerp-l10n-ar-localization/6.1 into lp:openerp-l10n-ar-localization/6.1
Damián Soriano has proposed merging lp:~damiansoriano/openerp-l10n-ar-localization/6.1 into lp:openerp-l10n-ar-localization/6.1.
Requested reviews:
Lopez Ignacio (lopezignacio)
For more details, see:
https://code.launchpad.net/~damiansoriano/openerp-l10n-ar-localization/6.1/+merge/112909
Este es el modulo para que las ciudades sean entidades
--
https://code.launchpad.net/~damiansoriano/openerp-l10n-ar-localization/6.1/+merge/112909
Your team Team de OpenERP - Localización Argentina is subscribed to branch lp:openerp-l10n-ar-localization/6.1.
=== added directory 'cities'
=== added file 'cities/__init__.py'
--- cities/__init__.py 1970-01-01 00:00:00 +0000
+++ cities/__init__.py 2012-06-30 19:15:23 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import city
+import partner
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'cities/__openerp__.py'
--- cities/__openerp__.py 1970-01-01 00:00:00 +0000
+++ cities/__openerp__.py 2012-06-30 19:15:23 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+ 'name': 'Cities',
+ 'version': '1.0',
+ 'category': 'Base',
+ 'description': """
+Creates object Cities and adds it to the clientes and client's addresses. Substitutes it from the view. Updates the old text value with the textual representation of the object when write in the database to hold backwards compatibility
+
+Adds a menu entry at:
+ Ventas / Configuración / Libreta de direcciones / Ubicación / Ciudades
+ """,
+ 'author': 'ADHOC Sistemas',
+ 'website': 'http://www.adhocsistemas.com.ar/',
+ 'depends': ['base'],
+ 'init_xml': [],
+ 'update_xml': ['city_view.xml',
+ 'city_menu.xml',
+ 'partner_view.xml',
+ 'security/ir.model.access.csv'],
+ 'demo_xml': [],
+ 'test':[],
+ 'installable': True,
+ 'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'cities/city.py'
--- cities/city.py 1970-01-01 00:00:00 +0000
+++ cities/city.py 2012-06-30 19:15:23 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv
+from osv import fields
+
+class country_state_city(osv.osv):
+ _name = 'res.country.state.city'
+ _description = 'Ciudades'
+
+ _columns = {
+ 'state_id': fields.many2one('res.country.state', 'Provincia', required=True),
+ 'country_id': fields.related('state_id', 'country_id', type='many2one', relation='res.country', string='País'),
+ 'name': fields.char('Nombre', size=64, required=True),
+ 'code': fields.char('Codigo', size=9, help="Codigo de la Ciudad."),
+ 'zip': fields.char('Codigo Postal', size=64),
+ }
+
+country_state_city()
=== added file 'cities/city_menu.xml'
--- cities/city_menu.xml 1970-01-01 00:00:00 +0000
+++ cities/city_menu.xml 2012-06-30 19:15:23 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <record id="action_city_form" model="ir.actions.act_window">
+ <field name="name">Ciudad</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">res.country.state.city</field>
+ <field name="view_type">form</field>
+ </record>
+
+ <menuitem
+ name="Ciudades"
+ id="menu_city_partner"
+ action="action_city_form"
+ parent="base.menu_localisation"
+ sequence="2"/>
+
+ </data>
+</openerp>
=== added file 'cities/city_view.xml'
--- cities/city_view.xml 1970-01-01 00:00:00 +0000
+++ cities/city_view.xml 2012-06-30 19:15:23 +0000
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <record id="view_city_form" model="ir.ui.view">
+ <field name="name">city.form</field>
+ <field name="model">res.country.state.city</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Ciudad">
+ <field name="name"/>
+ <field name="zip"/>
+ <field name="code"/>
+ <field name="state_id"/>
+ </form>
+ </field>
+ </record>
+
+ <record id="view_city_tree" model="ir.ui.view">
+ <field name="name">city.tree</field>
+ <field name="model">res.country.state.city</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Ciudad">
+ <field name="name"/>
+ <field name="state_id"/>
+ <field name="zip"/>
+ <field name="code"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="view_city_search" model="ir.ui.view">
+ <field name="name">city.search</field>
+ <field name="model">res.country.state.city</field>
+ <field name="type">search</field>
+ <field name="arch" type="xml">
+ <search string="Ciudades">
+ <group col='10' colspan='4'>
+ <field name="name"/>
+ <field name="zip"/>
+ <field name="state_id"/>
+ <field name="country_id"/>
+ </group>
+ </search>
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== added file 'cities/partner.py'
--- cities/partner.py 1970-01-01 00:00:00 +0000
+++ cities/partner.py 2012-06-30 19:15:23 +0000
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv
+from osv import fields
+
+class res_partner_address(osv.osv):
+ _name = 'res.partner.address'
+ _inherit = 'res.partner.address'
+
+ _columns = {
+ 'city_id': fields.many2one('res.country.state.city', 'Ciudad', domain="[('state_id','=',state_id)]", required=False),
+ }
+
+ def onchange_city(self, cr, uid, ids, city_id):
+ v = {}
+ if city_id:
+ city = self.pool.get('res.country.state.city').browse(cr, uid, city_id)
+ v['zip'] = city.zip
+ return {'value': v}
+
+ def write(self, cr, uid, ids, vals, context=None):
+ if 'city_id' in vals and vals['city_id']:
+ city = self.pool.get('res.country.state.city').browse(cr, uid, vals['city_id'], context=context)
+ vals['city'] = city.name
+ return super(res_partner_address, self).write(cr, uid, ids, vals, context=context)
+
+ def create(self, cr, uid, vals, context=None):
+ if 'city_id' in vals and vals['city_id']:
+ city = self.pool.get('res.country.state.city').browse(cr, uid, vals['city_id'], context=context)
+ vals['city'] = city.name
+ return super(res_partner_address, self).create(cr, uid, vals, context=context)
+
+res_partner_address()
+
+class res_partner(osv.osv):
+ _name = 'res_partner'
+ _inherit = 'res.partner'
+
+ def onchange_city(self, cr, uid, ids, city_id):
+ v = {}
+ if city_id:
+ city = self.pool.get('res.country.state.city').browse(cr, uid, city_id)
+ v['zip'] = city.zip
+ return {'value': v}
+
+res_partner()
=== added file 'cities/partner_view.xml'
--- cities/partner_view.xml 1970-01-01 00:00:00 +0000
+++ cities/partner_view.xml 2012-06-30 19:15:23 +0000
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <!-- Partner Address -->
+ <record model="ir.ui.view" id="view_cities_partner_address_form1">
+ <field name="name">cities_parent_address_form1_inherit</field>
+ <field name="priority" eval="30"/>
+ <field name="model">res.partner.address</field>
+ <field name="inherit_id" ref="base.view_partner_address_form1"/>
+ <field name="arch" type="xml">
+ <field name="country_id" position="replace"/>
+ <field name="state_id" position="replace"/>
+ <field name="city" position="replace"/>
+ <field name="zip" position="replace"/>
+
+ <field name="street2" position="after">
+ <field name="country_id"/>
+ <field name="state_id"/>
+ <field name="city_id" on_change="onchange_city(city_id)"/>
+ <field name="city" invisible="1"/>
+ <field name="zip" string="C.P. Sugerido"/>
+ </field>
+ </field>
+ </record>
+
+ <!-- Partner -->
+ <record model="ir.ui.view" id="view_adhoc_partner_form1">
+ <field name="name">adhoc_parent_form_inherit</field>
+ <field name="priority" eval="30"/>
+ <field name="model">res.partner</field>
+ <field name="inherit_id" ref="base.view_partner_form"/>
+ <field name="arch" type="xml">
+ <field name="country_id" position="replace"/>
+ <field name="state_id" position="replace"/>
+ <field name="city" position="replace"/>
+ <field name="zip" position="replace"/>
+
+ <field name="street2" position="after">
+ <field name="country_id"/>
+ <field name="state_id"/>
+ <field name="city_id" on_change="onchange_city(city_id)"/>
+ <field name="city" invisible="1"/>
+ <field name="zip" string="C.P. Sugerido"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'cities/security'
=== added file 'cities/security/ir.model.access.csv'
--- cities/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ cities/security/ir.model.access.csv 2012-06-30 19:15:23 +0000
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_city_group_all","city group_user_all","model_res_country_state_city",,1,0,0,0
+"access_city_group_user","city group_user","model_res_country_state_city","base.group_partner_manager",1,1,1,1
Follow ups