Merge lp:~openerp-dev/openobject-addons/trunk-res-country-state-cleaning-mme into lp:openobject-addons
- trunk-res-country-state-cleaning-mme
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+208116@code.launchpad.net |
Commit message
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
1 | === modified file 'account/edi/invoice_action_data.xml' | |||
2 | --- account/edi/invoice_action_data.xml 2013-11-27 15:32:57 +0000 | |||
3 | +++ account/edi/invoice_action_data.xml 2014-02-26 06:23:38 +0000 | |||
4 | @@ -79,7 +79,7 @@ | |||
5 | 79 | ${object.company_id.zip} ${object.company_id.city}<br/> | 79 | ${object.company_id.zip} ${object.company_id.city}<br/> |
6 | 80 | % endif | 80 | % endif |
7 | 81 | % if object.company_id.country_id: | 81 | % if object.company_id.country_id: |
9 | 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/> |
10 | 83 | % endif | 83 | % endif |
11 | 84 | </span> | 84 | </span> |
12 | 85 | % if object.company_id.phone: | 85 | % if object.company_id.phone: |
13 | 86 | 86 | ||
14 | === modified file 'account/i18n/account.pot' | |||
15 | --- account/i18n/account.pot 2013-10-27 12:31:04 +0000 | |||
16 | +++ account/i18n/account.pot 2014-02-26 06:23:38 +0000 | |||
17 | @@ -3262,7 +3262,7 @@ | |||
18 | 3262 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" | 3262 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" |
19 | 3263 | " % endif\n" | 3263 | " % endif\n" |
20 | 3264 | " % if object.company_id.country_id:\n" | 3264 | " % if object.company_id.country_id:\n" |
22 | 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" |
23 | 3266 | " % endif\n" | 3266 | " % endif\n" |
24 | 3267 | " </span>\n" | 3267 | " </span>\n" |
25 | 3268 | " % if object.company_id.phone:\n" | 3268 | " % if object.company_id.phone:\n" |
26 | 3269 | 3269 | ||
27 | === modified file 'base_geolocalize/models/res_partner.py' | |||
28 | --- base_geolocalize/models/res_partner.py 2013-10-07 14:41:35 +0000 | |||
29 | +++ base_geolocalize/models/res_partner.py 2014-02-26 06:23:38 +0000 | |||
30 | @@ -77,7 +77,7 @@ | |||
31 | 77 | result = geo_find(geo_query_address(street=partner.street, | 77 | result = geo_find(geo_query_address(street=partner.street, |
32 | 78 | zip=partner.zip, | 78 | zip=partner.zip, |
33 | 79 | city=partner.city, | 79 | city=partner.city, |
35 | 80 | state=partner.state_id.name, | 80 | state=partner.state, |
36 | 81 | country=partner.country_id.name)) | 81 | country=partner.country_id.name)) |
37 | 82 | if result: | 82 | if result: |
38 | 83 | self.write(cr, uid, [partner.id], { | 83 | self.write(cr, uid, [partner.id], { |
39 | 84 | 84 | ||
40 | === modified file 'crm/crm_lead.py' | |||
41 | --- crm/crm_lead.py 2014-02-20 16:38:15 +0000 | |||
42 | +++ crm/crm_lead.py 2014-02-26 06:23:38 +0000 | |||
43 | @@ -37,7 +37,7 @@ | |||
44 | 37 | 'company_id', | 37 | 'company_id', |
45 | 38 | 'country_id', | 38 | 'country_id', |
46 | 39 | 'section_id', | 39 | 'section_id', |
48 | 40 | 'state_id', | 40 | 'state', |
49 | 41 | 'stage_id', | 41 | 'stage_id', |
50 | 42 | 'type_id', | 42 | 'type_id', |
51 | 43 | 'user_id', | 43 | 'user_id', |
52 | @@ -278,7 +278,7 @@ | |||
53 | 278 | 'street2': fields.char('Street2', size=128), | 278 | 'street2': fields.char('Street2', size=128), |
54 | 279 | 'zip': fields.char('Zip', change_default=True, size=24), | 279 | 'zip': fields.char('Zip', change_default=True, size=24), |
55 | 280 | 'city': fields.char('City', size=128), | 280 | 'city': fields.char('City', size=128), |
57 | 281 | 'state_id': fields.many2one("res.country.state", 'State'), | 281 | 'state': fields.char('State'), |
58 | 282 | 'country_id': fields.many2one('res.country', 'Country'), | 282 | 'country_id': fields.many2one('res.country', 'Country'), |
59 | 283 | 'phone': fields.char('Phone', size=64), | 283 | 'phone': fields.char('Phone', size=64), |
60 | 284 | 'fax': fields.char('Fax', size=64), | 284 | 'fax': fields.char('Fax', size=64), |
61 | @@ -324,7 +324,7 @@ | |||
62 | 324 | 'street': partner.street, | 324 | 'street': partner.street, |
63 | 325 | 'street2': partner.street2, | 325 | 'street2': partner.street2, |
64 | 326 | 'city': partner.city, | 326 | 'city': partner.city, |
66 | 327 | 'state_id': partner.state_id and partner.state_id.id or False, | 327 | 'state': partner.state, |
67 | 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, |
68 | 329 | 'email_from': partner.email, | 329 | 'email_from': partner.email, |
69 | 330 | 'phone': partner.phone, | 330 | 'phone': partner.phone, |
70 | @@ -736,7 +736,7 @@ | |||
71 | 736 | 'zip': lead.zip, | 736 | 'zip': lead.zip, |
72 | 737 | 'city': lead.city, | 737 | 'city': lead.city, |
73 | 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, |
75 | 739 | 'state_id': lead.state_id and lead.state_id.id or False, | 739 | 'state': lead.state, |
76 | 740 | 'is_company': is_company, | 740 | 'is_company': is_company, |
77 | 741 | 'type': 'contact' | 741 | 'type': 'contact' |
78 | 742 | } | 742 | } |
79 | @@ -1060,10 +1060,4 @@ | |||
80 | 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) |
81 | 1061 | return self.message_post(cr, uid, ids, body=message, context=context) | 1061 | return self.message_post(cr, uid, ids, body=message, context=context) |
82 | 1062 | 1062 | ||
83 | 1063 | def onchange_state(self, cr, uid, ids, state_id, context=None): | ||
84 | 1064 | if state_id: | ||
85 | 1065 | country_id=self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id | ||
86 | 1066 | return {'value':{'country_id':country_id}} | ||
87 | 1067 | return {} | ||
88 | 1068 | |||
89 | 1069 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 1063 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
90 | 1070 | 1064 | ||
91 | === modified file 'crm/crm_lead_view.xml' | |||
92 | --- crm/crm_lead_view.xml 2014-02-12 18:08:45 +0000 | |||
93 | +++ crm/crm_lead_view.xml 2014-02-26 06:23:38 +0000 | |||
94 | @@ -119,14 +119,14 @@ | |||
95 | 119 | <field name="partner_id" string="Customer" | 119 | <field name="partner_id" string="Customer" |
96 | 120 | on_change="on_change_partner_id(partner_id)" | 120 | on_change="on_change_partner_id(partner_id)" |
97 | 121 | options='{"create_name_field": "name"}' | 121 | options='{"create_name_field": "name"}' |
99 | 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}"/> |
100 | 123 | <label for="street" string="Address"/> | 123 | <label for="street" string="Address"/> |
101 | 124 | <div> | 124 | <div> |
102 | 125 | <field name="street" placeholder="Street..."/> | 125 | <field name="street" placeholder="Street..."/> |
103 | 126 | <field name="street2"/> | 126 | <field name="street2"/> |
104 | 127 | <div class="address_format"> | 127 | <div class="address_format"> |
105 | 128 | <field name="city" placeholder="City" style="width: 40%%"/> | 128 | <field name="city" placeholder="City" style="width: 40%%"/> |
107 | 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%%"/> |
108 | 130 | <field name="zip" placeholder="ZIP" style="width: 34%%"/> | 130 | <field name="zip" placeholder="ZIP" style="width: 34%%"/> |
109 | 131 | </div> | 131 | </div> |
110 | 132 | <field name="country_id" placeholder="Country" options='{"no_open": True}'/> | 132 | <field name="country_id" placeholder="Country" options='{"no_open": True}'/> |
111 | @@ -458,7 +458,7 @@ | |||
112 | 458 | <field name="street2"/> | 458 | <field name="street2"/> |
113 | 459 | <div class="address_format"> | 459 | <div class="address_format"> |
114 | 460 | <field name="city" placeholder="City" style="width: 40%%"/> | 460 | <field name="city" placeholder="City" style="width: 40%%"/> |
116 | 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%%"/> |
117 | 462 | <field name="zip" placeholder="ZIP" style="width: 34%%"/> | 462 | <field name="zip" placeholder="ZIP" style="width: 34%%"/> |
118 | 463 | </div> | 463 | </div> |
119 | 464 | <field name="country_id" placeholder="Country" options='{"no_open": True}'/> | 464 | <field name="country_id" placeholder="Country" options='{"no_open": True}'/> |
120 | 465 | 465 | ||
121 | === modified file 'crm_partner_assign/crm_partner_assign.py' | |||
122 | --- crm_partner_assign/crm_partner_assign.py 2013-12-02 15:09:25 +0000 | |||
123 | +++ crm_partner_assign/crm_partner_assign.py 2014-02-26 06:23:38 +0000 | |||
124 | @@ -148,7 +148,7 @@ | |||
125 | 148 | result = geo_find(geo_query_address(street=lead.street, | 148 | result = geo_find(geo_query_address(street=lead.street, |
126 | 149 | zip=lead.zip, | 149 | zip=lead.zip, |
127 | 150 | city=lead.city, | 150 | city=lead.city, |
129 | 151 | state=lead.state_id.name, | 151 | state=lead.state, |
130 | 152 | country=lead.country_id.name)) | 152 | country=lead.country_id.name)) |
131 | 153 | if result: | 153 | if result: |
132 | 154 | self.write(cr, uid, [lead.id], { | 154 | self.write(cr, uid, [lead.id], { |
133 | 155 | 155 | ||
134 | === modified file 'crm_partner_assign/crm_portal_view.xml' | |||
135 | --- crm_partner_assign/crm_portal_view.xml 2014-02-20 12:38:19 +0000 | |||
136 | +++ crm_partner_assign/crm_portal_view.xml 2014-02-26 06:23:38 +0000 | |||
137 | @@ -53,7 +53,7 @@ | |||
138 | 53 | <field name="zip" readonly="1"/> | 53 | <field name="zip" readonly="1"/> |
139 | 54 | <field name="city" readonly="1"/> | 54 | <field name="city" readonly="1"/> |
140 | 55 | <field name="country_id" readonly="1"/> | 55 | <field name="country_id" readonly="1"/> |
142 | 56 | <field name="state_id" readonly="1"/> | 56 | <field name="state" readonly="1"/> |
143 | 57 | </group> | 57 | </group> |
144 | 58 | <label for="description" colspan="2"/> | 58 | <label for="description" colspan="2"/> |
145 | 59 | <field name="description" nolabel="1" colspan="2"/> | 59 | <field name="description" nolabel="1" colspan="2"/> |
146 | @@ -126,7 +126,7 @@ | |||
147 | 126 | <field name="zip" readonly="1"/> | 126 | <field name="zip" readonly="1"/> |
148 | 127 | <field name="city" readonly="1"/> | 127 | <field name="city" readonly="1"/> |
149 | 128 | <field name="country_id" readonly="1"/> | 128 | <field name="country_id" readonly="1"/> |
151 | 129 | <field name="state_id" readonly="1"/> | 129 | <field name="state" readonly="1"/> |
152 | 130 | <field name="phone" readonly="1"/> | 130 | <field name="phone" readonly="1"/> |
153 | 131 | </group> | 131 | </group> |
154 | 132 | </group> | 132 | </group> |
155 | 133 | 133 | ||
156 | === modified file 'delivery/delivery.py' | |||
157 | --- delivery/delivery.py 2014-01-30 21:49:44 +0000 | |||
158 | +++ delivery/delivery.py 2014-02-26 06:23:38 +0000 | |||
159 | @@ -86,11 +86,8 @@ | |||
160 | 86 | for grid in carrier.grids_id: | 86 | for grid in carrier.grids_id: |
161 | 87 | get_id = lambda x: x.id | 87 | get_id = lambda x: x.id |
162 | 88 | country_ids = map(get_id, grid.country_ids) | 88 | country_ids = map(get_id, grid.country_ids) |
163 | 89 | state_ids = map(get_id, grid.state_ids) | ||
164 | 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: |
165 | 91 | continue | 90 | continue |
166 | 92 | if state_ids and not contact.state_id.id in state_ids: | ||
167 | 93 | continue | ||
168 | 94 | if grid.zip_from and (contact.zip or '')< grid.zip_from: | 91 | if grid.zip_from and (contact.zip or '')< grid.zip_from: |
169 | 95 | continue | 92 | continue |
170 | 96 | if grid.zip_to and (contact.zip or '')> grid.zip_to: | 93 | if grid.zip_to and (contact.zip or '')> grid.zip_to: |
171 | @@ -175,7 +172,7 @@ | |||
172 | 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."), |
173 | 176 | 'carrier_id': fields.many2one('delivery.carrier', 'Carrier', required=True, ondelete='cascade'), | 173 | 'carrier_id': fields.many2one('delivery.carrier', 'Carrier', required=True, ondelete='cascade'), |
174 | 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'), |
176 | 178 | 'state_ids': fields.many2many('res.country.state', 'delivery_grid_state_rel', 'grid_id', 'state_id', 'States'), | 175 | 'state': fields.char('States'), |
177 | 179 | 'zip_from': fields.char('Start Zip', size=12), | 176 | 'zip_from': fields.char('Start Zip', size=12), |
178 | 180 | 'zip_to': fields.char('To Zip', size=12), | 177 | 'zip_to': fields.char('To Zip', size=12), |
179 | 181 | 'line_ids': fields.one2many('delivery.grid.line', 'grid_id', 'Grid Line'), | 178 | 'line_ids': fields.one2many('delivery.grid.line', 'grid_id', 'Grid Line'), |
180 | 182 | 179 | ||
181 | === modified file 'delivery/delivery_view.xml' | |||
182 | --- delivery/delivery_view.xml 2012-12-21 16:48:08 +0000 | |||
183 | +++ delivery/delivery_view.xml 2014-02-26 06:23:38 +0000 | |||
184 | @@ -70,7 +70,7 @@ | |||
185 | 70 | <group> | 70 | <group> |
186 | 71 | <group> | 71 | <group> |
187 | 72 | <field name="country_ids" widget="many2many_tags"/> | 72 | <field name="country_ids" widget="many2many_tags"/> |
189 | 73 | <field name="state_ids" widget="many2many_tags"/> | 73 | <field name="state"/> |
190 | 74 | </group> | 74 | </group> |
191 | 75 | <group> | 75 | <group> |
192 | 76 | <label for="zip_from" string="Zip"/> | 76 | <label for="zip_from" string="Zip"/> |
193 | @@ -145,7 +145,7 @@ | |||
194 | 145 | <field name="country_ids"/> | 145 | <field name="country_ids"/> |
195 | 146 | </group> | 146 | </group> |
196 | 147 | <group string="States"> | 147 | <group string="States"> |
198 | 148 | <field colspan="2" name="state_ids" nolabel="1"/> | 148 | <field colspan="2" name="state" nolabel="1"/> |
199 | 149 | <field name="zip_from"/> | 149 | <field name="zip_from"/> |
200 | 150 | <field name="zip_to"/> | 150 | <field name="zip_to"/> |
201 | 151 | </group> | 151 | </group> |
202 | 152 | 152 | ||
203 | === modified file 'edi/models/res_partner.py' | |||
204 | --- edi/models/res_partner.py 2014-01-23 17:50:54 +0000 | |||
205 | +++ edi/models/res_partner.py 2014-02-26 06:23:38 +0000 | |||
206 | @@ -36,7 +36,7 @@ | |||
207 | 36 | 'zip': True, | 36 | 'zip': True, |
208 | 37 | 'city': True, | 37 | 'city': True, |
209 | 38 | 'country_id': True, | 38 | 'country_id': True, |
211 | 39 | 'state_id': True, | 39 | 'state': True, |
212 | 40 | 'phone': True, | 40 | 'phone': True, |
213 | 41 | 'fax': True, | 41 | 'fax': True, |
214 | 42 | 'mobile': True, | 42 | 'mobile': True, |
215 | 43 | 43 | ||
216 | === modified file 'l10n_cn/__openerp__.py' | |||
217 | --- l10n_cn/__openerp__.py 2012-11-29 22:26:45 +0000 | |||
218 | +++ l10n_cn/__openerp__.py 2014-02-26 06:23:38 +0000 | |||
219 | @@ -35,7 +35,6 @@ | |||
220 | 35 | 'data': [ | 35 | 'data': [ |
221 | 36 | 'account_chart.xml', | 36 | 'account_chart.xml', |
222 | 37 | 'l10n_chart_cn_wizard.xml', | 37 | 'l10n_chart_cn_wizard.xml', |
223 | 38 | 'base_data.xml', | ||
224 | 39 | ], | 38 | ], |
225 | 40 | 'license': 'GPL-3', | 39 | 'license': 'GPL-3', |
226 | 41 | 'auto_install': False, | 40 | 'auto_install': False, |
227 | 42 | 41 | ||
228 | === removed file 'l10n_cn/base_data.xml' | |||
229 | --- l10n_cn/base_data.xml 2012-11-29 22:26:45 +0000 | |||
230 | +++ l10n_cn/base_data.xml 1970-01-01 00:00:00 +0000 | |||
231 | @@ -1,162 +0,0 @@ | |||
232 | 1 | <?xml version="1.0"?> | ||
233 | 2 | <openerp> | ||
234 | 3 | <data noupdate="1"> | ||
235 | 4 | |||
236 | 5 | <!-- 添加省份数据 --> | ||
237 | 6 | <record id="state_BJ" model="res.country.state"> | ||
238 | 7 | <field name="name">北京市</field> | ||
239 | 8 | <field name="code">京</field> | ||
240 | 9 | <field name="country_id" ref="base.cn"/> | ||
241 | 10 | </record> | ||
242 | 11 | <record id="state_SH" model="res.country.state"> | ||
243 | 12 | <field name="name">上海市</field> | ||
244 | 13 | <field name="code">沪</field> | ||
245 | 14 | <field name="country_id" ref="base.cn"/> | ||
246 | 15 | </record> | ||
247 | 16 | <record id="state_ZJ" model="res.country.state"> | ||
248 | 17 | <field name="name">浙江省</field> | ||
249 | 18 | <field name="code">浙</field> | ||
250 | 19 | <field name="country_id" ref="base.cn"/> | ||
251 | 20 | </record> | ||
252 | 21 | <record id="state_TJ" model="res.country.state"> | ||
253 | 22 | <field name="name">天津市</field> | ||
254 | 23 | <field name="code">津</field> | ||
255 | 24 | <field name="country_id" ref="base.cn"/> | ||
256 | 25 | </record> | ||
257 | 26 | <record id="state_AH" model="res.country.state"> | ||
258 | 27 | <field name="name">安徽省</field> | ||
259 | 28 | <field name="code">皖</field> | ||
260 | 29 | <field name="country_id" ref="base.cn"/> | ||
261 | 30 | </record> | ||
262 | 31 | <record id="state_FJ" model="res.country.state"> | ||
263 | 32 | <field name="name">福建省</field> | ||
264 | 33 | <field name="code">闽</field> | ||
265 | 34 | <field name="country_id" ref="base.cn"/> | ||
266 | 35 | </record> | ||
267 | 36 | <record id="state_CQ" model="res.country.state"> | ||
268 | 37 | <field name="name">重庆市</field> | ||
269 | 38 | <field name="code">渝 </field> | ||
270 | 39 | <field name="country_id" ref="base.cn"/> | ||
271 | 40 | </record> | ||
272 | 41 | <record id="state_JX" model="res.country.state"> | ||
273 | 42 | <field name="name">江西省</field> | ||
274 | 43 | <field name="code">赣</field> | ||
275 | 44 | <field name="country_id" ref="base.cn"/> | ||
276 | 45 | </record> | ||
277 | 46 | <record id="state_SD" model="res.country.state"> | ||
278 | 47 | <field name="name">山东省</field> | ||
279 | 48 | <field name="code">鲁</field> | ||
280 | 49 | <field name="country_id" ref="base.cn"/> | ||
281 | 50 | </record> | ||
282 | 51 | <record id="state_HeN" model="res.country.state"> | ||
283 | 52 | <field name="name">河南省</field> | ||
284 | 53 | <field name="code">豫</field> | ||
285 | 54 | <field name="country_id" ref="base.cn"/> | ||
286 | 55 | </record> | ||
287 | 56 | <record id="state_NM" model="res.country.state"> | ||
288 | 57 | <field name="name">内蒙古自治区</field> | ||
289 | 58 | <field name="code">蒙</field> | ||
290 | 59 | <field name="country_id" ref="base.cn"/> | ||
291 | 60 | </record> | ||
292 | 61 | <record id="state_HuB" model="res.country.state"> | ||
293 | 62 | <field name="name">湖北省</field> | ||
294 | 63 | <field name="code">鄂</field> | ||
295 | 64 | <field name="country_id" ref="base.cn"/> | ||
296 | 65 | </record> | ||
297 | 66 | <record id="state_XJ" model="res.country.state"> | ||
298 | 67 | <field name="name">新疆维吾尔自治区</field> | ||
299 | 68 | <field name="code">新</field> | ||
300 | 69 | <field name="country_id" ref="base.cn"/> | ||
301 | 70 | </record> | ||
302 | 71 | <record id="state_HuN" model="res.country.state"> | ||
303 | 72 | <field name="name">湖南省</field> | ||
304 | 73 | <field name="code">湘</field> | ||
305 | 74 | <field name="country_id" ref="base.cn"/> | ||
306 | 75 | </record> | ||
307 | 76 | <record id="state_NX" model="res.country.state"> | ||
308 | 77 | <field name="name">宁夏回族自治区</field> | ||
309 | 78 | <field name="code">宁</field> | ||
310 | 79 | <field name="country_id" ref="base.cn"/> | ||
311 | 80 | </record> | ||
312 | 81 | <record id="state_GD" model="res.country.state"> | ||
313 | 82 | <field name="name">广东省</field> | ||
314 | 83 | <field name="code">粤</field> | ||
315 | 84 | <field name="country_id" ref="base.cn"/> | ||
316 | 85 | </record> | ||
317 | 86 | <record id="state_XZ" model="res.country.state"> | ||
318 | 87 | <field name="name">西藏自治区</field> | ||
319 | 88 | <field name="code">藏</field> | ||
320 | 89 | <field name="country_id" ref="base.cn"/> | ||
321 | 90 | </record> | ||
322 | 91 | <record id="state_HaN" model="res.country.state"> | ||
323 | 92 | <field name="name">海南省</field> | ||
324 | 93 | <field name="code">琼</field> | ||
325 | 94 | <field name="country_id" ref="base.cn"/> | ||
326 | 95 | </record> | ||
327 | 96 | <record id="state_GX" model="res.country.state"> | ||
328 | 97 | <field name="name">广西壮族自治区</field> | ||
329 | 98 | <field name="code">桂</field> | ||
330 | 99 | <field name="country_id" ref="base.cn"/> | ||
331 | 100 | </record> | ||
332 | 101 | <record id="state_SC" model="res.country.state"> | ||
333 | 102 | <field name="name">四川省</field> | ||
334 | 103 | <field name="code">蜀</field> | ||
335 | 104 | <field name="country_id" ref="base.cn"/> | ||
336 | 105 | </record> | ||
337 | 106 | <record id="state_HeB" model="res.country.state"> | ||
338 | 107 | <field name="name">河北省</field> | ||
339 | 108 | <field name="code">冀</field> | ||
340 | 109 | <field name="country_id" ref="base.cn"/> | ||
341 | 110 | </record> | ||
342 | 111 | <record id="state_GZ" model="res.country.state"> | ||
343 | 112 | <field name="name">贵州省</field> | ||
344 | 113 | <field name="code">黔</field> | ||
345 | 114 | <field name="country_id" ref="base.cn"/> | ||
346 | 115 | </record> | ||
347 | 116 | <record id="state_SX" model="res.country.state"> | ||
348 | 117 | <field name="name">山西省</field> | ||
349 | 118 | <field name="code">晋</field> | ||
350 | 119 | <field name="country_id" ref="base.cn"/> | ||
351 | 120 | </record> | ||
352 | 121 | <record id="state_YN" model="res.country.state"> | ||
353 | 122 | <field name="name">云南省</field> | ||
354 | 123 | <field name="code">滇</field> | ||
355 | 124 | <field name="country_id" ref="base.cn"/> | ||
356 | 125 | </record> | ||
357 | 126 | <record id="state_LN" model="res.country.state"> | ||
358 | 127 | <field name="name">辽宁省</field> | ||
359 | 128 | <field name="code">辽</field> | ||
360 | 129 | <field name="country_id" ref="base.cn"/> | ||
361 | 130 | </record> | ||
362 | 131 | <record id="state_SX" model="res.country.state"> | ||
363 | 132 | <field name="name">陕西省</field> | ||
364 | 133 | <field name="code">陕</field> | ||
365 | 134 | <field name="country_id" ref="base.cn"/> | ||
366 | 135 | </record> | ||
367 | 136 | <record id="state_JL" model="res.country.state"> | ||
368 | 137 | <field name="name">吉林省</field> | ||
369 | 138 | <field name="code">吉</field> | ||
370 | 139 | <field name="country_id" ref="base.cn"/> | ||
371 | 140 | </record> | ||
372 | 141 | <record id="state_GS" model="res.country.state"> | ||
373 | 142 | <field name="name">甘肃省</field> | ||
374 | 143 | <field name="code">甘</field> | ||
375 | 144 | <field name="country_id" ref="base.cn"/> | ||
376 | 145 | </record> | ||
377 | 146 | <record id="state_HL" model="res.country.state"> | ||
378 | 147 | <field name="name">黑龙江省</field> | ||
379 | 148 | <field name="code">黑</field> | ||
380 | 149 | <field name="country_id" ref="base.cn"/> | ||
381 | 150 | </record> | ||
382 | 151 | <record id="state_QH" model="res.country.state"> | ||
383 | 152 | <field name="name">青海省</field> | ||
384 | 153 | <field name="code">青</field> | ||
385 | 154 | <field name="country_id" ref="base.cn"/> | ||
386 | 155 | </record> | ||
387 | 156 | <record id="state_JS" model="res.country.state"> | ||
388 | 157 | <field name="name">江苏省</field> | ||
389 | 158 | <field name="code">苏</field> | ||
390 | 159 | <field name="country_id" ref="base.cn"/> | ||
391 | 160 | </record> | ||
392 | 161 | </data> | ||
393 | 162 | </openerp> | ||
394 | 163 | 0 | ||
395 | === modified file 'l10n_cr/l10n_cr_base_data.xml' | |||
396 | --- l10n_cr/l10n_cr_base_data.xml 2013-10-27 12:31:04 +0000 | |||
397 | +++ l10n_cr/l10n_cr_base_data.xml 2014-02-26 06:23:38 +0000 | |||
398 | @@ -1,46 +1,6 @@ | |||
399 | 1 | <openerp> | 1 | <openerp> |
400 | 2 | <data> | 2 | <data> |
401 | 3 | 3 | ||
402 | 4 | <!-- | ||
403 | 5 | Resource: res.country.state | ||
404 | 6 | Update states | ||
405 | 7 | --> | ||
406 | 8 | <record id="state_SJ" model="res.country.state"> | ||
407 | 9 | <field name="code">SJ</field> | ||
408 | 10 | <field name="name">San José</field> | ||
409 | 11 | <field name="country_id" ref="base.cr"/> | ||
410 | 12 | </record> | ||
411 | 13 | <record id="state_A" model="res.country.state"> | ||
412 | 14 | <field name="code">A</field> | ||
413 | 15 | <field name="name">Alajuela</field> | ||
414 | 16 | <field name="country_id" ref="base.cr"/> | ||
415 | 17 | </record> | ||
416 | 18 | <record id="state_H" model="res.country.state"> | ||
417 | 19 | <field name="code">H</field> | ||
418 | 20 | <field name="name">Heredia</field> | ||
419 | 21 | <field name="country_id" ref="base.cr"/> | ||
420 | 22 | </record> | ||
421 | 23 | <record id="state_C" model="res.country.state"> | ||
422 | 24 | <field name="code">C</field> | ||
423 | 25 | <field name="name">Cartago</field> | ||
424 | 26 | <field name="country_id" ref="base.cr"/> | ||
425 | 27 | </record> | ||
426 | 28 | <record id="state_P" model="res.country.state"> | ||
427 | 29 | <field name="code">P</field> | ||
428 | 30 | <field name="name">Puntarenas</field> | ||
429 | 31 | <field name="country_id" ref="base.cr"/> | ||
430 | 32 | </record> | ||
431 | 33 | <record id="state_G" model="res.country.state"> | ||
432 | 34 | <field name="code">G</field> | ||
433 | 35 | <field name="name">Guanacaste</field> | ||
434 | 36 | <field name="country_id" ref="base.cr"/> | ||
435 | 37 | </record> | ||
436 | 38 | <record id="state_L" model="res.country.state"> | ||
437 | 39 | <field name="code">L</field> | ||
438 | 40 | <field name="name">Limón</field> | ||
439 | 41 | <field name="country_id" ref="base.cr"/> | ||
440 | 42 | </record> | ||
441 | 43 | <!-- | ||
442 | 44 | Resource: res.partner.title | 4 | Resource: res.partner.title |
443 | 45 | Update partner titles | 5 | Update partner titles |
444 | 46 | --> | 6 | --> |
445 | 47 | 7 | ||
446 | === modified file 'l10n_et/__openerp__.py' | |||
447 | --- l10n_et/__openerp__.py 2013-10-27 12:31:04 +0000 | |||
448 | +++ l10n_et/__openerp__.py 2014-02-26 06:23:38 +0000 | |||
449 | @@ -45,7 +45,6 @@ | |||
450 | 45 | 'data/account.tax.code.template.csv', | 45 | 'data/account.tax.code.template.csv', |
451 | 46 | 'data/account.chart.template.csv', | 46 | 'data/account.chart.template.csv', |
452 | 47 | 'data/account.tax.template.csv', | 47 | 'data/account.tax.template.csv', |
453 | 48 | 'data/res.country.state.csv', | ||
454 | 49 | ], | 48 | ], |
455 | 50 | 'data': [ | 49 | 'data': [ |
456 | 51 | 'l10n_et_wizard.xml', | 50 | 'l10n_et_wizard.xml', |
457 | 52 | 51 | ||
458 | === removed file 'l10n_et/data/res.country.state.csv' | |||
459 | --- l10n_et/data/res.country.state.csv 2012-12-14 16:52:54 +0000 | |||
460 | +++ l10n_et/data/res.country.state.csv 1970-01-01 00:00:00 +0000 | |||
461 | @@ -1,12 +0,0 @@ | |||
462 | 1 | "id","country_id:id","code","name" | ||
463 | 2 | "state_et_1","base.et","AA","Addis Ababa" | ||
464 | 3 | "state_et_2","base.et","AF","Afar" | ||
465 | 4 | "state_et_3","base.et","AM","Amhara" | ||
466 | 5 | "state_et_4","base.et","BN","Benishangul-Gumuz" | ||
467 | 6 | "state_et_5","base.et","DR","Dire Dawa" | ||
468 | 7 | "state_et_6","base.et","GM","Gambella Peoples" | ||
469 | 8 | "state_et_7","base.et","HR","Harrari Peoples" | ||
470 | 9 | "state_et_8","base.et","OR","Oromia" | ||
471 | 10 | "state_et_9","base.et","SM","Somalia" | ||
472 | 11 | "state_et_10","base.et","SP","Southern Peoples, Nations, and Nationalities" | ||
473 | 12 | "state_et_11","base.et","TG","Tigray" | ||
474 | 13 | 0 | ||
475 | === modified file 'l10n_uk/__openerp__.py' | |||
476 | --- l10n_uk/__openerp__.py 2012-12-06 15:38:56 +0000 | |||
477 | +++ l10n_uk/__openerp__.py 2014-02-26 06:23:38 +0000 | |||
478 | @@ -39,7 +39,6 @@ | |||
479 | 39 | 'data/account.tax.code.template.csv', | 39 | 'data/account.tax.code.template.csv', |
480 | 40 | 'data/account.chart.template.csv', | 40 | 'data/account.chart.template.csv', |
481 | 41 | 'data/account.tax.template.csv', | 41 | 'data/account.tax.template.csv', |
482 | 42 | 'data/res.country.state.csv', | ||
483 | 43 | 'l10n_uk_wizard.xml', | 42 | 'l10n_uk_wizard.xml', |
484 | 44 | ], | 43 | ], |
485 | 45 | 'demo' : ['demo/demo.xml'], | 44 | 'demo' : ['demo/demo.xml'], |
486 | 46 | 45 | ||
487 | === removed file 'l10n_uk/data/res.country.state.csv' | |||
488 | --- l10n_uk/data/res.country.state.csv 2011-09-16 14:01:34 +0000 | |||
489 | +++ l10n_uk/data/res.country.state.csv 1970-01-01 00:00:00 +0000 | |||
490 | @@ -1,120 +0,0 @@ | |||
491 | 1 | "id","country_id:id","code","name" | ||
492 | 2 | "state_uk_1","base.uk","A1","Aberdeenshire" | ||
493 | 3 | "state_uk_2","base.uk","A5","Angus" | ||
494 | 4 | "state_uk_3","base.uk","A7","Argyll" | ||
495 | 5 | "state_uk_4","base.uk","A9","Avon" | ||
496 | 6 | "state_uk_5","base.uk","B1","Ayrshire" | ||
497 | 7 | "state_uk_6","base.uk","B3","Banffshire" | ||
498 | 8 | "state_uk_7","base.uk","B5","Bedfordshire" | ||
499 | 9 | "state_uk_8","base.uk","B7","Berkshire" | ||
500 | 10 | "state_uk_9","base.uk","B9","Berwickshire" | ||
501 | 11 | "state_uk_10","base.uk","C1","Buckinghamshire" | ||
502 | 12 | "state_uk_11","base.uk","C3","Caithness" | ||
503 | 13 | "state_uk_12","base.uk","C5","Cambridgeshire" | ||
504 | 14 | "state_uk_13","base.uk","C6","Channel Islands" | ||
505 | 15 | "state_uk_14","base.uk","C7","Cheshire" | ||
506 | 16 | "state_uk_15","base.uk","C9","Clackmannanshire" | ||
507 | 17 | "state_uk_16","base.uk","D1","Cleveland" | ||
508 | 18 | "state_uk_17","base.uk","D3","Clwyd" | ||
509 | 19 | "state_uk_18","base.uk","D5","County Antrim" | ||
510 | 20 | "state_uk_19","base.uk","D7","County Armagh" | ||
511 | 21 | "state_uk_20","base.uk","D9","County Down" | ||
512 | 22 | "state_uk_21","base.uk","E1","County Durham" | ||
513 | 23 | "state_uk_22","base.uk","E3","County Fermanagh" | ||
514 | 24 | "state_uk_23","base.uk","E5","County Londonderry" | ||
515 | 25 | "state_uk_24","base.uk","E7","County Tyrone" | ||
516 | 26 | "state_uk_25","base.uk","E9","Cornwall" | ||
517 | 27 | "state_uk_26","base.uk","F1","Cumbria" | ||
518 | 28 | "state_uk_27","base.uk","F3","Derbyshire" | ||
519 | 29 | "state_uk_28","base.uk","F5","Devon" | ||
520 | 30 | "state_uk_29","base.uk","F7","Dorset" | ||
521 | 31 | "state_uk_30","base.uk","F9","Dumfriesshire" | ||
522 | 32 | "state_uk_31","base.uk","G1","Dunbartonshire" | ||
523 | 33 | "state_uk_32","base.uk","G3","Dyfed" | ||
524 | 34 | "state_uk_33","base.uk","G5","East Lothian" | ||
525 | 35 | "state_uk_34","base.uk","G7","East Sussex" | ||
526 | 36 | "state_uk_35","base.uk","G9","Essex" | ||
527 | 37 | "state_uk_36","base.uk","H1","Fife" | ||
528 | 38 | "state_uk_37","base.uk","H3","Gloucestershire" | ||
529 | 39 | "state_uk_38","base.uk","H7","Gwent" | ||
530 | 40 | "state_uk_39","base.uk","H9","Gwynedd" | ||
531 | 41 | "state_uk_40","base.uk","I1","Hampshire" | ||
532 | 42 | "state_uk_41","base.uk","I3","Herefordshire" | ||
533 | 43 | "state_uk_42","base.uk","I5","Hertfordshire" | ||
534 | 44 | "state_uk_43","base.uk","I7","Inverness-Shire" | ||
535 | 45 | "state_uk_44","base.uk","I9","Isle of Arran" | ||
536 | 46 | "state_uk_45","base.uk","J1","Isle of Barra" | ||
537 | 47 | "state_uk_46","base.uk","J3","Isle of Benbecula" | ||
538 | 48 | "state_uk_47","base.uk","J5","Isle of Bute" | ||
539 | 49 | "state_uk_48","base.uk","J7","Isle of Canna" | ||
540 | 50 | "state_uk_49","base.uk","J9","Isle of Coll" | ||
541 | 51 | "state_uk_50","base.uk","K1","Isle of Colonsay" | ||
542 | 52 | "state_uk_51","base.uk","K3","Isle of Cumbrae" | ||
543 | 53 | "state_uk_52","base.uk","K5","Isle of Eigg" | ||
544 | 54 | "state_uk_53","base.uk","K7","Isle of Gigha" | ||
545 | 55 | "state_uk_54","base.uk","K9","Isle of Harris" | ||
546 | 56 | "state_uk_55","base.uk","L1","Isle of Iona" | ||
547 | 57 | "state_uk_56","base.uk","L2","Isle of Islay" | ||
548 | 58 | "state_uk_57","base.uk","L5","Isle of Jura" | ||
549 | 59 | "state_uk_58","base.uk","L7","Isle of Lewis" | ||
550 | 60 | "state_uk_59","base.uk","L9","Isle of Man" | ||
551 | 61 | "state_uk_60","base.uk","M1","Isle of Mull" | ||
552 | 62 | "state_uk_61","base.uk","M3","Isle of North Uist" | ||
553 | 63 | "state_uk_62","base.uk","M7","Isle of Rhum" | ||
554 | 64 | "state_uk_63","base.uk","M9","Isle of Scalpay" | ||
555 | 65 | "state_uk_64","base.uk","N1","Shetland Islands" | ||
556 | 66 | "state_uk_65","base.uk","N3","Isle of Skye" | ||
557 | 67 | "state_uk_66","base.uk","N5","Isle of South Uist" | ||
558 | 68 | "state_uk_67","base.uk","N7","Isle of Tiree" | ||
559 | 69 | "state_uk_68","base.uk","N9","Isle of Wight" | ||
560 | 70 | "state_uk_69","base.uk","O5","Kent" | ||
561 | 71 | "state_uk_70","base.uk","O7","Kincardineshire" | ||
562 | 72 | "state_uk_71","base.uk","O9","Kinross-Shire" | ||
563 | 73 | "state_uk_72","base.uk","P1","Kirkcudbrightshire" | ||
564 | 74 | "state_uk_73","base.uk","P5","Lancashire" | ||
565 | 75 | "state_uk_74","base.uk","P7","Leicestershire" | ||
566 | 76 | "state_uk_75","base.uk","P9","Lincolnshire" | ||
567 | 77 | "state_uk_76","base.uk","Q3","Merseyside" | ||
568 | 78 | "state_uk_77","base.uk","Q5","Mid Glamorgan" | ||
569 | 79 | "state_uk_78","base.uk","Q9","Middlesex" | ||
570 | 80 | "state_uk_79","base.uk","R1","Morayshire" | ||
571 | 81 | "state_uk_80","base.uk","R3","Nairnshire" | ||
572 | 82 | "state_uk_81","base.uk","R7","North Humberside" | ||
573 | 83 | "state_uk_82","base.uk","R9","North Yorkshire" | ||
574 | 84 | "state_uk_83","base.uk","S1","Northamptonshire" | ||
575 | 85 | "state_uk_84","base.uk","S3","Northumberland" | ||
576 | 86 | "state_uk_85","base.uk","S5","Nottinghamshire" | ||
577 | 87 | "state_uk_86","base.uk","S7","Oxfordshire" | ||
578 | 88 | "state_uk_87","base.uk","S9","Peeblesshire" | ||
579 | 89 | "state_uk_88","base.uk","T1","Perthshire" | ||
580 | 90 | "state_uk_89","base.uk","T3","Powys" | ||
581 | 91 | "state_uk_90","base.uk","T5","Renfrewshire" | ||
582 | 92 | "state_uk_91","base.uk","T7","Ross-Shire" | ||
583 | 93 | "state_uk_92","base.uk","T9","Roxburghshire" | ||
584 | 94 | "state_uk_93","base.uk","U3","Selkirkshire" | ||
585 | 95 | "state_uk_94","base.uk","U5","Shropshire" | ||
586 | 96 | "state_uk_95","base.uk","U7","Somerset" | ||
587 | 97 | "state_uk_96","base.uk","U9","South Glamorgan" | ||
588 | 98 | "state_uk_97","base.uk","V1","South Humberside" | ||
589 | 99 | "state_uk_98","base.uk","V3","South Yorkshire" | ||
590 | 100 | "state_uk_99","base.uk","V5","Staffordshire" | ||
591 | 101 | "state_uk_100","base.uk","V7","Stirlingshire" | ||
592 | 102 | "state_uk_101","base.uk","V9","Suffolk" | ||
593 | 103 | "state_uk_102","base.uk","W1","Surrey" | ||
594 | 104 | "state_uk_103","base.uk","W3","Sutherland" | ||
595 | 105 | "state_uk_104","base.uk","W5","Tyne and Wear" | ||
596 | 106 | "state_uk_105","base.uk","W7","Warwickshire" | ||
597 | 107 | "state_uk_106","base.uk","W9","West Glamorgan" | ||
598 | 108 | "state_uk_107","base.uk","X1","West Lothian" | ||
599 | 109 | "state_uk_108","base.uk","X3","West Midlands" | ||
600 | 110 | "state_uk_109","base.uk","X5","West Sussex" | ||
601 | 111 | "state_uk_110","base.uk","X7","West Yorkshire" | ||
602 | 112 | "state_uk_111","base.uk","X9","Wigtownshire" | ||
603 | 113 | "state_uk_112","base.uk","Y1","Wiltshire" | ||
604 | 114 | "state_uk_113","base.uk","Y3","Worcestershire" | ||
605 | 115 | "state_uk_114","base.uk","M5","Orkney" | ||
606 | 116 | "state_uk_115","base.uk","O1","Isles of Scilly" | ||
607 | 117 | "state_uk_116","base.uk","P3","Lanarkshire" | ||
608 | 118 | "state_uk_117","base.uk","Q1","London" | ||
609 | 119 | "state_uk_118","base.uk","Q7","Midlothian" | ||
610 | 120 | "state_uk_119","base.uk","R5","Norfolk" | ||
611 | 121 | 0 | ||
612 | === modified file 'portal_sale/i18n/portal_sale.pot' | |||
613 | --- portal_sale/i18n/portal_sale.pot 2013-10-27 12:31:04 +0000 | |||
614 | +++ portal_sale/i18n/portal_sale.pot 2014-02-26 06:23:38 +0000 | |||
615 | @@ -125,7 +125,7 @@ | |||
616 | 125 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" | 125 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" |
617 | 126 | " % endif\n" | 126 | " % endif\n" |
618 | 127 | " % if object.company_id.country_id:\n" | 127 | " % if object.company_id.country_id:\n" |
620 | 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" |
621 | 129 | " % endif\n" | 129 | " % endif\n" |
622 | 130 | " </span>\n" | 130 | " </span>\n" |
623 | 131 | " % if object.company_id.phone:\n" | 131 | " % if object.company_id.phone:\n" |
624 | @@ -252,7 +252,7 @@ | |||
625 | 252 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" | 252 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" |
626 | 253 | " % endif\n" | 253 | " % endif\n" |
627 | 254 | " % if object.company_id.country_id:\n" | 254 | " % if object.company_id.country_id:\n" |
629 | 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" |
630 | 256 | " % endif\n" | 256 | " % endif\n" |
631 | 257 | " </span>\n" | 257 | " </span>\n" |
632 | 258 | " % if object.company_id.phone:\n" | 258 | " % if object.company_id.phone:\n" |
633 | 259 | 259 | ||
634 | === modified file 'portal_sale/portal_sale_data.xml' | |||
635 | --- portal_sale/portal_sale_data.xml 2013-12-04 13:00:23 +0000 | |||
636 | +++ portal_sale/portal_sale_data.xml 2014-02-26 06:23:38 +0000 | |||
637 | @@ -75,7 +75,7 @@ | |||
638 | 75 | ${object.company_id.zip} ${object.company_id.city}<br/> | 75 | ${object.company_id.zip} ${object.company_id.city}<br/> |
639 | 76 | % endif | 76 | % endif |
640 | 77 | % if object.company_id.country_id: | 77 | % if object.company_id.country_id: |
642 | 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/> |
643 | 79 | % endif | 79 | % endif |
644 | 80 | </span> | 80 | </span> |
645 | 81 | % if object.company_id.phone: | 81 | % if object.company_id.phone: |
646 | @@ -162,7 +162,7 @@ | |||
647 | 162 | ${object.company_id.zip} ${object.company_id.city}<br/> | 162 | ${object.company_id.zip} ${object.company_id.city}<br/> |
648 | 163 | % endif | 163 | % endif |
649 | 164 | % if object.company_id.country_id: | 164 | % if object.company_id.country_id: |
651 | 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/> |
652 | 166 | % endif | 166 | % endif |
653 | 167 | </span> | 167 | </span> |
654 | 168 | % if object.company_id.phone: | 168 | % if object.company_id.phone: |
655 | 169 | 169 | ||
656 | === modified file 'purchase/edi/purchase_order_action_data.xml' | |||
657 | --- purchase/edi/purchase_order_action_data.xml 2013-11-27 15:32:57 +0000 | |||
658 | +++ purchase/edi/purchase_order_action_data.xml 2014-02-26 06:23:38 +0000 | |||
659 | @@ -71,7 +71,7 @@ | |||
660 | 71 | ${object.company_id.zip} ${object.company_id.city}<br/> | 71 | ${object.company_id.zip} ${object.company_id.city}<br/> |
661 | 72 | % endif | 72 | % endif |
662 | 73 | % if object.company_id.country_id: | 73 | % if object.company_id.country_id: |
664 | 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/> |
665 | 75 | % endif | 75 | % endif |
666 | 76 | </span> | 76 | </span> |
667 | 77 | % if object.company_id.phone: | 77 | % if object.company_id.phone: |
668 | 78 | 78 | ||
669 | === modified file 'purchase/i18n/purchase.pot' | |||
670 | --- purchase/i18n/purchase.pot 2013-10-27 12:31:04 +0000 | |||
671 | +++ purchase/i18n/purchase.pot 2014-02-26 06:23:38 +0000 | |||
672 | @@ -938,7 +938,7 @@ | |||
673 | 938 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" | 938 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" |
674 | 939 | " % endif\n" | 939 | " % endif\n" |
675 | 940 | " % if object.company_id.country_id:\n" | 940 | " % if object.company_id.country_id:\n" |
677 | 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" |
678 | 942 | " % endif\n" | 942 | " % endif\n" |
679 | 943 | " </span>\n" | 943 | " </span>\n" |
680 | 944 | " % if object.company_id.phone:\n" | 944 | " % if object.company_id.phone:\n" |
681 | 945 | 945 | ||
682 | === modified file 'sale/edi/sale_order_action_data.xml' | |||
683 | --- sale/edi/sale_order_action_data.xml 2013-11-27 15:32:57 +0000 | |||
684 | +++ sale/edi/sale_order_action_data.xml 2014-02-26 06:23:38 +0000 | |||
685 | @@ -80,7 +80,7 @@ | |||
686 | 80 | ${object.company_id.zip} ${object.company_id.city}<br/> | 80 | ${object.company_id.zip} ${object.company_id.city}<br/> |
687 | 81 | % endif | 81 | % endif |
688 | 82 | % if object.company_id.country_id: | 82 | % if object.company_id.country_id: |
690 | 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/> |
691 | 84 | % endif | 84 | % endif |
692 | 85 | </span> | 85 | </span> |
693 | 86 | % if object.company_id.phone: | 86 | % if object.company_id.phone: |
694 | 87 | 87 | ||
695 | === modified file 'sale/i18n/sale.pot' | |||
696 | --- sale/i18n/sale.pot 2013-10-27 12:31:04 +0000 | |||
697 | +++ sale/i18n/sale.pot 2014-02-26 06:23:38 +0000 | |||
698 | @@ -1604,7 +1604,7 @@ | |||
699 | 1604 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" | 1604 | " ${object.company_id.zip} ${object.company_id.city}<br/>\n" |
700 | 1605 | " % endif\n" | 1605 | " % endif\n" |
701 | 1606 | " % if object.company_id.country_id:\n" | 1606 | " % if object.company_id.country_id:\n" |
703 | 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" |
704 | 1608 | " % endif\n" | 1608 | " % endif\n" |
705 | 1609 | " </span>\n" | 1609 | " </span>\n" |
706 | 1610 | " % if object.company_id.phone:\n" | 1610 | " % if object.company_id.phone:\n" |
707 | 1611 | 1611 | ||
708 | === modified file 'stock/stock_demo.xml' | |||
709 | --- stock/stock_demo.xml 2013-12-02 15:09:25 +0000 | |||
710 | +++ stock/stock_demo.xml 2014-02-26 06:23:38 +0000 | |||
711 | @@ -187,7 +187,6 @@ | |||
712 | 187 | <field eval="1" name="active"/> | 187 | <field eval="1" name="active"/> |
713 | 188 | <field name="street">90 Streets Avenue</field> | 188 | <field name="street">90 Streets Avenue</field> |
714 | 189 | <field model="res.country" name="country_id" search="[('code','ilike','us')]"/> | 189 | <field model="res.country" name="country_id" search="[('code','ilike','us')]"/> |
715 | 190 | <field model="res.country.state" name="state_id" search="[('code','ilike','il')]"/> | ||
716 | 191 | <field name="zip">60610</field> | 190 | <field name="zip">60610</field> |
717 | 192 | <field name="city">Chicago</field> | 191 | <field name="city">Chicago</field> |
718 | 193 | <field name="email">chicago@yourcompany.com</field> | 192 | <field name="email">chicago@yourcompany.com</field> |
719 | 194 | 193 | ||
720 | === added directory 'website/static/lib/autocomplete' | |||
721 | === added file 'website/static/lib/autocomplete/jquery.auto-complete.js' | |||
722 | --- website/static/lib/autocomplete/jquery.auto-complete.js 1970-01-01 00:00:00 +0000 | |||
723 | +++ website/static/lib/autocomplete/jquery.auto-complete.js 2014-02-26 06:23:38 +0000 | |||
724 | @@ -0,0 +1,1369 @@ | |||
725 | 1 | /*! | ||
726 | 2 | * Auto Complete 5.1 | ||
727 | 3 | * April 13, 2010 | ||
728 | 4 | * Corey Hart @ http://www.codenothing.com | ||
729 | 5 | */ | ||
730 | 6 | (function( $, window, undefined ) { | ||
731 | 7 | |||
732 | 8 | // Expose autoComplete to the jQuery chain | ||
733 | 9 | $.fn.autoComplete = function() { | ||
734 | 10 | // Force array of arguments | ||
735 | 11 | var args = Slice.call( arguments ), | ||
736 | 12 | self = this, | ||
737 | 13 | first = args.shift(), | ||
738 | 14 | isMethod = typeof first === 'string', | ||
739 | 15 | handler, el; | ||
740 | 16 | |||
741 | 17 | // Deep namespacing is not supported in jQuery, a mistake I made in v4.1 | ||
742 | 18 | if ( isMethod ) { | ||
743 | 19 | first = first.replace( rdot, '-' ); | ||
744 | 20 | } | ||
745 | 21 | |||
746 | 22 | // Allow for passing array of arguments, or multiple arguments | ||
747 | 23 | // Eg: .autoComplete('trigger', [arg1, arg2, arg3...]) or .autoComplete('trigger', arg1, arg2, arg3...) | ||
748 | 24 | // Mainly to allow for .autoComplete('trigger', arguments) to work | ||
749 | 25 | // Note*: Some triggers pass an array as the first param, so check against that first | ||
750 | 26 | args = ( AutoComplete.arrayMethods[ first ] === TRUE && $.isArray( args[0] ) && $.isArray( args[0][0] ) ) || | ||
751 | 27 | ( args.length === 1 && $.isArray( args[0] ) ) ? | ||
752 | 28 | args[0] : args; | ||
753 | 29 | |||
754 | 30 | // Check method against handlers that need to use triggerHandler | ||
755 | 31 | handler = isMethod && ( AutoComplete.handlerMethods[ first ] === -1 || args.length < ( AutoComplete.handlerMethods[ first ] || 0 ) ) ? | ||
756 | 32 | 'triggerHandler' : 'trigger'; | ||
757 | 33 | |||
758 | 34 | return isMethod ? | ||
759 | 35 | self[ handler ]( 'autoComplete.' + first, args ) : | ||
760 | 36 | |||
761 | 37 | // Allow passing a jquery event special object {from $.Event()} | ||
762 | 38 | first && first.preventDefault !== undefined ? self.trigger( first, args ) : | ||
763 | 39 | |||
764 | 40 | // Initiate the autocomplete on each element (Only takes a single argument, the options object) | ||
765 | 41 | self.each(function(){ | ||
766 | 42 | if ( $( el = this ).data( 'autoComplete' ) !== TRUE ) { | ||
767 | 43 | AutoCompleteFunction( el, first ); | ||
768 | 44 | } | ||
769 | 45 | }); | ||
770 | 46 | }; | ||
771 | 47 | |||
772 | 48 | // bgiframe is needed to fix z-index problem for IE6 users. | ||
773 | 49 | $.fn.bgiframe = $.fn.bgiframe ? $.fn.bgiframe : $.fn.bgIframe ? $.fn.bgIframe : function() { | ||
774 | 50 | // For applications that don't have bgiframe plugin installed, create a useless | ||
775 | 51 | // function that doesn't break the chain | ||
776 | 52 | return this; | ||
777 | 53 | }; | ||
778 | 54 | |||
779 | 55 | // Allows for single event binding to document and forms associated with the autoComplete inputs | ||
780 | 56 | // by deferring the event to the input in focus | ||
781 | 57 | function setup( $input, inputIndex ) { | ||
782 | 58 | if ( setup.flag !== TRUE ) { | ||
783 | 59 | setup.flag = TRUE; | ||
784 | 60 | rootjQuery.bind( 'click.autoComplete', function( event ) { | ||
785 | 61 | AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.document-click', [ event ] ); | ||
786 | 62 | }); | ||
787 | 63 | } | ||
788 | 64 | |||
789 | 65 | var $form = $input.closest( 'form' ), formList = $form.data( 'ac-inputs' ) || {}, $el; | ||
790 | 66 | |||
791 | 67 | formList[ inputIndex ] = TRUE; | ||
792 | 68 | $form.data( 'ac-inputs', formList ); | ||
793 | 69 | |||
794 | 70 | if ( $form.data( 'autoComplete' ) !== TRUE ) { | ||
795 | 71 | $form.data( 'autoComplete', TRUE ).bind( 'submit.autoComplete', function( event ) { | ||
796 | 72 | return ( $el = AutoComplete.getFocus( TRUE ) ).length ? | ||
797 | 73 | $el.triggerHandler( 'autoComplete.form-submit', [ event, this ] ) : | ||
798 | 74 | TRUE; | ||
799 | 75 | }); | ||
800 | 76 | } | ||
801 | 77 | } | ||
802 | 78 | |||
803 | 79 | // Removes the single events attached to the document and respective input form | ||
804 | 80 | function teardown( $input, inputIndex ) { | ||
805 | 81 | AutoComplete.remove( inputIndex ); | ||
806 | 82 | |||
807 | 83 | if ( setup.flag === TRUE && AutoComplete.length === 0 ) { | ||
808 | 84 | setup.flag = FALSE; | ||
809 | 85 | rootjQuery.unbind( 'click.autoComplete' ); | ||
810 | 86 | } | ||
811 | 87 | |||
812 | 88 | var $form = $input.closest( 'form' ), formList = $form.data( 'ac-inputs' ) || {}, i; | ||
813 | 89 | |||
814 | 90 | formList[ inputIndex ] = FALSE; | ||
815 | 91 | for ( i in formList ) { | ||
816 | 92 | if ( formList.hasOwnProperty( i ) && formList[ i ] === TRUE ) { | ||
817 | 93 | return; | ||
818 | 94 | } | ||
819 | 95 | } | ||
820 | 96 | |||
821 | 97 | $form.unbind( 'submit.autoComplete' ); | ||
822 | 98 | } | ||
823 | 99 | |||
824 | 100 | // Default function for adding all supply items to the list | ||
825 | 101 | function allSupply( event, ui ) { | ||
826 | 102 | if ( ! $.isArray( ui.supply ) ) { | ||
827 | 103 | return []; | ||
828 | 104 | } | ||
829 | 105 | |||
830 | 106 | for ( var i = -1, l = ui.supply.length, ret = [], entry; ++i < l; ) { | ||
831 | 107 | entry = ui.supply[ i ]; | ||
832 | 108 | entry = entry && entry.value ? entry : { value: entry }; | ||
833 | 109 | ret.push( entry ); | ||
834 | 110 | } | ||
835 | 111 | |||
836 | 112 | return ret; | ||
837 | 113 | } | ||
838 | 114 | |||
839 | 115 | |||
840 | 116 | |||
841 | 117 | // Internals | ||
842 | 118 | var | ||
843 | 119 | // Munging | ||
844 | 120 | TRUE = true, | ||
845 | 121 | FALSE = false, | ||
846 | 122 | |||
847 | 123 | // Copy of the slice prototype | ||
848 | 124 | Slice = Array.prototype.slice, | ||
849 | 125 | |||
850 | 126 | // Make a copy of the document element for caching | ||
851 | 127 | rootjQuery = $( window.document ), | ||
852 | 128 | |||
853 | 129 | // Also make a copy of an empty jQuery set for fast referencing | ||
854 | 130 | emptyjQuery = $( ), | ||
855 | 131 | |||
856 | 132 | // regex's | ||
857 | 133 | rdot = /\./, | ||
858 | 134 | |||
859 | 135 | // Opera and Firefox on Mac need to use the keypress event to track holding of | ||
860 | 136 | // a key down and not releasing | ||
861 | 137 | keypress = window.opera || ( /macintosh/i.test( window.navigator.userAgent ) && $.browser.mozilla ), | ||
862 | 138 | |||
863 | 139 | // Event flag that gets passed around | ||
864 | 140 | ExpandoFlag = 'autoComplete_' + $.expando, | ||
865 | 141 | |||
866 | 142 | // Make a local copy of the key codes used throughout the plugin | ||
867 | 143 | KEY = { | ||
868 | 144 | backspace: 8, | ||
869 | 145 | tab: 9, | ||
870 | 146 | enter: 13, | ||
871 | 147 | shift: 16, | ||
872 | 148 | space: 32, | ||
873 | 149 | pageup: 33, | ||
874 | 150 | pagedown: 34, | ||
875 | 151 | left: 37, | ||
876 | 152 | up: 38, | ||
877 | 153 | right: 39, | ||
878 | 154 | down: 40 | ||
879 | 155 | }, | ||
880 | 156 | |||
881 | 157 | // Attach global aspects to jQuery itself | ||
882 | 158 | AutoComplete = $.autoComplete = { | ||
883 | 159 | // Autocomplete Version | ||
884 | 160 | version: '5.1', | ||
885 | 161 | |||
886 | 162 | // Index Counter | ||
887 | 163 | counter: 0, | ||
888 | 164 | |||
889 | 165 | // Length of stack | ||
890 | 166 | length: 0, | ||
891 | 167 | |||
892 | 168 | // Storage of elements | ||
893 | 169 | stack: {}, | ||
894 | 170 | |||
895 | 171 | // jQuery object versions of the storage elements | ||
896 | 172 | jqStack: {}, | ||
897 | 173 | |||
898 | 174 | // Storage order of uid's | ||
899 | 175 | order: [], | ||
900 | 176 | |||
901 | 177 | // Global access to elements in use | ||
902 | 178 | hasFocus: FALSE, | ||
903 | 179 | |||
904 | 180 | // Expose the used keycodes | ||
905 | 181 | keys: KEY, | ||
906 | 182 | |||
907 | 183 | // Methods whose first argument may contain an array | ||
908 | 184 | arrayMethods: { | ||
909 | 185 | 'button-supply': TRUE, | ||
910 | 186 | 'direct-supply': TRUE | ||
911 | 187 | }, | ||
912 | 188 | |||
913 | 189 | // Defines the maximum number of arguments that can be passed for using | ||
914 | 190 | // triggerHandler method instead of trigger. Passing -1 forces triggerHandler | ||
915 | 191 | // no matter the number of arguments | ||
916 | 192 | handlerMethods: { | ||
917 | 193 | 'option': 2 | ||
918 | 194 | }, | ||
919 | 195 | |||
920 | 196 | // Events triggered whenever one of the autoComplete | ||
921 | 197 | // input's come into focus or blur out. | ||
922 | 198 | focus: undefined, | ||
923 | 199 | blur: undefined, | ||
924 | 200 | |||
925 | 201 | // Allow access to jquery cached object versions of the elements | ||
926 | 202 | getFocus: function( jqStack ) { | ||
927 | 203 | return ! AutoComplete.order[0] ? jqStack ? emptyjQuery : undefined : | ||
928 | 204 | jqStack ? AutoComplete.jqStack[ AutoComplete.order[0] ] : | ||
929 | 205 | AutoComplete.stack[ AutoComplete.order[0] ]; | ||
930 | 206 | }, | ||
931 | 207 | |||
932 | 208 | getPrevious: function( jqStack ) { | ||
933 | 209 | // Removing elements cause some indexs on the order stack | ||
934 | 210 | // to become undefined, so loop until one is found | ||
935 | 211 | for ( var i = 0, l = AutoComplete.order.length; ++i < l; ) { | ||
936 | 212 | if ( AutoComplete.order[i] ) { | ||
937 | 213 | return jqStack ? | ||
938 | 214 | AutoComplete.jqStack[ AutoComplete.order[i] ] : | ||
939 | 215 | AutoComplete.stack[ AutoComplete.order[i] ]; | ||
940 | 216 | } | ||
941 | 217 | } | ||
942 | 218 | |||
943 | 219 | return jqStack ? emptyjQuery : undefined; | ||
944 | 220 | }, | ||
945 | 221 | |||
946 | 222 | remove: function( n ) { | ||
947 | 223 | for ( var i = -1, l = AutoComplete.order.length; ++i < l; ) { | ||
948 | 224 | if ( AutoComplete.order[i] === n ) { | ||
949 | 225 | AutoComplete.order[i] = undefined; | ||
950 | 226 | } | ||
951 | 227 | } | ||
952 | 228 | |||
953 | 229 | AutoComplete.length--; | ||
954 | 230 | delete AutoComplete.stack[n]; | ||
955 | 231 | }, | ||
956 | 232 | |||
957 | 233 | // Returns full stack in jQuery form | ||
958 | 234 | getAll: function(){ | ||
959 | 235 | for ( var i = -1, l = AutoComplete.counter, stack = []; ++i < l; ) { | ||
960 | 236 | if ( AutoComplete.stack[i] ) { | ||
961 | 237 | stack.push( AutoComplete.stack[i] ); | ||
962 | 238 | } | ||
963 | 239 | } | ||
964 | 240 | return $( stack ); | ||
965 | 241 | }, | ||
966 | 242 | |||
967 | 243 | defaults: { | ||
968 | 244 | // To smooth upgrade process to 5.x, set backwardsCompatible to true | ||
969 | 245 | backwardsCompatible: FALSE, | ||
970 | 246 | // Server Script Path | ||
971 | 247 | ajax: 'ajax.php', | ||
972 | 248 | ajaxCache: $.ajaxSettings.cache, | ||
973 | 249 | // Data Configuration | ||
974 | 250 | dataSupply: [], | ||
975 | 251 | dataFn: undefined, | ||
976 | 252 | formatSupply: undefined, | ||
977 | 253 | // Drop List CSS | ||
978 | 254 | list: 'auto-complete-list', | ||
979 | 255 | rollover: 'auto-complete-list-rollover', | ||
980 | 256 | width: undefined, // Defined as inputs width when extended (can be overridden with this global/options/meta) | ||
981 | 257 | striped: undefined, | ||
982 | 258 | maxHeight: undefined, | ||
983 | 259 | bgiframe: undefined, | ||
984 | 260 | newList: FALSE, | ||
985 | 261 | // Post Data | ||
986 | 262 | postVar: 'value', | ||
987 | 263 | postData: {}, | ||
988 | 264 | postFormat: undefined, | ||
989 | 265 | // Limitations | ||
990 | 266 | minChars: 1, | ||
991 | 267 | maxItems: -1, | ||
992 | 268 | maxRequests: 0, | ||
993 | 269 | maxRequestsDeep: FALSE, | ||
994 | 270 | requestType: 'POST', | ||
995 | 271 | // Input | ||
996 | 272 | inputControl: undefined, | ||
997 | 273 | autoFill: FALSE, | ||
998 | 274 | nonInput: [ KEY.shift, KEY.left, KEY.right ], | ||
999 | 275 | multiple: FALSE, | ||
1000 | 276 | multipleSeparator: ' ', | ||
1001 | 277 | // Events | ||
1002 | 278 | onBlur: undefined, | ||
1003 | 279 | onFocus: undefined, | ||
1004 | 280 | onHide: undefined, | ||
1005 | 281 | onLoad: undefined, | ||
1006 | 282 | onMaxRequest: undefined, | ||
1007 | 283 | onRollover: undefined, | ||
1008 | 284 | onSelect: undefined, | ||
1009 | 285 | onShow: undefined, | ||
1010 | 286 | onListFormat: undefined, | ||
1011 | 287 | onSubmit: undefined, | ||
1012 | 288 | spinner: undefined, | ||
1013 | 289 | preventEnterSubmit: TRUE, | ||
1014 | 290 | delay: 0, | ||
1015 | 291 | // Caching Options | ||
1016 | 292 | useCache: TRUE, | ||
1017 | 293 | cacheLimit: 50 | ||
1018 | 294 | } | ||
1019 | 295 | }, | ||
1020 | 296 | |||
1021 | 297 | // Autocomplete function | ||
1022 | 298 | AutoCompleteFunction = function( self, options ) { | ||
1023 | 299 | // Start with counters as they are used within declarations | ||
1024 | 300 | AutoComplete.length++; | ||
1025 | 301 | AutoComplete.counter++; | ||
1026 | 302 | |||
1027 | 303 | // Input specific vars | ||
1028 | 304 | var $input = $( self ).attr( 'autocomplete', 'off' ), | ||
1029 | 305 | // Data object stored on 'autoComplete' data namespace of input | ||
1030 | 306 | ACData = {}, | ||
1031 | 307 | // Track every event triggered | ||
1032 | 308 | LastEvent = {}, | ||
1033 | 309 | // String of current input value | ||
1034 | 310 | inputval = '', | ||
1035 | 311 | // Holds the current list | ||
1036 | 312 | currentList = [], | ||
1037 | 313 | // Place holder for all list elements | ||
1038 | 314 | $elems = { length: 0 }, | ||
1039 | 315 | // Place holder for the list element in focus | ||
1040 | 316 | $li, | ||
1041 | 317 | // View and heights for scrolling | ||
1042 | 318 | view, ulHeight, liHeight, liPerView, | ||
1043 | 319 | // Hardcoded value for ul visiblity | ||
1044 | 320 | ulOpen = FALSE, | ||
1045 | 321 | // Timer for delay | ||
1046 | 322 | timeid, | ||
1047 | 323 | // Ajax requests holder | ||
1048 | 324 | xhr, | ||
1049 | 325 | // li element in focus, and its data | ||
1050 | 326 | liFocus = -1, liData, | ||
1051 | 327 | // Fast referencing for multiple selections | ||
1052 | 328 | separator, | ||
1053 | 329 | // Index of current input | ||
1054 | 330 | inputIndex = AutoComplete.counter, | ||
1055 | 331 | // Number of requests made | ||
1056 | 332 | requests = 0, | ||
1057 | 333 | // Internal Per Input Cache | ||
1058 | 334 | cache = { | ||
1059 | 335 | length: 0, | ||
1060 | 336 | val: undefined, | ||
1061 | 337 | list: {} | ||
1062 | 338 | }, | ||
1063 | 339 | |||
1064 | 340 | // Merge defaults with passed options and metadata options | ||
1065 | 341 | settings = $.extend( | ||
1066 | 342 | { width: $input.outerWidth() }, | ||
1067 | 343 | AutoComplete.defaults, | ||
1068 | 344 | options||{}, | ||
1069 | 345 | $.metadata ? $input.metadata() : {} | ||
1070 | 346 | ), | ||
1071 | 347 | |||
1072 | 348 | // Create the drop list (Use an existing one if possible) | ||
1073 | 349 | $ul = ! settings.newList && rootjQuery.find( 'ul.' + settings.list )[ 0 ] ? | ||
1074 | 350 | rootjQuery.find( 'ul.' + settings.list ).eq( 0 ).bgiframe( settings.bgiframe ) : | ||
1075 | 351 | $('<ul/>').appendTo('body').addClass( settings.list ).bgiframe( settings.bgiframe ).hide().data( 'ac-selfmade', TRUE ); | ||
1076 | 352 | |||
1077 | 353 | |||
1078 | 354 | // Start Binding | ||
1079 | 355 | $input.data( 'autoComplete', ACData = { | ||
1080 | 356 | index: inputIndex, | ||
1081 | 357 | hasFocus: FALSE, | ||
1082 | 358 | active: TRUE, | ||
1083 | 359 | settings: settings, | ||
1084 | 360 | initialSettings: $.extend( TRUE, {}, settings ) | ||
1085 | 361 | }); | ||
1086 | 362 | |||
1087 | 363 | // IE catches the enter key only on keypress/keyup, so add a helper | ||
1088 | 364 | // to track that event if needed | ||
1089 | 365 | if ( $.browser.msie ) { | ||
1090 | 366 | $input.bind( 'keypress.autoComplete', function( event ) { | ||
1091 | 367 | if ( ! ACData.active ) { | ||
1092 | 368 | return TRUE; | ||
1093 | 369 | } | ||
1094 | 370 | |||
1095 | 371 | if ( event.keyCode === KEY.enter ) { | ||
1096 | 372 | var enter = TRUE; | ||
1097 | 373 | |||
1098 | 374 | // See entertracking on main key(press/down) event for explanation | ||
1099 | 375 | if ( $li && $li.hasClass( settings.rollover ) ) { | ||
1100 | 376 | enter = settings.preventEnterSubmit && ulOpen ? FALSE : TRUE; | ||
1101 | 377 | select( event ); | ||
1102 | 378 | } | ||
1103 | 379 | else if ( ulOpen ) { | ||
1104 | 380 | $ul.hide( event ); | ||
1105 | 381 | } | ||
1106 | 382 | |||
1107 | 383 | return enter; | ||
1108 | 384 | } | ||
1109 | 385 | }); | ||
1110 | 386 | } | ||
1111 | 387 | |||
1112 | 388 | |||
1113 | 389 | // Opera && firefox on Mac use keypress to track holding down of key, | ||
1114 | 390 | // while everybody else uses keydown for same functionality | ||
1115 | 391 | $input.bind( keypress ? 'keypress.autoComplete' : 'keydown.autoComplete' , function( event ) { | ||
1116 | 392 | // If autoComplete has been disabled, prevent input events | ||
1117 | 393 | if ( ! ACData.active ) { | ||
1118 | 394 | return TRUE; | ||
1119 | 395 | } | ||
1120 | 396 | |||
1121 | 397 | // Track last event and store code for munging | ||
1122 | 398 | var key = ( LastEvent = event ).keyCode, enter = FALSE; | ||
1123 | 399 | |||
1124 | 400 | |||
1125 | 401 | // Tab Key | ||
1126 | 402 | if ( key === KEY.tab && ulOpen ) { | ||
1127 | 403 | select( event ); | ||
1128 | 404 | } | ||
1129 | 405 | // Enter Key | ||
1130 | 406 | else if ( key === KEY.enter ) { | ||
1131 | 407 | // When tracking whether to submit the form or not, we have | ||
1132 | 408 | // to ensure that the user is actually selecting an element from the drop | ||
1133 | 409 | // down list. It no element is selected, then hide the list and track form | ||
1134 | 410 | // submission. If an element is selected, then track for submission first, | ||
1135 | 411 | // then hide the list. | ||
1136 | 412 | enter = TRUE; | ||
1137 | 413 | if ( $li && $li.hasClass( settings.rollover ) ) { | ||
1138 | 414 | enter = settings.preventEnterSubmit && ulOpen ? FALSE : TRUE; | ||
1139 | 415 | select( event ); | ||
1140 | 416 | } | ||
1141 | 417 | else if ( ulOpen ) { | ||
1142 | 418 | $ul.hide( event ); | ||
1143 | 419 | } | ||
1144 | 420 | } | ||
1145 | 421 | // Up Arrow | ||
1146 | 422 | else if ( key === KEY.up && ulOpen ) { | ||
1147 | 423 | if ( liFocus > 0 ) { | ||
1148 | 424 | liFocus--; | ||
1149 | 425 | up( event ); | ||
1150 | 426 | } else { | ||
1151 | 427 | liFocus = -1; | ||
1152 | 428 | $input.val( inputval ); | ||
1153 | 429 | $ul.hide( event ); | ||
1154 | 430 | } | ||
1155 | 431 | } | ||
1156 | 432 | // Down Arrow | ||
1157 | 433 | else if ( key === KEY.down && ulOpen ) { | ||
1158 | 434 | if ( liFocus < $elems.length - 1 ) { | ||
1159 | 435 | liFocus++; | ||
1160 | 436 | down( event ); | ||
1161 | 437 | } | ||
1162 | 438 | } | ||
1163 | 439 | // Page Up | ||
1164 | 440 | else if ( key === KEY.pageup && ulOpen ) { | ||
1165 | 441 | if ( liFocus > 0 ) { | ||
1166 | 442 | liFocus -= liPerView; | ||
1167 | 443 | |||
1168 | 444 | if ( liFocus < 0 ) { | ||
1169 | 445 | liFocus = 0; | ||
1170 | 446 | } | ||
1171 | 447 | |||
1172 | 448 | up( event ); | ||
1173 | 449 | } | ||
1174 | 450 | } | ||
1175 | 451 | // Page Down | ||
1176 | 452 | else if ( key === KEY.pagedown && ulOpen ) { | ||
1177 | 453 | if ( liFocus < $elems.length - 1 ) { | ||
1178 | 454 | liFocus += liPerView; | ||
1179 | 455 | |||
1180 | 456 | if ( liFocus > $elems.length - 1 ) { | ||
1181 | 457 | liFocus = $elems.length - 1; | ||
1182 | 458 | } | ||
1183 | 459 | |||
1184 | 460 | down( event ); | ||
1185 | 461 | } | ||
1186 | 462 | } | ||
1187 | 463 | // Check for non input values defined by user | ||
1188 | 464 | else if ( settings.nonInput && $.inArray( key, settings.nonInput ) > -1 ) { | ||
1189 | 465 | $ul.html('').hide( event ); | ||
1190 | 466 | enter = TRUE; | ||
1191 | 467 | } | ||
1192 | 468 | // Everything else is considered possible input, so | ||
1193 | 469 | // return before keyup prevention flag is set | ||
1194 | 470 | else { | ||
1195 | 471 | return TRUE; | ||
1196 | 472 | } | ||
1197 | 473 | |||
1198 | 474 | // Prevent autoComplete keyup event's from triggering by | ||
1199 | 475 | // attaching a flag to the last event | ||
1200 | 476 | LastEvent[ 'keydown_' + ExpandoFlag ] = TRUE; | ||
1201 | 477 | return enter; | ||
1202 | 478 | }) | ||
1203 | 479 | .bind({ | ||
1204 | 480 | 'keyup.autoComplete': function( event ) { | ||
1205 | 481 | // If autoComplete has been disabled or keyup prevention | ||
1206 | 482 | // flag has be set, prevent input events | ||
1207 | 483 | if ( ! ACData.active || LastEvent[ 'keydown_' + ExpandoFlag ] ) { | ||
1208 | 484 | return TRUE; | ||
1209 | 485 | } | ||
1210 | 486 | |||
1211 | 487 | // If no special operations were run on keydown, | ||
1212 | 488 | // allow for regular text searching | ||
1213 | 489 | inputval = $input.val(); | ||
1214 | 490 | var key = ( LastEvent = event ).keyCode, val = separator ? inputval.split( separator ).pop() : inputval; | ||
1215 | 491 | |||
1216 | 492 | // Still check to make sure 'enter' wasn't pressed | ||
1217 | 493 | if ( key != KEY.enter ) { | ||
1218 | 494 | |||
1219 | 495 | // Caching key value | ||
1220 | 496 | cache.val = settings.inputControl === undefined ? val : | ||
1221 | 497 | settings.inputControl.apply( self, settings.backwardsCompatible ? | ||
1222 | 498 | [ val, key, $ul, event, settings, cache ] : | ||
1223 | 499 | [ event, { | ||
1224 | 500 | val: val, | ||
1225 | 501 | key: key, | ||
1226 | 502 | settings: settings, | ||
1227 | 503 | cache: cache, | ||
1228 | 504 | ul: $ul | ||
1229 | 505 | }] | ||
1230 | 506 | ); | ||
1231 | 507 | |||
1232 | 508 | // Only send request if character length passes | ||
1233 | 509 | if ( cache.val.length >= settings.minChars ) { | ||
1234 | 510 | sendRequest( event, settings, cache, ( key === KEY.backspace || key === KEY.space ) ); | ||
1235 | 511 | } | ||
1236 | 512 | // Remove list on backspace of small string | ||
1237 | 513 | else if ( key == KEY.backspace ) { | ||
1238 | 514 | $ul.html('').hide( event ); | ||
1239 | 515 | } | ||
1240 | 516 | } | ||
1241 | 517 | }, | ||
1242 | 518 | |||
1243 | 519 | 'blur.autoComplete': function( event ) { | ||
1244 | 520 | // If autoComplete has been disabled or the drop list | ||
1245 | 521 | // is still open, prevent input events | ||
1246 | 522 | if ( ! ACData.active || ulOpen ) { | ||
1247 | 523 | return TRUE; | ||
1248 | 524 | } | ||
1249 | 525 | |||
1250 | 526 | // Only push undefined index onto order stack | ||
1251 | 527 | // if not already there (in-case multiple blur events occur) | ||
1252 | 528 | if ( AutoComplete.order[0] !== undefined ) { | ||
1253 | 529 | AutoComplete.order.unshift( undefined ); | ||
1254 | 530 | } | ||
1255 | 531 | |||
1256 | 532 | // Expose focus | ||
1257 | 533 | AutoComplete.hasFocus = FALSE; | ||
1258 | 534 | ACData.hasFocus = FALSE; | ||
1259 | 535 | liFocus = -1; | ||
1260 | 536 | $ul.hide( LastEvent = event ); | ||
1261 | 537 | |||
1262 | 538 | // Trigger both the global and element specific blur events | ||
1263 | 539 | if ( AutoComplete.blur ) { | ||
1264 | 540 | AutoComplete.blur.call( self, event, { settings: settings, cache: cache, ul: $ul } ); | ||
1265 | 541 | } | ||
1266 | 542 | |||
1267 | 543 | if ( settings.onBlur ) { | ||
1268 | 544 | settings.onBlur.apply( self, settings.backwardsCompatible ? | ||
1269 | 545 | [ inputval, $ul, event, settings, cache ] : [ event, { | ||
1270 | 546 | val: inputval, | ||
1271 | 547 | settings: settings, | ||
1272 | 548 | cache: cache, | ||
1273 | 549 | ul: $ul | ||
1274 | 550 | }] | ||
1275 | 551 | ); | ||
1276 | 552 | } | ||
1277 | 553 | }, | ||
1278 | 554 | |||
1279 | 555 | 'focus.autoComplete': function( event, flag ) { | ||
1280 | 556 | // Prevent inner focus events if caused by autoComplete inner functionality | ||
1281 | 557 | // Also, because IE triggers focus AND closes the drop list before form submission, | ||
1282 | 558 | // keep the select flag by not reseting the last event | ||
1283 | 559 | if ( ! ACData.active || ( ACData.hasFocus && flag === ExpandoFlag ) || LastEvent[ 'enter_' + ExpandoFlag ] ) { | ||
1284 | 560 | return TRUE; | ||
1285 | 561 | } | ||
1286 | 562 | |||
1287 | 563 | if ( inputIndex !== $ul.data( 'ac-input-index' ) ) { | ||
1288 | 564 | $ul.html('').hide( event ); | ||
1289 | 565 | } | ||
1290 | 566 | |||
1291 | 567 | // Overwrite undefined index pushed on by the blur event | ||
1292 | 568 | if ( AutoComplete.order[0] === undefined ) { | ||
1293 | 569 | if ( AutoComplete.order[1] === inputIndex ) { | ||
1294 | 570 | AutoComplete.order.shift(); | ||
1295 | 571 | } else { | ||
1296 | 572 | AutoComplete.order[0] = inputIndex; | ||
1297 | 573 | } | ||
1298 | 574 | } | ||
1299 | 575 | else if ( AutoComplete.order[0] != inputIndex && AutoComplete.order[1] != inputIndex ) { | ||
1300 | 576 | AutoComplete.order.unshift( inputIndex ); | ||
1301 | 577 | } | ||
1302 | 578 | |||
1303 | 579 | if ( AutoComplete.defaults.cacheLimit !== -1 && AutoComplete.order.length > AutoComplete.defaults.cacheLimit ) { | ||
1304 | 580 | AutoComplete.order.pop(); | ||
1305 | 581 | } | ||
1306 | 582 | |||
1307 | 583 | // Expose focus | ||
1308 | 584 | AutoComplete.hasFocus = TRUE; | ||
1309 | 585 | ACData.hasFocus = TRUE; | ||
1310 | 586 | LastEvent = event; | ||
1311 | 587 | |||
1312 | 588 | // Trigger both the global and element specific focus events | ||
1313 | 589 | if ( AutoComplete.focus ) { | ||
1314 | 590 | AutoComplete.focus.call( self, event, { settings: settings, cache: cache, ul: $ul } ); | ||
1315 | 591 | } | ||
1316 | 592 | |||
1317 | 593 | if ( settings.onFocus ) { | ||
1318 | 594 | settings.onFocus.apply( self, | ||
1319 | 595 | settings.backwardsCompatible ? [ $ul, event, settings, cache ] : [ event, { | ||
1320 | 596 | settings: settings, | ||
1321 | 597 | cache: cache, | ||
1322 | 598 | ul: $ul | ||
1323 | 599 | }] | ||
1324 | 600 | ); | ||
1325 | 601 | } | ||
1326 | 602 | }, | ||
1327 | 603 | |||
1328 | 604 | /** | ||
1329 | 605 | * Autocomplete Custom Methods (Extensions off autoComplete event) | ||
1330 | 606 | */ | ||
1331 | 607 | // Catches document click events from the global scope | ||
1332 | 608 | 'autoComplete.document-click': function( e, event ) { | ||
1333 | 609 | if ( ACData.active && ulOpen && | ||
1334 | 610 | // Double check the event timestamps to ensure there isn't a delayed reaction from a button | ||
1335 | 611 | ( ! LastEvent || event.timeStamp - LastEvent.timeStamp > 200 ) && | ||
1336 | 612 | // Check the target after all other checks are passed (less processing) | ||
1337 | 613 | $( event.target ).closest( 'ul' ).data( 'ac-input-index' ) !== inputIndex ) { | ||
1338 | 614 | $ul.hide( LastEvent = event ); | ||
1339 | 615 | $input.blur(); | ||
1340 | 616 | } | ||
1341 | 617 | }, | ||
1342 | 618 | |||
1343 | 619 | // Catches form submission ( so only one event is attached to the form ) | ||
1344 | 620 | 'autoComplete.form-submit': function( e, event, form ) { | ||
1345 | 621 | if ( ! ACData.active ) { | ||
1346 | 622 | return TRUE; | ||
1347 | 623 | } | ||
1348 | 624 | |||
1349 | 625 | LastEvent = event; | ||
1350 | 626 | |||
1351 | 627 | // Because IE triggers focus AND closes the drop list before form submission, | ||
1352 | 628 | // tracking enter is set on the keydown event | ||
1353 | 629 | return settings.preventEnterSubmit && ( ulOpen || LastEvent[ 'enter_' + ExpandoFlag ] ) ? FALSE : | ||
1354 | 630 | settings.onSubmit === undefined ? TRUE : | ||
1355 | 631 | settings.onSubmit.call( self, event, { form: form, settings: settings, cache: cache, ul: $ul } ); | ||
1356 | 632 | }, | ||
1357 | 633 | |||
1358 | 634 | // Catch mouseovers on the drop down element | ||
1359 | 635 | 'autoComplete.ul-mouseenter': function( e, event, li ) { | ||
1360 | 636 | if ( $li ) { | ||
1361 | 637 | $li.removeClass( settings.rollover ); | ||
1362 | 638 | } | ||
1363 | 639 | |||
1364 | 640 | $li = $( li ).addClass( settings.rollover ); | ||
1365 | 641 | liFocus = $elems.index( li ); | ||
1366 | 642 | liData = currentList[ liFocus ]; | ||
1367 | 643 | view = $ul.scrollTop() + ulHeight; | ||
1368 | 644 | LastEvent = event; | ||
1369 | 645 | |||
1370 | 646 | if ( settings.onRollover ) { | ||
1371 | 647 | settings.onRollover.apply( self, settings.backwardsCompatible ? | ||
1372 | 648 | [ liData, $li, $ul, event, settings, cache ] : | ||
1373 | 649 | [ event, { | ||
1374 | 650 | data: liData, | ||
1375 | 651 | li: $li, | ||
1376 | 652 | settings: settings, | ||
1377 | 653 | cache: cache, | ||
1378 | 654 | ul: $ul | ||
1379 | 655 | }] | ||
1380 | 656 | ); | ||
1381 | 657 | } | ||
1382 | 658 | }, | ||
1383 | 659 | |||
1384 | 660 | // Catch click events on the drop down | ||
1385 | 661 | 'autoComplete.ul-click': function( e, event ) { | ||
1386 | 662 | // Refocus the input box and pass flag to prevent inner focus events | ||
1387 | 663 | $input.trigger( 'focus', [ ExpandoFlag ] ); | ||
1388 | 664 | |||
1389 | 665 | // Check against separator for input value | ||
1390 | 666 | $input.val( inputval === separator ? | ||
1391 | 667 | inputval.substr( 0, inputval.length - inputval.split( separator ).pop().length ) + liData.value + separator : | ||
1392 | 668 | liData.value | ||
1393 | 669 | ); | ||
1394 | 670 | |||
1395 | 671 | $ul.hide( LastEvent = event ); | ||
1396 | 672 | autoFill(); | ||
1397 | 673 | |||
1398 | 674 | if ( settings.onSelect ) { | ||
1399 | 675 | settings.onSelect.apply( self, settings.backwardsCompatible ? | ||
1400 | 676 | [ liData, $li, $ul, event, settings, cache ] : | ||
1401 | 677 | [ event, { | ||
1402 | 678 | data: liData, | ||
1403 | 679 | li: $li, | ||
1404 | 680 | settings: settings, | ||
1405 | 681 | cache: cache, | ||
1406 | 682 | ul: $ul | ||
1407 | 683 | }] | ||
1408 | 684 | ); | ||
1409 | 685 | } | ||
1410 | 686 | }, | ||
1411 | 687 | |||
1412 | 688 | // Allow for change of settings at any point | ||
1413 | 689 | 'autoComplete.settings': function( event, newSettings ) { | ||
1414 | 690 | if ( ! ACData.active ) { | ||
1415 | 691 | return TRUE; | ||
1416 | 692 | } | ||
1417 | 693 | |||
1418 | 694 | var ret, $el; | ||
1419 | 695 | LastEvent = event; | ||
1420 | 696 | |||
1421 | 697 | // Give access to current settings and cache | ||
1422 | 698 | if ( $.isFunction( newSettings ) ) { | ||
1423 | 699 | ret = newSettings.apply( self, settings.backwardsCompatible ? | ||
1424 | 700 | [ settings, cache, $ul, event ] : [ event, { settings: settings, cache: cache, ul: $ul } ] | ||
1425 | 701 | ); | ||
1426 | 702 | |||
1427 | 703 | // Allow for extending of settings/cache based off function return values | ||
1428 | 704 | if ( $.isArray( ret ) && ret[0] !== undefined ) { | ||
1429 | 705 | $.extend( TRUE, settings, ret[0] || settings ); | ||
1430 | 706 | $.extend( TRUE, cache, ret[1] || cache ); | ||
1431 | 707 | } | ||
1432 | 708 | } else { | ||
1433 | 709 | $.extend( TRUE, settings, newSettings || {} ); | ||
1434 | 710 | } | ||
1435 | 711 | |||
1436 | 712 | // Change the drop down if dev want's a differen't class attached | ||
1437 | 713 | $ul = ! settings.newList && $ul.hasClass( settings.list ) ? $ul : | ||
1438 | 714 | ! settings.newList && ( $el = rootjQuery.find( 'ul.' + settings.list ).eq( 0 ) ).length ? | ||
1439 | 715 | $el.bgiframe( settings.bgiframe ) : | ||
1440 | 716 | $('<ul/>').appendTo('body').addClass( settings.list ) | ||
1441 | 717 | .bgiframe( settings.bgiframe ).hide().data( 'ac-selfmade', TRUE ); | ||
1442 | 718 | |||
1443 | 719 | // Custom drop list modifications | ||
1444 | 720 | newUl(); | ||
1445 | 721 | |||
1446 | 722 | // Change case here so it doesn't have to be done on every request | ||
1447 | 723 | settings.requestType = settings.requestType.toUpperCase(); | ||
1448 | 724 | |||
1449 | 725 | // Local copy of the seperator for faster referencing | ||
1450 | 726 | separator = settings.multiple ? settings.multipleSeparator : undefined; | ||
1451 | 727 | |||
1452 | 728 | // Just to be sure, reset the settings object into the data storage | ||
1453 | 729 | ACData.settings = settings; | ||
1454 | 730 | }, | ||
1455 | 731 | |||
1456 | 732 | // Clears the Cache & requests (requests can be blocked from clearing) | ||
1457 | 733 | 'autoComplete.flush': function( event, cacheOnly ) { | ||
1458 | 734 | if ( ! ACData.active ) { | ||
1459 | 735 | return TRUE; | ||
1460 | 736 | } | ||
1461 | 737 | |||
1462 | 738 | if ( ! cacheOnly ) { | ||
1463 | 739 | requests = 0; | ||
1464 | 740 | } | ||
1465 | 741 | |||
1466 | 742 | cache = { length: 0, val: undefined, list: {} }; | ||
1467 | 743 | LastEvent = event; | ||
1468 | 744 | }, | ||
1469 | 745 | |||
1470 | 746 | // External button trigger for ajax requests | ||
1471 | 747 | 'autoComplete.button-ajax': function( event, postData, cacheName ) { | ||
1472 | 748 | if ( ! ACData.active ) { | ||
1473 | 749 | return TRUE; | ||
1474 | 750 | } | ||
1475 | 751 | |||
1476 | 752 | if ( typeof postData === 'string' ) { | ||
1477 | 753 | cacheName = postData; | ||
1478 | 754 | postData = {}; | ||
1479 | 755 | } | ||
1480 | 756 | |||
1481 | 757 | // Save off the last event before triggering focus on the off-chance | ||
1482 | 758 | // it is needed by a secondary focus event | ||
1483 | 759 | LastEvent = event; | ||
1484 | 760 | |||
1485 | 761 | // Refocus the input box, but pass flag to prevent inner focus events | ||
1486 | 762 | $input.trigger( 'focus', [ ExpandoFlag ] ); | ||
1487 | 763 | |||
1488 | 764 | // If no cache name is given, supply a non-common word | ||
1489 | 765 | cache.val = cacheName || 'button-ajax_' + ExpandoFlag; | ||
1490 | 766 | |||
1491 | 767 | return sendRequest( | ||
1492 | 768 | event, | ||
1493 | 769 | $.extend( TRUE, {}, settings, { maxItems: -1, postData: postData || {} } ), | ||
1494 | 770 | cache | ||
1495 | 771 | ); | ||
1496 | 772 | }, | ||
1497 | 773 | |||
1498 | 774 | // External button trigger for supplied data | ||
1499 | 775 | 'autoComplete.button-supply': function( event, data, cacheName ) { | ||
1500 | 776 | if ( ! ACData.active ) { | ||
1501 | 777 | return TRUE; | ||
1502 | 778 | } | ||
1503 | 779 | |||
1504 | 780 | if ( typeof data === 'string' ) { | ||
1505 | 781 | cacheName = data; | ||
1506 | 782 | data = undefined; | ||
1507 | 783 | } | ||
1508 | 784 | |||
1509 | 785 | // Again, save off event before triggering focus | ||
1510 | 786 | LastEvent = event; | ||
1511 | 787 | |||
1512 | 788 | // Refocus the input box and pass flag to prevent inner focus events | ||
1513 | 789 | $input.trigger( 'focus', [ ExpandoFlag ] ); | ||
1514 | 790 | |||
1515 | 791 | // If no cache name is given, supply a non-common word | ||
1516 | 792 | cache.val = cacheName || 'button-supply_' + ExpandoFlag; | ||
1517 | 793 | |||
1518 | 794 | // If no data is supplied, use data in settings | ||
1519 | 795 | data = $.isArray( data ) ? data : settings.dataSupply; | ||
1520 | 796 | |||
1521 | 797 | return sendRequest( | ||
1522 | 798 | event, | ||
1523 | 799 | $.extend( TRUE, {}, settings, { maxItems: -1, dataSupply: data, formatSupply: allSupply } ), | ||
1524 | 800 | cache | ||
1525 | 801 | ); | ||
1526 | 802 | }, | ||
1527 | 803 | |||
1528 | 804 | // Supply list directly into the result function | ||
1529 | 805 | 'autoComplete.direct-supply': function( event, data, cacheName ) { | ||
1530 | 806 | if ( ! ACData.active ) { | ||
1531 | 807 | return TRUE; | ||
1532 | 808 | } | ||
1533 | 809 | |||
1534 | 810 | if ( typeof data === 'string' ) { | ||
1535 | 811 | cacheName = data; | ||
1536 | 812 | data = undefined; | ||
1537 | 813 | } | ||
1538 | 814 | |||
1539 | 815 | // Again, save off event before triggering focus | ||
1540 | 816 | LastEvent = event; | ||
1541 | 817 | |||
1542 | 818 | // Refocus the input box and pass flag to prevent inner focus events | ||
1543 | 819 | $input.trigger( 'focus', [ ExpandoFlag ] ); | ||
1544 | 820 | |||
1545 | 821 | // If no cache name is given, supply a non-common word | ||
1546 | 822 | cache.val = cacheName || 'direct-supply_' + ExpandoFlag; | ||
1547 | 823 | |||
1548 | 824 | // If no data is supplied, use data in settings | ||
1549 | 825 | data = $.isArray( data ) && data.length ? data : settings.dataSupply; | ||
1550 | 826 | |||
1551 | 827 | // Load the results directly into the results function bypassing request holdups | ||
1552 | 828 | return loadResults( | ||
1553 | 829 | event, | ||
1554 | 830 | data, | ||
1555 | 831 | $.extend( TRUE, {}, settings, { maxItems: -1, dataSupply: data, formatSupply: allSupply } ), | ||
1556 | 832 | cache | ||
1557 | 833 | ); | ||
1558 | 834 | }, | ||
1559 | 835 | |||
1560 | 836 | // Triggering autocomplete programatically | ||
1561 | 837 | 'autoComplete.search': function( event, value ) { | ||
1562 | 838 | if ( ! ACData.active ) { | ||
1563 | 839 | return TRUE; | ||
1564 | 840 | } | ||
1565 | 841 | |||
1566 | 842 | cache.val = value || ''; | ||
1567 | 843 | return sendRequest( LastEvent = event, settings, cache ); | ||
1568 | 844 | }, | ||
1569 | 845 | |||
1570 | 846 | // Add jquery-ui like option access | ||
1571 | 847 | 'autoComplete.option': function( event, name, value ) { | ||
1572 | 848 | if ( ! ACData.active ) { | ||
1573 | 849 | return TRUE; | ||
1574 | 850 | } | ||
1575 | 851 | |||
1576 | 852 | LastEvent = event; | ||
1577 | 853 | switch ( Slice.call( arguments ).length ) { | ||
1578 | 854 | case 3: | ||
1579 | 855 | settings[ name ] = value; | ||
1580 | 856 | return value; | ||
1581 | 857 | case 2: | ||
1582 | 858 | return name === 'ul' ? $ul : | ||
1583 | 859 | name === 'cache' ? cache : | ||
1584 | 860 | name === 'xhr' ? xhr : | ||
1585 | 861 | name === 'input' ? $input : | ||
1586 | 862 | settings[ name ] || undefined; | ||
1587 | 863 | default: | ||
1588 | 864 | return settings; | ||
1589 | 865 | } | ||
1590 | 866 | }, | ||
1591 | 867 | |||
1592 | 868 | // Add enabling event (only applicable after disable) | ||
1593 | 869 | 'autoComplete.enable': function( event ) { | ||
1594 | 870 | ACData.active = TRUE; | ||
1595 | 871 | LastEvent = event; | ||
1596 | 872 | }, | ||
1597 | 873 | |||
1598 | 874 | // Add disable event | ||
1599 | 875 | 'autoComplete.disable': function( event ) { | ||
1600 | 876 | ACData.active = FALSE; | ||
1601 | 877 | $ul.html('').hide( LastEvent = event ); | ||
1602 | 878 | }, | ||
1603 | 879 | |||
1604 | 880 | // Add a destruction function | ||
1605 | 881 | 'autoComplete.destroy': function( event ) { | ||
1606 | 882 | var list = $ul.html('').hide( LastEvent = event ).data( 'ac-inputs' ) || {}, i; | ||
1607 | 883 | |||
1608 | 884 | // Remove all autoComplete specific data and events | ||
1609 | 885 | $input.removeData( 'autoComplete' ).unbind( '.autoComplete autoComplete' ); | ||
1610 | 886 | |||
1611 | 887 | // Remove form/drop list/document event catchers if possible | ||
1612 | 888 | teardown( $input, inputIndex ); | ||
1613 | 889 | |||
1614 | 890 | // Remove input from the drop down element of inputs | ||
1615 | 891 | list[ inputIndex ] = undefined; | ||
1616 | 892 | |||
1617 | 893 | // Go through the drop down element and see if any other inputs are attached to it | ||
1618 | 894 | for ( i in list ) { | ||
1619 | 895 | if ( list.hasOwnProperty( i ) && list[ i ] === TRUE ) { | ||
1620 | 896 | return LastEvent; | ||
1621 | 897 | } | ||
1622 | 898 | } | ||
1623 | 899 | |||
1624 | 900 | // Remove the element from the DOM if self created | ||
1625 | 901 | if ( $ul.data( 'ac-selfmade' ) === TRUE ) { | ||
1626 | 902 | $ul.remove(); | ||
1627 | 903 | } | ||
1628 | 904 | // Kill all data associated with autoComplete for a cleaned drop down element | ||
1629 | 905 | else { | ||
1630 | 906 | $ul.removeData( 'autoComplete' ).removeData( 'ac-input-index' ).removeData( 'ac-inputs' ); | ||
1631 | 907 | } | ||
1632 | 908 | } | ||
1633 | 909 | }); | ||
1634 | 910 | |||
1635 | 911 | // Ajax/Cache Request | ||
1636 | 912 | function sendRequest( event, settings, cache, backSpace, timeout ) { | ||
1637 | 913 | // Merely setting max requests still allows usage of cache and supplied data, | ||
1638 | 914 | // this 'Deep' option prevents those scenarios if needed | ||
1639 | 915 | if ( settings.maxRequestsDeep === true && requests >= settings.maxRequests ) { | ||
1640 | 916 | return FALSE; | ||
1641 | 917 | } | ||
1642 | 918 | |||
1643 | 919 | if ( settings.spinner ) { | ||
1644 | 920 | settings.spinner.call( self, event, { active: TRUE, settings: settings, cache: cache, ul: $ul } ); | ||
1645 | 921 | } | ||
1646 | 922 | |||
1647 | 923 | if ( timeid ) { | ||
1648 | 924 | timeid = clearTimeout( timeid ); | ||
1649 | 925 | } | ||
1650 | 926 | |||
1651 | 927 | // Call send request again with timeout flag if on delay | ||
1652 | 928 | if ( settings.delay > 0 && timeout === undefined ) { | ||
1653 | 929 | timeid = window.setTimeout(function(){ | ||
1654 | 930 | sendRequest( event, settings, cache, backSpace, TRUE ); | ||
1655 | 931 | }, settings.delay ); | ||
1656 | 932 | return timeid; | ||
1657 | 933 | } | ||
1658 | 934 | |||
1659 | 935 | // Abort previous request incase it's still running | ||
1660 | 936 | if ( xhr ) { | ||
1661 | 937 | xhr.abort(); | ||
1662 | 938 | } | ||
1663 | 939 | |||
1664 | 940 | // Load from cache if possible | ||
1665 | 941 | if ( settings.useCache && $.isArray( cache.list[ cache.val ] ) ) { | ||
1666 | 942 | return loadResults( event, cache.list[ cache.val ], settings, cache, backSpace ); | ||
1667 | 943 | } | ||
1668 | 944 | |||
1669 | 945 | // Use user supplied data when defined | ||
1670 | 946 | if ( settings.dataSupply.length ) { | ||
1671 | 947 | return userSuppliedData( event, settings, cache, backSpace ); | ||
1672 | 948 | } | ||
1673 | 949 | |||
1674 | 950 | // Check Max requests first before sending request | ||
1675 | 951 | if ( settings.maxRequests && ++requests >= settings.maxRequests ) { | ||
1676 | 952 | $ul.html('').hide( event ); | ||
1677 | 953 | |||
1678 | 954 | if ( settings.spinner ) { | ||
1679 | 955 | settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } ); | ||
1680 | 956 | } | ||
1681 | 957 | |||
1682 | 958 | if ( settings.onMaxRequest && requests === settings.maxRequests ) { | ||
1683 | 959 | return settings.onMaxRequest.apply( self, settings.backwardsCompatible ? | ||
1684 | 960 | [ cache.val, $ul, event, inputval, settings, cache ] : | ||
1685 | 961 | [ event, { | ||
1686 | 962 | search: cache.val, | ||
1687 | 963 | val: inputval, | ||
1688 | 964 | settings: settings, | ||
1689 | 965 | cache: cache, | ||
1690 | 966 | ul: $ul | ||
1691 | 967 | }] | ||
1692 | 968 | ); | ||
1693 | 969 | } | ||
1694 | 970 | |||
1695 | 971 | return FALSE; | ||
1696 | 972 | } | ||
1697 | 973 | |||
1698 | 974 | settings.postData[ settings.postVar ] = cache.val; | ||
1699 | 975 | xhr = $.ajax({ | ||
1700 | 976 | type: settings.requestType, | ||
1701 | 977 | url: settings.ajax, | ||
1702 | 978 | cache: settings.ajaxCache, | ||
1703 | 979 | dataType: 'json', | ||
1704 | 980 | |||
1705 | 981 | // Send personalised data | ||
1706 | 982 | data: settings.postFormat ? | ||
1707 | 983 | settings.postFormat.call( self, event, { | ||
1708 | 984 | data: settings.postData, | ||
1709 | 985 | search: cache.val, | ||
1710 | 986 | val: inputval, | ||
1711 | 987 | settings: settings, | ||
1712 | 988 | cache: cache, | ||
1713 | 989 | ul: $ul | ||
1714 | 990 | }) : | ||
1715 | 991 | settings.postData, | ||
1716 | 992 | |||
1717 | 993 | success: function( list ) { | ||
1718 | 994 | loadResults( event, list, settings, cache, backSpace ); | ||
1719 | 995 | }, | ||
1720 | 996 | |||
1721 | 997 | error: function() { | ||
1722 | 998 | $ul.html('').hide( event ); | ||
1723 | 999 | if ( settings.spinner ) { | ||
1724 | 1000 | settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } ); | ||
1725 | 1001 | } | ||
1726 | 1002 | } | ||
1727 | 1003 | }); | ||
1728 | 1004 | |||
1729 | 1005 | return xhr; | ||
1730 | 1006 | } | ||
1731 | 1007 | |||
1732 | 1008 | // Parse User Supplied Data | ||
1733 | 1009 | function userSuppliedData( event, settings, cache, backSpace ) { | ||
1734 | 1010 | var list = [], args = [], | ||
1735 | 1011 | fn = $.isFunction( settings.dataFn ), | ||
1736 | 1012 | regex = fn ? undefined : new RegExp( '^'+cache.val, 'i' ), | ||
1737 | 1013 | items = 0, entry, i = -1, l = settings.dataSupply.length; | ||
1738 | 1014 | |||
1739 | 1015 | if ( settings.formatSupply ) { | ||
1740 | 1016 | list = settings.formatSupply.call( self, event, { | ||
1741 | 1017 | search: cache.val, | ||
1742 | 1018 | supply: settings.dataSupply, | ||
1743 | 1019 | settings: settings, | ||
1744 | 1020 | cache: cache, | ||
1745 | 1021 | ul: $ul | ||
1746 | 1022 | }); | ||
1747 | 1023 | } else { | ||
1748 | 1024 | for ( ; ++i < l ; ) { | ||
1749 | 1025 | // Force object wrapper for entry | ||
1750 | 1026 | entry = settings.dataSupply[i]; | ||
1751 | 1027 | entry = entry && typeof entry.value === 'string' ? entry : { value: entry }; | ||
1752 | 1028 | |||
1753 | 1029 | // Setup arguments for dataFn in a backwards compatible way if needed | ||
1754 | 1030 | args = settings.backwardsCompatible ? | ||
1755 | 1031 | [ cache.val, entry.value, list, i, settings.dataSupply, $ul, event, settings, cache ] : | ||
1756 | 1032 | [ event, { | ||
1757 | 1033 | search: cache.val, | ||
1758 | 1034 | entry: entry.value, | ||
1759 | 1035 | list: list, | ||
1760 | 1036 | i: i, | ||
1761 | 1037 | supply: settings.dataSupply, | ||
1762 | 1038 | settings: settings, | ||
1763 | 1039 | cache: cache, | ||
1764 | 1040 | ul: $ul | ||
1765 | 1041 | }]; | ||
1766 | 1042 | |||
1767 | 1043 | // If user supplied function, use that, otherwise test with default regex | ||
1768 | 1044 | if ( ( fn && settings.dataFn.apply( self, args ) ) || ( ! fn && entry.value.match( regex ) ) ) { | ||
1769 | 1045 | // Reduce browser load by breaking on limit if it exists | ||
1770 | 1046 | if ( settings.maxItems > -1 && ++items > settings.maxItems ) { | ||
1771 | 1047 | break; | ||
1772 | 1048 | } | ||
1773 | 1049 | list.push( entry ); | ||
1774 | 1050 | } | ||
1775 | 1051 | } | ||
1776 | 1052 | } | ||
1777 | 1053 | |||
1778 | 1054 | // Use normal load functionality | ||
1779 | 1055 | return loadResults( event, list, settings, cache, backSpace ); | ||
1780 | 1056 | } | ||
1781 | 1057 | |||
1782 | 1058 | // Key element Selection | ||
1783 | 1059 | function select( event ) { | ||
1784 | 1060 | // Ensure the select function only gets fired when list of open | ||
1785 | 1061 | if ( ulOpen ) { | ||
1786 | 1062 | if ( settings.onSelect ) { | ||
1787 | 1063 | settings.onSelect.apply( self, settings.backwardsCompatible ? | ||
1788 | 1064 | [ liData, $li, $ul, event, settings, cache ] : | ||
1789 | 1065 | [ event, { | ||
1790 | 1066 | data: liData, | ||
1791 | 1067 | li: $li, | ||
1792 | 1068 | settings: settings, | ||
1793 | 1069 | cache: cache, | ||
1794 | 1070 | ul: $ul | ||
1795 | 1071 | }] | ||
1796 | 1072 | ); | ||
1797 | 1073 | } | ||
1798 | 1074 | |||
1799 | 1075 | autoFill(); | ||
1800 | 1076 | inputval = $input.val(); | ||
1801 | 1077 | |||
1802 | 1078 | // Because IE triggers focus AND closes the drop list before form submission | ||
1803 | 1079 | // attach a flag on 'enter' selection | ||
1804 | 1080 | if ( LastEvent.type === 'keydown' ) { | ||
1805 | 1081 | LastEvent[ 'enter_' + ExpandoFlag ] = TRUE; | ||
1806 | 1082 | } | ||
1807 | 1083 | |||
1808 | 1084 | $ul.hide( event ); | ||
1809 | 1085 | } | ||
1810 | 1086 | |||
1811 | 1087 | $li = undefined; | ||
1812 | 1088 | } | ||
1813 | 1089 | |||
1814 | 1090 | // Key direction up | ||
1815 | 1091 | function up( event ) { | ||
1816 | 1092 | if ( $li ) { | ||
1817 | 1093 | $li.removeClass( settings.rollover ); | ||
1818 | 1094 | } | ||
1819 | 1095 | |||
1820 | 1096 | $ul.show( event ); | ||
1821 | 1097 | $li = $elems.eq( liFocus ).addClass( settings.rollover ); | ||
1822 | 1098 | liData = currentList[ liFocus ]; | ||
1823 | 1099 | |||
1824 | 1100 | if ( ! $li.length || ! liData ) { | ||
1825 | 1101 | return FALSE; | ||
1826 | 1102 | } | ||
1827 | 1103 | |||
1828 | 1104 | autoFill( liData.value ); | ||
1829 | 1105 | if ( settings.onRollover ) { | ||
1830 | 1106 | settings.onRollover.apply( self, settings.backwardsCompatible ? | ||
1831 | 1107 | [ liData, $li, $ul, event, settings, cache ] : | ||
1832 | 1108 | [ event, { | ||
1833 | 1109 | data: liData, | ||
1834 | 1110 | li: $li, | ||
1835 | 1111 | settings: settings, | ||
1836 | 1112 | cache: cache, | ||
1837 | 1113 | ul: $ul | ||
1838 | 1114 | }] | ||
1839 | 1115 | ); | ||
1840 | 1116 | } | ||
1841 | 1117 | |||
1842 | 1118 | // Scrolling | ||
1843 | 1119 | var scroll = liFocus * liHeight; | ||
1844 | 1120 | if ( scroll < view - ulHeight ) { | ||
1845 | 1121 | view = scroll + ulHeight; | ||
1846 | 1122 | $ul.scrollTop( scroll ); | ||
1847 | 1123 | } | ||
1848 | 1124 | } | ||
1849 | 1125 | |||
1850 | 1126 | // Key direction down | ||
1851 | 1127 | function down( event ) { | ||
1852 | 1128 | if ( $li ) { | ||
1853 | 1129 | $li.removeClass( settings.rollover ); | ||
1854 | 1130 | } | ||
1855 | 1131 | |||
1856 | 1132 | $ul.show( event ); | ||
1857 | 1133 | $li = $elems.eq( liFocus ).addClass( settings.rollover ); | ||
1858 | 1134 | liData = currentList[ liFocus ]; | ||
1859 | 1135 | |||
1860 | 1136 | if ( ! $li.length || ! liData ) { | ||
1861 | 1137 | return FALSE; | ||
1862 | 1138 | } | ||
1863 | 1139 | |||
1864 | 1140 | autoFill( liData.value ); | ||
1865 | 1141 | |||
1866 | 1142 | // Scrolling | ||
1867 | 1143 | var scroll = ( liFocus + 1 ) * liHeight; | ||
1868 | 1144 | if ( scroll > view ) { | ||
1869 | 1145 | $ul.scrollTop( ( view = scroll ) - ulHeight ); | ||
1870 | 1146 | } | ||
1871 | 1147 | |||
1872 | 1148 | if ( settings.onRollover ) { | ||
1873 | 1149 | settings.onRollover.apply( self, settings.backwardsCompatible ? | ||
1874 | 1150 | [ liData, $li, $ul, event, settings, cache ] : [ event, { | ||
1875 | 1151 | data: liData, | ||
1876 | 1152 | li: $li, | ||
1877 | 1153 | settings: settings, | ||
1878 | 1154 | cache: cache, | ||
1879 | 1155 | ul: $ul | ||
1880 | 1156 | }] | ||
1881 | 1157 | ); | ||
1882 | 1158 | } | ||
1883 | 1159 | } | ||
1884 | 1160 | |||
1885 | 1161 | // Attach new show/hide functionality to only the ul object (so not to infect all of jQuery), | ||
1886 | 1162 | // And also attach event handlers if not already done so | ||
1887 | 1163 | function newUl() { | ||
1888 | 1164 | var hide = $ul.hide, show = $ul.show, list = $ul.data( 'ac-inputs' ) || {}; | ||
1889 | 1165 | |||
1890 | 1166 | if ( ! $ul[ ExpandoFlag ] ) { | ||
1891 | 1167 | $ul.hide = function( event, speed, callback ) { | ||
1892 | 1168 | if ( settings.onHide && ulOpen ) { | ||
1893 | 1169 | settings.onHide.call( self, event, { ul: $ul, settings: settings, cache: cache } ); | ||
1894 | 1170 | } | ||
1895 | 1171 | |||
1896 | 1172 | ulOpen = FALSE; | ||
1897 | 1173 | return hide.call( $ul, speed, callback ); | ||
1898 | 1174 | }; | ||
1899 | 1175 | |||
1900 | 1176 | $ul.show = function( event, speed, callback ) { | ||
1901 | 1177 | if ( settings.onShow && ! ulOpen ) { | ||
1902 | 1178 | settings.onShow.call( self, event, { ul: $ul, settings: settings, cache: cache } ); | ||
1903 | 1179 | } | ||
1904 | 1180 | |||
1905 | 1181 | ulOpen = TRUE; | ||
1906 | 1182 | return show.call( $ul, speed, callback ); | ||
1907 | 1183 | }; | ||
1908 | 1184 | |||
1909 | 1185 | // A flag must be attached to the $ul cached object | ||
1910 | 1186 | $ul[ ExpandoFlag ] = TRUE; | ||
1911 | 1187 | } | ||
1912 | 1188 | |||
1913 | 1189 | // Attach global handlers for event delegation (So there is no more loss time in unbinding and rebinding) | ||
1914 | 1190 | if ( $ul.data( 'autoComplete' ) !== TRUE ) { | ||
1915 | 1191 | $ul.data( 'autoComplete', TRUE ) | ||
1916 | 1192 | .delegate( 'li', 'mouseenter.autoComplete', function( event ) { | ||
1917 | 1193 | AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.ul-mouseenter', [ event, this ] ); | ||
1918 | 1194 | }) | ||
1919 | 1195 | .bind( 'click.autoComplete', function( event ) { | ||
1920 | 1196 | AutoComplete.getFocus( TRUE ).trigger( 'autoComplete.ul-click', [ event ] ); | ||
1921 | 1197 | return FALSE; | ||
1922 | 1198 | }); | ||
1923 | 1199 | } | ||
1924 | 1200 | |||
1925 | 1201 | list[ inputIndex ] = TRUE; | ||
1926 | 1202 | $ul.data( 'ac-inputs', list ); | ||
1927 | 1203 | } | ||
1928 | 1204 | |||
1929 | 1205 | // Auto-fill the input | ||
1930 | 1206 | // Credit to Jörn Zaefferer @ http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ | ||
1931 | 1207 | // and http://www.pengoworks.com/workshop/jquery/autocomplete.htm for this functionality | ||
1932 | 1208 | function autoFill( val ) { | ||
1933 | 1209 | var start, end, range; | ||
1934 | 1210 | |||
1935 | 1211 | // Set starting and ending points based on values | ||
1936 | 1212 | if ( val === undefined || val === '' ) { | ||
1937 | 1213 | start = end = $input.val().length; | ||
1938 | 1214 | } else { | ||
1939 | 1215 | if ( separator ) { | ||
1940 | 1216 | val = inputval.substr( 0, inputval.length - inputval.split( separator ).pop().length ) + val + separator; | ||
1941 | 1217 | } | ||
1942 | 1218 | |||
1943 | 1219 | start = inputval.length; | ||
1944 | 1220 | end = val.length; | ||
1945 | 1221 | $input.val( val ); | ||
1946 | 1222 | } | ||
1947 | 1223 | |||
1948 | 1224 | // Create selection if allowed | ||
1949 | 1225 | if ( ! settings.autoFill || start > end ) { | ||
1950 | 1226 | return FALSE; | ||
1951 | 1227 | } | ||
1952 | 1228 | else if ( self.createTextRange ) { | ||
1953 | 1229 | range = self.createTextRange(); | ||
1954 | 1230 | if ( val === undefined ) { | ||
1955 | 1231 | range.move( 'character', start ); | ||
1956 | 1232 | range.select(); | ||
1957 | 1233 | } else { | ||
1958 | 1234 | range.collapse( TRUE ); | ||
1959 | 1235 | range.moveStart( 'character', start ); | ||
1960 | 1236 | range.moveEnd( 'character', end ); | ||
1961 | 1237 | range.select(); | ||
1962 | 1238 | } | ||
1963 | 1239 | } | ||
1964 | 1240 | else if ( self.setSelectionRange ) { | ||
1965 | 1241 | self.setSelectionRange( start, end ); | ||
1966 | 1242 | } | ||
1967 | 1243 | else if ( self.selectionStart ) { | ||
1968 | 1244 | self.selectionStart = start; | ||
1969 | 1245 | self.selectionEnd = end; | ||
1970 | 1246 | } | ||
1971 | 1247 | } | ||
1972 | 1248 | |||
1973 | 1249 | // List Functionality | ||
1974 | 1250 | function loadResults( event, list, settings, cache, backSpace ) { | ||
1975 | 1251 | // Allow another level of result handling | ||
1976 | 1252 | currentList = settings.onLoad ? | ||
1977 | 1253 | settings.onLoad.call( self, event, { list: list, settings: settings, cache: cache, ul: $ul } ) : list; | ||
1978 | 1254 | |||
1979 | 1255 | // Tell spinner function to stop if set | ||
1980 | 1256 | if ( settings.spinner ) { | ||
1981 | 1257 | settings.spinner.call( self, event, { active: FALSE, settings: settings, cache: cache, ul: $ul } ); | ||
1982 | 1258 | } | ||
1983 | 1259 | |||
1984 | 1260 | // Store results into the cache if allowed | ||
1985 | 1261 | if ( settings.useCache && ! $.isArray( cache.list[ cache.val ] ) ) { | ||
1986 | 1262 | cache.length++; | ||
1987 | 1263 | cache.list[ cache.val ] = list; | ||
1988 | 1264 | |||
1989 | 1265 | // Clear cache if necessary | ||
1990 | 1266 | if ( settings.cacheLimit !== -1 && cache.length > settings.cacheLimit ) { | ||
1991 | 1267 | cache.list = {}; | ||
1992 | 1268 | cache.length = 0; | ||
1993 | 1269 | } | ||
1994 | 1270 | } | ||
1995 | 1271 | |||
1996 | 1272 | // Ensure there is a list | ||
1997 | 1273 | if ( ! currentList || currentList.length < 1 ) { | ||
1998 | 1274 | return $ul.html('').hide( event ); | ||
1999 | 1275 | } | ||
2000 | 1276 | |||
2001 | 1277 | // Refocus list element | ||
2002 | 1278 | liFocus = -1; | ||
2003 | 1279 | |||
2004 | 1280 | // Initialize Vars together (save bytes) | ||
2005 | 1281 | var offset = $input.offset(), // Input position | ||
2006 | 1282 | container = [], // Container for list elements | ||
2007 | 1283 | items = 0, i = -1, striped = FALSE, length = currentList.length; // Loop Items | ||
2008 | 1284 | |||
2009 | 1285 | if ( settings.onListFormat ) { | ||
2010 | 1286 | settings.onListFormat.call( self, event, { list: currentList, settings: settings, cache: cache, ul: $ul } ); | ||
2011 | 1287 | } | ||
2012 | 1288 | else { | ||
2013 | 1289 | // Push items onto container | ||
2014 | 1290 | for ( ; ++i < length; ) { | ||
2015 | 1291 | if ( currentList[i].value ) { | ||
2016 | 1292 | if ( settings.maxItems > -1 && ++items > settings.maxItems ) { | ||
2017 | 1293 | break; | ||
2018 | 1294 | } | ||
2019 | 1295 | |||
2020 | 1296 | container.push( | ||
2021 | 1297 | settings.striped && striped ? '<li class="' + settings.striped + '">' : '<li>', | ||
2022 | 1298 | currentList[i].display || currentList[i].value, | ||
2023 | 1299 | '</li>' | ||
2024 | 1300 | ); | ||
2025 | 1301 | |||
2026 | 1302 | striped = ! striped; | ||
2027 | 1303 | } | ||
2028 | 1304 | } | ||
2029 | 1305 | $ul.html( container.join('') ); | ||
2030 | 1306 | } | ||
2031 | 1307 | |||
2032 | 1308 | // Cache the list items | ||
2033 | 1309 | $elems = $ul.children( 'li' ); | ||
2034 | 1310 | |||
2035 | 1311 | // Autofill input with first entry | ||
2036 | 1312 | if ( settings.autoFill && ! backSpace ) { | ||
2037 | 1313 | liFocus = 0; | ||
2038 | 1314 | liData = currentList[ 0 ]; | ||
2039 | 1315 | autoFill( liData.value ); | ||
2040 | 1316 | $li = $elems.eq( 0 ).addClass( settings.rollover ); | ||
2041 | 1317 | } | ||
2042 | 1318 | |||
2043 | 1319 | // Align the drop down element | ||
2044 | 1320 | $ul.data( 'ac-input-index', inputIndex ).scrollTop( 0 ).css({ | ||
2045 | 1321 | top: offset.top + $input.outerHeight(), | ||
2046 | 1322 | left: offset.left, | ||
2047 | 1323 | width: settings.width | ||
2048 | 1324 | }) | ||
2049 | 1325 | // The drop list has to be shown before maxHeight can be configured | ||
2050 | 1326 | .show( event ); | ||
2051 | 1327 | |||
2052 | 1328 | // Log li height for less computation | ||
2053 | 1329 | liHeight = $elems.eq( 0 ).outerHeight(); | ||
2054 | 1330 | |||
2055 | 1331 | // If Max Height specified, control it | ||
2056 | 1332 | if ( settings.maxHeight ) { | ||
2057 | 1333 | $ul.css({ | ||
2058 | 1334 | height: liHeight * $elems.length > settings.maxHeight ? settings.maxHeight : 'auto', | ||
2059 | 1335 | overflow: 'auto' | ||
2060 | 1336 | }); | ||
2061 | 1337 | } | ||
2062 | 1338 | |||
2063 | 1339 | // ulHeight gets manipulated, so assign to viewport seperately | ||
2064 | 1340 | // so referencing conflicts don't override viewport | ||
2065 | 1341 | ulHeight = $ul.outerHeight(); | ||
2066 | 1342 | view = ulHeight; | ||
2067 | 1343 | |||
2068 | 1344 | // Number of elements per viewport | ||
2069 | 1345 | liPerView = liHeight === 0 ? 0 : Math.floor( view / liHeight ); | ||
2070 | 1346 | |||
2071 | 1347 | // Include amount of time it took to load the list | ||
2072 | 1348 | // and run modifications | ||
2073 | 1349 | LastEvent.timeStamp = ( new Date() ).getTime(); | ||
2074 | 1350 | } | ||
2075 | 1351 | |||
2076 | 1352 | // Custom modifications to the drop down element | ||
2077 | 1353 | newUl(); | ||
2078 | 1354 | |||
2079 | 1355 | // Do case change on initialization so it's not run on every request | ||
2080 | 1356 | settings.requestType = settings.requestType.toUpperCase(); | ||
2081 | 1357 | |||
2082 | 1358 | // Local quick copy of the seperator (so we don't have to run this check every time) | ||
2083 | 1359 | separator = settings.multiple ? settings.multipleSeparator : undefined; | ||
2084 | 1360 | |||
2085 | 1361 | // Expose copies of both the input element and the cached jQuery version | ||
2086 | 1362 | AutoComplete.stack[ inputIndex ] = self; | ||
2087 | 1363 | AutoComplete.jqStack[ inputIndex ] = $input; | ||
2088 | 1364 | |||
2089 | 1365 | // Form and Document event attachment | ||
2090 | 1366 | setup( $input, inputIndex ); | ||
2091 | 1367 | }; | ||
2092 | 1368 | |||
2093 | 1369 | })( jQuery, window || this ); | ||
2094 | 0 | 1370 | ||
2095 | === modified file 'website/views/website_templates.xml' | |||
2096 | --- website/views/website_templates.xml 2014-02-21 10:47:25 +0000 | |||
2097 | +++ website/views/website_templates.xml 2014-02-26 06:23:38 +0000 | |||
2098 | @@ -271,7 +271,9 @@ | |||
2099 | 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> |
2100 | 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> |
2101 | 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> |
2103 | 274 | 274 | <!-- Add Auto complete Library --> | |
2104 | 275 | <script type="text/javascript" src="/website/static/lib/autocomplete/jquery.auto-complete.js"></script> | ||
2105 | 276 | |||
2106 | 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> |
2107 | 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> |
2108 | 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> |
2109 | 278 | 280 | ||
2110 | === modified file 'website_quote/data/website_quotation_data.xml' | |||
2111 | --- website_quote/data/website_quotation_data.xml 2014-01-25 23:25:25 +0000 | |||
2112 | +++ website_quote/data/website_quotation_data.xml 2014-02-26 06:23:38 +0000 | |||
2113 | @@ -63,7 +63,7 @@ | |||
2114 | 63 | ${object.company_id.zip} ${object.company_id.city}<br/> | 63 | ${object.company_id.zip} ${object.company_id.city}<br/> |
2115 | 64 | % endif | 64 | % endif |
2116 | 65 | % if object.company_id.country_id: | 65 | % if object.company_id.country_id: |
2118 | 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/> |
2119 | 67 | % endif | 67 | % endif |
2120 | 68 | </span> | 68 | </span> |
2121 | 69 | % if object.company_id.phone: | 69 | % if object.company_id.phone: |
2122 | 70 | 70 | ||
2123 | === modified file 'website_sale/controllers/main.py' | |||
2124 | --- website_sale/controllers/main.py 2014-02-25 09:05:06 +0000 | |||
2125 | +++ website_sale/controllers/main.py 2014-02-26 06:23:38 +0000 | |||
2126 | @@ -15,11 +15,11 @@ | |||
2127 | 15 | 15 | ||
2128 | 16 | class CheckoutInfo(object): | 16 | class CheckoutInfo(object): |
2129 | 17 | mandatory_billing_fields = ["name", "phone", "email", "street", "city", "country_id", "zip"] | 17 | mandatory_billing_fields = ["name", "phone", "email", "street", "city", "country_id", "zip"] |
2131 | 18 | optional_billing_fields = ["company", "state_id"] | 18 | optional_billing_fields = ["company", "state"] |
2132 | 19 | string_billing_fields = ["name", "phone", "email", "street", "city", "zip"] | 19 | string_billing_fields = ["name", "phone", "email", "street", "city", "zip"] |
2133 | 20 | 20 | ||
2134 | 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"] |
2136 | 22 | optional_shipping_field = ["shipping_state_id"] | 22 | optional_shipping_field = ["shipping_state"] |
2137 | 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"] |
2138 | 24 | 24 | ||
2139 | 25 | def mandatory_fields(self): | 25 | def mandatory_fields(self): |
2140 | @@ -41,7 +41,6 @@ | |||
2141 | 41 | else: | 41 | else: |
2142 | 42 | prefix = 'shipping_' | 42 | prefix = 'shipping_' |
2143 | 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)) |
2144 | 44 | result[prefix + 'state_id'] = partner.state_id and partner.state_id.id or '' | ||
2145 | 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 '' |
2146 | 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 '' |
2147 | 47 | return result | 46 | return result |
2148 | @@ -406,14 +405,10 @@ | |||
2149 | 406 | orm_country = registry.get('res.country') | 405 | orm_country = registry.get('res.country') |
2150 | 407 | country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context) | 406 | country_ids = orm_country.search(cr, SUPERUSER_ID, [], context=context) |
2151 | 408 | countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context) | 407 | countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context) |
2152 | 409 | state_orm = registry.get('res.country.state') | ||
2153 | 410 | states_ids = state_orm.search(cr, SUPERUSER_ID, [], context=context) | ||
2154 | 411 | states = state_orm.browse(cr, SUPERUSER_ID, states_ids, context) | ||
2155 | 412 | 408 | ||
2156 | 413 | info = CheckoutInfo() | 409 | info = CheckoutInfo() |
2157 | 414 | values = { | 410 | values = { |
2158 | 415 | 'countries': countries, | 411 | 'countries': countries, |
2159 | 416 | 'states': states, | ||
2160 | 417 | 'checkout': info.empty(), | 412 | 'checkout': info.empty(), |
2161 | 418 | 'shipping': post.get("shipping_different"), | 413 | 'shipping': post.get("shipping_different"), |
2162 | 419 | 'error': {}, | 414 | 'error': {}, |
2163 | @@ -441,6 +436,16 @@ | |||
2164 | 441 | 436 | ||
2165 | 442 | return request.website.render("website_sale.checkout", values) | 437 | return request.website.render("website_sale.checkout", values) |
2166 | 443 | 438 | ||
2167 | 439 | @http.route('/shop/get_country', type='json', auth='user', website=True) | ||
2168 | 440 | def get_country(self, **post): | ||
2169 | 441 | cr, uid, context, registry = request.cr, request.uid, request.context, request.registry | ||
2170 | 442 | orm_country = registry.get('res.country') | ||
2171 | 443 | country_ids = orm_country.search(cr, uid, [], context=context) | ||
2172 | 444 | countries = {} | ||
2173 | 445 | for country in orm_country.browse(cr, uid, country_ids, context): | ||
2174 | 446 | countries.update({country.id : country.name}) | ||
2175 | 447 | return countries | ||
2176 | 448 | |||
2177 | 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) |
2178 | 445 | def confirm_order(self, **post): | 450 | def confirm_order(self, **post): |
2179 | 446 | cr, uid, context, registry = request.cr, request.uid, request.context, request.registry | 451 | cr, uid, context, registry = request.cr, request.uid, request.context, request.registry |
2180 | @@ -459,16 +464,11 @@ | |||
2181 | 459 | orm_partner = registry.get('res.partner') | 464 | orm_partner = registry.get('res.partner') |
2182 | 460 | orm_user = registry.get('res.users') | 465 | orm_user = registry.get('res.users') |
2183 | 461 | orm_country = registry.get('res.country') | 466 | orm_country = registry.get('res.country') |
2190 | 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) |
2191 | 463 | countries = orm_country.browse(cr, SUPERUSER_ID, country_ids, context) | 468 | post['country_id'] = countries[0] |
2192 | 464 | orm_state = registry.get('res.country.state') | 469 | |
2187 | 465 | states_ids = orm_state.search(cr, SUPERUSER_ID, [], context=context) | ||
2188 | 466 | states = orm_state.browse(cr, SUPERUSER_ID, states_ids, context) | ||
2189 | 467 | |||
2193 | 468 | info = CheckoutInfo() | 470 | info = CheckoutInfo() |
2194 | 469 | values = { | 471 | values = { |
2195 | 470 | 'countries': countries, | ||
2196 | 471 | 'states': states, | ||
2197 | 472 | 'checkout': info.empty(), | 472 | 'checkout': info.empty(), |
2198 | 473 | 'shipping': post.get("shipping_different"), | 473 | 'shipping': post.get("shipping_different"), |
2199 | 474 | 'error': {}, | 474 | 'error': {}, |
2200 | @@ -513,6 +513,7 @@ | |||
2201 | 513 | 513 | ||
2202 | 514 | shipping_id = None | 514 | shipping_id = None |
2203 | 515 | if post.get('shipping_different'): | 515 | if post.get('shipping_different'): |
2204 | 516 | shiping_id = orm_country.search(cr, SUPERUSER_ID, [('name','=',post['shipping_country_id'])], context=context) | ||
2205 | 516 | shipping_info = { | 517 | shipping_info = { |
2206 | 517 | 'phone': post['shipping_phone'], | 518 | 'phone': post['shipping_phone'], |
2207 | 518 | 'zip': post['shipping_zip'], | 519 | 'zip': post['shipping_zip'], |
2208 | @@ -522,8 +523,7 @@ | |||
2209 | 522 | 'email': post['email'], | 523 | 'email': post['email'], |
2210 | 523 | 'type': 'delivery', | 524 | 'type': 'delivery', |
2211 | 524 | 'parent_id': partner_id, | 525 | 'parent_id': partner_id, |
2214 | 525 | 'country_id': post['shipping_country_id'], | 526 | 'shipping_country_id': shiping_id[0], |
2213 | 526 | 'state_id': post['shipping_state_id'], | ||
2215 | 527 | } | 527 | } |
2216 | 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) |
2217 | 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"]] |
2218 | @@ -670,7 +670,7 @@ | |||
2219 | 670 | if not tx_ids: | 670 | if not tx_ids: |
2220 | 671 | if order.amount_total: | 671 | if order.amount_total: |
2221 | 672 | return { | 672 | return { |
2223 | 673 | 'state': 'error', | 673 | 'f': 'error', |
2224 | 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>', |
2225 | 675 | } | 675 | } |
2226 | 676 | else: | 676 | else: |
2227 | 677 | 677 | ||
2228 | === modified file 'website_sale/static/src/js/website_sale.js' | |||
2229 | --- website_sale/static/src/js/website_sale.js 2014-02-06 14:07:46 +0000 | |||
2230 | +++ website_sale/static/src/js/website_sale.js 2014-02-26 06:23:38 +0000 | |||
2231 | @@ -6,7 +6,16 @@ | |||
2232 | 6 | $shippingDifferent.change(function () { | 6 | $shippingDifferent.change(function () { |
2233 | 7 | $(".oe_website_sale .js_shipping").toggle(); | 7 | $(".oe_website_sale .js_shipping").toggle(); |
2234 | 8 | }); | 8 | }); |
2236 | 9 | 9 | ||
2237 | 10 | openerp.jsonRpc('/shop/get_country', 'call', {}).then(function (countries){ | ||
2238 | 11 | var st = new Array(); | ||
2239 | 12 | $.each(countries, function(s, t) { | ||
2240 | 13 | st.push(t); | ||
2241 | 14 | }); | ||
2242 | 15 | $('input[name=country_id]').autocomplete({source: st}); | ||
2243 | 16 | $('input[name=shipping_country_id]').autocomplete({source: st}); | ||
2244 | 17 | }); | ||
2245 | 18 | |||
2246 | 10 | // change for css | 19 | // change for css |
2247 | 11 | $(document).on('mouseup', '.js_publish', function (ev) { | 20 | $(document).on('mouseup', '.js_publish', function (ev) { |
2248 | 12 | $(ev.currentTarget).parents(".thumbnail").toggleClass("disabled"); | 21 | $(ev.currentTarget).parents(".thumbnail").toggleClass("disabled"); |
2249 | 13 | 22 | ||
2250 | === modified file 'website_sale/views/website_sale.xml' | |||
2251 | --- website_sale/views/website_sale.xml 2014-02-20 16:38:15 +0000 | |||
2252 | +++ website_sale/views/website_sale.xml 2014-02-26 06:23:38 +0000 | |||
2253 | @@ -762,23 +762,13 @@ | |||
2254 | 762 | <label class="control-label" for="zip">Zip / Postal Code</label> | 762 | <label class="control-label" for="zip">Zip / Postal Code</label> |
2255 | 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')"/> |
2256 | 764 | </div> | 764 | </div> |
2266 | 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"> |
2267 | 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> |
2268 | 767 | <select name="state_id" class="form-control"> | 767 | <input type="" name="state" class="form-control" t-att-value="state" /> |
2269 | 768 | <option value="">select...</option> | 768 | </div> |
2261 | 769 | <t t-foreach="states or []" t-as="state"> | ||
2262 | 770 | <option t-att-value="state.id" t-att-selected="state.id == checkout.get('state_id')"><t t-esc="state.name"/></option> | ||
2263 | 771 | </t> | ||
2264 | 772 | </select> | ||
2265 | 773 | </div> | ||
2270 | 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"> |
2278 | 775 | <label class="control-label" for="contact_name">Country</label> | 770 | <label class="control-label" for="country_id">Country</label> |
2279 | 776 | <select name="country_id" class="form-control"> | 771 | <input type="text" name="country_id" class="form-control" t-att-value="country_id" /> |
2273 | 777 | <option value="">Country...</option> | ||
2274 | 778 | <t t-foreach="countries or []" t-as="country"> | ||
2275 | 779 | <option t-att-value="country.id" t-att-selected="country.id == checkout.get('country_id')"><t t-esc="country.name"/></option> | ||
2276 | 780 | </t> | ||
2277 | 781 | </select> | ||
2280 | 782 | </div> | 772 | </div> |
2281 | 783 | 773 | ||
2282 | 784 | <div class="clearfix"/> | 774 | <div class="clearfix"/> |
2283 | @@ -814,24 +804,14 @@ | |||
2284 | 814 | <label class="control-label" for="contact_name">Zip / Postal Code</label> | 804 | <label class="control-label" for="contact_name">Zip / Postal Code</label> |
2285 | 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', '')"/> |
2286 | 816 | </div> | 806 | </div> |
2296 | 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"> |
2297 | 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> |
2298 | 819 | <select name="shipping_state_id" class="form-control"> | 809 | <input type="" name="shipping_state" class="form-control" t-att-value="shipping_state" /> |
2299 | 820 | <option value="">State / Province...</option> | 810 | </div> |
2291 | 821 | <t t-foreach="states or []" t-as="state"> | ||
2292 | 822 | <option t-att-value="state.id" t-att-selected="state.id == checkout.get('shipping_state_id')"><t t-esc="state.name"/></option> | ||
2293 | 823 | </t> | ||
2294 | 824 | </select> | ||
2295 | 825 | </div> | ||
2300 | 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"> |
2309 | 827 | <label class="control-label" for="contact_name">Country</label> | 812 | <label class="control-label" for="shipping_country_id">Country</label> |
2310 | 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" /> |
2311 | 829 | <option value="">Country...</option> | 814 | </div> |
2304 | 830 | <t t-foreach="countries or []" t-as="country"> | ||
2305 | 831 | <option t-att-value="country.id" t-att-selected="country.id == checkout.get('shipping_country_id')"><t t-esc="country.name"/></option> | ||
2306 | 832 | </t> | ||
2307 | 833 | </select> | ||
2308 | 834 | </div> | ||
2312 | 835 | </div> | 815 | </div> |
2313 | 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> |
2314 | 837 | </div> | 817 | </div> |