Commit Graph
2912 Commits
Author SHA1 Message Date
Damien Bouvy e0522e0bf5 [IMP] hr_expense: stop tracking the approver on expenses
The field is related towards the 'manager' field of the expense sheet,
which means that when the approver is suggested automatically based
on hr data, the expense records get written a value for this field
(which is not in the view) which gets logged as:
- None -> Mitchell Admin (Approved By)

which seems to suggest that:
- the expense has been approved (it has not, a report was created)
- Mitchell Admin has approved: it may not be him (as when approving,
the 'manager' field does not log who did the approval but who was
supposed to initially)

Disabling tracking for this field (which contained no actionable
information at best, and incorrect suggestions at worst) makes this
problem go away.

closes odoo/odoo#100241

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-16 10:09:39 +02:00
tuyenphung df4ca7f7ba [FIX] hr_expense: clean context when click cancel for expense sheet
The context before click button cancel in expense sheet not cleaned yet.

closes odoo/odoo#100288

X-original-commit: 6f8d3d989cc024c8e5b3e9e1a6b2f4af636721d6
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-16 09:04:41 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Damien Bouvy 1f8e265e43 [IMP] hr_expense: allow default for the company journal
Revision 26a5653f48 introduced
the possibility to set up a default journal for accounting
entries created by "employee-paid" expenses

This commit adds the same possibility for the "company-paid"
expenses (because why allow it for one and not the other?).

closes odoo/odoo#99993

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-13 09:31:30 +02:00
Philippe Wauthy f77840cfc7 [IMP] hr(_holidays): improve department filters
In the Employees app, when using the department kanban view and clicking on the
Time Off Requests or Allocation Requests, it leads to a tree view but the department
from which the user comes from is not part of the filters.

This commit adds the department in the filters of the tree view.

Due to the search panel being present in the tree view, the department filter is removed from the list of
filters to avoid a duplication of the filters in the search panel.

task-2939207

closes odoo/odoo#97773

Related: odoo/enterprise#30358
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-09-07 12:41:09 +02:00
Antoine (anso) 3a24c550e1 [IMP] hr_expense : change expenses category's pictograms
Current outdated pictograms had to be replaced with better designed and
visually consistent pictograms.

PNG were replaced with SVG to gain in quality and lightness.

Unused category icons were removed.

task 2951089

closes odoo/odoo#99276

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-09-06 10:58:09 +02:00
Damien Bouvy deaed2ba46 [FIX] hr_expense: fix split wizard layout
Turns out having a <sheet> node is not well supported in layout
for dialogs, as it introduces unnecessary horizontall scrollbars.

closes odoo/odoo#99524

Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2022-09-05 18:35:20 +02:00
Denis Ledoux 8b91cab67f [IMP] base: remove groups_id from ir.ui.view
The goal of this revision is to get rid of the `groups_id` field of the model `ir.ui.view`.

- This feature wasn't really known or used by most developers,
   and not straight-forward to understand.
   Removing it allows one less complicated thing to learn for developers.
   Besides, thanks to odoo/odoo#95729,
   changing the behavior of the `groups=` attribute,
   we can easily get rid of this `groups_id` feature
   by simply adding `groups=` in the elements of the views
   using the `groups_id` field, it will have the same effect:
   adding the elements in the view only for the users part of the specified group.

- By getting rid of the groups_id many2many field on ir.ui.view,
   it makes possible to cache the view architecture without
   requiring to use the groups in the cache key.
   Currently, if we want to cache the view architecture,
  it would be required to use the intersection of the user
  groups with the groups_id groups of the view,
  making it costly to compute the cache key,
  therefore altering the performance point to cache the view
  architectures.

Part-of: odoo/odoo#98551
2022-08-29 22:42:50 +02:00
sofiagvaladze 40a82e1fe4 [IMP] hr_expense,sale_expense: UX improvements
Major changes:
	- converted list view to owl
	- merged menus
	- added CREATE REPORT button on hr.expense that reports either
      ticked draft expenses, or all the draft expenses for the user
	- added dynamic buttons on expense.sheet list view
	- added searchpanel on expense.sheet for team approvers and above
	- moved (and changed) expense categories from demo to data
	- added support on drag'n'drop while in list and kanban view of
      expense for quick upload

task - 2831036

closes odoo/odoo#93802

