Merge lp:~openerp-dev/openobject-addons/trunk-res-country-state-cleaning-mme into lp:openobject-addons

Proposed by Thibault Delavallée (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-res-country-state-cleaning-mme
Merge into: lp:openobject-addons
Diff against target: 2314 lines (+1439/-426)
30 files modified
account/edi/invoice_action_data.xml (+1/-1)
account/i18n/account.pot (+1/-1)
base_geolocalize/models/res_partner.py (+1/-1)
crm/crm_lead.py (+4/-10)
crm/crm_lead_view.xml (+3/-3)
crm_partner_assign/crm_partner_assign.py (+1/-1)
crm_partner_assign/crm_portal_view.xml (+2/-2)
delivery/delivery.py (+1/-4)
delivery/delivery_view.xml (+2/-2)
edi/models/res_partner.py (+1/-1)
l10n_cn/__openerp__.py (+0/-1)
l10n_cn/base_data.xml (+0/-162)
l10n_cr/l10n_cr_base_data.xml (+0/-40)
l10n_et/__openerp__.py (+0/-1)
l10n_et/data/res.country.state.csv (+0/-12)
l10n_uk/__openerp__.py (+0/-1)
l10n_uk/data/res.country.state.csv (+0/-120)
portal_sale/i18n/portal_sale.pot (+2/-2)
portal_sale/portal_sale_data.xml (+2/-2)
purchase/edi/purchase_order_action_data.xml (+1/-1)
purchase/i18n/purchase.pot (+1/-1)
sale/edi/sale_order_action_data.xml (+1/-1)
sale/i18n/sale.pot (+1/-1)
stock/stock_demo.xml (+0/-1)
website/static/lib/autocomplete/jquery.auto-complete.js (+1369/-0)
website/views/website_templates.xml (+3/-1)
website_quote/data/website_quotation_data.xml (+1/-1)
website_sale/controllers/main.py (+18/-18)
website_sale/static/src/js/website_sale.js (+10/-1)
website_sale/views/website_sale.xml (+13/-33)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-res-country-state-cleaning-mme
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+208116@code.launchpad.net

Description of the change

[Fix] remove res.country.state model and replace all many2one state by a char field

To post a comment you must log in.
9087. By Niko (OpenERP)

[IMP] Add some video to manisfest ( website, website_blog, website_event, website_ecommerce)

9170. By Mehul Mehta(OpenERP)

[IMP] improvement in code

9171. By Mehul Mehta(OpenERP)

[IMP] improvement in code

Unmerged revisions

9171. By Mehul Mehta(OpenERP)

[IMP] improvement in code

9170. By Mehul Mehta(OpenERP)

[IMP] improvement in code

9169. By Mehul Mehta(OpenERP)

[MERGE] Merged lp:openobject-addons

9168. By Mehul Mehta(OpenERP)

[ADD] autocomplete country selector in website_sale and replace all many2one state by a char field

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/edi/invoice_action_data.xml'
--- account/edi/invoice_action_data.xml 2013-11-27 15:32:57 +0000
+++ account/edi/invoice_action_data.xml 2014-02-26 06:23:38 +0000
@@ -79,7 +79,7 @@
79 ${object.company_id.zip} ${object.company_id.city}<br/>79 ${object.company_id.zip} ${object.company_id.city}<br/>
80 % endif80 % endif
81 % if object.company_id.country_id:81 % if object.company_id.country_id:
82 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>82 ${object.company_id.state}<br/>
83 % endif83 % endif
84 </span>84 </span>
85 % if object.company_id.phone:85 % if object.company_id.phone:
8686
=== modified file 'account/i18n/account.pot'
--- account/i18n/account.pot 2013-10-27 12:31:04 +0000
+++ account/i18n/account.pot 2014-02-26 06:23:38 +0000
@@ -3262,7 +3262,7 @@
3262" ${object.company_id.zip} ${object.company_id.city}<br/>\n"3262" ${object.company_id.zip} ${object.company_id.city}<br/>\n"
3263" % endif\n"3263" % endif\n"
3264" % if object.company_id.country_id:\n"3264" % if object.company_id.country_id:\n"
3265" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"3265" ${object.company_id.state}<br/>\n"
3266" % endif\n"3266" % endif\n"
3267" </span>\n"3267" </span>\n"
3268" % if object.company_id.phone:\n"3268" % if object.company_id.phone:\n"
32693269
=== modified file 'base_geolocalize/models/res_partner.py'
--- base_geolocalize/models/res_partner.py 2013-10-07 14:41:35 +0000
+++ base_geolocalize/models/res_partner.py 2014-02-26 06:23:38 +0000
@@ -77,7 +77,7 @@
77 result = geo_find(geo_query_address(street=partner.street,77 result = geo_find(geo_query_address(street=partner.street,
78 zip=partner.zip,78 zip=partner.zip,
79 city=partner.city,79 city=partner.city,
80 state=partner.state_id.name,80 state=partner.state,
81 country=partner.country_id.name))81 country=partner.country_id.name))
82 if result:82 if result:
83 self.write(cr, uid, [partner.id], {83 self.write(cr, uid, [partner.id], {
8484
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py 2014-02-20 16:38:15 +0000
+++ crm/crm_lead.py 2014-02-26 06:23:38 +0000
@@ -37,7 +37,7 @@
37 'company_id',37 'company_id',
38 'country_id',38 'country_id',
39 'section_id',39 'section_id',
40 'state_id',40 'state',
41 'stage_id',41 'stage_id',
42 'type_id',42 'type_id',
43 'user_id',43 'user_id',
@@ -278,7 +278,7 @@
278 'street2': fields.char('Street2', size=128),278 'street2': fields.char('Street2', size=128),
279 'zip': fields.char('Zip', change_default=True, size=24),279 'zip': fields.char('Zip', change_default=True, size=24),
280 'city': fields.char('City', size=128),280 'city': fields.char('City', size=128),
281 'state_id': fields.many2one("res.country.state", 'State'),281 'state': fields.char('State'),
282 'country_id': fields.many2one('res.country', 'Country'),282 'country_id': fields.many2one('res.country', 'Country'),
283 'phone': fields.char('Phone', size=64),283 'phone': fields.char('Phone', size=64),
284 'fax': fields.char('Fax', size=64),284 'fax': fields.char('Fax', size=64),
@@ -324,7 +324,7 @@
324 'street': partner.street,324 'street': partner.street,
325 'street2': partner.street2,325 'street2': partner.street2,
326 'city': partner.city,326 'city': partner.city,
327 'state_id': partner.state_id and partner.state_id.id or False,327 'state': partner.state,
328 'country_id': partner.country_id and partner.country_id.id or False,328 'country_id': partner.country_id and partner.country_id.id or False,
329 'email_from': partner.email,329 'email_from': partner.email,
330 'phone': partner.phone,330 'phone': partner.phone,
@@ -736,7 +736,7 @@
736 'zip': lead.zip,736 'zip': lead.zip,
737 'city': lead.city,737 'city': lead.city,
738 'country_id': lead.country_id and lead.country_id.id or False,738 'country_id': lead.country_id and lead.country_id.id or False,
739 'state_id': lead.state_id and lead.state_id.id or False,739 'state': lead.state,
740 'is_company': is_company,740 'is_company': is_company,
741 'type': 'contact'741 'type': 'contact'
742 }742 }
@@ -1060,10 +1060,4 @@
1060 message = _("Meeting scheduled at '%s'<br> Subject: %s <br> Duration: %s hour(s)") % (meeting_date, meeting_subject, duration)1060 message = _("Meeting scheduled at '%s'<br> Subject: %s <br> Duration: %s hour(s)") % (meeting_date, meeting_subject, duration)
1061 return self.message_post(cr, uid, ids, body=message, context=context)1061 return self.message_post(cr, uid, ids, body=message, context=context)
10621062
1063 def onchange_state(self, cr, uid, ids, state_id, context=None):
1064 if state_id:
1065 country_id=self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id
1066 return {'value':{'country_id':country_id}}
1067 return {}
1068
1069# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:1063# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
10701064
=== modified file 'crm/crm_lead_view.xml'
--- crm/crm_lead_view.xml 2014-02-12 18:08:45 +0000
+++ crm/crm_lead_view.xml 2014-02-26 06:23:38 +0000
@@ -119,14 +119,14 @@
119 <field name="partner_id" string="Customer"119 <field name="partner_id" string="Customer"
120 on_change="on_change_partner_id(partner_id)"120 on_change="on_change_partner_id(partner_id)"
121 options='{"create_name_field": "name"}'121 options='{"create_name_field": "name"}'
122 context="{'default_name': contact_name, 'default_street': street, 'default_city': city, 'default_state_id': state_id, 'default_zip': zip, 'default_country_id': country_id, 'default_function': function, 'default_phone': phone, 'default_mobile': mobile, 'default_fax': fax, 'default_email': email_from, 'default_user_id': user_id, 'default_section_id': section_id}"/>122 context="{'default_name': contact_name, 'default_street': street, 'default_city': city, 'default_state': state, 'default_zip': zip, 'default_country_id': country_id, 'default_function': function, 'default_phone': phone, 'default_mobile': mobile, 'default_fax': fax, 'default_email': email_from, 'default_user_id': user_id, 'default_section_id': section_id}"/>
123 <label for="street" string="Address"/>123 <label for="street" string="Address"/>
124 <div>124 <div>
125 <field name="street" placeholder="Street..."/>125 <field name="street" placeholder="Street..."/>
126 <field name="street2"/>126 <field name="street2"/>
127 <div class="address_format">127 <div class="address_format">
128 <field name="city" placeholder="City" style="width: 40%%"/>128 <field name="city" placeholder="City" style="width: 40%%"/>
129 <field name="state_id" on_change="onchange_state(state_id)" options='{"no_open": True}' placeholder="State" style="width: 24%%"/>129 <field name="state" placeholder="State" style="width: 24%%"/>
130 <field name="zip" placeholder="ZIP" style="width: 34%%"/>130 <field name="zip" placeholder="ZIP" style="width: 34%%"/>
131 </div>131 </div>
132 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>132 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
@@ -458,7 +458,7 @@
458 <field name="street2"/>458 <field name="street2"/>
459 <div class="address_format">459 <div class="address_format">
460 <field name="city" placeholder="City" style="width: 40%%"/>460 <field name="city" placeholder="City" style="width: 40%%"/>
461 <field name="state_id" options='{"no_open": True}' on_change="onchange_state(state_id)" placeholder="State" style="width: 24%%"/>461 <field name="state" placeholder="State" style="width: 24%%"/>
462 <field name="zip" placeholder="ZIP" style="width: 34%%"/>462 <field name="zip" placeholder="ZIP" style="width: 34%%"/>
463 </div>463 </div>
464 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>464 <field name="country_id" placeholder="Country" options='{"no_open": True}'/>
465465
=== modified file 'crm_partner_assign/crm_partner_assign.py'
--- crm_partner_assign/crm_partner_assign.py 2013-12-02 15:09:25 +0000
+++ crm_partner_assign/crm_partner_assign.py 2014-02-26 06:23:38 +0000
@@ -148,7 +148,7 @@
148 result = geo_find(geo_query_address(street=lead.street,148 result = geo_find(geo_query_address(street=lead.street,
149 zip=lead.zip,149 zip=lead.zip,
150 city=lead.city,150 city=lead.city,
151 state=lead.state_id.name,151 state=lead.state,
152 country=lead.country_id.name))152 country=lead.country_id.name))
153 if result:153 if result:
154 self.write(cr, uid, [lead.id], {154 self.write(cr, uid, [lead.id], {
155155
=== modified file 'crm_partner_assign/crm_portal_view.xml'
--- crm_partner_assign/crm_portal_view.xml 2014-02-20 12:38:19 +0000
+++ crm_partner_assign/crm_portal_view.xml 2014-02-26 06:23:38 +0000
@@ -53,7 +53,7 @@
53 <field name="zip" readonly="1"/>53 <field name="zip" readonly="1"/>
54 <field name="city" readonly="1"/>54 <field name="city" readonly="1"/>
55 <field name="country_id" readonly="1"/>55 <field name="country_id" readonly="1"/>
56 <field name="state_id" readonly="1"/>56 <field name="state" readonly="1"/>
57 </group>57 </group>
58 <label for="description" colspan="2"/>58 <label for="description" colspan="2"/>
59 <field name="description" nolabel="1" colspan="2"/>59 <field name="description" nolabel="1" colspan="2"/>
@@ -126,7 +126,7 @@
126 <field name="zip" readonly="1"/>126 <field name="zip" readonly="1"/>
127 <field name="city" readonly="1"/>127 <field name="city" readonly="1"/>
128 <field name="country_id" readonly="1"/>128 <field name="country_id" readonly="1"/>
129 <field name="state_id" readonly="1"/>129 <field name="state" readonly="1"/>
130 <field name="phone" readonly="1"/>130 <field name="phone" readonly="1"/>
131 </group>131 </group>
132 </group>132 </group>
133133
=== modified file 'delivery/delivery.py'
--- delivery/delivery.py 2014-01-30 21:49:44 +0000
+++ delivery/delivery.py 2014-02-26 06:23:38 +0000
@@ -86,11 +86,8 @@
86 for grid in carrier.grids_id:86 for grid in carrier.grids_id:
87 get_id = lambda x: x.id87 get_id = lambda x: x.id
88 country_ids = map(get_id, grid.country_ids)88 country_ids = map(get_id, grid.country_ids)
89 state_ids = map(get_id, grid.state_ids)
90 if country_ids and not contact.country_id.id in country_ids:89 if country_ids and not contact.country_id.id in country_ids:
91 continue90 continue
92 if state_ids and not contact.state_id.id in state_ids:
93 continue
94 if grid.zip_from and (contact.zip or '')< grid.zip_from:91 if grid.zip_from and (contact.zip or '')< grid.zip_from:
95 continue92 continue
96 if grid.zip_to and (contact.zip or '')> grid.zip_to:93 if grid.zip_to and (contact.zip or '')> grid.zip_to:
@@ -175,7 +172,7 @@
175 'sequence': fields.integer('Sequence', size=64, required=True, help="Gives the sequence order when displaying a list of delivery grid."),172 'sequence': fields.integer('Sequence', size=64, required=True, help="Gives the sequence order when displaying a list of delivery grid."),
176 'carrier_id': fields.many2one('delivery.carrier', 'Carrier', required=True, ondelete='cascade'),173 'carrier_id': fields.many2one('delivery.carrier', 'Carrier', required=True, ondelete='cascade'),
177 'country_ids': fields.many2many('res.country', 'delivery_grid_country_rel', 'grid_id', 'country_id', 'Countries'),174 'country_ids': fields.many2many('res.country', 'delivery_grid_country_rel', 'grid_id', 'country_id', 'Countries'),
178 'state_ids': fields.many2many('res.country.state', 'delivery_grid_state_rel', 'grid_id', 'state_id', 'States'),175 'state': fields.char('States'),
179 'zip_from': fields.char('Start Zip', size=12),176 'zip_from': fields.char('Start Zip', size=12),
180 'zip_to': fields.char('To Zip', size=12),177 'zip_to': fields.char('To Zip', size=12),
181 'line_ids': fields.one2many('delivery.grid.line', 'grid_id', 'Grid Line'),178 'line_ids': fields.one2many('delivery.grid.line', 'grid_id', 'Grid Line'),
182179
=== modified file 'delivery/delivery_view.xml'
--- delivery/delivery_view.xml 2012-12-21 16:48:08 +0000
+++ delivery/delivery_view.xml 2014-02-26 06:23:38 +0000
@@ -70,7 +70,7 @@
70 <group>70 <group>
71 <group>71 <group>
72 <field name="country_ids" widget="many2many_tags"/>72 <field name="country_ids" widget="many2many_tags"/>
73 <field name="state_ids" widget="many2many_tags"/>73 <field name="state"/>
74 </group>74 </group>
75 <group>75 <group>
76 <label for="zip_from" string="Zip"/>76 <label for="zip_from" string="Zip"/>
@@ -145,7 +145,7 @@
145 <field name="country_ids"/>145 <field name="country_ids"/>
146 </group>146 </group>
147 <group string="States">147 <group string="States">
148 <field colspan="2" name="state_ids" nolabel="1"/>148 <field colspan="2" name="state" nolabel="1"/>
149 <field name="zip_from"/>149 <field name="zip_from"/>
150 <field name="zip_to"/>150 <field name="zip_to"/>
151 </group>151 </group>
152152
=== modified file 'edi/models/res_partner.py'
--- edi/models/res_partner.py 2014-01-23 17:50:54 +0000
+++ edi/models/res_partner.py 2014-02-26 06:23:38 +0000
@@ -36,7 +36,7 @@
36 'zip': True,36 'zip': True,
37 'city': True,37 'city': True,
38 'country_id': True,38 'country_id': True,
39 'state_id': True,39 'state': True,
40 'phone': True,40 'phone': True,
41 'fax': True,41 'fax': True,
42 'mobile': True,42 'mobile': True,
4343
=== modified file 'l10n_cn/__openerp__.py'
--- l10n_cn/__openerp__.py 2012-11-29 22:26:45 +0000
+++ l10n_cn/__openerp__.py 2014-02-26 06:23:38 +0000
@@ -35,7 +35,6 @@
35 'data': [35 'data': [
36 'account_chart.xml',36 'account_chart.xml',
37 'l10n_chart_cn_wizard.xml',37 'l10n_chart_cn_wizard.xml',
38 'base_data.xml',
39 ],38 ],
40 'license': 'GPL-3',39 'license': 'GPL-3',
41 'auto_install': False,40 'auto_install': False,
4241
=== removed file 'l10n_cn/base_data.xml'
--- l10n_cn/base_data.xml 2012-11-29 22:26:45 +0000
+++ l10n_cn/base_data.xml 1970-01-01 00:00:00 +0000
@@ -1,162 +0,0 @@
1<?xml version="1.0"?>
2<openerp>
3 <data noupdate="1">
4
5 <!-- 添加省份数据 -->
6 <record id="state_BJ" model="res.country.state">
7 <field name="name">北京市</field>
8 <field name="code">京</field>
9 <field name="country_id" ref="base.cn"/>
10 </record>
11 <record id="state_SH" model="res.country.state">
12 <field name="name">上海市</field>
13 <field name="code">沪</field>
14 <field name="country_id" ref="base.cn"/>
15 </record>
16 <record id="state_ZJ" model="res.country.state">
17 <field name="name">浙江省</field>
18 <field name="code">浙</field>
19 <field name="country_id" ref="base.cn"/>
20 </record>
21 <record id="state_TJ" model="res.country.state">
22 <field name="name">天津市</field>
23 <field name="code">津</field>
24 <field name="country_id" ref="base.cn"/>
25 </record>
26 <record id="state_AH" model="res.country.state">
27 <field name="name">安徽省</field>
28 <field name="code">皖</field>
29 <field name="country_id" ref="base.cn"/>
30 </record>
31 <record id="state_FJ" model="res.country.state">
32 <field name="name">福建省</field>
33 <field name="code">闽</field>
34 <field name="country_id" ref="base.cn"/>
35 </record>
36 <record id="state_CQ" model="res.country.state">
37 <field name="name">重庆市</field>
38 <field name="code">渝 </field>
39 <field name="country_id" ref="base.cn"/>
40 </record>
41 <record id="state_JX" model="res.country.state">
42 <field name="name">江西省</field>
43 <field name="code">赣</field>
44 <field name="country_id" ref="base.cn"/>
45 </record>
46 <record id="state_SD" model="res.country.state">
47 <field name="name">山东省</field>
48 <field name="code">鲁</field>
49 <field name="country_id" ref="base.cn"/>
50 </record>
51 <record id="state_HeN" model="res.country.state">
52 <field name="name">河南省</field>
53 <field name="code">豫</field>
54 <field name="country_id" ref="base.cn"/>
55 </record>
56 <record id="state_NM" model="res.country.state">
57 <field name="name">内蒙古自治区</field>
58 <field name="code">蒙</field>
59 <field name="country_id" ref="base.cn"/>
60 </record>
61 <record id="state_HuB" model="res.country.state">
62 <field name="name">湖北省</field>
63 <field name="code">鄂</field>
64 <field name="country_id" ref="base.cn"/>
65 </record>
66 <record id="state_XJ" model="res.country.state">
67 <field name="name">新疆维吾尔自治区</field>
68 <field name="code">新</field>
69 <field name="country_id" ref="base.cn"/>
70 </record>
71 <record id="state_HuN" model="res.country.state">
72 <field name="name">湖南省</field>
73 <field name="code">湘</field>
74 <field name="country_id" ref="base.cn"/>
75 </record>
76 <record id="state_NX" model="res.country.state">
77 <field name="name">宁夏回族自治区</field>
78 <field name="code">宁</field>
79 <field name="country_id" ref="base.cn"/>
80 </record>
81 <record id="state_GD" model="res.country.state">
82 <field name="name">广东省</field>
83 <field name="code">粤</field>
84 <field name="country_id" ref="base.cn"/>
85 </record>
86 <record id="state_XZ" model="res.country.state">
87 <field name="name">西藏自治区</field>
88 <field name="code">藏</field>
89 <field name="country_id" ref="base.cn"/>
90 </record>
91 <record id="state_HaN" model="res.country.state">
92 <field name="name">海南省</field>
93 <field name="code">琼</field>
94 <field name="country_id" ref="base.cn"/>
95 </record>
96 <record id="state_GX" model="res.country.state">
97 <field name="name">广西壮族自治区</field>
98 <field name="code">桂</field>
99 <field name="country_id" ref="base.cn"/>
100 </record>
101 <record id="state_SC" model="res.country.state">
102 <field name="name">四川省</field>
103 <field name="code">蜀</field>
104 <field name="country_id" ref="base.cn"/>
105 </record>
106 <record id="state_HeB" model="res.country.state">
107 <field name="name">河北省</field>
108 <field name="code">冀</field>
109 <field name="country_id" ref="base.cn"/>
110 </record>
111 <record id="state_GZ" model="res.country.state">
112 <field name="name">贵州省</field>
113 <field name="code">黔</field>
114 <field name="country_id" ref="base.cn"/>
115 </record>
116 <record id="state_SX" model="res.country.state">
117 <field name="name">山西省</field>
118 <field name="code">晋</field>
119 <field name="country_id" ref="base.cn"/>
120 </record>
121 <record id="state_YN" model="res.country.state">
122 <field name="name">云南省</field>
123 <field name="code">滇</field>
124 <field name="country_id" ref="base.cn"/>
125 </record>
126 <record id="state_LN" model="res.country.state">
127 <field name="name">辽宁省</field>
128 <field name="code">辽</field>
129 <field name="country_id" ref="base.cn"/>
130 </record>
131 <record id="state_SX" model="res.country.state">
132 <field name="name">陕西省</field>
133 <field name="code">陕</field>
134 <field name="country_id" ref="base.cn"/>
135 </record>
136 <record id="state_JL" model="res.country.state">
137 <field name="name">吉林省</field>
138 <field name="code">吉</field>
139 <field name="country_id" ref="base.cn"/>
140 </record>
141 <record id="state_GS" model="res.country.state">
142 <field name="name">甘肃省</field>
143 <field name="code">甘</field>
144 <field name="country_id" ref="base.cn"/>
145 </record>
146 <record id="state_HL" model="res.country.state">
147 <field name="name">黑龙江省</field>
148 <field name="code">黑</field>
149 <field name="country_id" ref="base.cn"/>
150 </record>
151 <record id="state_QH" model="res.country.state">
152 <field name="name">青海省</field>
153 <field name="code">青</field>
154 <field name="country_id" ref="base.cn"/>
155 </record>
156 <record id="state_JS" model="res.country.state">
157 <field name="name">江苏省</field>
158 <field name="code">苏</field>
159 <field name="country_id" ref="base.cn"/>
160 </record>
161 </data>
162</openerp>
1630
=== modified file 'l10n_cr/l10n_cr_base_data.xml'
--- l10n_cr/l10n_cr_base_data.xml 2013-10-27 12:31:04 +0000
+++ l10n_cr/l10n_cr_base_data.xml 2014-02-26 06:23:38 +0000
@@ -1,46 +1,6 @@
1<openerp>1<openerp>
2 <data>2 <data>
33
4 <!--
5 Resource: res.country.state
6 Update states
7 -->
8 <record id="state_SJ" model="res.country.state">
9 <field name="code">SJ</field>
10 <field name="name">San Jos&#233;</field>
11 <field name="country_id" ref="base.cr"/>
12 </record>
13 <record id="state_A" model="res.country.state">
14 <field name="code">A</field>
15 <field name="name">Alajuela</field>
16 <field name="country_id" ref="base.cr"/>
17 </record>
18 <record id="state_H" model="res.country.state">
19 <field name="code">H</field>
20 <field name="name">Heredia</field>
21 <field name="country_id" ref="base.cr"/>
22 </record>
23 <record id="state_C" model="res.country.state">
24 <field name="code">C</field>
25 <field name="name">Cartago</field>
26 <field name="country_id" ref="base.cr"/>
27 </record>
28 <record id="state_P" model="res.country.state">
29 <field name="code">P</field>
30 <field name="name">Puntarenas</field>
31 <field name="country_id" ref="base.cr"/>
32 </record>
33 <record id="state_G" model="res.country.state">
34 <field name="code">G</field>
35 <field name="name">Guanacaste</field>
36 <field name="country_id" ref="base.cr"/>
37 </record>
38 <record id="state_L" model="res.country.state">
39 <field name="code">L</field>
40 <field name="name">Lim&#243;n</field>
41 <field name="country_id" ref="base.cr"/>
42 </record>
43 <!--
44 Resource: res.partner.title4 Resource: res.partner.title
45 Update partner titles5 Update partner titles
46 -->6 -->
477
=== modified file 'l10n_et/__openerp__.py'
--- l10n_et/__openerp__.py 2013-10-27 12:31:04 +0000
+++ l10n_et/__openerp__.py 2014-02-26 06:23:38 +0000
@@ -45,7 +45,6 @@
45 'data/account.tax.code.template.csv',45 'data/account.tax.code.template.csv',
46 'data/account.chart.template.csv',46 'data/account.chart.template.csv',
47 'data/account.tax.template.csv',47 'data/account.tax.template.csv',
48 'data/res.country.state.csv',
49 ],48 ],
50 'data': [49 'data': [
51 'l10n_et_wizard.xml',50 'l10n_et_wizard.xml',
5251
=== removed file 'l10n_et/data/res.country.state.csv'
--- l10n_et/data/res.country.state.csv 2012-12-14 16:52:54 +0000
+++ l10n_et/data/res.country.state.csv 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1"id","country_id:id","code","name"
2"state_et_1","base.et","AA","Addis Ababa"
3"state_et_2","base.et","AF","Afar"
4"state_et_3","base.et","AM","Amhara"
5"state_et_4","base.et","BN","Benishangul-Gumuz"
6"state_et_5","base.et","DR","Dire Dawa"
7"state_et_6","base.et","GM","Gambella Peoples"
8"state_et_7","base.et","HR","Harrari Peoples"
9"state_et_8","base.et","OR","Oromia"
10"state_et_9","base.et","SM","Somalia"
11"state_et_10","base.et","SP","Southern Peoples, Nations, and Nationalities"
12"state_et_11","base.et","TG","Tigray"
130
=== modified file 'l10n_uk/__openerp__.py'
--- l10n_uk/__openerp__.py 2012-12-06 15:38:56 +0000
+++ l10n_uk/__openerp__.py 2014-02-26 06:23:38 +0000
@@ -39,7 +39,6 @@
39 'data/account.tax.code.template.csv',39 'data/account.tax.code.template.csv',
40 'data/account.chart.template.csv',40 'data/account.chart.template.csv',
41 'data/account.tax.template.csv',41 'data/account.tax.template.csv',
42 'data/res.country.state.csv',
43 'l10n_uk_wizard.xml',42 'l10n_uk_wizard.xml',
44 ],43 ],
45 'demo' : ['demo/demo.xml'],44 'demo' : ['demo/demo.xml'],
4645
=== removed file 'l10n_uk/data/res.country.state.csv'
--- l10n_uk/data/res.country.state.csv 2011-09-16 14:01:34 +0000
+++ l10n_uk/data/res.country.state.csv 1970-01-01 00:00:00 +0000
@@ -1,120 +0,0 @@
1"id","country_id:id","code","name"
2"state_uk_1","base.uk","A1","Aberdeenshire"
3"state_uk_2","base.uk","A5","Angus"
4"state_uk_3","base.uk","A7","Argyll"
5"state_uk_4","base.uk","A9","Avon"
6"state_uk_5","base.uk","B1","Ayrshire"
7"state_uk_6","base.uk","B3","Banffshire"
8"state_uk_7","base.uk","B5","Bedfordshire"
9"state_uk_8","base.uk","B7","Berkshire"
10"state_uk_9","base.uk","B9","Berwickshire"
11"state_uk_10","base.uk","C1","Buckinghamshire"
12"state_uk_11","base.uk","C3","Caithness"
13"state_uk_12","base.uk","C5","Cambridgeshire"
14"state_uk_13","base.uk","C6","Channel Islands"
15"state_uk_14","base.uk","C7","Cheshire"
16"state_uk_15","base.uk","C9","Clackmannanshire"
17"state_uk_16","base.uk","D1","Cleveland"
18"state_uk_17","base.uk","D3","Clwyd"
19"state_uk_18","base.uk","D5","County Antrim"
20"state_uk_19","base.uk","D7","County Armagh"
21"state_uk_20","base.uk","D9","County Down"
22"state_uk_21","base.uk","E1","County Durham"
23"state_uk_22","base.uk","E3","County Fermanagh"
24"state_uk_23","base.uk","E5","County Londonderry"
25"state_uk_24","base.uk","E7","County Tyrone"
26"state_uk_25","base.uk","E9","Cornwall"
27"state_uk_26","base.uk","F1","Cumbria"
28"state_uk_27","base.uk","F3","Derbyshire"
29"state_uk_28","base.uk","F5","Devon"
30"state_uk_29","base.uk","F7","Dorset"
31"state_uk_30","base.uk","F9","Dumfriesshire"
32"state_uk_31","base.uk","G1","Dunbartonshire"
33"state_uk_32","base.uk","G3","Dyfed"
34"state_uk_33","base.uk","G5","East Lothian"
35"state_uk_34","base.uk","G7","East Sussex"
36"state_uk_35","base.uk","G9","Essex"
37"state_uk_36","base.uk","H1","Fife"
38"state_uk_37","base.uk","H3","Gloucestershire"
39"state_uk_38","base.uk","H7","Gwent"
40"state_uk_39","base.uk","H9","Gwynedd"
41"state_uk_40","base.uk","I1","Hampshire"
42"state_uk_41","base.uk","I3","Herefordshire"
43"state_uk_42","base.uk","I5","Hertfordshire"
44"state_uk_43","base.uk","I7","Inverness-Shire"
45"state_uk_44","base.uk","I9","Isle of Arran"
46"state_uk_45","base.uk","J1","Isle of Barra"
47"state_uk_46","base.uk","J3","Isle of Benbecula"
48"state_uk_47","base.uk","J5","Isle of Bute"
49"state_uk_48","base.uk","J7","Isle of Canna"
50"state_uk_49","base.uk","J9","Isle of Coll"
51"state_uk_50","base.uk","K1","Isle of Colonsay"
52"state_uk_51","base.uk","K3","Isle of Cumbrae"
53"state_uk_52","base.uk","K5","Isle of Eigg"
54"state_uk_53","base.uk","K7","Isle of Gigha"
55"state_uk_54","base.uk","K9","Isle of Harris"
56"state_uk_55","base.uk","L1","Isle of Iona"
57"state_uk_56","base.uk","L2","Isle of Islay"
58"state_uk_57","base.uk","L5","Isle of Jura"
59"state_uk_58","base.uk","L7","Isle of Lewis"
60"state_uk_59","base.uk","L9","Isle of Man"
61"state_uk_60","base.uk","M1","Isle of Mull"
62"state_uk_61","base.uk","M3","Isle of North Uist"
63"state_uk_62","base.uk","M7","Isle of Rhum"
64"state_uk_63","base.uk","M9","Isle of Scalpay"
65"state_uk_64","base.uk","N1","Shetland Islands"
66"state_uk_65","base.uk","N3","Isle of Skye"
67"state_uk_66","base.uk","N5","Isle of South Uist"
68"state_uk_67","base.uk","N7","Isle of Tiree"
69"state_uk_68","base.uk","N9","Isle of Wight"
70"state_uk_69","base.uk","O5","Kent"
71"state_uk_70","base.uk","O7","Kincardineshire"
72"state_uk_71","base.uk","O9","Kinross-Shire"
73"state_uk_72","base.uk","P1","Kirkcudbrightshire"
74"state_uk_73","base.uk","P5","Lancashire"
75"state_uk_74","base.uk","P7","Leicestershire"
76"state_uk_75","base.uk","P9","Lincolnshire"
77"state_uk_76","base.uk","Q3","Merseyside"
78"state_uk_77","base.uk","Q5","Mid Glamorgan"
79"state_uk_78","base.uk","Q9","Middlesex"
80"state_uk_79","base.uk","R1","Morayshire"
81"state_uk_80","base.uk","R3","Nairnshire"
82"state_uk_81","base.uk","R7","North Humberside"
83"state_uk_82","base.uk","R9","North Yorkshire"
84"state_uk_83","base.uk","S1","Northamptonshire"
85"state_uk_84","base.uk","S3","Northumberland"
86"state_uk_85","base.uk","S5","Nottinghamshire"
87"state_uk_86","base.uk","S7","Oxfordshire"
88"state_uk_87","base.uk","S9","Peeblesshire"
89"state_uk_88","base.uk","T1","Perthshire"
90"state_uk_89","base.uk","T3","Powys"
91"state_uk_90","base.uk","T5","Renfrewshire"
92"state_uk_91","base.uk","T7","Ross-Shire"
93"state_uk_92","base.uk","T9","Roxburghshire"
94"state_uk_93","base.uk","U3","Selkirkshire"
95"state_uk_94","base.uk","U5","Shropshire"
96"state_uk_95","base.uk","U7","Somerset"
97"state_uk_96","base.uk","U9","South Glamorgan"
98"state_uk_97","base.uk","V1","South Humberside"
99"state_uk_98","base.uk","V3","South Yorkshire"
100"state_uk_99","base.uk","V5","Staffordshire"
101"state_uk_100","base.uk","V7","Stirlingshire"
102"state_uk_101","base.uk","V9","Suffolk"
103"state_uk_102","base.uk","W1","Surrey"
104"state_uk_103","base.uk","W3","Sutherland"
105"state_uk_104","base.uk","W5","Tyne and Wear"
106"state_uk_105","base.uk","W7","Warwickshire"
107"state_uk_106","base.uk","W9","West Glamorgan"
108"state_uk_107","base.uk","X1","West Lothian"
109"state_uk_108","base.uk","X3","West Midlands"
110"state_uk_109","base.uk","X5","West Sussex"
111"state_uk_110","base.uk","X7","West Yorkshire"
112"state_uk_111","base.uk","X9","Wigtownshire"
113"state_uk_112","base.uk","Y1","Wiltshire"
114"state_uk_113","base.uk","Y3","Worcestershire"
115"state_uk_114","base.uk","M5","Orkney"
116"state_uk_115","base.uk","O1","Isles of Scilly"
117"state_uk_116","base.uk","P3","Lanarkshire"
118"state_uk_117","base.uk","Q1","London"
119"state_uk_118","base.uk","Q7","Midlothian"
120"state_uk_119","base.uk","R5","Norfolk"
1210
=== modified file 'portal_sale/i18n/portal_sale.pot'
--- portal_sale/i18n/portal_sale.pot 2013-10-27 12:31:04 +0000
+++ portal_sale/i18n/portal_sale.pot 2014-02-26 06:23:38 +0000
@@ -125,7 +125,7 @@
125" ${object.company_id.zip} ${object.company_id.city}<br/>\n"125" ${object.company_id.zip} ${object.company_id.city}<br/>\n"
126" % endif\n"126" % endif\n"
127" % if object.company_id.country_id:\n"127" % if object.company_id.country_id:\n"
128" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"128" ${object.company_id.state}<br/>\n"
129" % endif\n"129" % endif\n"
130" </span>\n"130" </span>\n"
131" % if object.company_id.phone:\n"131" % if object.company_id.phone:\n"
@@ -252,7 +252,7 @@
252" ${object.company_id.zip} ${object.company_id.city}<br/>\n"252" ${object.company_id.zip} ${object.company_id.city}<br/>\n"
253" % endif\n"253" % endif\n"
254" % if object.company_id.country_id:\n"254" % if object.company_id.country_id:\n"
255" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"255" ${object.company_id.state}<br/>\n"
256" % endif\n"256" % endif\n"
257" </span>\n"257" </span>\n"
258" % if object.company_id.phone:\n"258" % if object.company_id.phone:\n"
259259
=== modified file 'portal_sale/portal_sale_data.xml'
--- portal_sale/portal_sale_data.xml 2013-12-04 13:00:23 +0000
+++ portal_sale/portal_sale_data.xml 2014-02-26 06:23:38 +0000
@@ -75,7 +75,7 @@
75 ${object.company_id.zip} ${object.company_id.city}<br/>75 ${object.company_id.zip} ${object.company_id.city}<br/>
76 % endif76 % endif
77 % if object.company_id.country_id:77 % if object.company_id.country_id:
78 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>78 ${object.company_id.state}<br/>
79 % endif79 % endif
80 </span>80 </span>
81 % if object.company_id.phone:81 % if object.company_id.phone:
@@ -162,7 +162,7 @@
162 ${object.company_id.zip} ${object.company_id.city}<br/>162 ${object.company_id.zip} ${object.company_id.city}<br/>
163 % endif163 % endif
164 % if object.company_id.country_id:164 % if object.company_id.country_id:
165 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>165 ${object.company_id.state}<br/>
166 % endif166 % endif
167 </span>167 </span>
168 % if object.company_id.phone:168 % if object.company_id.phone:
169169
=== modified file 'purchase/edi/purchase_order_action_data.xml'
--- purchase/edi/purchase_order_action_data.xml 2013-11-27 15:32:57 +0000
+++ purchase/edi/purchase_order_action_data.xml 2014-02-26 06:23:38 +0000
@@ -71,7 +71,7 @@
71 ${object.company_id.zip} ${object.company_id.city}<br/>71 ${object.company_id.zip} ${object.company_id.city}<br/>
72 % endif72 % endif
73 % if object.company_id.country_id:73 % if object.company_id.country_id:
74 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>74 ${object.company_id.state}<br/>
75 % endif75 % endif
76 </span>76 </span>
77 % if object.company_id.phone:77 % if object.company_id.phone:
7878
=== modified file 'purchase/i18n/purchase.pot'
--- purchase/i18n/purchase.pot 2013-10-27 12:31:04 +0000
+++ purchase/i18n/purchase.pot 2014-02-26 06:23:38 +0000
@@ -938,7 +938,7 @@
938" ${object.company_id.zip} ${object.company_id.city}<br/>\n"938" ${object.company_id.zip} ${object.company_id.city}<br/>\n"
939" % endif\n"939" % endif\n"
940" % if object.company_id.country_id:\n"940" % if object.company_id.country_id:\n"
941" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"941" ${object.company_id.state}<br/>\n"
942" % endif\n"942" % endif\n"
943" </span>\n"943" </span>\n"
944" % if object.company_id.phone:\n"944" % if object.company_id.phone:\n"
945945
=== modified file 'sale/edi/sale_order_action_data.xml'
--- sale/edi/sale_order_action_data.xml 2013-11-27 15:32:57 +0000
+++ sale/edi/sale_order_action_data.xml 2014-02-26 06:23:38 +0000
@@ -80,7 +80,7 @@
80 ${object.company_id.zip} ${object.company_id.city}<br/>80 ${object.company_id.zip} ${object.company_id.city}<br/>
81 % endif81 % endif
82 % if object.company_id.country_id:82 % if object.company_id.country_id:
83 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>83 ${object.company_id.state}<br/>
84 % endif84 % endif
85 </span>85 </span>
86 % if object.company_id.phone:86 % if object.company_id.phone:
8787
=== modified file 'sale/i18n/sale.pot'
--- sale/i18n/sale.pot 2013-10-27 12:31:04 +0000
+++ sale/i18n/sale.pot 2014-02-26 06:23:38 +0000
@@ -1604,7 +1604,7 @@
1604" ${object.company_id.zip} ${object.company_id.city}<br/>\n"1604" ${object.company_id.zip} ${object.company_id.city}<br/>\n"
1605" % endif\n"1605" % endif\n"
1606" % if object.company_id.country_id:\n"1606" % if object.company_id.country_id:\n"
1607" ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>\n"1607" ${object.company_id.state}<br/>\n"
1608" % endif\n"1608" % endif\n"
1609" </span>\n"1609" </span>\n"
1610" % if object.company_id.phone:\n"1610" % if object.company_id.phone:\n"
16111611
=== modified file 'stock/stock_demo.xml'
--- stock/stock_demo.xml 2013-12-02 15:09:25 +0000
+++ stock/stock_demo.xml 2014-02-26 06:23:38 +0000
@@ -187,7 +187,6 @@
187 <field eval="1" name="active"/>187 <field eval="1" name="active"/>
188 <field name="street">90 Streets Avenue</field>188 <field name="street">90 Streets Avenue</field>
189 <field model="res.country" name="country_id" search="[('code','ilike','us')]"/>189 <field model="res.country" name="country_id" search="[('code','ilike','us')]"/>
190 <field model="res.country.state" name="state_id" search="[('code','ilike','il')]"/>
191 <field name="zip">60610</field>190 <field name="zip">60610</field>
192 <field name="city">Chicago</field>191 <field name="city">Chicago</field>
193 <field name="email">chicago@yourcompany.com</field>192 <field name="email">chicago@yourcompany.com</field>
194193
=== added directory 'website/static/lib/autocomplete'
=== added file 'website/static/lib/autocomplete/jquery.auto-complete.js'
--- website/static/lib/autocomplete/jquery.auto-complete.js 1970-01-01 00:00:00 +0000
+++ website/static/lib/autocomplete/jquery.auto-complete.js 2014-02-26 06:23:38 +0000
@@ -0,0 +1,1369 @@
1/*!
2 * Auto Complete 5.1
3 * April 13, 2010
4 * Corey Hart @ http://www.codenothing.com
5 */
6(function( $, window, undefined ) {
7
8 // Expose autoComplete to the jQuery chain
9 $.fn.autoComplete = function() {
10 // Force array of arguments
11 var args = Slice.call( arguments ),
12 self = this,
13 first = args.shift(),
14 isMethod = typeof first === 'string',
15 handler, el;
16
17 // Deep namespacing is not supported in jQuery, a mistake I made in v4.1
18 if ( isMethod ) {
19 first = first.replace( rdot, '-' );
20 }
21
22 // Allow for passing array of arguments, or multiple arguments
23 // Eg: .autoComplete('trigger', [arg1, arg2, arg3...]) or .autoComplete('trigger', arg1, arg2, arg3...)
24 // Mainly to allow for .autoComplete('trigger', arguments) to work
25 // Note*: Some triggers pass an array as the first param, so check against that first
26 args = ( AutoComplete.arrayMethods[ first ] === TRUE && $.isArray( args[0] ) && $.isArray( args[0][0] ) ) ||
27 ( args.length === 1 && $.isArray( args[0] ) ) ?
28 args[0] : args;
29
30 // Check method against handlers that need to use triggerHandler
31 handler = isMethod && ( AutoComplete.handlerMethods[ first ] === -1 || args.length < ( AutoComplete.handlerMethods[ first ] || 0 ) ) ?
32 'triggerHandler' : 'trigger';
33
34 return isMethod ?
35 self[ handler ]( 'autoComplete.' + first, args ) :
36
37 // Allow passing a jquery event special object {from $.Event()}
38 first && first.preventDefault !== undefined ? self.trigger( first, args ) :
39
40 // Initiate the autocomplete on each element (Only takes a single argument, the options object)
41 self.each(function(){
42 if ( $( el = this ).data( 'autoComplete' ) !== TRUE ) {
43 AutoCompleteFunction( el, first );
44 }
45 });
46 };
47
48 // bgiframe is needed to fix z-index problem for IE6 users.
49 $.fn.bgiframe = $.fn.bgiframe ? $.fn.bgiframe : $.fn.bgIframe ? $.fn.bgIframe : function() {
50 // For applications that don't have bgiframe plugin installed, create a useless
51 // function that doesn't break the chain
52 return this;
53 };
54
55 // Allows for single event binding to document and forms associated with the autoComplete inputs
56 // by deferring the event to the input in focus
57 function setup( $input, inputIndex ) {
58 if ( setup.flag !== TRUE ) {
59 setup.flag = TRUE;
60 rootjQuery.bind( 'click.autoComplete', function( event ) {
61 AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.document-click', [ event ] );
62 });
63 }
64
65 var $form = $input.closest( 'form' ), formList = $form.data( 'ac-inputs' ) || {}, $el;
66
67 formList[ inputIndex ] = TRUE;
68 $form.data( 'ac-inputs', formList );
69
70 if ( $form.data( 'autoComplete' ) !== TRUE ) {
71 $form.data( 'autoComplete', TRUE ).bind( 'submit.autoComplete', function( event ) {
72 return ( $el = AutoComplete.getFocus( TRUE ) ).length ?
73 $el.triggerHandler( 'autoComplete.form-submit', [ event, this ] ) :
74 TRUE;
75 });
76 }
77 }
78
79 // Removes the single events attached to the document and respective input form
80 function teardown( $input, inputIndex ) {
81 AutoComplete.remove( inputIndex );
82
83 if ( setup.flag === TRUE && AutoComplete.length === 0 ) {
84 setup.flag = FALSE;
85 rootjQuery.unbind( 'click.autoComplete' );
86 }
87
88 var $form = $input.closest( 'form' ), formList = $form.data( 'ac-inputs' ) || {}, i;
89
90 formList[ inputIndex ] = FALSE;
91 for ( i in formList ) {
92 if ( formList.hasOwnProperty( i ) && formList[ i ] === TRUE ) {
93 return;
94 }
95 }
96
97 $form.unbind( 'submit.autoComplete' );
98 }
99
100 // Default function for adding all supply items to the list
101 function allSupply( event, ui ) {
102 if ( ! $.isArray( ui.supply ) ) {
103 return [];
104 }
105
106 for ( var i = -1, l = ui.supply.length, ret = [], entry; ++i < l; ) {
107 entry = ui.supply[ i ];
108 entry = entry && entry.value ? entry : { value: entry };
109 ret.push( entry );
110 }
111
112 return ret;
113 }
114
115
116
117// Internals
118var
119 // Munging
120 TRUE = true,
121 FALSE = false,
122
123 // Copy of the slice prototype
124 Slice = Array.prototype.slice,
125
126 // Make a copy of the document element for caching
127 rootjQuery = $( window.document ),
128
129 // Also make a copy of an empty jQuery set for fast referencing
130 emptyjQuery = $( ),
131
132 // regex's
133 rdot = /\./,
134
135 // Opera and Firefox on Mac need to use the keypress event to track holding of
136 // a key down and not releasing
137 keypress = window.opera || ( /macintosh/i.test( window.navigator.userAgent ) && $.browser.mozilla ),
138
139 // Event flag that gets passed around
140 ExpandoFlag = 'autoComplete_' + $.expando,
141
142 // Make a local copy of the key codes used throughout the plugin
143 KEY = {
144 backspace: 8,
145 tab: 9,
146 enter: 13,
147 shift: 16,
148 space: 32,
149 pageup: 33,
150 pagedown: 34,
151 left: 37,
152 up: 38,
153 right: 39,
154 down: 40
155 },
156
157 // Attach global aspects to jQuery itself
158 AutoComplete = $.autoComplete = {
159 // Autocomplete Version
160 version: '5.1',
161
162 // Index Counter
163 counter: 0,
164
165 // Length of stack
166 length: 0,
167
168 // Storage of elements
169 stack: {},
170
171 // jQuery object versions of the storage elements
172 jqStack: {},
173
174 // Storage order of uid's
175 order: [],
176
177 // Global access to elements in use
178 hasFocus: FALSE,
179
180 // Expose the used keycodes
181 keys: KEY,
182
183 // Methods whose first argument may contain an array
184 arrayMethods: {
185 'button-supply': TRUE,
186 'direct-supply': TRUE
187 },
188
189 // Defines the maximum number of arguments that can be passed for using
190 // triggerHandler method instead of trigger. Passing -1 forces triggerHandler
191 // no matter the number of arguments
192 handlerMethods: {
193 'option': 2
194 },
195
196 // Events triggered whenever one of the autoComplete
197 // input's come into focus or blur out.
198 focus: undefined,
199 blur: undefined,
200
201 // Allow access to jquery cached object versions of the elements
202 getFocus: function( jqStack ) {
203 return ! AutoComplete.order[0] ? jqStack ? emptyjQuery : undefined :
204 jqStack ? AutoComplete.jqStack[ AutoComplete.order[0] ] :
205 AutoComplete.stack[ AutoComplete.order[0] ];
206 },
207
208 getPrevious: function( jqStack ) {
209 // Removing elements cause some indexs on the order stack
210 // to become undefined, so loop until one is found
211 for ( var i = 0, l = AutoComplete.order.length; ++i < l; ) {
212 if ( AutoComplete.order[i] ) {
213 return jqStack ?
214 AutoComplete.jqStack[ AutoComplete.order[i] ] :
215 AutoComplete.stack[ AutoComplete.order[i] ];
216 }
217 }
218
219 return jqStack ? emptyjQuery : undefined;
220 },
221
222 remove: function( n ) {
223 for ( var i = -1, l = AutoComplete.order.length; ++i < l; ) {
224 if ( AutoComplete.order[i] === n ) {
225 AutoComplete.order[i] = undefined;
226 }
227 }
228
229 AutoComplete.length--;
230 delete AutoComplete.stack[n];
231 },
232
233 // Returns full stack in jQuery form
234 getAll: function(){
235 for ( var i = -1, l = AutoComplete.counter, stack = []; ++i < l; ) {
236 if ( AutoComplete.stack[i] ) {
237 stack.push( AutoComplete.stack[i] );
238 }
239 }
240 return $( stack );
241 },
242
243 defaults: {
244 // To smooth upgrade process to 5.x, set backwardsCompatible to true
245 backwardsCompatible: FALSE,
246 // Server Script Path
247 ajax: 'ajax.php',
248 ajaxCache: $.ajaxSettings.cache,
249 // Data Configuration
250 dataSupply: [],
251 dataFn: undefined,
252 formatSupply: undefined,
253 // Drop List CSS
254 list: 'auto-complete-list',
255 rollover: 'auto-complete-list-rollover',
256 width: undefined, // Defined as inputs width when extended (can be overridden with this global/options/meta)
257 striped: undefined,
258 maxHeight: undefined,
259 bgiframe: undefined,
260 newList: FALSE,
261 // Post Data
262 postVar: 'value',
263 postData: {},
264 postFormat: undefined,
265 // Limitations
266 minChars: 1,
267 maxItems: -1,
268 maxRequests: 0,
269 maxRequestsDeep: FALSE,
270 requestType: 'POST',
271 // Input
272 inputControl: undefined,
273 autoFill: FALSE,
274 nonInput: [ KEY.shift, KEY.left, KEY.right ],
275 multiple: FALSE,
276 multipleSeparator: ' ',
277 // Events
278 onBlur: undefined,
279 onFocus: undefined,
280 onHide: undefined,
281 onLoad: undefined,
282 onMaxRequest: undefined,
283 onRollover: undefined,
284 onSelect: undefined,
285 onShow: undefined,
286 onListFormat: undefined,
287 onSubmit: undefined,
288 spinner: undefined,
289 preventEnterSubmit: TRUE,
290 delay: 0,
291 // Caching Options
292 useCache: TRUE,
293 cacheLimit: 50
294 }
295 },
296
297 // Autocomplete function
298 AutoCompleteFunction = function( self, options ) {
299 // Start with counters as they are used within declarations
300 AutoComplete.length++;
301 AutoComplete.counter++;
302
303 // Input specific vars
304 var $input = $( self ).attr( 'autocomplete', 'off' ),
305 // Data object stored on 'autoComplete' data namespace of input
306 ACData = {},
307 // Track every event triggered
308 LastEvent = {},
309 // String of current input value
310 inputval = '',
311 // Holds the current list
312 currentList = [],
313 // Place holder for all list elements
314 $elems = { length: 0 },
315 // Place holder for the list element in focus
316 $li,
317 // View and heights for scrolling
318 view, ulHeight, liHeight, liPerView,
319 // Hardcoded value for ul visiblity
320 ulOpen = FALSE,
321 // Timer for delay
322 timeid,
323 // Ajax requests holder
324 xhr,
325 // li element in focus, and its data
326 liFocus = -1, liData,
327 // Fast referencing for multiple selections
328 separator,
329 // Index of current input
330 inputIndex = AutoComplete.counter,
331 // Number of requests made
332 requests = 0,
333 // Internal Per Input Cache
334 cache = {
335 length: 0,
336 val: undefined,
337 list: {}
338 },
339
340 // Merge defaults with passed options and metadata options
341 settings = $.extend(
342 { width: $input.outerWidth() },
343 AutoComplete.defaults,
344 options||{},
345 $.metadata ? $input.metadata() : {}
346 ),
347
348 // Create the drop list (Use an existing one if possible)
349 $ul = ! settings.newList && rootjQuery.find( 'ul.' + settings.list )[ 0 ] ?
350 rootjQuery.find( 'ul.' + settings.list ).eq( 0 ).bgiframe( settings.bgiframe ) :
351 $('<ul/>').appendTo('body').addClass( settings.list ).bgiframe( settings.bgiframe ).hide().data( 'ac-selfmade', TRUE );
352
353
354 // Start Binding
355 $input.data( 'autoComplete', ACData = {
356 index: inputIndex,
357 hasFocus: FALSE,
358 active: TRUE,
359 settings: settings,
360 initialSettings: $.extend( TRUE, {}, settings )
361 });
362
363 // IE catches the enter key only on keypress/keyup, so add a helper
364 // to track that event if needed
365 if ( $.browser.msie ) {
366 $input.bind( 'keypress.autoComplete', function( event ) {
367 if ( ! ACData.active ) {
368 return TRUE;
369 }
370
371 if ( event.keyCode === KEY.enter ) {
372 var enter = TRUE;
373
374 // See entertracking on main key(press/down) event for explanation
375 if ( $li && $li.hasClass( settings.rollover ) ) {
376 enter = settings.preventEnterSubmit && ulOpen ? FALSE : TRUE;
377 select( event );
378 }
379 else if ( ulOpen ) {
380 $ul.hide( event );
381 }
382
383 return enter;
384 }
385 });
386 }
387
388
389 // Opera && firefox on Mac use keypress to track holding down of key,
390 // while everybody else uses keydown for same functionality
391 $input.bind( keypress ? 'keypress.autoComplete' : 'keydown.autoComplete' , function( event ) {
392 // If autoComplete has been disabled, prevent input events
393 if ( ! ACData.active ) {
394 return TRUE;
395 }
396
397 // Track last event and store code for munging
398 var key = ( LastEvent = event ).keyCode, enter = FALSE;
399
400
401 // Tab Key
402 if ( key === KEY.tab && ulOpen ) {
403 select( event );
404 }
405 // Enter Key
406 else if ( key === KEY.enter ) {
407 // When tracking whether to submit the form or not, we have
408 // to ensure that the user is actually selecting an element from the drop
409 // down list. It no element is selected, then hide the list and track form
410 // submission. If an element is selected, then track for submission first,
411 // then hide the list.
412 enter = TRUE;
413 if ( $li && $li.hasClass( settings.rollover ) ) {
414 enter = settings.preventEnterSubmit && ulOpen ? FALSE : TRUE;
415 select( event );
416 }
417 else if ( ulOpen ) {
418 $ul.hide( event );
419 }
420 }
421 // Up Arrow
422 else if ( key === KEY.up && ulOpen ) {
423 if ( liFocus > 0 ) {
424 liFocus--;
425 up( event );
426 } else {
427 liFocus = -1;
428 $input.val( inputval );
429 $ul.hide( event );
430 }
431 }
432 // Down Arrow
433 else if ( key === KEY.down && ulOpen ) {
434 if ( liFocus < $elems.length - 1 ) {
435 liFocus++;
436 down( event );
437 }
438 }
439 // Page Up
440 else if ( key === KEY.pageup && ulOpen ) {
441 if ( liFocus > 0 ) {
442 liFocus -= liPerView;
443
444 if ( liFocus < 0 ) {
445 liFocus = 0;
446 }
447
448 up( event );
449 }
450 }
451 // Page Down
452 else if ( key === KEY.pagedown && ulOpen ) {
453 if ( liFocus < $elems.length - 1 ) {
454 liFocus += liPerView;
455
456 if ( liFocus > $elems.length - 1 ) {
457 liFocus = $elems.length - 1;
458 }
459
460 down( event );
461 }
462 }
463 // Check for non input values defined by user
464 else if ( settings.nonInput && $.inArray( key, settings.nonInput ) > -1 ) {
465 $ul.html('').hide( event );
466 enter = TRUE;
467 }
468 // Everything else is considered possible input, so
469 // return before keyup prevention flag is set
470 else {
471 return TRUE;
472 }
473
474 // Prevent autoComplete keyup event's from triggering by
475 // attaching a flag to the last event
476 LastEvent[ 'keydown_' + ExpandoFlag ] = TRUE;
477 return enter;
478 })
479 .bind({
480 'keyup.autoComplete': function( event ) {
481 // If autoComplete has been disabled or keyup prevention
482 // flag has be set, prevent input events
483 if ( ! ACData.active || LastEvent[ 'keydown_' + ExpandoFlag ] ) {
484 return TRUE;
485 }
486
487 // If no special operations were run on keydown,
488 // allow for regular text searching
489 inputval = $input.val();
490 var key = ( LastEvent = event ).keyCode, val = separator ? inputval.split( separator ).pop() : inputval;
491
492 // Still check to make sure 'enter' wasn't pressed
493 if ( key != KEY.enter ) {
494
495 // Caching key value
496 cache.val = settings.inputControl === undefined ? val :
497 settings.inputControl.apply( self, settings.backwardsCompatible ?
498 [ val, key, $ul, event, settings, cache ] :
499 [ event, {
500 val: val,
501 key: key,
502 settings: settings,
503 cache: cache,
504 ul: $ul
505 }]
506 );
507
508 // Only send request if character length passes
509 if ( cache.val.length >= settings.minChars ) {
510 sendRequest( event, settings, cache, ( key === KEY.backspace || key === KEY.space ) );
511 }
512 // Remove list on backspace of small string
513 else if ( key == KEY.backspace ) {
514 $ul.html('').hide( event );
515 }
516 }
517 },
518
519 'blur.autoComplete': function( event ) {
520 // If autoComplete has been disabled or the drop list
521 // is still open, prevent input events
522 if ( ! ACData.active || ulOpen ) {
523 return TRUE;
524 }
525
526 // Only push undefined index onto order stack
527 // if not already there (in-case multiple blur events occur)
528 if ( AutoComplete.order[0] !== undefined ) {
529 AutoComplete.order.unshift( undefined );
530 }
531
532 // Expose focus
533 AutoComplete.hasFocus = FALSE;
534 ACData.hasFocus = FALSE;
535 liFocus = -1;
536 $ul.hide( LastEvent = event );
537
538 // Trigger both the global and element specific blur events
539 if ( AutoComplete.blur ) {
540 AutoComplete.blur.call( self, event, { settings: settings, cache: cache, ul: $ul } );
541 }
542
543 if ( settings.onBlur ) {
544 settings.onBlur.apply( self, settings.backwardsCompatible ?
545 [ inputval, $ul, event, settings, cache ] : [ event, {
546 val: inputval,
547 settings: settings,
548 cache: cache,
549 ul: $ul
550 }]
551 );
552 }
553 },
554
555 'focus.autoComplete': function( event, flag ) {
556 // Prevent inner focus events if caused by autoComplete inner functionality
557 // Also, because IE triggers focus AND closes the drop list before form submission,
558 // keep the select flag by not reseting the last event
559 if ( ! ACData.active || ( ACData.hasFocus && flag === ExpandoFlag ) || LastEvent[ 'enter_' + ExpandoFlag ] ) {
560 return TRUE;
561 }
562
563 if ( inputIndex !== $ul.data( 'ac-input-index' ) ) {
564 $ul.html('').hide( event );
565 }
566
567 // Overwrite undefined index pushed on by the blur event
568 if ( AutoComplete.order[0] === undefined ) {
569 if ( AutoComplete.order[1] === inputIndex ) {
570 AutoComplete.order.shift();
571 } else {
572 AutoComplete.order[0] = inputIndex;
573 }
574 }
575 else if ( AutoComplete.order[0] != inputIndex && AutoComplete.order[1] != inputIndex ) {
576 AutoComplete.order.unshift( inputIndex );
577 }
578
579 if ( AutoComplete.defaults.cacheLimit !== -1 && AutoComplete.order.length > AutoComplete.defaults.cacheLimit ) {
580 AutoComplete.order.pop();
581 }
582
583 // Expose focus
584 AutoComplete.hasFocus = TRUE;
585 ACData.hasFocus = TRUE;
586 LastEvent = event;
587
588 // Trigger both the global and element specific focus events
589 if ( AutoComplete.focus ) {
590 AutoComplete.focus.call( self, event, { settings: settings, cache: cache, ul: $ul } );
591 }
592
593 if ( settings.onFocus ) {
594 settings.onFocus.apply( self,
595 settings.backwardsCompatible ? [ $ul, event, settings, cache ] : [ event, {
596 settings: settings,
597 cache: cache,
598 ul: $ul
599 }]
600 );
601 }
602 },
603
604 /**
605 * Autocomplete Custom Methods (Extensions off autoComplete event)
606 */
607 // Catches document click events from the global scope
608 'autoComplete.document-click': function( e, event ) {
609 if ( ACData.active && ulOpen &&
610 // Double check the event timestamps to ensure there isn't a delayed reaction from a button
611 ( ! LastEvent || event.timeStamp - LastEvent.timeStamp > 200 ) &&
612 // Check the target after all other checks are passed (less processing)
613 $( event.target ).closest( 'ul' ).data( 'ac-input-index' ) !== inputIndex ) {
614 $ul.hide( LastEvent = event );
615 $input.blur();
616 }
617 },
618
619 // Catches form submission ( so only one event is attached to the form )
620 'autoComplete.form-submit': function( e, event, form ) {
621 if ( ! ACData.active ) {
622 return TRUE;
623 }
624
625 LastEvent = event;
626
627 // Because IE triggers focus AND closes the drop list before form submission,
628 // tracking enter is set on the keydown event
629 return settings.preventEnterSubmit && ( ulOpen || LastEvent[ 'enter_' + ExpandoFlag ] ) ? FALSE :
630 settings.onSubmit === undefined ? TRUE :
631 settings.onSubmit.call( self, event, { form: form, settings: settings, cache: cache, ul: $ul } );
632 },
633
634 // Catch mouseovers on the drop down element
635 'autoComplete.ul-mouseenter': function( e, event, li ) {
636 if ( $li ) {
637 $li.removeClass( settings.rollover );
638 }
639
640 $li = $( li ).addClass( settings.rollover );
641 liFocus = $elems.index( li );
642 liData = currentList[ liFocus ];
643 view = $ul.scrollTop() + ulHeight;
644 LastEvent = event;
645
646 if ( settings.onRollover ) {
647 settings.onRollover.apply( self, settings.backwardsCompatible ?
648 [ liData, $li, $ul, event, settings, cache ] :
649 [ event, {
650 data: liData,
651 li: $li,
652 settings: settings,
653 cache: cache,
654 ul: $ul
655 }]
656 );
657 }
658 },
659
660 // Catch click events on the drop down
661 'autoComplete.ul-click': function( e, event ) {
662 // Refocus the input box and pass flag to prevent inner focus events
663 $input.trigger( 'focus', [ ExpandoFlag ] );
664
665 // Check against separator for input value
666 $input.val( inputval === separator ?
667 inputval.substr( 0, inputval.length - inputval.split( separator ).pop().length ) + liData.value + separator :
668 liData.value
669 );
670
671 $ul.hide( LastEvent = event );
672 autoFill();
673
674 if ( settings.onSelect ) {
675 settings.onSelect.apply( self, settings.backwardsCompatible ?
676 [ liData, $li, $ul, event, settings, cache ] :
677 [ event, {
678 data: liData,
679 li: $li,
680 settings: settings,
681 cache: cache,
682 ul: $ul
683 }]
684 );
685 }
686 },
687
688 // Allow for change of settings at any point
689 'autoComplete.settings': function( event, newSettings ) {
690 if ( ! ACData.active ) {
691 return TRUE;
692 }
693
694 var ret, $el;
695 LastEvent = event;
696
697 // Give access to current settings and cache
698 if ( $.isFunction( newSettings ) ) {
699 ret = newSettings.apply( self, settings.backwardsCompatible ?
700 [ settings, cache, $ul, event ] : [ event, { settings: settings, cache: cache, ul: $ul } ]
701 );
702
703 // Allow for extending of settings/cache based off function return values
704 if ( $.isArray( ret ) && ret[0] !== undefined ) {
705 $.extend( TRUE, settings, ret[0] || settings );
706 $.extend( TRUE, cache, ret[1] || cache );
707 }
708 } else {
709 $.extend( TRUE, settings, newSettings || {} );
710 }
711
712 // Change the drop down if dev want's a differen't class attached
713 $ul = ! settings.newList && $ul.hasClass( settings.list ) ? $ul :
714 ! settings.newList && ( $el = rootjQuery.find( 'ul.' + settings.list ).eq( 0 ) ).length ?
715 $el.bgiframe( settings.bgiframe ) :
716 $('<ul/>').appendTo('body').addClass( settings.list )
717 .bgiframe( settings.bgiframe ).hide().data( 'ac-selfmade', TRUE );
718
719 // Custom drop list modifications
720 newUl();
721
722 // Change case here so it doesn't have to be done on every request
723 settings.requestType = settings.requestType.toUpperCase();
724
725 // Local copy of the seperator for faster referencing
726 separator = settings.multiple ? settings.multipleSeparator : undefined;
727
728 // Just to be sure, reset the settings object into the data storage
729 ACData.settings = settings;
730 },
731
732 // Clears the Cache & requests (requests can be blocked from clearing)
733 'autoComplete.flush': function( event, cacheOnly ) {
734 if ( ! ACData.active ) {
735 return TRUE;
736 }
737
738 if ( ! cacheOnly ) {
739 requests = 0;
740 }
741
742 cache = { length: 0, val: undefined, list: {} };
743 LastEvent = event;
744 },
745
746 // External button trigger for ajax requests
747 'autoComplete.button-ajax': function( event, postData, cacheName ) {
748 if ( ! ACData.active ) {
749 return TRUE;
750 }
751
752 if ( typeof postData === 'string' ) {
753 cacheName = postData;
754 postData = {};
755 }
756
757 // Save off the last event before triggering focus on the off-chance
758 // it is needed by a secondary focus event
759 LastEvent = event;
760
761 // Refocus the input box, but pass flag to prevent inner focus events
762 $input.trigger( 'focus', [ ExpandoFlag ] );
763
764 // If no cache name is given, supply a non-common word
765 cache.val = cacheName || 'button-ajax_' + ExpandoFlag;
766
767 return sendRequest(
768 event,
769 $.extend( TRUE, {}, settings, { maxItems: -1, postData: postData || {} } ),
770 cache
771 );
772 },
773
774 // External button trigger for supplied data
775 'autoComplete.button-supply': function( event, data, cacheName ) {
776 if ( ! ACData.active ) {
777 return TRUE;
778 }
779
780 if ( typeof data === 'string' ) {
781 cacheName = data;
782 data = undefined;
783 }
784
785 // Again, save off event before triggering focus
786 LastEvent = event;
787
788 // Refocus the input box and pass flag to prevent inner focus events
789 $input.trigger( 'focus', [ ExpandoFlag ] );
790
791 // If no cache name is given, supply a non-common word
792 cache.val = cacheName || 'button-supply_' + ExpandoFlag;
793
794 // If no data is supplied, use data in settings
795 data = $.isArray( data ) ? data : settings.dataSupply;
796
797 return sendRequest(
798 event,
799 $.extend( TRUE, {}, settings, { maxItems: -1, dataSupply: data, formatSupply: allSupply } ),
800 cache
801 );
802 },
803
804 // Supply list directly into the result function
805 'autoComplete.direct-supply': function( event, data, cacheName ) {
806 if ( ! ACData.active ) {
807 return TRUE;
808 }
809
810 if ( typeof data === 'string' ) {
811 cacheName = data;
812 data = undefined;
813 }
814
815 // Again, save off event before triggering focus
816 LastEvent = event;
817
818 // Refocus the input box and pass flag to prevent inner focus events
819 $input.trigger( 'focus', [ ExpandoFlag ] );
820
821 // If no cache name is given, supply a non-common word
822 cache.val = cacheName || 'direct-supply_' + ExpandoFlag;
823
824 // If no data is supplied, use data in settings
825 data = $.isArray( data ) && data.length ? data : settings.dataSupply;
826
827 // Load the results directly into the results function bypassing request holdups
828 return loadResults(
829 event,
830 data,
831 $.extend( TRUE, {}, settings, { maxItems: -1, dataSupply: data, formatSupply: allSupply } ),
832 cache
833 );
834 },
835
836 // Triggering autocomplete programatically
837 'autoComplete.search': function( event, value ) {
838 if ( ! ACData.active ) {
839 return TRUE;
840 }
841
842 cache.val = value || '';
843 return sendRequest( LastEvent = event, settings, cache );
844 },
845
846 // Add jquery-ui like option access
847 'autoComplete.option': function( event, name, value ) {
848 if ( ! ACData.active ) {
849 return TRUE;
850 }
851
852 LastEvent = event;
853 switch ( Slice.call( arguments ).length ) {
854 case 3:
855 settings[ name ] = value;
856 return value;
857 case 2:
858 return name === 'ul' ? $ul :
859 name === 'cache' ? cache :
860 name === 'xhr' ? xhr :
861 name === 'input' ? $input :
862 settings[ name ] || undefined;
863 default:
864 return settings;
865 }
866 },
867
868 // Add enabling event (only applicable after disable)
869 'autoComplete.enable': function( event ) {
870 ACData.active = TRUE;
871 LastEvent = event;
872 },
873
874 // Add disable event
875 'autoComplete.disable': function( event ) {
876 ACData.active = FALSE;
877 $ul.html('').hide( LastEvent = event );
878 },
879
880 // Add a destruction function
881 'autoComplete.destroy': function( event ) {
882 var list = $ul.html('').hide( LastEvent = event ).data( 'ac-inputs' ) || {}, i;
883
884 // Remove all autoComplete specific data and events
885 $input.removeData( 'autoComplete' ).unbind( '.autoComplete autoComplete' );
886
887 // Remove form/drop list/document event catchers if possible
888 teardown( $input, inputIndex );
889
890 // Remove input from the drop down element of inputs
891 list[ inputIndex ] = undefined;
892
893 // Go through the drop down element and see if any other inputs are attached to it
894 for ( i in list ) {
895 if ( list.hasOwnProperty( i ) && list[ i ] === TRUE ) {
896 return LastEvent;
897 }
898 }
899
900 // Remove the element from the DOM if self created
901 if ( $ul.data( 'ac-selfmade' ) === TRUE ) {
902 $ul.remove();
903 }
904 // Kill all data associated with autoComplete for a cleaned drop down element
905 else {
906 $ul.removeData( 'autoComplete' ).removeData( 'ac-input-index' ).removeData( 'ac-inputs' );
907 }
908 }
909 });
910
911 // Ajax/Cache Request
912 function sendRequest( event, settings, cache, backSpace, timeout ) {
913 // Merely setting max requests still allows usage of cache and supplied data,
914 // this 'Deep' option prevents those scenarios if needed
915 if ( settings.maxRequestsDeep === true && requests >= settings.maxRequests ) {
916 return FALSE;
917 }
918
919 if ( settings.spinner ) {
920 settings.spinner.call( self, event, { active: TRUE, settings: settings, cache: cache, ul: $ul } );
921 }
922
923 if ( timeid ) {
924 timeid = clearTimeout( timeid );
925 }
926
927 // Call send request again with timeout flag if on delay
928 if ( settings.delay > 0 && timeout === undefined ) {
929 timeid = window.setTimeout(function(){
930 sendRequest( event, settings, cache, backSpace, TRUE );
931 }, settings.delay );
932 return timeid;
933 }
934
935 // Abort previous request incase it's still running
936 if ( xhr ) {
937 xhr.abort();
938 }
939
940 // Load from cache if possible
941 if ( settings.useCache && $.isArray( cache.list[ cache.val ] ) ) {
942 return loadResults( event, cache.list[ cache.val ], settings, cache, backSpace );
943 }
944
945 // Use user supplied data when defined
946 if ( settings.dataSupply.length ) {
947 return userSuppliedData( event, settings, cache, backSpace );
948 }
949
950 // Check Max requests first before sending request
951 if ( settings.maxRequests && ++requests >= settings.maxRequests ) {
952 $ul.html('').hide( event );
953
954 if ( settings.spinner ) {
955 settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } );
956 }
957
958 if ( settings.onMaxRequest && requests === settings.maxRequests ) {
959 return settings.onMaxRequest.apply( self, settings.backwardsCompatible ?
960 [ cache.val, $ul, event, inputval, settings, cache ] :
961 [ event, {
962 search: cache.val,
963 val: inputval,
964 settings: settings,
965 cache: cache,
966 ul: $ul
967 }]
968 );
969 }
970
971 return FALSE;
972 }
973
974 settings.postData[ settings.postVar ] = cache.val;
975 xhr = $.ajax({
976 type: settings.requestType,
977 url: settings.ajax,
978 cache: settings.ajaxCache,
979 dataType: 'json',
980
981 // Send personalised data
982 data: settings.postFormat ?
983 settings.postFormat.call( self, event, {
984 data: settings.postData,
985 search: cache.val,
986 val: inputval,
987 settings: settings,
988 cache: cache,
989 ul: $ul
990 }) :
991 settings.postData,
992
993 success: function( list ) {
994 loadResults( event, list, settings, cache, backSpace );
995 },
996
997 error: function() {
998 $ul.html('').hide( event );
999 if ( settings.spinner ) {
1000 settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } );
1001 }
1002 }
1003 });
1004
1005 return xhr;
1006 }
1007
1008 // Parse User Supplied Data
1009 function userSuppliedData( event, settings, cache, backSpace ) {
1010 var list = [], args = [],
1011 fn = $.isFunction( settings.dataFn ),
1012 regex = fn ? undefined : new RegExp( '^'+cache.val, 'i' ),
1013 items = 0, entry, i = -1, l = settings.dataSupply.length;
1014
1015 if ( settings.formatSupply ) {
1016 list = settings.formatSupply.call( self, event, {
1017 search: cache.val,
1018 supply: settings.dataSupply,
1019 settings: settings,
1020 cache: cache,
1021 ul: $ul
1022 });
1023 } else {
1024 for ( ; ++i < l ; ) {
1025 // Force object wrapper for entry
1026 entry = settings.dataSupply[i];
1027 entry = entry && typeof entry.value === 'string' ? entry : { value: entry };
1028
1029 // Setup arguments for dataFn in a backwards compatible way if needed
1030 args = settings.backwardsCompatible ?
1031 [ cache.val, entry.value, list, i, settings.dataSupply, $ul, event, settings, cache ] :
1032 [ event, {
1033 search: cache.val,
1034 entry: entry.value,
1035 list: list,
1036 i: i,
1037 supply: settings.dataSupply,
1038 settings: settings,
1039 cache: cache,
1040 ul: $ul
1041 }];
1042
1043 // If user supplied function, use that, otherwise test with default regex
1044 if ( ( fn && settings.dataFn.apply( self, args ) ) || ( ! fn && entry.value.match( regex ) ) ) {
1045 // Reduce browser load by breaking on limit if it exists
1046 if ( settings.maxItems > -1 && ++items > settings.maxItems ) {
1047 break;
1048 }
1049 list.push( entry );
1050 }
1051 }
1052 }
1053
1054 // Use normal load functionality
1055 return loadResults( event, list, settings, cache, backSpace );
1056 }
1057
1058 // Key element Selection
1059 function select( event ) {
1060 // Ensure the select function only gets fired when list of open
1061 if ( ulOpen ) {
1062 if ( settings.onSelect ) {
1063 settings.onSelect.apply( self, settings.backwardsCompatible ?
1064 [ liData, $li, $ul, event, settings, cache ] :
1065 [ event, {
1066 data: liData,
1067 li: $li,
1068 settings: settings,
1069 cache: cache,
1070 ul: $ul
1071 }]
1072 );
1073 }
1074
1075 autoFill();
1076 inputval = $input.val();
1077
1078 // Because IE triggers focus AND closes the drop list before form submission
1079 // attach a flag on 'enter' selection
1080 if ( LastEvent.type === 'keydown' ) {
1081 LastEvent[ 'enter_' + ExpandoFlag ] = TRUE;
1082 }
1083
1084 $ul.hide( event );
1085 }
1086
1087 $li = undefined;
1088 }
1089
1090 // Key direction up
1091 function up( event ) {
1092 if ( $li ) {
1093 $li.removeClass( settings.rollover );
1094 }
1095
1096 $ul.show( event );
1097 $li = $elems.eq( liFocus ).addClass( settings.rollover );
1098 liData = currentList[ liFocus ];
1099
1100 if ( ! $li.length || ! liData ) {
1101 return FALSE;
1102 }
1103
1104 autoFill( liData.value );
1105 if ( settings.onRollover ) {
1106 settings.onRollover.apply( self, settings.backwardsCompatible ?
1107 [ liData, $li, $ul, event, settings, cache ] :
1108 [ event, {
1109 data: liData,
1110 li: $li,
1111 settings: settings,
1112 cache: cache,
1113 ul: $ul
1114 }]
1115 );
1116 }
1117
1118 // Scrolling
1119 var scroll = liFocus * liHeight;
1120 if ( scroll < view - ulHeight ) {
1121 view = scroll + ulHeight;
1122 $ul.scrollTop( scroll );
1123 }
1124 }
1125
1126 // Key direction down
1127 function down( event ) {
1128 if ( $li ) {
1129 $li.removeClass( settings.rollover );
1130 }
1131
1132 $ul.show( event );
1133 $li = $elems.eq( liFocus ).addClass( settings.rollover );
1134 liData = currentList[ liFocus ];
1135
1136 if ( ! $li.length || ! liData ) {
1137 return FALSE;
1138 }
1139
1140 autoFill( liData.value );
1141
1142 // Scrolling
1143 var scroll = ( liFocus + 1 ) * liHeight;
1144 if ( scroll > view ) {
1145 $ul.scrollTop( ( view = scroll ) - ulHeight );
1146 }
1147
1148 if ( settings.onRollover ) {
1149 settings.onRollover.apply( self, settings.backwardsCompatible ?
1150 [ liData, $li, $ul, event, settings, cache ] : [ event, {
1151 data: liData,
1152 li: $li,
1153 settings: settings,
1154 cache: cache,
1155 ul: $ul
1156 }]
1157 );
1158 }
1159 }
1160
1161 // Attach new show/hide functionality to only the ul object (so not to infect all of jQuery),
1162 // And also attach event handlers if not already done so
1163 function newUl() {
1164 var hide = $ul.hide, show = $ul.show, list = $ul.data( 'ac-inputs' ) || {};
1165
1166 if ( ! $ul[ ExpandoFlag ] ) {
1167 $ul.hide = function( event, speed, callback ) {
1168 if ( settings.onHide && ulOpen ) {
1169 settings.onHide.call( self, event, { ul: $ul, settings: settings, cache: cache } );
1170 }
1171
1172 ulOpen = FALSE;
1173 return hide.call( $ul, speed, callback );
1174 };
1175
1176 $ul.show = function( event, speed, callback ) {
1177 if ( settings.onShow && ! ulOpen ) {
1178 settings.onShow.call( self, event, { ul: $ul, settings: settings, cache: cache } );
1179 }
1180
1181 ulOpen = TRUE;
1182 return show.call( $ul, speed, callback );
1183 };
1184
1185 // A flag must be attached to the $ul cached object
1186 $ul[ ExpandoFlag ] = TRUE;
1187 }
1188
1189 // Attach global handlers for event delegation (So there is no more loss time in unbinding and rebinding)
1190 if ( $ul.data( 'autoComplete' ) !== TRUE ) {
1191 $ul.data( 'autoComplete', TRUE )
1192 .delegate( 'li', 'mouseenter.autoComplete', function( event ) {
1193 AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.ul-mouseenter', [ event, this ] );
1194 })
1195 .bind( 'click.autoComplete', function( event ) {
1196 AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.ul-click', [ event ] );
1197 return FALSE;
1198 });
1199 }
1200
1201 list[ inputIndex ] = TRUE;
1202 $ul.data( 'ac-inputs', list );
1203 }
1204
1205 // Auto-fill the input
1206 // Credit to Jörn Zaefferer @ http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
1207 // and http://www.pengoworks.com/workshop/jquery/autocomplete.htm for this functionality
1208 function autoFill( val ) {
1209 var start, end, range;
1210
1211 // Set starting and ending points based on values
1212 if ( val === undefined || val === '' ) {
1213 start = end = $input.val().length;
1214 } else {
1215 if ( separator ) {
1216 val = inputval.substr( 0, inputval.length - inputval.split( separator ).pop().length ) + val + separator;
1217 }
1218
1219 start = inputval.length;
1220 end = val.length;
1221 $input.val( val );
1222 }
1223
1224 // Create selection if allowed
1225 if ( ! settings.autoFill || start > end ) {
1226 return FALSE;
1227 }
1228 else if ( self.createTextRange ) {
1229 range = self.createTextRange();
1230 if ( val === undefined ) {
1231 range.move( 'character', start );
1232 range.select();
1233 } else {
1234 range.collapse( TRUE );
1235 range.moveStart( 'character', start );
1236 range.moveEnd( 'character', end );
1237 range.select();
1238 }
1239 }
1240 else if ( self.setSelectionRange ) {
1241 self.setSelectionRange( start, end );
1242 }
1243 else if ( self.selectionStart ) {
1244 self.selectionStart = start;
1245 self.selectionEnd = end;
1246 }
1247 }
1248
1249 // List Functionality
1250 function loadResults( event, list, settings, cache, backSpace ) {
1251 // Allow another level of result handling
1252 currentList = settings.onLoad ?
1253 settings.onLoad.call( self, event, { list: list, settings: settings, cache: cache, ul: $ul } ) : list;
1254
1255 // Tell spinner function to stop if set
1256 if ( settings.spinner ) {
1257 settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } );
1258 }
1259
1260 // Store results into the cache if allowed
1261 if ( settings.useCache && ! $.isArray( cache.list[ cache.val ] ) ) {
1262 cache.length++;
1263 cache.list[ cache.val ] = list;
1264
1265 // Clear cache if necessary
1266 if ( settings.cacheLimit !== -1 && cache.length > settings.cacheLimit ) {
1267 cache.list = {};
1268 cache.length = 0;
1269 }
1270 }
1271
1272 // Ensure there is a list
1273 if ( ! currentList || currentList.length < 1 ) {
1274 return $ul.html('').hide( event );
1275 }
1276
1277 // Refocus list element
1278 liFocus = -1;
1279
1280 // Initialize Vars together (save bytes)
1281 var offset = $input.offset(), // Input position
1282 container = [], // Container for list elements
1283 items = 0, i = -1, striped = FALSE, length = currentList.length; // Loop Items
1284
1285 if ( settings.onListFormat ) {
1286 settings.onListFormat.call( self, event, { list: currentList, settings: settings, cache: cache, ul: $ul } );
1287 }
1288 else {
1289 // Push items onto container
1290 for ( ; ++i < length; ) {
1291 if ( currentList[i].value ) {
1292 if ( settings.maxItems > -1 && ++items > settings.maxItems ) {
1293 break;
1294 }
1295
1296 container.push(
1297 settings.striped && striped ? '<li class="' + settings.striped + '">' : '<li>',
1298 currentList[i].display || currentList[i].value,
1299 '</li>'
1300 );
1301
1302 striped = ! striped;
1303 }
1304 }
1305 $ul.html( container.join('') );
1306 }
1307
1308 // Cache the list items
1309 $elems = $ul.children( 'li' );
1310
1311 // Autofill input with first entry
1312 if ( settings.autoFill && ! backSpace ) {
1313 liFocus = 0;
1314 liData = currentList[ 0 ];
1315 autoFill( liData.value );
1316 $li = $elems.eq( 0 ).addClass( settings.rollover );
1317 }
1318
1319 // Align the drop down element
1320 $ul.data( 'ac-input-index', inputIndex ).scrollTop( 0 ).css({
1321 top: offset.top + $input.outerHeight(),
1322 left: offset.left,
1323 width: settings.width
1324 })
1325 // The drop list has to be shown before maxHeight can be configured
1326 .show( event );
1327
1328 // Log li height for less computation
1329 liHeight = $elems.eq( 0 ).outerHeight();
1330
1331 // If Max Height specified, control it
1332 if ( settings.maxHeight ) {
1333 $ul.css({
1334 height: liHeight * $elems.length > settings.maxHeight ? settings.maxHeight : 'auto',
1335 overflow: 'auto'
1336 });
1337 }
1338
1339 // ulHeight gets manipulated, so assign to viewport seperately
1340 // so referencing conflicts don't override viewport
1341 ulHeight = $ul.outerHeight();
1342 view = ulHeight;
1343
1344 // Number of elements per viewport
1345 liPerView = liHeight === 0 ? 0 : Math.floor( view / liHeight );
1346
1347 // Include amount of time it took to load the list
1348 // and run modifications
1349 LastEvent.timeStamp = ( new Date() ).getTime();
1350 }
1351
1352 // Custom modifications to the drop down element
1353 newUl();
1354
1355 // Do case change on initialization so it's not run on every request
1356 settings.requestType = settings.requestType.toUpperCase();
1357
1358 // Local quick copy of the seperator (so we don't have to run this check every time)
1359 separator = settings.multiple ? settings.multipleSeparator : undefined;
1360
1361 // Expose copies of both the input element and the cached jQuery version
1362 AutoComplete.stack[ inputIndex ] = self;
1363 AutoComplete.jqStack[ inputIndex ] = $input;
1364
1365 // Form and Document event attachment
1366 setup( $input, inputIndex );
1367 };
1368
1369})( jQuery, window || this );
01370
=== modified file 'website/views/website_templates.xml'
--- website/views/website_templates.xml 2014-02-21 10:47:25 +0000
+++ website/views/website_templates.xml 2014-02-26 06:23:38 +0000
@@ -271,7 +271,9 @@
271 <script type="text/javascript" src="/website/static/lib/MutationObservers/test/sidetable.js"></script>271 <script type="text/javascript" src="/website/static/lib/MutationObservers/test/sidetable.js"></script>
272 <script type="text/javascript" src='/website/static/lib/nearest/jquery.nearest.js'></script>272 <script type="text/javascript" src='/website/static/lib/nearest/jquery.nearest.js'></script>
273 <script type="text/javascript" src="/website/static/lib/MutationObservers/MutationObserver.js"></script>273 <script type="text/javascript" src="/website/static/lib/MutationObservers/MutationObserver.js"></script>
274274 <!-- Add Auto complete Library -->
275 <script type="text/javascript" src="/website/static/lib/autocomplete/jquery.auto-complete.js"></script>
276
275 <script type="text/javascript" src="/website/static/src/js/website.editor.js"></script>277 <script type="text/javascript" src="/website/static/src/js/website.editor.js"></script>
276 <script type="text/javascript" src="/website/static/src/js/website.editor.newpage.js" groups="base.group_website_designer"></script>278 <script type="text/javascript" src="/website/static/src/js/website.editor.newpage.js" groups="base.group_website_designer"></script>
277 <script type="text/javascript" src="/website/static/src/js/website.menu.js" groups="base.group_website_designer"></script>279 <script type="text/javascript" src="/website/static/src/js/website.menu.js" groups="base.group_website_designer"></script>
278280
=== modified file 'website_quote/data/website_quotation_data.xml'
--- website_quote/data/website_quotation_data.xml 2014-01-25 23:25:25 +0000
+++ website_quote/data/website_quotation_data.xml 2014-02-26 06:23:38 +0000
@@ -63,7 +63,7 @@
63 ${object.company_id.zip} ${object.company_id.city}<br/>63 ${object.company_id.zip} ${object.company_id.city}<br/>
64 % endif64 % endif
65 % if object.company_id.country_id:65 % if object.company_id.country_id:
66 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>66 ${object.company_id.state}<br/>
67 % endif67 % endif
68 </span>68 </span>
69 % if object.company_id.phone:69 % if object.company_id.phone:
7070
=== modified file 'website_sale/controllers/main.py'
--- website_sale/controllers/main.py 2014-02-25 09:05:06 +0000
+++ website_sale/controllers/main.py 2014-02-26 06:23:38 +0000
@@ -15,11 +15,11 @@
1515
16class CheckoutInfo(object):16class CheckoutInfo(object):
17 mandatory_billing_fields = ["name", "phone", "email", "street", "city", "country_id", "zip"]17 mandatory_billing_fields = ["name", "phone", "email", "street", "city", "country_id", "zip"]
18 optional_billing_fields = ["company", "state_id"]18 optional_billing_fields = ["company", "state"]
19 string_billing_fields = ["name", "phone", "email", "street", "city", "zip"]19 string_billing_fields = ["name", "phone", "email", "street", "city", "zip"]
2020
21 mandatory_shipping_fields = ["shipping_name", "shipping_phone", "shipping_street", "shipping_city", "shipping_country_id", "shipping_zip"]21 mandatory_shipping_fields = ["shipping_name", "shipping_phone", "shipping_street", "shipping_city", "shipping_country_id", "shipping_zip"]
22 optional_shipping_field = ["shipping_state_id"]22 optional_shipping_field = ["shipping_state"]
23 string_shipping_fields = ["shipping_name", "shipping_phone", "shipping_street", "shipping_city", "shipping_zip"]23 string_shipping_fields = ["shipping_name", "shipping_phone", "shipping_street", "shipping_city", "shipping_zip"]
2424
25 def mandatory_fields(self):25 def mandatory_fields(self):
@@ -41,7 +41,6 @@
41 else:41 else:
42 prefix = 'shipping_'42 prefix = 'shipping_'
43 result = dict((prefix + field_name, getattr(partner, field_name)) for field_name in self.string_billing_fields if getattr(partner, field_name))43 result = dict((prefix + field_name, getattr(partner, field_name)) for field_name in self.string_billing_fields if getattr(partner, field_name))
44 result[prefix + 'state_id'] = partner.state_id and partner.state_id.id or ''
45 result[prefix + 'country_id'] = partner.country_id and partner.country_id.id or ''44 result[prefix + 'country_id'] = partner.country_id and partner.country_id.id or ''
46 result[prefix + 'company'] = partner.parent_id and partner.parent_id.name or ''45 result[prefix + 'company'] = partner.parent_id and partner.parent_id.name or ''
47 return result46 return result
@@ -406,14 +405,10 @@
406 orm_country = registry.get('res.country')405 orm_country = registry.get('res.country')
407 country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context)406 country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context)
408 countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context)407 countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context)
409 state_orm = registry.get('res.country.state')
410 states_ids = state_orm.search(cr, SUPERUSER_ID, [], context=context)
411 states = state_orm.browse(cr, SUPERUSER_ID, states_ids, context)
412408
413 info = CheckoutInfo()409 info = CheckoutInfo()
414 values = {410 values = {
415 'countries': countries,411 'countries': countries,
416 'states': states,
417 'checkout': info.empty(),412 'checkout': info.empty(),
418 'shipping': post.get("shipping_different"),413 'shipping': post.get("shipping_different"),
419 'error': {},414 'error': {},
@@ -441,6 +436,16 @@
441436
442 return request.website.render("website_sale.checkout", values)437 return request.website.render("website_sale.checkout", values)
443438
439 @http.route('/shop/get_country', type='json', auth='user', website=True)
440 def get_country(self, **post):
441 cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
442 orm_country = registry.get('res.country')
443 country_ids = orm_country.search(cr, uid, [], context=context)
444 countries = {}
445 for country in orm_country.browse(cr, uid, country_ids, context):
446 countries.update({country.id : country.name})
447 return countries
448
444 @http.route(['/shop/confirm_order/'], type='http', auth="public", website=True, multilang=True)449 @http.route(['/shop/confirm_order/'], type='http', auth="public", website=True, multilang=True)
445 def confirm_order(self, **post):450 def confirm_order(self, **post):
446 cr, uid, context, registry = request.cr, request.uid, request.context, request.registry451 cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
@@ -459,16 +464,11 @@
459 orm_partner = registry.get('res.partner')464 orm_partner = registry.get('res.partner')
460 orm_user = registry.get('res.users')465 orm_user = registry.get('res.users')
461 orm_country = registry.get('res.country')466 orm_country = registry.get('res.country')
462 country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context)467 countries = orm_country.search(cr, SUPERUSER_ID, [('name','=',post['country_id'])], context=context)
463 countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context)468 post['country_id'] = countries[0]
464 orm_state = registry.get('res.country.state')469
465 states_ids = orm_state.search(cr, SUPERUSER_ID, [], context=context)
466 states = orm_state.browse(cr, SUPERUSER_ID, states_ids, context)
467
468 info = CheckoutInfo()470 info = CheckoutInfo()
469 values = {471 values = {
470 'countries': countries,
471 'states': states,
472 'checkout': info.empty(),472 'checkout': info.empty(),
473 'shipping': post.get("shipping_different"),473 'shipping': post.get("shipping_different"),
474 'error': {},474 'error': {},
@@ -513,6 +513,7 @@
513513
514 shipping_id = None514 shipping_id = None
515 if post.get('shipping_different'):515 if post.get('shipping_different'):
516 shiping_id = orm_country.search(cr, SUPERUSER_ID, [('name','=',post['shipping_country_id'])], context=context)
516 shipping_info = {517 shipping_info = {
517 'phone': post['shipping_phone'],518 'phone': post['shipping_phone'],
518 'zip': post['shipping_zip'],519 'zip': post['shipping_zip'],
@@ -522,8 +523,7 @@
522 'email': post['email'],523 'email': post['email'],
523 'type': 'delivery',524 'type': 'delivery',
524 'parent_id': partner_id,525 'parent_id': partner_id,
525 'country_id': post['shipping_country_id'],526 'shipping_country_id': shiping_id[0],
526 'state_id': post['shipping_state_id'],
527 }527 }
528 domain = [(key, '_id' in key and '=' or 'ilike', '_id' in key and value and int(value) or value)528 domain = [(key, '_id' in key and '=' or 'ilike', '_id' in key and value and int(value) or value)
529 for key, value in shipping_info.items() if key in info.mandatory_billing_fields + ["type", "parent_id"]]529 for key, value in shipping_info.items() if key in info.mandatory_billing_fields + ["type", "parent_id"]]
@@ -670,7 +670,7 @@
670 if not tx_ids:670 if not tx_ids:
671 if order.amount_total:671 if order.amount_total:
672 return {672 return {
673 'state': 'error',673 'f': 'error',
674 'message': '<p>There seems to be an error with your request.</p>',674 'message': '<p>There seems to be an error with your request.</p>',
675 }675 }
676 else:676 else:
677677
=== modified file 'website_sale/static/src/js/website_sale.js'
--- website_sale/static/src/js/website_sale.js 2014-02-06 14:07:46 +0000
+++ website_sale/static/src/js/website_sale.js 2014-02-26 06:23:38 +0000
@@ -6,7 +6,16 @@
6 $shippingDifferent.change(function () {6 $shippingDifferent.change(function () {
7 $(".oe_website_sale .js_shipping").toggle();7 $(".oe_website_sale .js_shipping").toggle();
8 });8 });
99
10 openerp.jsonRpc('/shop/get_country', 'call', {}).then(function (countries){
11 var st = new Array();
12 $.each(countries, function(s, t) {
13 st.push(t);
14 });
15 $('input[name=country_id]').autocomplete({source: st});
16 $('input[name=shipping_country_id]').autocomplete({source: st});
17 });
18
10 // change for css19 // change for css
11 $(document).on('mouseup', '.js_publish', function (ev) {20 $(document).on('mouseup', '.js_publish', function (ev) {
12 $(ev.currentTarget).parents(".thumbnail").toggleClass("disabled");21 $(ev.currentTarget).parents(".thumbnail").toggleClass("disabled");
1322
=== modified file 'website_sale/views/website_sale.xml'
--- website_sale/views/website_sale.xml 2014-02-20 16:38:15 +0000
+++ website_sale/views/website_sale.xml 2014-02-26 06:23:38 +0000
@@ -762,23 +762,13 @@
762 <label class="control-label" for="zip">Zip / Postal Code</label>762 <label class="control-label" for="zip">Zip / Postal Code</label>
763 <input type="text" name="zip" class="form-control" t-att-value="checkout.get('zip')"/>763 <input type="text" name="zip" class="form-control" t-att-value="checkout.get('zip')"/>
764 </div>764 </div>
765 <div t-attf-class="form-group #{error.get('state_id') and 'has-error' or ''} col-lg-6">765 <div t-attf-class="form-group #{error.get('state') and 'has-error' or ''} col-lg-6">
766 <label class="control-label" for="state_id" style="font-weight: normal">State / Province</label>766 <label class="control-label" for="state"> State / Province...</label>
767 <select name="state_id" class="form-control">767 <input type="" name="state" class="form-control" t-att-value="state" />
768 <option value="">select...</option>768 </div>
769 <t t-foreach="states or []" t-as="state">
770 <option t-att-value="state.id" t-att-selected="state.id == checkout.get('state_id')"><t t-esc="state.name"/></option>
771 </t>
772 </select>
773 </div>
774 <div t-attf-class="form-group #{error.get('country_id') and 'has-error' or ''} col-lg-6">769 <div t-attf-class="form-group #{error.get('country_id') and 'has-error' or ''} col-lg-6">
775 <label class="control-label" for="contact_name">Country</label>770 <label class="control-label" for="country_id">Country</label>
776 <select name="country_id" class="form-control">771 <input type="text" name="country_id" class="form-control" t-att-value="country_id" />
777 <option value="">Country...</option>
778 <t t-foreach="countries or []" t-as="country">
779 <option t-att-value="country.id" t-att-selected="country.id == checkout.get('country_id')"><t t-esc="country.name"/></option>
780 </t>
781 </select>
782 </div>772 </div>
783773
784 <div class="clearfix"/>774 <div class="clearfix"/>
@@ -814,24 +804,14 @@
814 <label class="control-label" for="contact_name">Zip / Postal Code</label>804 <label class="control-label" for="contact_name">Zip / Postal Code</label>
815 <input type="text" name="shipping_zip" class="form-control" t-att-value="checkout.get('shipping_zip', '')"/>805 <input type="text" name="shipping_zip" class="form-control" t-att-value="checkout.get('shipping_zip', '')"/>
816 </div>806 </div>
817 <div t-attf-class="form-group #{error.get('shipping_state_id') and 'has-error' or ''} col-lg-6">807 <div t-attf-class="form-group #{error.get('shipping_state') and 'has-error' or ''} col-lg-6">
818 <label class="control-label" for="contact_name" style="font-weight: normal">State / Province</label>808 <label class="control-label" for="shipping_state"> State / Province...</label>
819 <select name="shipping_state_id" class="form-control">809 <input type="" name="shipping_state" class="form-control" t-att-value="shipping_state" />
820 <option value="">State / Province...</option>810 </div>
821 <t t-foreach="states or []" t-as="state">
822 <option t-att-value="state.id" t-att-selected="state.id == checkout.get('shipping_state_id')"><t t-esc="state.name"/></option>
823 </t>
824 </select>
825 </div>
826 <div t-attf-class="form-group #{error.get('shipping_country_id') and 'has-error' or ''} col-lg-6">811 <div t-attf-class="form-group #{error.get('shipping_country_id') and 'has-error' or ''} col-lg-6">
827 <label class="control-label" for="contact_name">Country</label>812 <label class="control-label" for="shipping_country_id">Country</label>
828 <select name="shipping_country_id" class="form-control">813 <input type="text" name="shipping_country_id" class="form-control" t-att-value="shipping_country_id" />
829 <option value="">Country...</option>814 </div>
830 <t t-foreach="countries or []" t-as="country">
831 <option t-att-value="country.id" t-att-selected="country.id == checkout.get('shipping_country_id')"><t t-esc="country.name"/></option>
832 </t>
833 </select>
834 </div>
835 </div>815 </div>
836 <button type="submit" class="btn btn-default btn-primary pull-right mb32">Confirm <span class="fa fa-long-arrow-right"/></button>816 <button type="submit" class="btn btn-default btn-primary pull-right mb32">Confirm <span class="fa fa-long-arrow-right"/></button>
837 </div>817 </div>

Subscribers

People subscribed via source and target branches

to all changes: