Browse Source

[IMP] base_location: Make ZIP code optional

pull/2/head
unknown 11 years ago
committed by Holger Brunn
parent
commit
520dd16119
  1. 5
      base_location/better_zip.py
  2. 12
      base_location/better_zip_view.xml
  3. 1
      base_location/company_view.xml
  4. 13
      base_location/i18n/base_location.pot
  5. 15
      base_location/i18n/es.po
  6. 9
      base_location/partner_view.xml

5
base_location/better_zip.py

@ -30,7 +30,7 @@ class BetterZip(orm.Model):
_order = "priority" _order = "priority"
_columns = {'priority': fields.integer('Priority', deprecated=True), _columns = {'priority': fields.integer('Priority', deprecated=True),
'name': fields.char('ZIP', required=True),
'name': fields.char('ZIP'),
'city': fields.char('City', required=True), 'city': fields.char('City', required=True),
'state_id': fields.many2one('res.country.state', 'State'), 'state_id': fields.many2one('res.country.state', 'State'),
'country_id': fields.many2one('res.country', 'Country'), 'country_id': fields.many2one('res.country', 'Country'),
@ -43,7 +43,10 @@ class BetterZip(orm.Model):
def name_get(self, cursor, uid, ids, context=None): def name_get(self, cursor, uid, ids, context=None):
res = [] res = []
for bzip in self.browse(cursor, uid, ids): for bzip in self.browse(cursor, uid, ids):
if bzip.name:
name = [bzip.name, bzip.city] name = [bzip.name, bzip.city]
else:
name = [bzip.city]
if bzip.state_id: if bzip.state_id:
name.append(bzip.state_id.name) name.append(bzip.state_id.name)
if bzip.country_id: if bzip.country_id:

12
base_location/better_zip_view.xml

@ -33,12 +33,24 @@
</field> </field>
</record> </record>
<record id="view_better_zip_filter" model="ir.ui.view">
<field name="name">res.better.zip.select</field>
<field name="model">res.better.zip</field>
<field name="arch" type="xml">
<search string="Search city">
<field name="name"/>
<field name="city"/>
</search>
</field>
</record>
<record id="action_zip_tree" model="ir.actions.act_window"> <record id="action_zip_tree" model="ir.actions.act_window">
<field name="name">Cites/locations Management</field> <field name="name">Cites/locations Management</field>
<field name="res_model">res.better.zip</field> <field name="res_model">res.better.zip</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field ref="better_zip_tree" name="view_id"/> <field ref="better_zip_tree" name="view_id"/>
<field name="search_view_id" ref="view_better_zip_filter"/>
</record> </record>
<menuitem <menuitem

1
base_location/company_view.xml

@ -9,6 +9,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="street2" position="after"> <field name="street2" position="after">
<field name="better_zip_id" <field name="better_zip_id"
options="{'create_name_field': 'city'}"
colspan="4" colspan="4"
on_change="on_change_city(better_zip_id)" on_change="on_change_city(better_zip_id)"
placeholder="City completion" /> placeholder="City completion" />

13
base_location/i18n/base_location.pot

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n" "Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-06-25 08:56+0000\n"
"PO-Revision-Date: 2013-06-25 08:56+0000\n"
"POT-Creation-Date: 2013-12-12 22:33+0000\n"
"PO-Revision-Date: 2013-12-12 22:33+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -31,6 +31,11 @@ msgstr ""
msgid "ZIP" msgid "ZIP"
msgstr "" msgstr ""
#. module: base_location
#: field:res.better.zip,state_id:0
msgid "State"
msgstr ""
#. module: base_location #. module: base_location
#: field:res.better.zip,country_id:0 #: field:res.better.zip,country_id:0
msgid "Country" msgid "Country"
@ -67,8 +72,8 @@ msgid "City/Location"
msgstr "" msgstr ""
#. module: base_location #. module: base_location
#: field:res.better.zip,state_id:0
msgid "State"
#: view:res.better.zip:0
msgid "Search city"
msgstr "" msgstr ""
#. module: base_location #. module: base_location

15
base_location/i18n/es.po

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n" "Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-06-25 08:47+0000\n"
"PO-Revision-Date: 2013-06-25 10:47+0100\n"
"POT-Creation-Date: 2013-12-12 22:34+0000\n"
"PO-Revision-Date: 2013-12-12 23:34+0100\n"
"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n" "Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -31,6 +31,11 @@ msgstr "Ciudad"
msgid "ZIP" msgid "ZIP"
msgstr "C.P." msgstr "C.P."
#. module: base_location
#: field:res.better.zip,state_id:0
msgid "State"
msgstr "Provincia"
#. module: base_location #. module: base_location
#: field:res.better.zip,country_id:0 #: field:res.better.zip,country_id:0
msgid "Country" msgid "Country"
@ -67,9 +72,9 @@ msgid "City/Location"
msgstr "Ciudad/Ubicación" msgstr "Ciudad/Ubicación"
#. module: base_location #. module: base_location
#: field:res.better.zip,state_id:0
msgid "State"
msgstr "Provincia"
#: view:res.better.zip:0
msgid "Search city"
msgstr "Buscar ciudad"
#. module: base_location #. module: base_location
#: field:res.company,better_zip_id:0 #: field:res.company,better_zip_id:0

9
base_location/partner_view.xml

@ -8,11 +8,20 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="street2" position="after"> <field name="street2" position="after">
<field name="zip_id" <field name="zip_id"
options="{'create_name_field': 'city'}"
on_change="onchange_zip_id(zip_id)" on_change="onchange_zip_id(zip_id)"
placeholder="City completion" placeholder="City completion"
attrs="{'invisible': [('use_parent_address','=',True)]}" attrs="{'invisible': [('use_parent_address','=',True)]}"
/> />
</field> </field>
<xpath expr="//field[@name='child_ids']/form//field[@name='street2']" position="after">
<field name="zip_id"
options="{'create_name_field': 'city'}"
on_change="onchange_zip_id(zip_id)"
placeholder="City completion"
attrs="{'invisible': [('use_parent_address','=',True)]}"
/>
</xpath>
</field> </field>
</record> </record>
</data> </data>

Loading…
Cancel
Save