diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py index 1e3b896a2c4..fcb5c443dea 100644 --- a/addons/payment_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -198,11 +198,7 @@ class TxPaypal(osv.Model): def _paypal_form_get_invalid_parameters(self, cr, uid, tx, data, context=None): invalid_parameters = [] - if data.get('notify_version')[0] != '3.4': - _logger.warning( - 'Received a notification from Paypal with version %s instead of 2.6. This could lead to issues when managing it.' % - data.get('notify_version') - ) + _logger.info('Received a notification from Paypal with IPN version %s', data.get('notify_version')) if data.get('test_ipn'): _logger.warning( 'Received a notification from Paypal using sandbox' diff --git a/addons/pos_restaurant/restaurant.py b/addons/pos_restaurant/restaurant.py index 11548073bb2..f06e3b47e3a 100644 --- a/addons/pos_restaurant/restaurant.py +++ b/addons/pos_restaurant/restaurant.py @@ -15,6 +15,7 @@ class restaurant_floor(osv.osv): _columns = { 'name': fields.char('Floor Name', required=True, help='An internal identification of the restaurant floor'), 'pos_config_id': fields.many2one('pos.config','Point of Sale'), + # todo: remove in master 'background_image': fields.binary('Background Image', attachment=True, help='A background image used to display a floor layout in the point of sale interface'), 'background_color': fields.char('Background Color', help='The background color of the floor layout, (must be specified in a html-compatible format)'), 'table_ids': fields.one2many('restaurant.table','floor_id','Tables', help='The list of tables in this floor'), diff --git a/addons/pos_restaurant/restaurant_view.xml b/addons/pos_restaurant/restaurant_view.xml index 27f323651b7..dda6e821562 100644 --- a/addons/pos_restaurant/restaurant_view.xml +++ b/addons/pos_restaurant/restaurant_view.xml @@ -28,7 +28,6 @@ - diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 7f5e6c54da4..1214f6e2ce3 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -1530,13 +1530,20 @@ var FieldStatus = common.AbstractField.extend({ val = $li.data("id"); } if (val != self.get('value')) { - this.view.recursive_save().done(function() { - var change = {}; - change[self.name] = val; - self.view.dataset.write(self.view.datarecord.id, change).done(function() { - self.view.reload(); + if (!this.view.datarecord.id || + this.view.datarecord.id.toString().match(data.BufferedDataSet.virtual_id_regex)) { + // don't save, only set value for not-yet-saved many2ones + self.set_value(val); + } + else { + this.view.recursive_save().done(function() { + var change = {}; + change[self.name] = val; + self.view.dataset.write(self.view.datarecord.id, change).done(function() { + self.view.reload(); + }); }); - }); + } } }, }); diff --git a/addons/website_sale/models/payment.py b/addons/website_sale/models/payment.py index bd0a224b2ee..05e3f9e4bbb 100644 --- a/addons/website_sale/models/payment.py +++ b/addons/website_sale/models/payment.py @@ -3,6 +3,7 @@ import logging from openerp import SUPERUSER_ID from openerp.osv import orm, fields +from openerp.tools import float_compare _logger = logging.getLogger(__name__) @@ -26,10 +27,20 @@ class PaymentTransaction(orm.Model): 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)(cr, uid, data, context=context) - if tx and tx.state == 'done' and tx.acquirer_id.auto_confirm == 'at_pay_confirm' and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']: - self.pool['sale.order'].action_confirm(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=dict(context, send_email=True)) - elif tx and tx.state not in ['cancel', 'error'] and tx.sale_order_id and tx.sale_order_id.state in ['draft']: - self.pool['sale.order'].force_quotation_send(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=context) + _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: + # verify SO/TX match, excluding tx.fees which are currently not included in SO + amount_matches = (tx.sale_order_id.state in ['draft', 'sent'] and float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0) + if amount_matches: + if tx.state == 'done' and tx.acquirer_id.auto_confirm == 'at_pay_confirm': + _logger.info('<%s> transaction completed, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id) + self.pool['sale.order'].action_confirm(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=dict(context, send_email=True)) + 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) + self.pool['sale.order'].force_quotation_send(cr, SUPERUSER_ID, [tx.sale_order_id.id], context=context) + 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 '')