Related: odoo/enterprise#28474
Related: odoo/upgrade#3778
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-27 03:32:54 +02:00
Thibault Delavallée d13d251a2f [MOV] various: move and split mail data
Just doing the summer file cleaning. Move mail data into files named based on
their model, easing maintenance and searching for those data.

Spotted during Task-2207626 (Rating: Delay rating notification to ease feedback)

Part-of: odoo/odoo#98661
2022-08-25 10:31:56 +02:00
Denis Ledoux 53482ac8c1 [FIX] hr_expense: precompute name, uom, taxes and account
This is an oversight of odoo/odoo#95729

In a database with multi-uom disabled,
when attempting to create an expense choosing a product
with a different unit of measure than the Unit(s)
a ValidationError was raised to the user
regarding  an UOM incompatibility

e.g.
- Create an expense
- Set the product "[MIL] Mileage", using the uom "km"
- Save
-> ValidationError about UOMs

This is because the above mentioned PR makes the
`product_uom_id` completely removed from the view,
and the onchange no longer set the uom correctly within the form.

Solve this by setting `precompute=True` on the UOM field,
and the other fields using the same compute method.

In addition to solve the issue, it also allows to create
more easily expenses from the XMLRPC API:
Before, when creating an expense for the product "Mileage",
it was required you set yourself the uom correctly
in your API call,
even if multi UOMs was disabled in your database.
After, it's no longer mandatory to pass the UOM to use,
it is correctly computed from the product directly,
by default.

closes odoo/odoo#98662

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-23 16:29:32 +02:00
FrancoisGe b2a0a1c7d3 [FIX] web: ListViewHeaderButton use the correct context
Before this commit, when a ListViewHeaderButton was clicked, the view
context wasn't sent to the server.

As ListViewHeaderButton shows, the onClickViewButton API is not correct.
It expects a record in params but this is not correct in the case of
ListViewHeaderButton. So we decided not to pass a record but a getParams
callback that allows us to calculate the params when we need them.

Part-of: odoo/odoo#97558
2022-08-23 16:28:57 +02:00
Nam Dao b041d377d1 [FIX] hr_expense: User with account permission but no employee permission can't register payment
- A user has accounting permission but no employee permission, when that user register payment in spending it gives an error that does not have access to the bank_account_id field
- This commit allows the user to read the bank_account_id field when register payment

Original PR: odoo/odoo#98432

closes odoo/odoo#98485

X-original-commit: 35e07de192dfeba0979170ba8421e4a61c5a483b
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-19 19:10:54 +02:00
Denis Ledoux 0501bbd62e [IMP] base: uniform "groups" in back-end view
This revision is to make uniform the behavior of the `groups` attribute
on the Python model fields
and on the node in the view architecture.
In both cases, remove the node from the view completely.

Before this revision,

in a back-end view:
 - In the Python model, if a field has the `groups` attribute set
   and the user is not part of
   the groups, the field is removed, completely, from the view.
 - In the view architecture, if a node has the `groups` attribute set
   and the user is not part of
   the groups, the node is made invisible (not completely removed, just
   made invisible).

in a front-end view:
 - if a node has a "groups" or "t-groups" set and the user
   is not part of the groups, the node is removed from the view.

So it's 2/3 cases removing nodes restricted to a group.
and 1/3 case making invisible nodes restricted to a group.
It's simpler to have a uniform behavior for the 3 cases,
simpler to understandard for developers.

In addition, this will help for the goal to cache back-end views.
It makes possible to convert views using the `groups_id` field
by moving the content of these views directly
in the view to which they add content which is suppose to be completely
removed when the user has not the according group.
By getting rid of the `groups_id` many2many field on `ir.ui.view`,
it makes possible to cache the view architecture without
requiring to use the groups in the cache key.
Currently, if we want to cache the view architecture,
it would be required to use the intersection of the user
groups with the `groups_id` groups of the view,
making it costly to compute the cache key,
therefore altering the performance point to cache the view
architectures.

closes odoo/odoo#95729

Related: odoo/enterprise#29592
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-08-19 19:10:39 +02:00
Dossogne Bertrand 2b0521d91a [IMP] hr_expense: port expense form view to owl
taskID 2958013

