Commit Graph
202 Commits
Author SHA1 Message Date
Nicolas Lempereur 8e77632e58 [FIX] *mail_thread: don't modify modified help
The 'help' of window action is often fiddled with, adding thing before,
after or arround it.

For example in CRM leads, we add at the beginning "Click to add a new
opportunity" with an arrow towards the button, and after if there is a
mail alias: "All email incoming to * will automatically create new...".

But for crm.lead, hr.expense, sale.order this would not take into
account that the fiddled "help" can be edited, so if we edit 2 times
help in studio or backend action editing, we would get:

  Click to add a new opportunity
  Click to add a new opportunity
  Click to add a new opportunity
  [Original help content]
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...
  All email incoming to * will automatically create new...

And see several "arrows" towards the button (in enterprise the
additional ones are on same color background).

With this commit we do what is done in "mail.thread" by default which is
not fiddling with the `help` if has been fiddled before (if it contains
"oe_view_nocontent_create" class).

note: this is the 11.0 version of #26912

opw-1877663
closes #26911
2018-09-12 13:18:35 +02:00
Nicolas Martinelli 8baee81c79 [FIX] hr_expense: account on expense
- Set a specific expense account on an expense product
- Send an email to the expense alias

The specific expense account is not used; a default account is used
instead.

opw-1838174
2018-04-30 14:46:15 +02:00
Christophe Simonis bfe88c50e2 [MERGE] forward port branch saas-15 up to 0ae300e9e6 2018-03-08 13:22:28 +01:00
Christophe Simonis 0ae300e9e6 [MERGE] forward port branch saas-14 up to 85fd5cc147 2018-03-08 12:45:29 +01:00
Christophe Simonis 85fd5cc147 [MERGE] forward port branch 10.0 up to 41af298d9d 2018-03-08 11:37:10 +01:00
Romain Derie 1c01528375 [FIX] hr_expense: ensure message_new has only one record (singleton)
Before this commit:
Expense emails title are parsed to find a product that match the given [CODE].
For example, an email title like '[CARD] Graphic Card $900' will create an
expense for the product having 'CARD' as internal reference.
Since the search is done with an 'ilike' and with no 'limit', it could return
multiple product: all the one containing the CODE in their internal reference.
This would throw a singleton error when trying afterward to read product.id.
Then, the mail would not go through the mail.thread flow and it would return
a Mail System Delivery fail saying the address does not exist.
Users would get stuck with this, having no way to understand where the error
comes from.

Now, we ensure to find only 1 product.
To avoid breaking the ilike behavior that could be used by users only typing
the first caracters of a long CODE, we still use ilike but force exact match if
there is multiple results.

Closes #23419
opw-1816340
2018-03-07 14:25:16 +01:00
Romain Derie b730de1978 [FIX] hr_expense: correctly set address_id for restricted user
New rights were applied on hr.employee with this commit https://github.com/odoo/odoo/commit/2d777d5ade94f4a80862608e2807660f289d9923

Since, users with limited rights would see a read error when submitting an
expense to manager.
Indeed, when clicking on "SUBMIT TO MANAGER", it opens the view form for
'hr.expense.sheet' that trigger an onchange on employee_id to set the
employee's private address to the expense.
Since restricted users can't read that field, the rpc call to that onchange
was throwing an error resulting in:
1. Showing an read error when entering form view that user could close to
   save anyway.
2. The hr.expense.sheet address would not be set as it should have

Now, we give sudo rights to read that field during the onchange

OPW-815786
2018-02-20 15:46:24 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Christophe Simonis 0af13af5de [MERGE] forward port branch saas-15 up to ddd293065e 2018-01-02 15:36:25 +01:00
Christophe Simonis ddd293065e [MERGE] forward port branch saas-14 up to ba2a83ddfa 2018-01-02 15:02:26 +01:00
Christophe Simonis ba2a83ddfa [MERGE] forward port branch 10.0 up to e336dc38ca 2018-01-02 13:56:49 +01:00
Nicolas Martinelli 4e2ce33f87 [FIX] hr_expense: set to paid
Filter out expenses which are already paid when set to paid.

