Commit Graph
12 Commits
Author SHA1 Message Date
Kevin Baptiste f63a0d3d5f [FIX] hr_attendance: use correct company in Kiosk mode
A wrong company was used in the Kiosk mode, preventing users to check in
/ out.

closes odoo/odoo#80035

Taskid: 2691031
X-original-commit: ed3003c9d8ce11a8f59966d28371883df5eb9c36
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2021-11-18 18:45:19 +00:00
Kevin Baptiste 9e6d2da504 [IMP] hr_attendance: compute overtime on attendances
This commit adds a new model `hr.attendance.overtime`.

When an employee checks out, an overtime entry will be created when:
    - the option is enabled on the company;
    - the employee worked more or less than the number of hours they
    were supposed to work that day.

TaskID: 1904850
2021-07-06 11:35:01 +02:00
Aaron Bohy 9470eca77f [FIX] hr_attendance: correctly unpatch session at end of test
The 'addMockEnvironment' test utils allows to patch a lot of stuff,
including the session, for the sake of a test. However, it assumes
that it is only called once inside a test (or at least, that its
cleanUp function is always called before it is called again).

In this hr_attendance test, it isn't the case. 2 client actions are
instantiated, and addMockEnvironment is called for each of them,
in particular to patch the session.

The first call stores the current session (the real one), to restore
it in its cleanup (1). The second call stores the current session
(the mocked one, produced by the first call), to restore it in its
cleanup (2). The cleanup functions are called in order, so (1)
before (2), meaning that at the end, we end up with the session
being the mocked one of the first call to addMockEnvironment.

The very short term solution is to ensure, in this test, that the
cleanup functions are called in the correct order. For the long
term, we are working on a robust mechanism to correctly clean up
everything after a test.

Issue spotted in the assets revamp task, which mixed a bit the
order of the tests.

closes odoo/odoo#67891

X-original-commit: bb43c74dd10c76b8a80d5749106b86432b13909e
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-15 16:40:46 +00:00
Aaron Bohy b4ba0fc340 [FIX] *: adapt tests to env rework
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
2020-06-12 09:47:48 +00:00
Lucas Lefèvre ee1776dc5f [IMP] hr_attendance: Display checked in hours today
Purpose
======
When an empoyee wants to check out, he does not know the number of hours he worked today.

Specification
==========
In the check out view, display how many hours the employee was checked in today.

closes odoo/odoo#33974

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-06-26 06:52:31 +00:00
2a2f2cfec2 [REF] hr_attendance: adapt code after jQuery update
Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-03-06 20:07:17 +01:00
b1ef0001f6 [REF] *: adapt all client actions
to ControlPanel/Search view refactoring.

The ControlPanel being now inside the DOM of client actions, those
existing widgets needed to be adapted (in the way they define if
and how they want a ControlPanel, and in the way the manipulate
their DOM as it slightly changed). Tests needed to be adapted as
well.

Part of task 1893568

Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-12-07 13:16:07 +00:00
Géry Debongnie abf32b8b21 [REF] *: update js test suite to use helpers
This rev. introduces robust helpers to use in the JS tests suite to
interact with DOM and components, and starts using them (almost)
everywhere.

All the helpers are exposed though testUtils.js.

There are 2 kinds of helpers:

1. Assertions
-------------
 * assert.containsNone, containsN, containsOnce check that the DOM
   (or a specific part of the DOM) contains a `selector`. It
   generates a correct error message automatically.
    ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg");
        -> assert.containsOnce(form, '.o_form_editable');
 * assert.isVisible, isNotVisible check that the DOM has an element
   visible or not. They also check that the element is actually in
   the DOM (before most tests didn't verify this).
 * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific
   properties of a DOM element, and also validate that it is
   applied on a single existing DOM element (before most tests
   didn't verify this).
    ex: assert.notOk(form.$('button').hasClass('btn-primary'));
       -> assert.doesNotHaveClass(form.$('button'), 'btn-primary');

2. Utilities
------------
The goal of the utilities is to centralize the definition of many
standard components and interactions, ensuring that when we
refactor the JS framework, we do not need to change all the tests.

Existing mock utilities (addMockEnvironment, intercept, path,
patchDate, unpatch and fieldsViewGet) are moved to
'testUtils.mock.*'.
Existing DOM utilities are moved to 'testUtils.dom.*'.
New dom utilities are created for opendDatePicker, click,
clickFirst and clickLast. Helper `click` verifies that there is
exactly 1 element visible in the DOM you click on, `clickFirst`
and `clickLast` verify that there are more than one element on the
DOM.
 ex: form.$('button').click();
     -> testUtils.dom.click(form.$('button'));

New Form utilities: (testUtils.form.*)
 clickEdit, clickSave, clickCreate, clickDiscard, all clicks on
 the control panel buttons of the form.
 `reload` reloads the form data.

New modal, graph, kanban and pivot utils (testUtils.pivot.*,
testUtils.kanban.*, etc.).

New fields utils: (testUtils.fields.*)
 * editInput, editSelect: allow to change the value of a field,
   using a selector to identify it. They validate that the input
   exists and trigger the change event automatically.
 * editAndTrigger: allow to modify a field and trigger specific
   events after the value change
 * many2one (testUtils.fields.many2one.*)
   clickOpenDropdown, clickHighlightedItem, clickItem,
   searchAndClickItem: use a field name instead of a selector and
   do all the complex mechanism to open, filter and highlight
   many2one fields.

Joint work with aab, dam, ged, mge, svs and vsc.
2018-11-19 11:24:28 +00:00
Nicolas Martinelli 6604f7aef1 [FIX] hr_attendance: multiple scans
- Open the Attendance kiosk mode
- Scan an incorrect barcode

It's not possible to scan any barcode anymore.

If the barcode is incorrect, we need to add back the event listener.
Moreover, the RPC introduced with bbc7e9586d is not necessary if
we retrieve the barcode thanks to the existing RPC call.

opw-1878632
opw-1888402

closes odoo/odoo#28354
2018-11-02 10:43:38 +00:00
David Beguin bbc7e9586d [FIX] hr_attendance : fix kiosk mode - js review
The main goal here is to avoid using a global variable.
The greeting message _onBarcodeScanned bus can be stoped right after
the barcode_scanned as every time a barcode is scanned, it creates
a new instance of the greeting message.

Some other JS guidelines are also applied here.

Special thanks to Martin Geubelle (@mge-odoo) for helping me on this.

[TEST] hr_attendance : add test for multiple quick scan in kiosk mode

Glorious thanks to @RomainLibert who fu**s off his brain to help me
understand what was really going on and how to simulate the
functional behaviour of Greeting Message kiosk stuff.

Task ID 1878251
Closes PR #27127
2018-09-21 13:59:05 +02:00
stefanorigano 716640bb67 [FIX] hr_attendance: invert icons for sign-in/out
Set the right employee's possible states.

Before the restyling, the main title was always “Welcome!” regardless
of the user state (checked_in or checked_out). Using conditional titles
has exposed the issue.
2018-05-22 10:38:05 +02:00
Aaron Bohy 2eda2a7296 [FIX] hr_attendance: crash when opening the app
'session' is no longer an widget attribute, 'getSession()' should
be used instead.

Also remove a dead JS field widget (not used since
odoo/odoo@158f779b46)
2017-04-14 22:35:27 +02:00