Commit Graph
125952 Commits
Author SHA1 Message Date
Joren Van Onder f18e4fc0ea [FIX] pos_hr: make employee selection work again
this is undefined, use self.

Oversight of 5f3b5f0a9d.

closes odoo/odoo#32860

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-22 23:57:55 +00:00
qsm-odoo 75f16ee07f [FIX] web, website: adapt menu loading to jQuery 3
Javascript is responsible of showing the menu, potentially with some
parts regrouped in an extra dropdown, on page load (this is what we
call the "autohide" feature). This was done on both the menu and the
affix menu. It worked on the affix menu because the affix menu widget
was initialized before (by luck: alphabetical order).

Since the jQuery 3 update https://github.com/odoo/odoo/commit/bb004e3d7f3df5a5af6b2e994ec0af79e2da890f
deferred are always delayed (even if their resolve condition is met on
creation). This made the animations to be initialized in the same order
as before but their 'start' method to be delayed (as the willStart was
delayed). So what happened before was:

1) Find menus to enable affix
2) Enable affix on found menus (duplicate the menus to do that)
3) Find menus to enable autohide
4) Enable autohide on found menus (both the menu and the duplicated one
   were found)

And since jQuery 3:

1) Find menus to enable affix
2) Find menus to enable autohide
3) Enable affix on found menus (duplicate the menus to do that)
4) Enable autohide on found menus (the duplicated one was not found at
   step 2 since it did not exist yet)

In fact, widget starting should never have relied on alphabetical order.
The fix only consists of starting widgets on the duplicated menu once it
is ready. This is what this commit does.

However, doing this revealed another bug: if the widgets are started
only for a DOM portion like a '.a' element, a widget with a multiple
parts selector like a '.a .b' selector will not be considered, as
searching inside a '.a' element will not allow to match elements with
a selector containing a '.a'. This is in fact not really a "bug" but a
limitation, so unless we get problems because of this in stable
versions, we can only "fix" this for the current saas. This is fixed
thanks to `dom.cssFind` which already existed. This commit however
improves it to try making it more efficient.

closes odoo/odoo#32465

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-19 12:07:14 +00:00
qsm-odoo a742bf3d5b [FIX] website_sale: fix double click on add to cart
Using "async" in the event parameter is not enough, you have to
return correct promises in the event handlers.

closes odoo/odoo#32479

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-19 11:17:56 +00:00
RomainLibert bf1e39540f [FIX] web: remove traceback when attaching a document
The closure overrides the arguments, which makes it impossible to
recover the attachment_ids hence sending null python code which then
breaks.

closes odoo/odoo#32810

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-04-18 14:02:14 +00:00
Cedric Snauwaert af1841560b [IMP] account: automatic periodical VAT closure
closes odoo/odoo#32619

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-04-17 12:10:33 +00:00
Cedric Snauwaert b72756be1f [IMP] account: next activities in misc journals dashboard 2019-04-17 12:10:24 +00:00
qdp-odoo 19aa35fabb [FIX] account: fix test_account_move_tax_lock_date.
Make sure the move, journal and the accounts will share the same company to prevent undeterministic error in runbot ('Cannot create moves for different companies.')

closes odoo/odoo#32759

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-04-17 08:34:48 +00:00
Yenthe666 8c402ca38a [FIX] stock: remove duplicated field definiton
closes odoo/odoo#32708

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-04-16 08:01:46 +00:00
Simon Lejeune 8c377471b6 [REF] sale_mrp: speedup tests
Before on rubot
odoo.addons.sale_mrp.tests.test_sale_mrp_flow tested in 97.08s, 117272 queries

After on runbot
odoo.addons.sale_mrp.tests.test_sale_mrp_flow tested in 50.84s, 61903 queries

closes odoo/odoo#32537

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-04-15 07:32:32 +00:00
Simon Lejeune 4ad81157e7 [REF] mrp_subcontracting: speedup tests
Before on runbot
odoo.addons.mrp_subcontracting.tests.test_subcontracting tested in 11.40s, 14213 queries

After on runbot
odoo.addons.mrp_subcontracting.tests.test_subcontracting tested in 7.95s, 9863 queries
2019-04-15 07:32:32 +00:00
Simon Lejeune 81afb10083 [REF] stock_account: speedup tests
Before on runbot
odoo.addons.stock_account.tests.test_stockvaluation tested in 25.52s, 59252 queries

