if options and options.get('hide_seconds'):
pattern = pattern.replace(":ss", "").replace(":s", "")
-
+
return babel.dates.format_datetime(value, format=pattern, locale=locale)
class TextConverter(osv.AbstractModel):
lang_code = context.get('lang') or 'en_US'
lang = self.pool['res.lang']
- formatted_amount = lang.format(cr, uid, [lang_code],
+ formatted_amount = lang.format(cr, uid, [lang_code],
fmt, Currency.round(cr, uid, display, record[field_name]),
grouping=True, monetary=True)
except ValueError:
self.last_modified = datetime.datetime.strptime(attach[0]['__last_update'], server_format)
except Exception:
- raise KeyError("Could not find asset '%s' for '%s' addon" % (self.url, module))
+ self._missingAsset(module)
+
+ def _missingAsset(self, module):
+ raise KeyError("Could not find asset '%s' for '%s' addon" % (self.url, module))
@openerp.tools.func.lazy_property
def content(self):
else:
return '<script type="text/javascript" charset="utf-8">%s</script>' % self.source
+ def _missingAsset(self, module):
+ self.source="console.log('Missing JS source : %s')" % self.url
+ self.url = None
+ self.last_modified = datetime.datetime.now()
+
class StylesheetAsset(WebAsset):
rx_import = re.compile(r"""@import\s+('|")(?!'|"|/|https?://)""", re.U)
rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://|data:)""", re.U)