Browse Source

[FIX] handle multiple or empty mail servers

[FIX] use only confirmed mail servers
pull/1/head
Ivan Yelizariev 9 years ago
parent
commit
509c25eef4
  1. 7
      models.py
  2. 7
      static/src/js/main.js

7
models.py

@ -53,7 +53,12 @@ class FetchMailImmediately(models.AbstractModel):
@api.model
def get_last_update_time(self):
return self.env['fetchmail.server'].sudo().search([]).run_time
res = self.env['fetchmail.server'].sudo().search([('state', '=', 'done')])
array = [r.run_time for r in res]
if array:
return array[0]
else:
return None
@api.model
def run_fetchmail_manually(self):

7
static/src/js/main.js

@ -38,8 +38,11 @@ openerp.mail_check_immediately = function(instance, local) {
get_last_fetched_time: function(){
var _this = this;
this.imm_model.call('get_last_update_time', {context: new instance.web.CompoundContext()}).then(function(res){
// using jQuery timeago library
_this.$el.find('span.oe_view_manager_fetch_mail_imm_field').html($.timeago(res));
var value;
if (res)
value = $.timeago(res);
value = value || 'undefined';
_this.$el.find('span.oe_view_manager_fetch_mail_imm_field').html(value);
})
},

Loading…
Cancel
Save