After on runbot
odoo.addons.stock_account.tests.test_stockvaluation tested in 20.43s, 38535 queries
2019-04-15 07:32:32 +00:00
Simon Lejeune c5ff803fcc [REF] stock: speedup tests
before on runbot:
odoo.addons.stock.tests.test_move tested in 31.79s, 63166 queries
odoo.addons.stock.tests.test_move2 tested in 33.69s, 68046 queries
odoo.addons.stock.tests.test_quant tested in 8.48s, 15351 queries
odoo.addons.stock.tests.test_stock_flow tested in 16.99s, 31506 queries
amounting to 90 seconds on a build page

after om runbot:
odoo.addons.stock.tests.test_move tested in 12.41s, 24197 queries
odoo.addons.stock.tests.test_move2 tested in 13.55s, 24254 queries
odoo.addons.stock.tests.test_stock_flow tested in 9.74s, 15795 queries
amounting to 37 seconds on a build page

Use savepoint case instead of transaction case.

We took the opportunity to rename the master data more appropriately,
which results now in a bigger diff in TestMove and TestQuant. In
TestQuant, the master data creation had to be moved in the setUpClass
too.

We removed test_shipment as test_backorder_1-4 in tet_move_2 covers the
same parts of the code.
2019-04-15 07:32:32 +00:00
Arnold Moyaux 12da02d161 [REF] mrp: rename subproduct in byproduct
subproduct and byproduct are both used in code.
However the UI always shows by-product only.
Rename sub.product, sub_product,... in byproduct
in order to use the same term everywhere.

closes odoo/odoo#32540

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-04-12 12:50:34 +00:00
Arnold Moyaux b5780cf8bb [FIX] mrp: by-products typo + default type on product
Be consistent with by-products and byproducts. Only use by-products.
When a product is created from the BoM view, it has a default type
as storable product, set the same type when the product is created
from by-products tab.
2019-04-12 12:50:34 +00:00
Arnold Moyaux 1fac199517 [FIX] mrp: tracability on extra move line
Usecase to reproduce:
- BoM with final product tracked by SN
- Produce wizard add a component tracked by SN (not from BoM)
- Produce and mark the MO as done

The tracability report do not show the extra component used.

It happens because _record_production call _action_done on moves raw
and finished. _action_done create extra move with moves that created
more than expected (the purpose is to trigger rules). However in stock
the new move is created then merged in its parent but in mrp moves are
not merge. _record production set the tracability for initial moves but
ignore the extra moves created. So the tracability report is not
complete.

Fix it by catching the new moves created after _action_done and set
the consume_line_ids for the extra moves also.
2019-04-12 12:50:34 +00:00
Arnold Moyaux 030db4a4b0 [IMP] mrp: tracability on byproducts
In MRP the tracability is only set between the finished
products and the components. However when the by-products is
tracked by serial number, it could be usefull to know from which
components it was created. This commit add the link between by-products
and raw materials (only in produce wizard at the moment).

Technically we replaced the one2many field by a many2many.
2019-04-12 12:50:34 +00:00
Arnold Moyaux 3b4e33672a [IMP] mrp: unbuild byproducts
Unbuild a manufacturing order only undo the final product and its
components. The byproduct created will not be undo with the correct
ratio. This commit will allow to undo a ratio of byproducts for a
specific MO or base on the BoM if the byproducts are not tracked.
2019-04-12 12:50:34 +00:00
Arnold Moyaux a4c0994cf4 [REF] mrp: byproduct as a workorder line
Technical refactoring in order to set by-products the same way
than raw materials. Before this commit byproduct were always set
at the last workorder or automaticaly set at the end of produce
wizard with the same quantity than in the BoM. In order to modify
it, the user has to produce the finished product then unlock and edit
the finished move line linked to the byproduct. In this commit, the
user could specify at which workorder the byproduct is created and
he could directly specify another quantity done in the produce wizard
inside a specific tab for by-products.