opw-787874
2017-12-27 13:55:49 +01:00
Stéphane Bidoul (ACSONE) 34ed42f16d [FIX] hr_expense: unbreak consistency check
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
2017-12-18 12:37:28 +01:00
Stéphane Bidoul (ACSONE) 5377f7b85c [FIX] hr_expense: Make _check_employee dependent on employee_id
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.
2017-12-18 12:32:17 +01:00
William Henrotin b62bab6992 [FIX] hr_expense: missing exception import
In hr_expense.py, a ValidationError exception can be raised in some
cases but it's not imported from odoo.exceptions
2017-12-04 09:10:18 +01:00
Christophe Simonis 42264d8dcb [MERGE] forward port branch saas-16 up to 5d7ad2b16c 2017-11-30 18:43:08 +01:00
Christophe Simonis ab084d580f [MERGE] forward port branch saas-15 up to 98539336a5 2017-11-30 15:27:59 +01:00
Christophe Simonis 98539336a5 [MERGE] forward port branch saas-14 up to b780e4a0e4 2017-11-30 14:44:49 +01:00
Christophe Simonis 299a5e058b [MERGE] forward port branch 10.0 up to 7754538750 2017-11-28 12:25:16 +01:00
Nicolas Martinelli f075b52a25 [FIX] hr_expense: multiple payment modes
- Create an expense paid by employee
- Create an expense paid by company
- Select the two expenses and submit a report

You are authorized to create this report but you cannot validate it and
you cannot refuse it because of the mix of an expense paid by employee
and paid by company. You're blocked.

We should block the creation of an expense report mixing expenses paid
by company and paid by employee

opw-783395
2017-11-21 14:19:13 +01:00
Christophe Simonis de93645fe3 [MERGE] forward port branch saas-16 up to 82add438f2 2017-11-09 19:16:05 +01:00
Christophe Simonis 82add438f2 [MERGE] forward port branch saas-15 up to 90ca872071 2017-11-09 18:05:49 +01:00
Christophe Simonis 90ca872071 [MERGE] forward port branch saas-14 up to d171f282c3 2017-11-09 16:49:41 +01:00
Christophe Simonis d171f282c3 [MERGE] forward port branch 10.0 up to f8540501ac 2017-11-09 16:19:21 +01:00
Martin Trigaux f8540501ac [FIX] hr_expense: verify the constrain server side too
The groups were set only on the view which does not prevent abuses.
The fact that users can bypass the groups on the view is not critical as the
changes are logged but this should be improved nevertheless.

In master, proper record rules should be set.