closes odoo/odoo#98459

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-19 16:23:49 +02:00
Florian Vranckx 14d1d46ced [FIX] hr_expense : mobile display quantity uom
Steps to reproduce:

	1. Install hr_expense,inventory
	2. Enable unit of measure in the invetory setting
	3. Create an expense product with a uom
	4. Switch to mobile display and refresh
	5. Try to create a new expense, the quantity field is not visible

Cause:

	In 15.0 it was decided in PR #68387 to switch from the selection widget to options. This changed the css of the element.

Solution:

	Checking the entire codebase with the following regex "<div.*class="o_row".*\n.*class="oe_inline".*\n.*class="oe_inline".*\n.*<\/div>"
	in order to find an other usage of o_row with two inline element yielded no result other than hr_expense. In order to minimise the amount of changes,
	a local fix of the styling is probably more appropriate.

opw-2924276

closes odoo/odoo#98336

X-original-commit: 0754f71b5e4760b1956f196f50bd6550e5fc41e0
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-18 15:08:00 +02:00
sofiagvaladze 19364c79d7 [FIX] hr_expense: add default_partner_bank_id in context
The mistake was made in odoo#81904

Instead of 'default_partner_bank_id' we have 'partner_bank_id' in the
context of action_register_payment.

In this commit, we undo that mistake and also backport the change to v15.

task - 2774594

closes odoo/odoo#97886

X-original-commit: 5c8b74bb3bddd67b5a76d37f7d97a1d5d77c00c4
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-10 16:08:18 +02:00
Martin Trigaux b821961236 [I18N] *: sync fr_BE translation terms
Only for terms containing Credit Note and expenses

closes odoo/odoo#97840

X-original-commit: 1754b094a66476a0bdb29fe60dc5583c03336c3f
Related: odoo/enterprise#30262
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-10 03:11:53 +02:00
Damien Bouvy 7d0eb87eea [IMP] hr_expense: show 'split expense' button for draft records
The domain "id = False" for the visibility of the "Split Expense"
was set because I (wrongfully) thought it was necessary to save
the record before the wizard could use it.

That is not the case, as the button call will first save the record
anyway - it was weird not to have this button immediately and made
the feature hard to discover.

I also changed the "create report" button for the same reason - there
is no need to restrict its usage to "saved" records (unlike the
"attach receipt" button which is a specific widget that needs the record
to exist in database to work).

closes odoo/odoo#97634

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-08-08 22:16:35 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
sofiagvaladze edcda35087 [FIX] hr_expense: set quantity to 1 when choosing 0-cost-product
Scenario:

Open expense, choose product with cost, set quantity to 5, now choose
any 0-cost product. Save the expense.

Behavior: quantity is 5

Expected behavior: quantity should be set to 1

Implications: As a result, in the list view on expenses, we see incorrect quantity.
Moreover, in SO, price_unit will be incorrectly computed.

task - 2867723

closes odoo/odoo#96732

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-28 09:14:47 +02:00
sofiagvaladze 32633e3087 [IMP] hr_expense: add can_be_expensed field in product view
Purpose: Allow users to make product 'expense available'
(or the opposite, unset them as expense products) by making the
field 'can_be_Expensed' available in the base product view.

task - 2909067

closes odoo/odoo#96619

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-27 04:52:49 +02:00
Nam Dao 3f2bb3df37 [FIX] hr_expense: User with account permission but no employee permission can't create payment
- A user has accounting permission but no employee permission, when that user creates a payment in spending it gives an error that does not have access to the bank_account_id field
- This commit allows the user to read the bank_account_id field when creating a payment

closes odoo/odoo#96607

X-original-commit: 8045780cbf2dc36d533dbfd3315bab31a229351d
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-27 03:35:06 +02:00
Kevin Baptiste d3525f24e3 [IMP] hr_expense: disable Expense dashboard on Analysis
The expense dashboard was displayed on the Expenses Analysis whilst it
shouldn't have.

closes odoo/odoo#95987

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-14 12:58:08 +02:00
Damien Bouvy 2781d15fe9 [FIX] hr_expense: incorrect domain for expense split line
Task 2850882 modified the behaviour of expenses to support working
with all purchase taxes, regardless of their 'price included'
configuration.

We missed a domain on the split lines though, so it was impossible
to use 'all taxes' when splitting an expense.

This commit resolves that limitation/oversight.

