From: Christophe Simonis Date: Wed, 5 Nov 2014 19:30:40 +0000 (+0100) Subject: [MERGE] forward port of branch 8.0 up to 491372e X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=5068cffbb043d7284014dcdd03b1794250631bc0;p=odoo%2Fodoo.git [MERGE] forward port of branch 8.0 up to 491372e --- 5068cffbb043d7284014dcdd03b1794250631bc0 diff --cc addons/base_action_rule/base_action_rule.py index ef01134,2bf83f9..dae5d0e --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@@ -141,11 -128,12 +141,11 @@@ class base_action_rule(osv.osv) def _process(self, cr, uid, action, record_ids, context=None): """ process the given action on the records """ model = self.pool[action.model_id.model] - # modify records values = {} - if 'date_action_last' in model._all_columns: + if 'date_action_last' in model._fields: values['date_action_last'] = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) - if action.act_user_id and 'user_id' in model._all_columns: + if action.act_user_id and 'user_id' in model._fields: values['user_id'] = action.act_user_id.id if values: model.write(cr, uid, record_ids, values, context=context) diff --cc addons/mail/mail_mail.py index 5de69fb,482db7a..ec4db70 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@@ -303,12 -298,22 +303,22 @@@ class mail_mail(osv.Model) subtype='html', subtype_alternative='plain', headers=headers) - res = ir_mail_server.send_email(cr, uid, msg, + try: + res = ir_mail_server.send_email(cr, uid, msg, mail_server_id=mail.mail_server_id.id, context=context) - + except AssertionError as error: + if error.message == ir_mail_server.NO_VALID_RECIPIENT: + # No valid recipient found for this particular + # mail item -> ignore error to avoid blocking + # delivery to next recipients, if any. If this is + # the only recipient, the mail will show as failed. + _logger.warning("Ignoring invalid recipients for mail.mail %s: %s", + mail.message_id, email.get('email_to')) + else: + raise if res: - mail.write({'state': 'sent', 'message_id': res}) + mail.write({'state': 'sent', 'message_id': res, 'failure_reason': False}) mail_sent = True # /!\ can't use mail.state here, as mail.refresh() will cause an error diff --cc addons/point_of_sale/static/src/js/screens.js index c38a719,3a09233..c45f415 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@@ -917,9 -926,25 +917,12 @@@ function openerp_pos_screens(instance, this._super(); var self = this; - var print_button = this.add_action_button({ - label: _t('Print'), - icon: '/point_of_sale/static/src/img/icons/png48/printer.png', - click: function(){ self.print(); }, - }); - - var finish_button = this.add_action_button({ - label: _t('Next Order'), - icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', - click: function() { self.finishOrder(); }, - }); - this.refresh(); - this.print(); + + if (!this.pos.get('selectedOrder')._printed) { + this.print(); + } - // // The problem is that in chrome the print() is asynchronous and doesn't // execute until all rpc are finished. So it conflicts with the rpc used // to send the orders to the backend, and the user is able to go to the next @@@ -936,40 -961,21 +939,41 @@@ // 2 seconds is the same as the default timeout for sending orders and so the dialog // should have appeared before the timeout... so yeah that's not ultra reliable. - finish_button.set_disabled(true); + this.lock_screen(true); setTimeout(function(){ - finish_button.set_disabled(false); + self.lock_screen(false); }, 2000); }, + lock_screen: function(locked) { + this._locked = locked; + if (locked) { + this.$('.next').removeClass('highlight'); + } else { + this.$('.next').addClass('highlight'); + } + }, print: function() { + this.pos.get('selectedOrder')._printed = true; window.print(); }, - finishOrder: function() { - this.pos.get('selectedOrder').destroy(); + finish_order: function() { + if (!this._locked) { + this.pos.get_order().finalize(); + } + }, + renderElement: function() { + var self = this; + this._super(); + this.$('.next').click(function(){ + self.finish_order(); + }); + this.$('.button.print').click(function(){ + self.print(); + }); }, refresh: function() { - var order = this.pos.get('selectedOrder'); - $('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{ + var order = this.pos.get_order(); + this.$('.pos-receipt-container').html(QWeb.render('PosTicket',{ widget:this, order: order, orderlines: order.get('orderLines').models, diff --cc addons/purchase/purchase_view.xml index 770e2bc,d22c0c1..632af46 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@@ -233,9 -241,9 +233,9 @@@ - + - - + + @@@ -411,12 -419,11 +411,12 @@@ - + ++ on_change="onchange_product_id(parent.pricelist_id,product_id,0,False,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,False,context)" context="{'partner_id': parent.partner_id}"/> diff --cc addons/web_kanban/static/src/js/kanban.js index 62489a3,0cc543c..1d2ba48 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@@ -273,11 -271,10 +273,10 @@@ instance.web_kanban.KanbanView = instan self.dataset.ids = []; if (!groups.length) { self.no_result(); - return false; + return $.when(); } self.nb_records = 0; - var remaining = groups.length - 1, - groups_array = []; + var groups_array = []; return $.when.apply(null, _.map(groups, function (group, index) { var def = $.when([]); var dataset = new instance.web.DataSetSearch(self, self.dataset.model, @@@ -300,7 -291,10 +293,12 @@@ if(!self.nb_records) { self.no_result(); } - self.trigger('kanban_groups_processed'); + if (self.dataset.index >= self.nb_records){ + self.dataset.index = self.dataset.size() ? 0 : null; + } - return self.do_add_groups(groups_array); ++ return self.do_add_groups(groups_array).done(function() { ++ self.trigger('kanban_groups_processed'); ++ }); }); }); }, diff --cc addons/website/views/website_templates.xml index af4843f,714c49fa..c01baa3 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@@ -242,7 -248,7 +243,7 @@@