diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 852d5138177..b6405873f80 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1184,23 +1184,40 @@ class Binary(openerpweb.Controller): return open(os.path.join(addons_path, 'web', 'static', 'src', 'img', 'placeholder.png'), 'rb').read() @openerpweb.httprequest - def saveas(self, req, model, id, field, fieldname, **kw): + def saveas(self, req, model, field, id=None, filename_field=None, **kw): + """ Download link for files stored as binary fields. + + If the ``id`` parameter is omitted, fetches the default value for the + binary field (via ``default_get``), otherwise fetches the field for + that precise record. + + :param req: OpenERP request + :type req: :class:`web.common.http.HttpRequest` + :param str model: name of the model to fetch the binary from + :param str field: binary field + :param str id: id of the record from which to fetch the binary + :param str filename_field: field holding the file's name, if any + :returns: :class:`werkzeug.wrappers.Response` + """ Model = req.session.model(model) context = req.session.eval_context(req.context) + fields = [field] + if filename_field: + fields.append(filename_field) if id: - res = Model.read([int(id)], [field, fieldname], context)[0] + res = Model.read([int(id)], fields, context)[0] else: - res = Model.default_get([field, fieldname], context) + res = Model.default_get(fields, context) filecontent = base64.b64decode(res.get(field, '')) if not filecontent: return req.not_found() else: filename = '%s_%s' % (model.replace('.', '_'), id) - if fieldname: - filename = res.get(fieldname, '') or filename + if filename_field: + filename = res.get(filename_field, '') or filename return req.make_response(filecontent, [('Content-Type', 'application/octet-stream'), - ('Content-Disposition', 'attachment; filename=' + filename)]) + ('Content-Disposition', 'attachment; filename="%s"' % filename)]) @openerpweb.httprequest def upload(self, req, callback, ufile): diff --git a/addons/web/po/ru.po b/addons/web/po/ru.po index beecb0203c1..0347a9e6c25 100644 --- a/addons/web/po/ru.po +++ b/addons/web/po/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openerp-web\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2011-12-20 18:48+0100\n" -"PO-Revision-Date: 2011-12-06 08:05+0000\n" -"Last-Translator: FULL NAME \n" +"PO-Revision-Date: 2012-01-10 10:48+0000\n" +"Last-Translator: Aleksei Motsik \n" "Language-Team: Russian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-01-04 05:17+0000\n" -"X-Generator: Launchpad (build 14616)\n" +"X-Launchpad-Export-Date: 2012-01-11 04:55+0000\n" +"X-Generator: Launchpad (build 14640)\n" #: addons/web/static/src/js/chrome.js:162 #: addons/web/static/src/js/chrome.js:175 @@ -28,15 +28,15 @@ msgstr "" #: addons/web/static/src/js/chrome.js:668 msgid "About" -msgstr "" +msgstr "О программе" #: addons/web/static/src/js/chrome.js:748 msgid "Preferences" -msgstr "" +msgstr "Настройки" #: addons/web/static/src/js/chrome.js:752 msgid "Change password" -msgstr "" +msgstr "Изменить пароль" #: addons/web/static/src/js/chrome.js:753 #: addons/web/static/src/js/search.js:235 @@ -47,21 +47,21 @@ msgstr "" #: addons/web/static/src/js/view_form.js:1085 #: addons/web/static/src/xml/base.xml:0 msgid "Cancel" -msgstr "" +msgstr "Отмена" #: addons/web/static/src/js/chrome.js:754 #: addons/web/static/src/js/view_editor.js:75 #: addons/web/static/src/js/views.js:871 addons/web/static/src/xml/base.xml:0 msgid "Save" -msgstr "" +msgstr "Сохранить" #: addons/web/static/src/js/chrome.js:774 addons/web/static/src/xml/base.xml:0 msgid "Change Password" -msgstr "" +msgstr "Изменить пароль" #: addons/web/static/src/js/data_export.js:6 msgid "Export Data" -msgstr "" +msgstr "Экспорт данных" #: addons/web/static/src/js/data_export.js:23 #: addons/web/static/src/js/data_import.js:73 @@ -70,7 +70,7 @@ msgstr "" #: addons/web/static/src/js/view_form.js:2775 #: addons/web/static/src/js/views.js:872 msgid "Close" -msgstr "" +msgstr "Закрыть" #: addons/web/static/src/js/data_export.js:24 msgid "Export To File" @@ -78,32 +78,32 @@ msgstr "" #: addons/web/static/src/js/data_import.js:34 msgid "Import Data" -msgstr "" +msgstr "Импорт данных" #: addons/web/static/src/js/data_import.js:74 msgid "Import File" -msgstr "" +msgstr "Импортировать файл" #: addons/web/static/src/js/data_import.js:109 msgid "External ID" -msgstr "" +msgstr "Внешний идентификатор" #: addons/web/static/src/js/search.js:233 msgid "Filter Entry" -msgstr "" +msgstr "Входящий фильтр" #: addons/web/static/src/js/search.js:238 #: addons/web/static/src/js/search.js:279 msgid "OK" -msgstr "" +msgstr "OK" #: addons/web/static/src/js/search.js:274 addons/web/static/src/xml/base.xml:0 msgid "Add to Dashboard" -msgstr "" +msgstr "Добавить на Панель" #: addons/web/static/src/js/search.js:403 msgid "Invalid Search" -msgstr "" +msgstr "Ошибка поиска" #: addons/web/static/src/js/search.js:403 msgid "triggered from search view" @@ -113,30 +113,31 @@ msgstr "" #, python-format msgid "Incorrect value for field %(fieldname)s: [%(value)s] is %(message)s" msgstr "" +"Некорректное значение для поля %(fieldname)s: [%(value)s] в %(message)s" #: addons/web/static/src/js/search.js:822 msgid "not a valid integer" -msgstr "" +msgstr "не является целым числом" #: addons/web/static/src/js/search.js:836 msgid "not a valid number" -msgstr "" +msgstr "не является числом" #: addons/web/static/src/js/search.js:898 msgid "Yes" -msgstr "" +msgstr "Да" #: addons/web/static/src/js/search.js:899 msgid "No" -msgstr "" +msgstr "Нет" #: addons/web/static/src/js/search.js:1252 msgid "contains" -msgstr "" +msgstr "содержит" #: addons/web/static/src/js/search.js:1253 msgid "doesn't contain" -msgstr "" +msgstr "не содержит" #: addons/web/static/src/js/search.js:1254 #: addons/web/static/src/js/search.js:1269 @@ -144,7 +145,7 @@ msgstr "" #: addons/web/static/src/js/search.js:1309 #: addons/web/static/src/js/search.js:1331 msgid "is equal to" -msgstr "" +msgstr "соответствует" #: addons/web/static/src/js/search.js:1255 #: addons/web/static/src/js/search.js:1270 @@ -152,7 +153,7 @@ msgstr "" #: addons/web/static/src/js/search.js:1310 #: addons/web/static/src/js/search.js:1332 msgid "is not equal to" -msgstr "" +msgstr "не соответствует" #: addons/web/static/src/js/search.js:1256 #: addons/web/static/src/js/search.js:1271 @@ -160,7 +161,7 @@ msgstr "" #: addons/web/static/src/js/search.js:1311 #: addons/web/static/src/js/search.js:1333 msgid "greater than" -msgstr "" +msgstr "больше чем" #: addons/web/static/src/js/search.js:1257 #: addons/web/static/src/js/search.js:1272 @@ -168,7 +169,7 @@ msgstr "" #: addons/web/static/src/js/search.js:1312 #: addons/web/static/src/js/search.js:1334 msgid "less than" -msgstr "" +msgstr "меньше чем" #: addons/web/static/src/js/search.js:1258 #: addons/web/static/src/js/search.js:1273 @@ -176,7 +177,7 @@ msgstr "" #: addons/web/static/src/js/search.js:1313 #: addons/web/static/src/js/search.js:1335 msgid "greater or equal than" -msgstr "" +msgstr "больше или равен" #: addons/web/static/src/js/search.js:1259 #: addons/web/static/src/js/search.js:1274 diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index df6d78e8aa5..6da9f1bbe8d 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2033,6 +2033,7 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { .openerp .oe_vm_switch_form, .openerp .oe_vm_switch_page, +.openerp .oe_vm_switch_tree, .openerp .oe_vm_switch_list, .openerp .oe_vm_switch_graph, .openerp .oe_vm_switch_gantt, @@ -2049,6 +2050,7 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { .openerp .oe_vm_switch_form span, .openerp .oe_vm_switch_page span, +.openerp .oe_vm_switch_tree span, .openerp .oe_vm_switch_list span, .openerp .oe_vm_switch_graph span, .openerp .oe_vm_switch_gantt span, @@ -2068,6 +2070,16 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { background-position: 0px -21px; } +.openerp .oe_vm_switch_tree { + background-position: 0px 0px; +} +.openerp .oe_vm_switch_tree:active, +.openerp .oe_vm_switch_tree:hover, +.openerp .oe_vm_switch_tree:focus, +.openerp .oe_vm_switch_tree[disabled="disabled"] { + background-position: 0px -21px; +} + .openerp .oe_vm_switch_form { background-position: -22px 0px; } @@ -2078,6 +2090,15 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { background-position: -22px -21px; } +.openerp .oe_vm_switch_page { + background-position: -22px 0px; +} +.openerp .oe_vm_switch_page:active, +.openerp .oe_vm_switch_page:hover, +.openerp .oe_vm_switch_page:focus, +.openerp .oe_vm_switch_page[disabled="disabled"] { + background-position: -22px -21px; +} .openerp .oe_vm_switch_graph { background-position: -44px 0px; } diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 2418439ac46..819301f9e55 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -237,7 +237,15 @@ openerp.web.auto_date_to_str = function(value, type) { }; /** - * Formats a provided cell based on its field type + * Formats a provided cell based on its field type. Most of the field types + * return a correctly formatted value, but some tags and fields are + * special-cased in their handling: + * + * * buttons will return an actual ``