closes odoo/odoo#95627

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-13 17:40:54 +02:00
Kevin Baptiste ecf07e1043 [IMP] hr,hr_expense: adapt kanban views to OWL
task-2900536

closes odoo/odoo#95317

Related: odoo/enterprise#29116
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-12 13:21:07 +02:00
aliya 26b2472f49 [IMP] account: refactor account types
Task: 2856281

- Remove user_type_id, account.account.type model, internal_type
- Add account_type that is a simple selection field
- Move internal_group and include_initial_balance to account.account
- Because of these changes, type_control_ids on account.journal is also removed

closes odoo/odoo#93212

Related: odoo/documentation#2223
Related: odoo/upgrade#3595
Related: odoo/enterprise#28205
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-07-08 19:52:15 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
sofiagvaladze 102136f2ae [IMP] hr_expense: prevent change of employee on line sheet
In case we change the employee on an expense and  in case expense has
sheet which has only one expense_line_ids, then changing the
expense.employee_id triggers changing the sheet.employee_id too.

In case there are more than one expense linked to the report, then we
unlink the expense line from sheet, (so that the user can create a new report).

task - 2890095

closes odoo/odoo#94424

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-07-06 10:36:22 +02:00
Aaron Bohy 4f984568e1 [REF] *: adapt code to new kanban view
This commit makes various adapations in addons with respect to
the introduction of the owl kanban view. Mainly, some selectors
in scss and in tests needed to be adapted. Moreover, in some tests
that we haven't adapted yet, we must ensure that legacy form and
list views are still used (useLegacyViews).

It also contains some adaptations in kanban templates, e.g. the
replacement of moment by luxon, the removal of underscore...

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
sofiagvaladze bcea427c02 [IMP] hr_expense: use all taxes as price_included
In expense flow the taxes are calculated as included in price.
Prior, to guarantee it, we had domain - ('price_include', '=', True) on taxes.
That could be inconvenient from user's point of view, as they first needed to
define taxes with price_include = True. That led to users duplicating taxes
between included/excluded just so that they could use taxes in expense.

Now we force taxes to act like price_include = True. This way, user does not
need to define taxes just for expense's purposes and still taxes will be calculated
as it supposed to be - included in price.

task - 2850882

closes odoo/odoo#94392

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-29 12:19:18 +02:00
Kevin Baptiste ce272ce13b [FIX] hr_expense: handle False-y list_help
The string concatenation would fail on False help_message.

Closes #93036

closes odoo/odoo#94505

X-original-commit: 97e066b4cfda8ac34208f84753a40c10524ae989
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-24 08:20:51 +02:00
hieu 69b5085f0b [FIX]hr_expense:fix constrains _check_payment_mode only applied on sheet
closes odoo/odoo#94497

X-original-commit: 5ba6c9ff5f842c32bfa0081cd277576114882fc7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-24 08:20:48 +02:00
Victor Feyens fba6ea5a47 [IMP] *: do not force admins to be app admins
For bugfix purposes, app administration groups have been given to
(implied by) the "Settings" group because without those rights,
opening/saving the settings crashed.

1) Do not load hidden view content

This commit uses the conditional inheritance of views
(depending on user groups) to avoid loading unnecessary view
& record content client-side.

This improves performance for admins without the specific application
admin rights, but also fixes the main bugfix problem,
caused by the webclient querying name_get for the records in relational
fields content.

Example:

sale_management adds a res.config.settings field to specify
the default sale.order.template for the current company.

If a 'Settings' user without 'sale.group_sale_manager' opens the
settings, he won't see this setting, but if a default template is
specified for the current company, the webclient will still request
the name_get of this template to the server, because the field
was present in the view, only hidden with a groups attribute.

With this commit change in sale, the field won't be in the view unless
you have the Sale manager group, avoiding the error/traceback/bug.

2) Remove implied application administration groups

Do not force the specific application groups on all 'Settings' user,
they globally do not need those rights, and if they need it, they
can add it to their account themselves.

3) Add a test to make sure settings user are able to manage settings.

4) Enforce 'settings' -> 'access rights' -> 'internal user' groups

As the previous test highlighted some 'false positives' because
it considered a settings user unable to read `crm.team`
and `stock.warehouse` records, we also took the opportunity to enforce
the fact that 'Settings' & 'Access rights' users must be internal users.

