Before this commit, there was a default behaviour reducing the padding of the qweb render
to 0 in order to display bakcground images correctly. Unfortunately, this doesn"t take in account
cases where images or more generally, qweb template were not provided in the InsufficientCreditError
message.
This commit solves this situation.
Before this commit, the way mode was handled was not optimal. The end
result was correct (the widget were properly created/displayed in
edit/readonly as required), but useless work was done. In particular,
if we have list/x2manys with widgets and modifiers, it could happen that
widgets were created in edit mode, then destroyed and recreated in
readonly mode.
This could happen in some important views, for example, any view with a
field many2many_tags with a readonly modifiers (pretty much all views
handling taxes)
In this commit, we add a 'editable' attribute to list renderer. This is
necessary, because the list renderer is not actually editable when it is
in a x2many in a form view which is in readonly mode. Also, we need to
manage the distinction between the fact that a list view is editable,
and the fact that some widgets are created in edit and other in readonly
mode, depending on modifiers, and on which line is being edited.
We also add a benchmark (courtesy of CHM) to be able to measure the
performance impact of edit/readonly/onchange in a larger form view.
Before this commit, running this form benchmark on my machine gave a
number of 0.4 op/sec, and after, it increases to 1.26 op/sec, so a
pretty large improvement.
There is a subtle issue happening in tests when we override a widget
property for the duration of the test and try to restore the initial state at
the end by rewriting on the property. It actually changes the widget, by
having a function bound to the sub widget prototype instead of its ancestor.
This in turns can cause weird interactions with the class system.
We introduced a proper way to temporarily patch a class/widget by adding
a method in testUtils to do exactly that. This commit simply uses that
method to prevent unwanted interactions in barcode tests
This rev. introduces two helper functions for the tests: patch
and unpatch. Those function allow patching an Odoo Widget (e.g.
AbstractField), and unpatch it at the end of the test with the
guarantee that the Widget's prototype is exactly the same as it
was before the test.
This was necessary because the way it was done before was a little
bit too naive, and could lead to unexpected behavior. Indeed, doing
var someFunction = AbstractField.prototype.someFunction;
// test content
AbstractField.prototype.someFunction = someFunction;
is correct if someFunction is actually define (or overriden) in
AbstractField, as in that case, it really exists on its prototype.
Otherwise, it isn't correct if it is not directly defined on the
prototype before the test, as it will be after..
The kanban view uses a template which comes from the server, already
translated. Before this commit, it tried to retranslate again the
template in qweb.js, which may be a problem (in addition to the useless
work): if some english string A is translated in B (french), but B is
also a valid english string which is translated into C in french, then
we will have a wrong result.
In this commit, we simply add a flag to disable the translation process, which
should also slightly improve the kanban view rendering performance.
- Sell a Product A
- From receipt screen, scan the barcode of Product B
- B will be in tab along with A
- Pay and validate
- Close the session
Only an order with Product A is recorded in the session (order 1).
When performing this set of actions, a new order is not created: the POS
simply reuses the current order. However, `create_from_ui` (called in
the receipt screen) discards an order if the reference already exists.
This means that the first order is correctly synchronized at validation,
while the second order is silently discarded.
Closes#16781
opw-766459
Purpose
=======
Unbreak consistency check:
- on creation (check not done)
- when applied to a record set of several sheets belonging to different employees (reporting spurious errors)
Specification
=============
- self.something() in a api.model method does not make sense, so I replaced it with a call on the newly created sheet.
- Iterate on sheets instead of mapping all the lines
Purpose
=======
Employee must match on sheet and lines
Since the employee_id field of hr.expense.sheet is modifiable in submit state, there is a possibility to modify a sheet in such a way that the employee does not match on the expense sheet and expense lines. This commit fixes this.
When using requisition with a mto product the link
between moves coming from supplier and move going to
customer are not created.
It happens because creating a purchase order from a
requisition set automaticaaly a default requisition id
that trigger an onchange. However the onchange modify the
move dest ids but those are not present in the purchase order
view and thus not send to the server during the create call.
This commit includes the move dest ids as invisible in the view.
Usecase to reproduce:
- Set a product with the same lot in different locations
- Create a MO that will uses theses products and that require more than one location
- Produce it.
-> Traceback Expected singleton: stock.move.line
It happens because product produce only expect one move line
by lot. Howeever it could exist more than one move line if the
product for a specific lot are shared among multiple under location.
This commit try to fill the move line with the correct quantity
one by one and add the extra in a new move line.
Use case to reproduce:
- Create a MO with a product tracked and a qty to produce greater than 1.
- The Bom should also use a routing with at least 2 operations.
- On the first workorder only produce 1 unit and record the production
- Go to the next workorder -> The final lot is not set.
It happens because the lot for the next workorder is only set if the
total quanity for the mo was produced.
This commit fixes the bug by removing the code for the workorder lot
assignation outside the wrong condition. This commit also update the
test test_00b_workorder_process that allows us to find the above bug.
Fix over this one: https://github.com/odoo/odoo/commit/cae188514fa8b0a7c785a630ac4aff677b2071fa
The intent was to disable buttons in form views until html fields are fully loaded,
but it was not disabling the buttons for the following reasons:
1. It is looking for buttons in the DOM, although they
are not already attached into the body at this moment.
2. It was disabling the buttons only at widget start(),
so only once after "Empty Cache and Hard Reload".
We propose a better solution than disabling the buttons in the control panel:
when we click on "Save", the html field ensures that it is fully loaded while commiting the changes.
When no input line is found in get_payslip_lines, the input line with
amount_python_compute = 'result = inputs.ARS.amount', the function __getattr__
on BrowsableObject returns 0.0 for ARS and raises an error for amount because
a float has no attribute amount.
Inspired from 9a6e7799fe
opw:785033
If a kanban view is grouped on a many2one, records with the field unset
are displayed in a column "Undefined" displayed first.
But the tab in mobile view doesn't respect this, so we can get:
columns: Undefined colA colB
tabs: colA colB Undefined
So we always get always on the wrong column wrong when clicking on a
tab: clicking on colB we get on colA, clicking on Undefined we get on
colB, ...
note: in this commit the "false" tab has been set to a translatable
"Undefined" name.
issue found when working on #21199
If at one time kanban column are sortable then they stay sortable for
ever even if they should not.
eg. kanban view is grouped by a many2one (sortable) then by selection
field (should not be sortable): the columns are still sortable.
issue found when working on #21199
A kanban column has two identifiers:
- db_id: framework unique identifier for the column
- id: either the record res_id (grouped on x2o) or the value
The issue is that sometimes the value may be a any string which
would be source of issue unexpected for an ID (and there was one
issue in mobile renderer).
This code change this so "id" is either the record res_id or
`undefined` value, and when used in XML we use id or fallback on db_id
when we need an identifier.
So in the XML data-id on a colum is always either the ID of the record
the group is based on, or the db_id in the form.
opw-782433
closes#21199
Before this commit, when grouping a kanban by date with a modifier
e.g. crm.lead grouped by create_date:month
A traceback was thrown on the python side bacause create_date:month was literally not a field
After this commit, the progress bar in that situation displays well,
at the price of copying bits of the read_group infrastructure
OPW 785021
- Added taxes for year 2018 of sales and purchase with percentage 3.7 and 7.7
- Added tags to show newly added tax in VAT report(enterprise branch) for Switzerland
Was PR #20851. Was task 39082.
- Added latest taxes for year 2018 of sales and purchase with percentage 3.7 and 7.7
- Added tags to show newly added taxies in VAT report(enterprise branch with PR #1628) for Switzerland
- Added fiscal positions mapping as well.
Was PR #20851. Was task 39082
Summernote uses `document.execCommand` to apply most styles when
editing, leveraging the implementation to the browser.
Summernote is configured to use HTML styling (`'styleWithSpan': false`),
and in this case, browsers such as Firefox use HTML attributes for
styling text align, while Chrome still uses CSS for that. In fact,
`document.execCommand` is browser-inconsistent... but so is the
`styleWithSpan` option. Indeed, setting the option to `true` will make
Firefox use CSS property for alignment too... but not Internet Explorer.
So we might consider changing this option's value but this would not
solve the current problem.
Indeed, any CSS `text-align` style in Firefox takes precedence above
the element's `align` attribute, so when users were trying to align text
on stuff that was pre-aligned, they were unable to do so.
We can better explain the situation with this example:
A user tries to left-align in Firefox a `p.text-center` element, and
produces this:
```html
<p class="text-center" align="left"/>
```
(`align` attribute is ignored because of the `text-center` class)
On Chrome, this would be produced with the same steps:
```html
<p class="text-center" style="text-align:left"/>
```
With this patch, we actually make that HTML look like expected by the
user, no matter the browser he's using, by forcing the editor to use
the text-align CSS property. Note that the implementation is quite
ugly but had to take care of compatibility.
See https://github.com/odoo/odoo/pull/20900
(thanks to @Yajo for original PR)
The condition in `_free_reservation` explicitely ignore move lines
having a done quantity. Let's imagine the scenrario where two stock
moves reserve all the quantity available and the user chose to process
all the quantity in a move while another user already set half the
quantity as reserved. In this case, we should keep the processed
quantity on the other move but correctly remove its reservation.
- Create an event with tickets
- Add the event in a SO
- Confim the SO
- Apply
An error occurs (record deleted).
Actually, the real error is hidden and is an insertion error in SQL on
`registration.editor.line` (`event_id` cannot be NULL).
`event_id` is mandatory but read-only, therefore it is not sent to the
server.
opw-787674