To distinguish two ir.attachment 'File Content', we base it on the file
size (this I imagine is for efficiency).
This is done by setting bin_size in the context. Doing this, the
returned db_datas field will be the file size of the converted to base64
content (if no filestore).
But this size is returned in string format, so "get_nice_size" (in
openerp/osv/fields.py) which gets this size calculates the length of the
string. e.g: if the size is '2142' get_nice_size will return 4.
This fix solves this by converting the string to an integer, thus
unifying it with the filestore case (where we use os.path.getsize which
return an integer).
Also, the field presenting the issue (FieldBinaryFile) has been changed
so it is always updated even if the size is the same (as it was already
done by 3632949 for FieldBinaryImage widget).
closes#7223
opw-643071
This decision comes from the following bug:
- Go to Sales -> Quotations, and open any existing quotation in form view (the
partner must have an address defined)
- Click on the partner
- Click on the stat button "Claims"
- You notice that the address of the partner is included in the search
This is due to the context property show_address which is set to 1 when a
quotation is open. Therefore, it is necessary to filter out this keyword.
Since the prefix "show_" is used for only few context variables, it was decided
to define this pattern as a standard pattern to filter out.
opw-642893
Partial backport of commit 093e39bd.
When a flow is stopped by a login redirection, some data (e.g: a product
comment being posted) could be lost. This commit in this case convert
POST request data to GET data (so it is possible to add a GET controller
which after login will terminate the action).
closes#7100
opw-642350
In css, overflow-x and overflow-y must have the same value. If overflow-x is equal to
auto then overflow-y is equal to auto.
To solve the problem, the height of the input is removed because it is forced by the Jquery
auto-completion plugin according to the wrapper.
Without this patch, when you go to Settings > Import/Export > Export Translation and click on the arrow to
to show the list of modules you can export, the list is partially hidden.
opw:632607
When a user tries to log into a postgresql database with no view web.login (this
happens if the database is not an odoo database or using a previous version of
odoo), the rendering failed, producing a 500 error (with no detail for the user)
Instead, redirect to the database selector with an informative message.
Fixes#3443
The database selector page is a jinja template with no access to database
required so should be able to be displayed on any database.
Future improvement could verify the version of base module for even more precise
verification before login (but need to make sure it's always accurate).
When the upload of an attachment failed,
e.g. for access rights reasons,
the traceback wasn't written or returned anywhere,
preventing the easy debugging.
opw-640242
To be able to see record attachments, you need to have
read access to the record.
To be able to add or delete attachment, you need to
have write access to the record.
The button add/delete were displayed as soon
as you had the read access, but if you had not the
write access, both buttons failed.
This revision do not display the add/delete
buttons of Attachment dropdown menu if you do not
have the right to add / delete attachments to the record
(you do not have write access to the record)
opw-640242
The headers returned by content_disposition must be either in Unicode or in ASCII.
The encode function expects a Unicode or ASCII string.
The quote function from urllib2 expects a UTF-8 string and retruns a ASCII string.
opw:634205
Fixes#6160, #6557
With Safari, the function content_disposition must return "attachment; filename=\"%s\"" % filename
to avoid that Werkzeug raises an UnicodeDecodeError.
Fixes#6160
opw:634205
The datejs globalisation files are loaded based on the user's language.
If the file is not present, the loading crashed and the user could not access to
the web client.
Adding empty files for lo_LA and renaming bs-BS.js to bs-BA.js for bs_BA (see
65d92da) that were missing.
By the way, this is a 0 bit commit, beat that!
When using another decimal separator than `.` (dot)
in the language settings,
it wasn't possible to build an advanced search specifying
the decimals.
e.g. with a language with decimal separator `,` and thousand
separator `.`,
if you want to search invoices with amount total 366,38
The advanced search "Total" "is equal to" obliged you
to enter your number with `.` as separator (366.38),
and then, when entering the search, the `.` was
regarded as the thousand separator, giving as domain
`('amount_total', '=', 36638)`, which is not what you asked.
opw-634201
PS: The `|| '.'` in the xml template are only for
retro-compatibility, so if the server sources are
updated, but the browser cache is not refreshed
(meaning the Javascript code isn't refreshed, and,
therefore, `widget.decimal_point is undefined)
it still works.
This fix gives the domain to the "See selection" view opened from a
FieldCharDomain.
In Odoo 8.0, this widget is available at two places:
- mass_mailing: Marketing > Mass Mailing | Mass Mailing > (any
newsletter) > "See selection".
- gamification: Settings > Gamification Tools > Challenge > (any
challenge) > "See selection".
With this fix the "Selected records" view display selected records.
closes#6463
opw-633201
In the search input, the result of filtered search with an arrow was
placed under the currently selected arrow.
Hence if we get to another arrow filter before the result is received,
the result is added under the wrong arrow.
This fix adds the result under the right arrow.
closes#6442
opw-632519
The onchange handler is doing a weak comparison between the values received from
the onchange() method and the current field value, which leads to a falsy value
such as "0000" being treated as equal to False.
This patches changes the operator to enforce non-coercive equality.
Fixes#6405
This fix adds the toJSON() method to datetime.datetime,
so domain expressions can use datetime values directly,
without having to compute the stringified version
with convoluted strftime() and timezone calculations.
The datetime results are sent down to the JSON-RPC
level where the JSON.stringify() serialization will
convert them to UTC string, to be deserialized
properly as UTC datetime values on the server side.
Thanks to this we can use the browser's local midnight
timestamp in a filter expression, for example like this:
`datetime.datetime.combine(context_today(), datetime.time(0,0,0))`
and get the expected result regardless of the user/browser's
timezone.
related to issue #2972 and pull request #2914 and #6229
(Next commit will fix them)
opw-621282
Previously, there was an exception when exporting unordinary table (e.g:
reports) coming from the export of the xml_id.
With this change, if the table is not ordinary, the xml_id is not
present in the exported file.
closes#6428
issue #6336
opw-633066
When a many2one field of a searchview was selected
by default, through a default_*_id within the context,
the many2one value name wasn't translated.
e.g. with Spanish loaded (and l10n_multilang installed),
translate a project.project name in Spanish.
Then, while being in Spanish, in the project.project kanban,
click on the Tasks link of a project (tareas),
then, notice the value of the project name in the
search bar.
opw-632818
Currently (since commit e6a2d222d6), the domain of a search view field tag
is dropped.
This previous change was done since some of these domains refers to a
field not available in the javascript.
This fix drop the domain only if it can't be evaluated in the javascript
side.
opw-632030
If a onchange is set on a binary field, the name of the file (filename attribute
defined in the view) is still the name of the previous file.
Fixes#2427, opw 617109
When setting a value to a field binary, a char field can be set as 'filename'
that needs to be recomputed to specify the new file name.
Before new api, the _internal_set_value method would trigger a onchange but it's
no longer the case now (so onchange on filename field was no longer executed).
Instead, manually set the value using set_value method which do trigger the
onchange.
Fixes#2427, opw 617109
When opening a task through a modal, like
when opening the task field of an issue while
being in edit mode, the priority stars
had not the same design than in the
regular task form.
opw-633426
Create a new stylesheet for IE9 and less custom css.
The issue #6198 and #6201 is present in IE9 since a div with height 100% inside
a table-cell (i.e: td tag) element only take the minimum height possible for the
content.
For issue #6198: in IE9 a kanban tile could not be moved to an empty kanban,
this fix sets a minimum height for a empty column (80px, the size of two empty
tiles) so now a tile can be moved in the 80px in the top of the column.
For issue #6201: graphs took the minimum height in IE9, this fix set a fixed
height to improve the situation.
For issue #6200: in IE9, the list view could wrongly not go the next line
even if its width is 100%. For the given case, the display CSS property of
these listview is set to value "block".
opw-632415 opw-632417 opw-632416
On internet explorer 6, 7, 8 and 9, the limit of CSS rules in a stylesheet is
4095 (http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx).
This commit breaks down a CSS bundle in several pages for these IE versions.
To do this, the CSS tag added is of the kind : /web/css.0/{xmlid}/{version} in
which there is:
- the whole CSS if there is no more than one page,
- a list of @import pointing to the multiple pages.
note: if a modification lowers the number of page, an old page may stay in
ir_attachment (e.g: go from 4 to 3 pages, the old 4th page of another version
will not be deleted untill the number goes again up to 4).
Note: the method css(self) previously returned an unicode variable (the first
time) or an str variable (the following times, if already cached), the fix
also correct this so an str variable is always returned.
fixes#5050
opw-627116
Do not check float_is_zero for float fields with
digits specifically set to 0, it means
the rounding precision is infintie for those ones,
and tmp === val is enough.
Apparently, browsers decide how they want to style readonly inputs,
and it seems like Firefox is greying them out while Chrome doesn't.
We use an opacity: 0.5 rule to grey them out ourselves in Chrome,
but in Firefox they are not dark enough to read easily because of
the double greying. I checked with the designers but they don't
have any better fix for that.
On a line write in a account.move.line tree view, the on_write return all the
sibling move lines of the written move line. The lines are then displayed even
if they do not match the current search domain.
This fix adds the context on the given on_write callback request, and in
on_create_write use a on_write_domain in this context to filter the returned ids.
fixes#3161, closes#5727
opw-630093
Currently, the view_form search_count doesn't propagate the context, so when
searching on a translated field, the count can be different than the one we
would expect and get with a search in a current language different than en_US.
opw-628792 opw-630212 closes#5825
The sequence for new items in some models is simply set to a constant 10.
Hence if 3 items had after reordering sequences 10, 11 and 12. If a new item is
added, it would get after saving at the second position.
This fix set the sequence of a new item to the maximum+1 or minimum-1 sequence
of current items sequences (max if tree has editable="bottom", min if tree has
editable="top").
opw-627830
This temporary patch was used to simulate the presence of a
`display_name` field in all models. It is not needed anymore
as of version 8.0, which comes with the actual magic to make
`display_name` work everywhere.
This patch removes the asynchronous code that was
still used to open the autocompletion drawer.
Even with the setTimeout delay forced to 0, the
asynchronous handling meant the final ENTER
keyUp event could be processed before the opening
of the autocompletion drawer related to the last
key pressed. This would trigger the search with
the search string of the previous autocompletion
popup, missing the last few keys.
Also handle ENTER at keyDown, because in some
rare cases a barcode scanner may emit only
the keyDown event for ENTER, without the
corresponding keyUp, causing a merge of two
successive scanned barcodes.
Based on many tests conducted with different
barcode scanners, the only thing that
is guaranteed is the correct order of the keyPress
events for all regular characters, and the
fact that the ENTER keyDown and/or keyUp will
always be sent after them.
All other events can be mixed or simply missing
if you make a rapid succession of scans, especially
if done with a long series of barcodes.
Scanners tested (with 1ms data transmission delay):
- Honeywell Eclipse MS5145
- Dacomex Slim 50mm CCD scanner
The menu was not present in 8.0 when going back from the mass mailing email
composer to the backend. This fix adds the current action id as a return_action
query string parameter and return to the correct action.
fixes#5591
opw-629526
This patch hopefully solves an annoying issue with the search view:
when the user types really fast (or uses a barcode scanner for example),
the resulting search string was (sometimes) missing the last few
characters. I'm unclear on the exact reason why it happens. From the
code, I can only guess that it happens because the scanner use a TAB
key instead of ENTER (TAB is handled in keydown event, ENTER in keyup),
or that the key events aren't in a correct order (if the user press a
key A, then press ENTER, then release ENTER, then release A, it results
in an empty key).
Anyway, the way this patch probably solves the issue is by using the
keypress event for triggering the search view. I hope that in every
case, the keypress event are correctly ordered. It leads to some code
I'm not really proud of this patch, but the key event handling are
quite messy. Also, I need to handle the search string also when the
keyup event is fired, because it might change the search (for example
backspace trigger a keyup, but not a keypress).
Allows exporting fields whose string is a non-ascii *byte*string (rather than unicode).
backport of 7286f4e424 fixing #773 to branch 7.0 by request of @flotho
This issue is related to
http://bugs.jqueryui.com/ticket/8656http://bugs.jqueryui.com/ticket/8749d693ce5324
When opening a form view, scrolling down,
and opening a many2one dropdown menu,
the dropdown menu wasn't directly under its input.
It could be really problematic when the menu was not even
visible on the current browser page (when you had to scroll down
a lot to access the many2one input).
The issue was resolved as soon as you opened the dropdown
menu a second time, and did not happen if you didn't scrolldown.
But, on initialization, the dropdown menu wasn't at the right position.
Fixes#5603
opw-629601
Text fields, or char fields having widget="text",
were not sized correctly when the field was not
visible by default, ans was set visible thanks
to attrs and other fields values.
opw-629394
Rewrite relativedelta.__add__ based on dateutil 2.4.0
* completely remove any hint of supporting time deltas (could be
implemented in the future, but not currently asked for and lots of
code to implement)
* implement weekday support (ordinal only)
* probably better leapyear support
* remove relativedelta.__sub__ (only works between relativedeltas)
* add relativedelta.__neg__
fixes#5089
inherited from main CSS, would prevent from scrolling body and thus from
seeing all the test cases and test case contents (e.g. error messages
and stack traces)
When providing an args of ``null`` (or ``undefined``) and a non-empty
kwargs, the kwargs would be removed/ignored.
While explicitly providing a null args is not necessary, it's perfectly
valid.
The priority widget did not handle the readonly concept
It was therefore possible to set the priority of
an issue (for instance) even if the field was marked
as readonly.
opw-628960
When accessing an existing record in form mode directly (enter the url or refresh a page), the daterecord has not been initialized yet. This means that the value of actual_mode will be set to 'edit' before loading the current record (method _actualize_mode() called from do_show()).
This was problematic for one2many fields that we loaded in edit mode, showing add/delete icons/buttons in readonly views. (opw 607910)
Backport of 7ec7f1ba40 for 7.0 and saas<6. (opw 627885)
When the number of records n and the limit l were such that n%l = 0
(e.g. 16 records total, 8 displayed per page), clicking on the
previous button on the first page, or on the next button on the
last page produced a bug because the total number of pages
computed for this edge case was incorrect.
27a48f8026 introduced the use of self.dataset
It appears it is not always defined.
Few lines above, self.getParent().dataset is used,
and looks to be always defined.
We therefore now use this dataset in order to get the context,
to correctly pass the current session language.
Closes#5416
This rev. reverts partially 1d76586a1b
This rev. is related to #3462
Regarding addons/web/controllers/main.py
---
name of model ir.actions.actions is not translated
it's the name of server actions, client actions and window actions
that are translated.
Meaning the name of the ir.actions.actions will always be in English,
even when passing the user language within the context.
Regarding addons/web/static/src/js/views.js
---
There is no reason to pass the field values within the context
of the /web/action/load call: The read methods of actions are
not overidden to use the field values. Besides, it pollutes
the context of the action, leading to unwanted behavior, such
as the translation of the action name within the lang available in the
fields of the form view (e.g. the partner form).
Initially, the field values added in the context has been added
within the rev. 542928adde
Indeed, sidebar_context (or sidebar_eval_context nowadays), contains
the field values, and the additional_context passed to /web/action/load
is an extension of this sidebar_context.
We are not sure the reasons why the sidebar_context was passed to the
/web/action/load, but we believe it was to pass the session/user context
containing the lang, timezone, and so on, not to pass the fields values.
Without this, if the user creates a second line (or more) with another search query and presses tab (or clicks somewhere else) quickly, it will take the previous search result instead of the new one because the new one did not occur yet.
With this fix, if the search did not have time to process, the Create a product modal appears, just like it already did for the same behavior on the first line.
Fixes 620679.
When having several databases in the login form (not monodb mode),
when switching from one database to another,
if the company logo was different,
the company logo could be the logo of the database you came from.
fixes#5291
opw-628131
When clicking on an element in a listview editable, the record_id
is not updated in the dataset, which means that when you switch to form
view, the list view does not display the last selected record.
Also, it should fix the issue solved by PR pull/2725