diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 716175a5fd8..2718e47dd2a 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -63,8 +63,7 @@ class AuthSignupHome(Home): qcontext['error'] = _("Could not reset your password") _logger.exception('error when resetting password') except Exception, e: - qcontext['error'] = e.message - + qcontext['error'] = e.message or e.name return request.render('auth_signup.reset_password', qcontext) diff --git a/addons/barcodes/static/src/js/barcode_events.js b/addons/barcodes/static/src/js/barcode_events.js index fca30916106..3c5cb289232 100644 --- a/addons/barcodes/static/src/js/barcode_events.js +++ b/addons/barcodes/static/src/js/barcode_events.js @@ -4,6 +4,16 @@ odoo.define('barcodes.BarcodeEvents', function(require) { var core = require('web.core'); var mixins = core.mixins; + +// For IE >= 9, use this, new CustomEvent(), instead of new Event() +function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; + } +CustomEvent.prototype = window.Event.prototype; + var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, { timeout: null, key_pressed: {}, @@ -63,10 +73,16 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, { // bug for the longest time that causes keyCode and // charCode to not be set for events created this way: // https://bugs.webkit.org/show_bug.cgi?id=16735 - new_event = new Event("keypress", { + var params = { 'bubbles': old_event.bubbles, 'cancelable': old_event.cancelable, - }); + }; + try { + new_event = new Event("keypress", params); + } catch(error) { + // For IE >= 9, use new CustomEvent(), instead of new Event() + new_event = new CustomEvent("keypress", params); + } new_event.viewArg = old_event.viewArg; new_event.ctrl = old_event.ctrl; diff --git a/addons/base_geolocalize/models/res_partner.py b/addons/base_geolocalize/models/res_partner.py index eef2b374975..2cc4ac92ab8 100644 --- a/addons/base_geolocalize/models/res_partner.py +++ b/addons/base_geolocalize/models/res_partner.py @@ -15,6 +15,7 @@ def geo_find(addr): result = json.load(urllib.urlopen(url)) except Exception as e: raise UserError(_('Cannot contact geolocation servers. Please make sure that your Internet connection is up and running (%s).') % e) + if result['status'] != 'OK': return None @@ -52,6 +53,13 @@ class ResPartner(models.Model): city=partner.city, state=partner.state_id.name, country=partner.country_id.name)) + if result is None: + result = geo_find(geo_query_address( + city=partner.city, + state=partner.state_id.name, + country=partner.country_id.name + )) + if result: partner.write({ 'partner_latitude': result[0], diff --git a/addons/crm/data/crm_lead_demo.xml b/addons/crm/data/crm_lead_demo.xml index e5281090e28..a4b40a6d984 100644 --- a/addons/crm/data/crm_lead_demo.xml +++ b/addons/crm/data/crm_lead_demo.xml @@ -669,7 +669,7 @@ Andrew
]]>Thanks,
-
-${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature | safe or ''}
-
+${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature or '' | safe}
+
% if not ctx['partner_id'].user_id:
PS: It looks like you do not have an account manager assigned to you, please contact us.
% endif
diff --git a/addons/website_crm_partner_assign/models/crm_lead.py b/addons/website_crm_partner_assign/models/crm_lead.py
index 4d85d3d661c..0689d809053 100644
--- a/addons/website_crm_partner_assign/models/crm_lead.py
+++ b/addons/website_crm_partner_assign/models/crm_lead.py
@@ -93,6 +93,14 @@ class CrmLead(models.Model):
city=lead.city,
state=lead.state_id.name,
country=lead.country_id.name))
+
+ if result is None:
+ result = geo_find(geo_query_address(
+ city=lead.city,
+ state=lead.state_id.name,
+ country=lead.country_id.name
+ ))
+
if result:
lead.write({
'partner_latitude': result[0],
diff --git a/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js b/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js
index d63fc68a972..cfc158c46bc 100644
--- a/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js
+++ b/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js
@@ -2,9 +2,7 @@ odoo.define('crm.partner_assign', function (require) {
'use strict';
var Model = require('web.Model');
-var time = require('web.time');
var website = require('website.website');
-
/*
* This file is intended to add interactivity to survey forms rendered by
* the website engine.
@@ -20,11 +18,16 @@ if(!interested_form.length && !desinterested_form.length && !opp_stage_buttons.l
}
$('.interested_partner_assign_confirm').on('click',function(e){
+ var $btn = $(this);
if ($('.interested_partner_assign_form .comment_interested').val() && $('.interested_partner_assign_form .contacted_interested').prop('checked')){
+ $btn.prop('disabled', true);
new Model('crm.lead')
.call("partner_interested",[[parseInt($('.interested_partner_assign_form .assign_lead_id').val())], $('.interested_partner_assign_form .comment_interested').val()])
.then(function(){
window.location.href = '/my/leads';
+ })
+ .always(function() {
+ $btn.prop('disabled', false);
});
}else{
$('.interested_partner_assign_form .error_partner_assign_interested').css('display', 'block');
@@ -33,7 +36,9 @@ $('.interested_partner_assign_confirm').on('click',function(e){
});
-$('.desinterested_partner_assign_confirm').on('click',function(e){
+$('.desinterested_partner_assign_confirm').on('click',function(){
+ var $btn = this;
+ $btn.prop('disabled', true);
new Model('crm.lead')
.call("partner_desinterested",
[[parseInt($('.desinterested_partner_assign_form .assign_lead_id').val())],
@@ -43,27 +48,36 @@ $('.desinterested_partner_assign_confirm').on('click',function(e){
])
.then(function(){
window.location.href = '/my/leads';
+ }).always(function() {
+ $btn.prop('disabled', false);
});
return false;
});
opp_stage_buttons.on('click',function(e){
+ var $btn = this;
+ $btn.prop('disabled', true);
new Model('crm.lead')
.call("write", [[parseInt(e.currentTarget.getAttribute('opp'))],{
stage_id: parseInt(e.currentTarget.getAttribute('data')),
},], {context: {website_partner_assign:1}})
+ .fail(function() {
+ $btn.prop('disabled', false);
+ })
.done(function () {
window.location.reload();
});
});
-$('.edit_contact_form .country_id').on('change', function(e){
+$('.edit_contact_form .country_id').on('change', function(){
var country_id = $('.edit_contact_form .country_id').find(":selected").attr('value');
$(".edit_contact_form .state[country!="+country_id+"]").css('display','none');
$(".edit_contact_form .state[country="+country_id+"]").css('display','block');
});
-$('.edit_contact_confirm').on('click',function(e){
+$('.edit_contact_confirm').on('click',function(){
+ var $btn = this;
+ $btn.prop('disabled', true);
new Model('crm.lead')
.call("write", [[parseInt($('.edit_contact_form .opportunity_id').val())],{
partner_name: $('.edit_contact_form .partner_name').val(),
@@ -77,7 +91,10 @@ $('.edit_contact_confirm').on('click',function(e){
state_id: parseInt($('.edit_contact_form .state_id').find(":selected").attr('value')),
country_id: parseInt($('.edit_contact_form .country_id').find(":selected").attr('value')),
}])
- .done(function(response){
+ .fail(function() {
+ $btn.prop('disabled', false);
+ })
+ .done(function(){
window.location.reload();
});
return false;
@@ -102,7 +119,9 @@ $('.new_opp_confirm').on('click',function(e){
return false;
});
-$('.edit_opp_confirm').on('click',function(e){
+$('.edit_opp_confirm').on('click',function(){
+ var $btn = this;
+ $btn.prop('disabled', true);
new Model('crm.lead')
.call("update_lead_portal", [[parseInt($('.edit_opp_form .opportunity_id').val())],{
activity_id: parseInt($('.edit_opp_form .next_activity').find(":selected").attr('data')),
@@ -113,13 +132,16 @@ $('.edit_opp_confirm').on('click',function(e){
date_action: $('.edit_opp_form .date_action').val(),
priority: $('input[name="PriorityRadioOptions"]:checked').val(),
}])
- .done(function(response){
+ .fail(function() {
+ $btn.prop('disabled', false);
+ })
+ .done(function(){
window.location.reload();
});
return false;
});
-$('.edit_opp_form .next_activity').on('change', function(e){
+$('.edit_opp_form .next_activity').on('change', function(){
var selected = $('.edit_opp_form .next_activity').find(":selected");
if(selected.attr('description')){
$('.edit_opp_form .title_action').val(selected.attr('description'));
diff --git a/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py
index a3e17583e6a..d91dccfa67a 100644
--- a/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py
+++ b/addons/website_crm_partner_assign/wizard/crm_forward_to_partner.py
@@ -99,7 +99,7 @@ class CrmLeadForwardToPartner(models.TransientModel):
for lead_data in partner_leads['leads']:
leads |= lead_data['lead_id']
values = {'partner_assigned_id': partner_id, 'user_id': partner_leads['partner'].user_id.id}
- leads.write(values)
+ leads.with_context(mail_auto_subscribe_no_notify=1).write(values)
self.env['crm.lead'].message_subscribe([partner_id])
return True
diff --git a/addons/website_portal_sale/models/payment.py b/addons/website_portal_sale/models/payment.py
index d52085ee8f4..3b77d74b51e 100644
--- a/addons/website_portal_sale/models/payment.py
+++ b/addons/website_portal_sale/models/payment.py
@@ -41,32 +41,42 @@ class PaymentTransaction(models.Model):
tx = None
res = super(PaymentTransaction, self).form_feedback(data, acquirer_name)
- # fetch the tx, check its state, confirm the potential SO
- try:
- tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name
- if hasattr(self, tx_find_method_name):
- tx = getattr(self, tx_find_method_name)(data)
- _logger.info('<%s> transaction processed: tx ref:%s, tx amount: %s', acquirer_name, tx.reference if tx else 'n/a', tx.amount if tx else 'n/a')
+ # fetch the tx
+ tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name
+ if hasattr(self, tx_find_method_name):
+ tx = getattr(self, tx_find_method_name)(data)
+ _logger.info('<%s> transaction processed: tx ref:%s, tx amount: %s', acquirer_name, tx.reference if tx else 'n/a', tx.amount if tx else 'n/a')
- if tx and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']:
- # verify SO/TX match, excluding tx.fees which are currently not included in SO
- amount_matches = float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0
- if amount_matches:
- if tx.state == 'authorized' and tx.acquirer_id.auto_confirm == 'authorize':
- _logger.info('<%s> transaction authorized, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
- tx.sale_order_id.with_context(send_email=True).action_confirm()
- if tx.state == 'done' and tx.acquirer_id.auto_confirm in ['confirm_so', 'generate_and_pay_invoice']:
- _logger.info('<%s> transaction completed, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
- tx.sale_order_id.with_context(send_email=True).action_confirm()
-
- if tx.acquirer_id.auto_confirm == 'generate_and_pay_invoice':
- self._generate_and_pay_invoice(tx, acquirer_name)
- elif tx.state not in ['cancel', 'error'] and tx.sale_order_id.state == 'draft':
- _logger.info('<%s> transaction pending/to confirm manually, sending quote email for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
- tx.sale_order_id.force_quotation_send()
- else:
- _logger.warning('<%s> transaction MISMATCH for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
- except Exception:
- _logger.exception('Fail to confirm the order or send the confirmation email%s', tx and ' for the transaction %s' % tx.reference or '')
+ if tx:
+ # Auto-confirm SO if necessary
+ tx._confirm_so(acquirer_name=acquirer_name)
return res
+
+ def _confirm_so(self, acquirer_name=False):
+ for tx in self:
+ try:
+ # check tx state, confirm the potential SO
+ if tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']:
+ # verify SO/TX match, excluding tx.fees which are currently not included in SO
+ amount_matches = float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0
+ if amount_matches:
+ if not acquirer_name:
+ acquirer_name = tx.sale_order_id.payment_acquirer_id.provider or 'unknown'
+ if tx.state == 'authorized' and tx.acquirer_id.auto_confirm == 'authorize':
+ _logger.info('<%s> transaction authorized, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
+ tx.sale_order_id.with_context(send_email=True).action_confirm()
+ if tx.state == 'done' and tx.acquirer_id.auto_confirm in ['confirm_so', 'generate_and_pay_invoice']:
+ _logger.info('<%s> transaction completed, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
+ tx.sale_order_id.with_context(send_email=True).action_confirm()
+
+ if tx.acquirer_id.auto_confirm == 'generate_and_pay_invoice':
+ self._generate_and_pay_invoice(tx, acquirer_name)
+ elif tx.state not in ['cancel', 'error'] and tx.sale_order_id.state == 'draft':
+ _logger.info('<%s> transaction pending/to confirm manually, sending quote email for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
+ tx.sale_order_id.force_quotation_send()
+ else:
+ _logger.warning('<%s> transaction MISMATCH for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
+
+ except Exception:
+ _logger.exception('Fail to confirm the order or send the confirmation email%s', tx and ' for the transaction %s' % tx.reference or '')
diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py
index 592a3e43c74..6e2c06b3fd1 100644
--- a/addons/website_sale/controllers/main.py
+++ b/addons/website_sale/controllers/main.py
@@ -753,7 +753,10 @@ class WebsiteSale(http.Controller):
valid_state = 'authorized' if tx.acquirer_id.auto_confirm == 'authorize' else 'done'
if not s2s_result or tx.state != valid_state:
return dict(success=False, error=_("Payment transaction failed (%s)") % tx.state_message)
- return dict(success=True, url='/shop/payment/validate')
+ else:
+ # Auto-confirm SO if necessary
+ tx._confirm_so()
+ return dict(success=True, url='/shop/payment/validate')
except Exception, e:
_logger.warning(_("Payment transaction (%s) failed : <%s>") % (tx.id, str(e)))
return dict(success=False, error=_("Payment transaction failed (Contact Administrator)"))
diff --git a/addons/website_sale/i18n/website_sale.pot b/addons/website_sale/i18n/website_sale.pot
index 6b6166eee65..de34d3cff59 100644
--- a/addons/website_sale/i18n/website_sale.pot
+++ b/addons/website_sale/i18n/website_sale.pot
@@ -840,13 +840,9 @@ msgstr ""
msgid "Delivery methods are selectable on the website: the customer pays for shipping costs"
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,field_description:website_sale.field_product_product_quote_description
-msgid "Description for the quote"
-msgstr ""
-
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_website_description
+#: model:ir.model.fields,field_description:website_sale.field_product_template_website_description
msgid "Description for the website"
msgstr ""
@@ -924,15 +920,6 @@ msgstr ""
msgid "Enter a name for your new product"
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,help:website_sale.field_product_product_split_method
-msgid "Equal : Cost will be equally divided.\n"
-"By Quantity : Cost will be divided according to product's quantity.\n"
-"By Current cost : Cost will be divided according to product's current cost.\n"
-"By Weight : Cost will be divided depending on its weight.\n"
-"By Volume : Cost will be divided depending on its volume."
-msgstr ""
-
#. module: website_sale
#: code:addons/website_sale/models/product.py:89
#, python-format
@@ -1001,11 +988,6 @@ msgstr ""
msgid "Gives the sequence order when displaying a list of product categories."
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,field_description:website_sale.field_product_product_hs_code
-msgid "HS Code"
-msgstr ""
-
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_style_html_class
msgid "HTML Classes"
@@ -1129,11 +1111,6 @@ msgstr ""
msgid "Keyboard / Mouse"
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,field_description:website_sale.field_product_product_landed_cost_ok
-msgid "Landed Costs"
-msgstr ""
-
#. module: website_sale
#: model:product.public.category,name:website_sale.laptops
msgid "Laptops"
@@ -1216,6 +1193,7 @@ msgstr ""
#: model:ir.model.fields,field_description:website_sale.field_product_image_name
#: model:ir.model.fields,field_description:website_sale.field_product_public_category_name
#: model:ir.ui.view,arch_db:website_sale.address
+#: model:ir.ui.view,arch_db:website_sale.sort
msgid "Name"
msgstr ""
@@ -1445,6 +1423,16 @@ msgstr ""
msgid "Price"
msgstr ""
+#. module: website_sale
+#: model:ir.ui.view,arch_db:website_sale.sort
+msgid "Price "
+msgstr ""
+
+#. module: website_sale
+#: model:ir.ui.view,arch_db:website_sale.sort
+msgid "Price "
+msgstr ""
+
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_website_pricelist_ids
msgid "Price list available for this Ecommerce/Website"
@@ -1476,11 +1464,6 @@ msgstr ""
msgid "Printer"
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,field_description:website_sale.field_product_product_purchase_requisition
-msgid "Procurement"
-msgstr ""
-
#. module: website_sale
#. openerp-web
#: code:addons/website_sale/static/src/xml/website_sale_dashboard.xml:29
@@ -1926,16 +1909,6 @@ msgid "Specific prices per customer segment, currency, etc.: new pricing table a
"Advanced pricing based on formulas (discounts, margins, rounding): apply price rules from a new *Pricelists* menu in Configuration."
msgstr ""
-#. module: website_sale
-#: model:ir.model.fields,field_description:website_sale.field_product_product_split_method
-msgid "Split Method"
-msgstr ""
-
-#. module: website_sale
-#: model:ir.model.fields,help:website_sale.field_product_product_hs_code
-msgid "Standardized code for international shipping and goods declaration"
-msgstr ""
-
#. module: website_sale
#: model:ir.ui.view,arch_db:website_sale.website_planner
msgid "Start your online shop by creating 3 products pages.