[MERGE] Forward-port saas-6 up to 2d4deca055

- Fix for status widget (b25c054c93) moved
  to appropriate file: addons/web/static/src/js/views/form_widgets.js
  even though the problem is less severe in 9.0 (no crash but triggers
  form save, which is unnecessary)

- Fix for website_event_sale ignored (880e951f34)
  because the problem does not exist anymore in 9.0, probably due to
  refactoring 66871ee65b
This commit is contained in:
Olivier Dony
2016-04-14 10:39:09 +02:00
5 changed files with 30 additions and 16 deletions
+1 -5
View File
@@ -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'
+1
View File
@@ -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'),
@@ -28,7 +28,6 @@
<group col="4">
<field name="name" />
<field name="pos_config_id" />
<field name="background_image" widget="image" />
<field name="background_color" />
</group>
<field name="table_ids">
+13 -6
View File
@@ -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();
});
});
});
}
}
},
});
+15 -4
View File
@@ -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 '')