Technicaly, abstract workorder will add a new many2one key on workorder
line in order to set 2 different one2many (one for finished goods and
the other for raw materials). The key is set depending the many2one
key for production on the linked stock move. On the by-products itself,
it is now managed as a workorder line, thus the code to generate them
and transform them in a finished stock move line is the same than for
the raw components.
2019-04-12 12:50:34 +00:00
Arnold Moyaux 6f25cf1aa7 [REF] mrp: add groups for byproducts
Since mrp_byproduct is in mrp. We want to keep the byproduct as an
additional feature. So this commit add a group and hide byproducts
fields in views.
2019-04-12 08:46:07 +00:00
Arnold Moyaux 4b2c73b0e0 [DEL] mrp_byproduct: remove module 2019-04-12 08:46:07 +00:00
Arnold Moyaux 5d1e73c5cb [MOV] mrp, mrp_byproduct: move byproduct in mrp
Move code from mrp_byproduct to mrp module. The purpose is to
delete mrp_byproduct module.
2019-04-12 08:46:07 +00:00
Aaron Bohy a3d98dae68 [FIX] web: do not open datepicker on focus
Before this rev., the datepicker was opened when a date(time) field
was focused (e.g. with keyboard navigation). We don't want this
behavior anymore, and we want the datepicker to open only when the
user clicks in the input. This rev. makes this change.

Moreover, this allowed to refined the keyboard navigation (ESC) in
editable list views: when a datepicker is opened, and the user
presses ESC, we close the datepicker, but we keep the row in
edition, whereas before this rev., the row was switched to readonly.

closes odoo/odoo#32408

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-04-12 12:42:02 +00:00
Aaron Bohy 7bc53ac30e [FIX] web: crash in editable lists with date field
Assume an editable list view with a date(time) widget, click to
edit a line, focus the date field (the datepicker opens), press
ESC: there is a crash in the lib, and the datepicker remains open
forever.

This fix is twofold:
 - we added a check in the lib to prevent it from crashing (it is
 easily reproducible: it crashes when an opened datepicker is
 removed from the DOM).
 - we added an event handler of ESC keydown event to hide the
 datepicker before the field is removed from the DOM.
2019-04-12 06:31:11 +00:00
David Monjoie cbafa9eddc [FIX] web: fix many2manytags widget height in editable list view
Subpixels computation is different accross browsers and platforms as no
rounding rule is specified by HTML5. Difference in this computation
breaks one of the editable list tests on Chrome and Firefox on MacOS.
2019-04-12 06:14:09 +00:00
Aaron Bohy b94c87c28d [FIX] web: list: update buttons when removing a search facet
In an editable list view with at least a facet (e.g. filter) in
the search view, start editing a row, then click on the 'x' to
remove the facet. The view being updated and re-rendered, the row
in edition (if still present) is back in readonly. However, the
buttons in the control panel are not updated ('Save' and 'Discard'
are still displayed, instead of 'Create' and 'Import').

Normally, when the user clicks outside the list, the edition is
left smoothly. However, this scenario is a corner-case because the
element we clicked on (the 'x' in the facet), is no longer in the
DOM when we enter the list '_onWindowClicked' handler, being in
charge of deciding whether or not we should leave the edition. For
this specific case, this handler doesn't leave the edition, because
it assumes that we have clicked on an sub-element of the list that
is no longer in the DOM (e.g. a modal opened from a field widget).
Since it's no longer in the DOM, there is no way to determine
whether it was in the list or not.

This whole '_onWindowClicked' logic is problematic, but we don't
have any better solution for now. So this rev. fixes the issue by
always resetting the buttons to 'readonly' when the view is
updated, which is valid in the case of the list view.

Unfortunately, we couldn't reproduce the bug in a test, because of
a difference between user clicks (with the mouse) in the browser,
and programmatical clicks (triggered in JS) as we do in the tests.
For natural clicks, there is a delay between the (different level
of) handlers call (probably a nextTick) whereas all handlers are
executed in the same tick for programmatically triggered clicks.
For instance, when the user clicks on the 'x' to remove the facet,
the 'click' handler on '.o_facet_remove' is executed, and the
searchbar is re-rendered (new Widget, so next micro-task tick, but
still before the next tick), and in the next tick, the 'click'
handler on 'html' is executed (and the event is triggered on
core.bus, followed by the execution on '_onWindowClicked'). In the
test, both handlers are executed directly, and thus when in
executing '_onWinowClicked', the searchbar hasn't been replaced by
the new one yet, and the clicked '.o_facet_remove' is still in the
DOM. The row is then unselected, and the buttons are correctly
updated.
2019-04-12 06:14:08 +00:00
Aaron Bohy 6722e66517 [FIX] web: list: editable="top" with less than 4 records
Before this rev., when adding then discarding a new record in a
(main) editable="top" list, the record was added to the top of
the list, and then replaced by an empty row when discarding,
whereas that empty row should have been rendered below potential
data rows.
2019-04-12 06:14:08 +00:00
Aaron Bohy d43624b5c5 [FIX] web: list: execute group button with keyboard navigation
Recent work on the list view allowed to add buttons in group
headers (see 015958dc17). However, we couldn't execute the action
of the button by pressing Enter, because the Enter keydown was
stopPropagated by another handler (folding the group).