It makes no sense for a portal/public user to have access to the
settings, and didn't work anyway.

Part-of: odoo/odoo#91909
2022-06-23 23:48:29 +02:00
thcl-odoo 75416b03a7 [FIX] hr_expense: fix expense total computation
Current behavior :
The amount shown for an expense is equals to 0 instead of the real price.

Steps :
- Install Expenses, Accounting
- Create an expense and finish the flow (register payment included)
- In Accounting app, go to Vendors > Payments
- In this view, amount is equals to 0 but the amount is correct in individual view

Note :
Since this commit [1], `expense_id` is added on move.line so that
`_payment_state_matters` now returns True [2]. We are now entering this
condition [3].

This causes some issues when recording payments for our expense.
Indeed, the 2 lines (credit + debit) enter this condition [4] but debit line
should be treated by this block [5] otherwise the 2 lines cancel each other out.

Solution :
Add `exclude_from_invoice_tab = True` receivable/payable expense payment lines

[1] : odoo@1645995#diff-5bee371350ae80995abbea23e800bfb1c52f968db6c9dc59f2681ac415d34103R27-R28
[2] : https://github.com/odoo/odoo/blob/1e3a9c90908f37d19f4aa1bbcb81568dea9fd451/addons/hr_expense/models/account_move_line.py#L9-L13
[3] : https://github.com/odoo/odoo/blob/d6ca59ed9bf6877ee6b1b311223472adfa4db549/addons/account/models/account_move.py#L1419
[4] : https://github.com/odoo/odoo/blob/d6ca59ed9bf6877ee6b1b311223472adfa4db549/addons/account/models/account_move.py#L1422
[5] : https://github.com/odoo/odoo/blob/d6ca59ed9bf6877ee6b1b311223472adfa4db549/addons/account/models/account_move.py#L1434-L1438

OPW-2838105

closes odoo/odoo#94259

X-original-commit: a6b8feabcb2323edf7ca24d3e96e6cb7f420fcc9
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-22 14:28:49 +02:00
Rob Coekaerts a2ba3739b8 [IMP] hr_expense: disable quick creation of taxes
Disable the (quick) creation of taxes in places where
it is likely to result in faulty data entry. This forces
the user to fill in new tax records consciously.

task-2860025

closes odoo/odoo#93319

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-21 11:20:13 +02:00
Martin Trigaux 5acb6db891 [I18N] *: export saas-15.4 source terms
closes odoo/odoo#93246

X-original-commit: 5ff6d185f70650c26c28a6aef7dd37c859ab58d2
Related: odoo/enterprise#28218
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-06-10 07:27:26 +02:00
Laurent Smet 080d41a341 [REF] account_accountant: Refactor the bank reconciliation widget
- Refactor the bank reconciliation widget to use more standards views and have a side-by-side kanban/widget views instead.
- Make sure the bank reconciliation widget is doing the same thing as the "reconcile" method on account.bank.statement.line. Then, what you see on the view is exactly what you get on the corresponding journal entry.
- Since the "reconcile" method is gone, clean the matching rules since it's now called only for one statement line at a time. Also, move the auto_validate feature into a CRON to avoid performance issues when opening the widget.

closes odoo/odoo#91448

Task: 2555114
Related: odoo/enterprise#27360
Related: odoo/upgrade#3555
Signed-off-by: William André (wan) <wan@odoo.com>
2022-06-07 10:16:14 +02:00
sofiagvaladze cef01fa521 [IMP] mail, hr_expense: show expense attachments on sheet
Purpose: Before it was hard to view expense attachments from sheet record.
To do so, the user should have gone through clicking on each expense first and
checking attachments, or could have clicked on a attachments smart button on embedded
expense table, which is redirecting to another view that only displays attachments for the one expense only.
Thus, checking all the attachments from sheet was an tedious task.

After this commit, the user can see in the sheet attachment preview all the associated expenses' attachments.

To make it possible, we ovveride 'mail.thread' method that is called to
fetch the data for the chatter. In the override, we fetch extra, associated expenses' attachments.

task - 2320177

closes odoo/odoo#92724

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-02 16:54:22 +02:00
sofiagvaladze be3d76a95a [FIX] hr_expense: fix 'hr.expense' has no attribute 'attach_document'​
In case hr_expense_extract is not installed and we click
'Attach Receipt' on hr_expense form view, we get a traceback.