Closes #20427
2017-11-09 15:51:14 +01:00
Christophe Simonis e918271f76 [MERGE] forward port branch saas-16 up to 8fdac4b6b2 2017-10-27 14:09:20 +02:00
Christophe Simonis 4873aeb501 [MERGE] forward port branch saas-15 up to 991ba1d861 2017-10-26 20:07:36 +02:00
Christophe Simonis 991ba1d861 [MERGE] forward port branch saas-14 up to a2890c1e76 2017-10-26 19:36:23 +02:00
Christophe Simonis a2890c1e76 [MERGE] forward port branch 10.0 up to bbc226cd6c 2017-10-26 19:03:19 +02:00
Benjamin Willig (ACSONE) e653798d5c [FIX] hr_expense: allow inheritance when adding followers (#20319) 2017-10-26 16:01:56 +02:00
Aaron Bohy 7b8001a847 [FIX] hr_expense,web: explicit link_to command for o2m
The ORM doesn't automatically link subrecords when it receives an
update command for a one2many. However, it may be necessary when
the default_get returns existing records for a one2many field. It
only worked before this rev. for the hr_expense model because of an
hack from 2016 (to reproduce: go to Expenses, check some expenses
from the list view, in Actions, click on 'Submit to Manager', the
new hr_expense_sheet contains the checked expenses (one2many), and
the webclient only sent an update command by linked subrecord).

This rev. fixes the problem properly: when the default_get returns
existing subrecords for a one2many field, a link_to command (4) is
generated alongside the update (1) command.
2017-10-26 08:19:43 +02:00
Christophe Simonis 8c2c954785 Revert "[FIX] hr_expense: avoid crash when submitting"
Commit 46c1091f36 was only a workaround.
Inability to submit expenses was actually a js bug that hass beed fixed
by 7d448d57e3.

Close #19877
2017-10-13 15:53:34 +02:00
Christophe Simonis 1da064a1d3 [MERGE] forward port branch saas-16 up to 8ee9024a4c 2017-10-13 13:13:11 +02:00
Christophe Simonis aeae519a65 [MERGE] forward port branch saas-15 up to 945dd32eb0 2017-10-12 21:44:28 +02:00
Christophe Simonis 945dd32eb0 [MERGE] forward port branch saas-14 up to 91e2264b28 2017-10-12 18:43:14 +02:00
Christophe Simonis 91e2264b28 [MERGE] forward port branch 10.0 up to ba519bde84 2017-10-12 17:30:01 +02:00
Nicolas Martinelli 02dffa45ae [FIX] hr_expense: included tax and round globally
- Set 'Tax calculation rounding method' to 'Round Globally'
- Create a expense product with a tax of 20% included in the price
- Create a expense of 19.99
- Submit the expense in a expense sheet
- Validate the expense
- Post the expense
- Register a payment of 19.99

The expense is not set as paid.

The source of the issue is that the tax line is created without being
rounded. In the specific example, two lines are created with amounts:
- 16.658
- 3.33166667 (Tax)

This introduces rounding error in the computation of the matched
percentage, and the expense is not set as paid.

We force the rounding of the taxes since the 'Round Globally' option has
no impact on an expense report.

opw-773908
2017-10-11 09:56:59 +02:00
Jérome Maes 146204edc0 [FIX] hr_expense: don't allow attachement edition/create from expense sheet
The attachment should be create and linked to
the expense directly, and not on the expense
report (where it is readonly).
2017-10-05 15:52:17 +02:00
Jérome Maes 46c1091f36 [FIX] hr_expense: avoid crash when submitting
Create the sheet before opening a cached one avoid to
get error when computing computed field.
2017-10-05 15:52:09 +02:00
Christophe Simonis 99bf9e4563 [MERGE] forward port branch saas-16 up to 89df681b45 2017-09-28 13:24:14 +02:00
Christophe Simonis 89df681b45 [MERGE] forward port branch saas-15 up to da15615c45 2017-09-28 11:56:23 +02:00
Christophe Simonis da15615c45 [MERGE] forward port branch saas-14 up to aca401c500 2017-09-28 10:53:37 +02:00
Christophe Simonis af117236de [MERGE] forward port branch 10.0 up to 8165018058 2017-09-27 17:07:23 +02:00
Yannick Tivisse 8e2d7c2e3c [FIX] hr_expense: Make expense sheet report multi currency coherent
Purpose
=======

Currently, if we want to print an expense report that has several currencies in its expense lines, the total amount is hidden on the report. Otherwise, it is simply summed.

That could lead to confusing uses cases. Example.
1 expense line of 92 dollars.
1 expense report expressed in euros.

In the report we will have
- 1 line of 92 dollars
- Total amount: 92 euros

Which is obviously wrong.

Specification
=============

Always display the amount + Compute the amount in the expense report currency, by converting the amount with the rate at the day the expense has been made.
2017-09-21 16:51:13 +02:00
Jérome Maes 751330a843 [IMP] sale_expense: reinvoice expense flow
The main change is we use SO and not analytic account
anymore to reinvoice expense.

When encoding an expense, each employee can directly
set the SO to allow re-invoicing the expense to a
client. Before this commit, this was done by determining
the SO based on the Analytic Account (magically) on the
expense.
This solution is less confusing and more explicit for
the end user.

This commit also bring usability improvements to
improve user experience during this flow:
- better expense product view
- access group on menu items
- ...
2017-09-14 14:48:07 +02:00
Jérome Maes 2dda108cb3 [IMP] hr_expense: link move line and expense for better tracking
Each move line generated from an expense posting will
be linked to the original expense. Some of those move
lines are for taxes, one for the product, ... but they
are all link to the same expense.
This will allow better reporting, and allow to access
the expense record from the move or its analytic lines
for futher developement.
2017-09-14 14:48:07 +02:00
Christophe Simonis d5382abeaa [MERGE] forward port branch saas-17 up to b8dd34fcbb 2017-09-06 17:40:59 +02:00
Christophe Simonis b8dd34fcbb [MERGE] forward port branch saas-16 up to 64d56995e0 2017-09-06 13:29:05 +02:00
Christophe Simonis 3ff4feafd2 [MERGE] forward port branch saas-15 up to 4d4d75709d 2017-09-04 18:12:00 +02:00
Christophe Simonis fc2a39cc7d [MERGE] forward port branch saas-14 up to 99426b95b5 2017-09-04 17:12:40 +02:00