This rev. makes this work, and also improves a bit the style of
the buttons in group headers.

Task 1915702
2019-04-12 06:14:08 +00:00
Aaron Bohy d971e4f4c7 [FIX] web: x2many list: edit and long click 'Add a line'
Assume an x2many editable list where the user edits a record (input
field), and then clicks on 'Add a line' (and keeps it pressed for a
while, before releasing the click).

When the 'mousedown' event occurs, the 'change' event is triggered
on the edited field, and (once potential onchanges have been
applied), the list is updated, i.e. all rows except for the one
being edited a re-rendered.

However, the 'Add a line' handler listens to the 'click' event,
which never occurs if we release the click after the rows have been
re-rendered.

This is an issue for every rows, not only 'Add a line', but for
data rows, the issue is already present in former versions, and is
not that easy to fix). The 'Add a line' case is a consequence of
the recent work on list views (see 234d92c4f0), so we can fix it
independently.

Task 1915702
2019-04-12 06:14:08 +00:00
Cedric Snauwaert f7432d0d04 [FIX] l10n_be: remove duplicated tax groups
There was one tax group per tax which was strange, so remove all duplicated tax group and only keep one tax group per tax percentage (0%, 6%, 12%, 21%)

closes odoo/odoo#32585

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-04-12 11:37:35 +00:00
Martin Geubelle 120359bf0c [FIX] web: restore handle and remove button width on list
Rev. odoo/odoo@9fbb4fb wrongly removed the fixed width on handle and
button width on list views.

This commit restores it.

closes odoo/odoo#32467

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-05 13:37:56 +00:00
Martin Geubelle cdd644befc [FIX] web: correctly update modifiers in editable list with buttons
Since rev. odoo/odoo@015958d it is possible to add buttons in list group
headers. These buttons are defined in <groupby> nodes, pointing to m2o
fields. Modifiers specified on these buttons thus use fields on the m2o
comodel.

There was a traceback in editable list view, when grouping by a m2o
that defines a groupby button with modifiers as the modifiers are not
registered with the same datapoint. When updating the modifiers, one
must ensure that the modifier are related to the updated record.

closes odoo/odoo#32456

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-08 11:23:24 +00:00
Aurélien Warnon b424aba504 [FIX] sale_product_configurator: remove es6 JS code
Task#1964518

This commit removes es6 code that was unintentionaly introduced
by the product configurator for better compatibility

closes odoo/odoo#32452

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-04-12 06:37:09 +00:00
Christophe Simonis 3fc2577c01 [MERGE] forward port branch saas-12.2 up to be3c981423 2019-04-11 19:27:36 +02:00
Christophe Simonis be3c981423 [MERGE] forward port branch saas-12.1 up to 636df25f21 2019-04-11 18:17:25 +02:00
Christophe Simonis 636df25f21 [MERGE] forward port branch 12.0 up to c9d3653f48 2019-04-11 18:00:27 +02:00
Christophe Simonis e7a0d82c3c [FIX] account_check_printing: correct test
Since 491deeb3d4, only check related to
reconciled invoices are printed. Adapt test to take it into account.
2019-04-11 17:24:25 +02:00
Arnold Moyaux c9d3653f48 [FIX] mrp: state on workorder with 0 batch size
Usecase:
- Go on a BoM with a routing. Go on the first operation and set
the next operation(batch field) as 'Once a minimum number of products is
processed'.
- Set the batch size (minimum operation) to 0.
- Create a MO and plan it.
- The second work order has state 'pending' instead of 'ready'

It happens because the system automatically set the first wo as
'ready' and the following as 'pending' and don't check the batch
and batch_size.