task - 2870500

closes odoo/odoo#92761

X-original-commit: 8593decb2fe6820cfc6f043cb3458f43dd635c87
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-02 15:51:04 +02:00
sofiagvaladze d70000bf21 [IMP] hr_expense/sale_expense: allow splitting an expense
Purpose: Sometimes, taxes are distinct on parts of the expense
(for example alcohol and food).
Therefore the expense should be split in two.

In order to split the expense, we added an wizard.
When creating a new expense from the split, we also
copy the attachments.

'hr.expense.split' has to have the similar logic and dependencies between
the fields as 'hr.expense' does. For example, in case we change the
product_id to the product that has cost defined on it, it should have
the same behavior as expense has. In particular, the 'total_price'
will be set and the user should not be able to modify the amount.

Similarly, if we change the product_id to the one that has no tax defined
on it, then split tax_ids should be cleared out and be set to readonly.
Similar logic goes to sale_order_id (Customer to Reinvoice'),
we should not be able to set it, in case the product can not be re-invoiced.

All of the above constraints leads to the amount of similar code to to the 'hr.expense.split' side.
But it could not have been avoided, if we want the smooth flow.

task - 2831024

closes odoo/odoo#90770

Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-06-02 08:02:04 +02:00
sofiagvaladze 09609889e3 [FIX] hr_expense: fix updating the unit amount on the expense form
The unit_amount should be updated when product changes, in case the product
has price defined on it.

task - 2831024

Part-of: odoo/odoo#90770
2022-06-02 08:02:04 +02:00
Achraf (abz) b655720558 [FIX] hr_expense: Markup no content helper
Steps:
 - Go to Expenses
 - Reporting/Expenses Analysis
 - List View
 - Remove every records
 - The no content help text is broken

To fix this we have to Markup the second part of the noContentHelp

opw-2862056

closes odoo/odoo#92532

X-original-commit: e2d20c97f2a9da0d2f357f1caa08c0e9632c1bcd
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2022-05-31 18:20:06 +02:00
Kevin Baptiste 48f340d885 [IMP] hr_expense: rename default Expense product
Both default expenses product were called Expenses, which was confusing
as it was not possible to distinguish them at first glance.

Here the expense product with a fixed cost is renamed to make it more
clear.

odoo/upgrade#3546

closes odoo/odoo#92232

Taskid: 2862104
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-05-31 11:07:02 +02:00
stefanorigano (SRI) c4a7cf7732 [IMP] hr_expense: review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2859751

closes odoo/odoo#92132

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-30 10:34:49 +02:00
Raphael Collet 6cf8db906f [REF] *: adapt code to new flush API
closes odoo/odoo#87527

Related: odoo/upgrade#3497
Related: odoo/enterprise#26939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-05-25 18:00:47 +02:00
Leonardo Pavan Rocha 31bf4abcb3 [IMP] hr: improves department kanban view
The recruitment kanban view was redesigned and it looks good, so it was
decided to implement the same design on the department kanban view. This commit
adds the number of employees to the "Employees" button and makes the kanban
cards wider.

task-2849418

closes odoo/odoo#91293

Related: odoo/enterprise#27324
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-05-24 09:41:24 +02:00
tranngocson1996 7de5b03f55 [FIX] hr_expense: fix compare the wrong object
closes odoo/odoo#92068

X-original-commit: c604f729d527925b981e2ae204e33a154208afcb
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-05-23 15:13:02 +02:00
stefanorigano (SRI) 87a7449afd [IMP] web, *: odoo-brand color classes
Prior to this commit branded UI components were styled exclusively in
raw SCSS using the '$o-brand-odoo' variable.

This leaded to unnecessary code repetitions since, to achieve the same
visual result, each module defined its own classes.
Visual inconsistencies were frequent too since each module defined its
own variations for interactive states (eg :hover).

This commit injects '$o-brand-odoo' into bootstrap's default
'$theme-color' map, allowing the framework to automatically generate
odoo utility/contextual classes.
These classes can be used to handle text, backgrounds, borders and
buttons wherever needed.

Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2800721

closes odoo/odoo#87448

Related: odoo/enterprise#25700
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-05 14:00:37 +02:00