closes odoo/odoo#32628

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-04-11 13:21:54 +00:00
Hugo Vinicius Garcia Razera 2a88e0197a [CLA] Sign Odoo CLA for hviniciusg
closes odoo/odoo#32591

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-04-11 11:55:38 +00:00
Yannick Tivisse 87a30cca7d [IMP] l10n_be_hr_payroll: Add an overridable method to compute costs
closes odoo/odoo#32582

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-04-11 11:19:50 +00:00
Nans Lefebvre 9365dc5d17 [FIX] account: better message on user group error
The validation error introduced in 552da8dc can pop up in contexts where
it is not expected;
e.g. not in editing user rights but while upgrading a module.
Therefore we make it more explicit, giving the user a way to resolve the error.

closes odoo/odoo#32623

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-04-11 10:29:30 +00:00
Xavier Morel 6bd9e71d9d [FIX] SSF: misinterpretation of onchange command (4)
From an onchange, at this point, (4) doesn't mean "no change" it means
"reset to database values". Through the interplay of client and server
reverse-engineering one another at this point the client (is supposed
to) assume the o2m results are "complete" and a diff from the
current *in-database* values rather than the in-client (sent to the
server) ones.

So a (1) should completely replace all existing values, and a (4)
should just remove all of them (but keep the record linked).

closes odoo/odoo#32617

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-04-11 07:49:21 +00:00
Goffin Simon 36d4c99828 [FIX] sale_coupon: Promotion code removed when adding in shopping cart
Steps to reproduce:
- Create a sale.coupon.program with a discount of 10% and generate coupons for it
- Go on the shop and add a product of 100€ in the cart
- Go in your shopping cart and add a promotion code
- A new line has been created in your cart with a discount of 10€
- Click on "Process to checkout"

Bug:

The discount had been removed from the cart

Technically:

When clicking on button "Process to checkout", the function "recompute_coupon_lines" is called several times.
The second time, in function "_remove_invalid_reward_lines", the valid applied coupon program couldn't be retrieved
due to the sale price of the discount_line_product_id = -1000000 €. The function _filter_on_mimimum_amount filtered
the targted program  because the untaxed_amount of the order was equal to -999900€. So the program._compute_program_amount
was all the time greater than untaxed_amount or untaxed_amount + tax_amount

It s not consistant to set a default value to -1000000 to prevent pricelist strikethrough because in some currencies,-1000000 is not enough.
Now the reward lines are not strikethrough.

X-port/cherry-pick of odoo/enterprise@2748249c0b

opw:1957671
2019-04-10 18:59:59 +02:00
Christophe Simonis 3a3f7fd586 [FIX] web: convert forward-ported test to use async/await 2019-04-10 18:11:24 +02:00
Christophe Simonis b917fdd1ac [FIX] web: correctly forward-port 8d34eb1328.
I shouldn't have trust the comment and apply the patch anyway.
2019-04-10 18:09:55 +02:00
Aurélien Warnon 2268e747c9 [FIX] survey: allow creating survey with no sections
Task#1958723

This commit fixes the survey form to allow creating, testing and sharing
surveys that don't have sections as long as they don't use the "page_per_section"
layout.

closes odoo/odoo#32159

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-04-10 15:03:10 +00:00
Priyanka Kakadiya 61495126ae [FIX] survey: correct score of answer in demo data
- when answer is correct, then score should be +1.

Related to Issue: 1967506

closes odoo/odoo#32612

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-04-11 07:02:59 +00:00
Goffin Simon 5a83cd2649 [FIX]sale_stock: Issue when clicking on "No backorder"
Steps to reproduce the bug:
- Create a SO with no salesperson
- Add a SO line with 2 storable product
- Confirm the SO and deliver only one product
- Click on "No backorder"

Bug:

A error was raised because the function "_log_activity"(called by _log_less_quantities_than_expected) requires a responsible

Partial Backport: https://github.com/odoo/odoo/commit/e1f9499d2672fb0a346f8ac74552f038f5204a64

opw:1950968

closes odoo/odoo#32592

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-04-10 14:35:40 +00:00
Christophe Simonis 5313cea8e6 [FIX] snailmail: add missing model entry in test declaration
This allow enterprise tests to pass.
2019-04-10 15:38:09 +02:00
Christophe Simonis e145f2b0c8 [MERGE] forward port branch saas-12.2 up to 2694174b41 2019-04-10 15:10:24 +02:00
Christophe Simonis 2694174b41 [MERGE] forward port branch saas-12.1 up to 0fb9110e46 2019-04-10 14:24:09 +02:00