The desired flow of currency rate in expense is as followed:
- (default) Use Odoo currency rate
- Allow the user to set a custom rate (to include fees) when changing
the total amount in company currency
- Revert to the default behaviour when the currency is changed
or the amount in foreign currency is changed
This aims to fix how currency rate is computed and overridden
- Reorganize all currency rate computation, so it doesn't revert to Odoo rate
at every compute call
- Deals with a bug where a "total_amount_currency", when changed
just before calling "action_submit_expenses" would not trigger
the computation of unit_amount
- Force save when changing currency on expense form view to prevent a bug
where the first modification of "total_amount_company" would be canceled
(due to the new behaviour of currency rate computation)
- Removes unit_amount_display from views as it should be removed
in later versions and is deprecated since 16.0
task-3476569
closesodoo/odoo#137598
Signed-off-by: Laurent Smet (las) <las@odoo.com>
This traceback arises when the user selects multi
company records and click on the 'create report' button.
To reproduce this issue:
1) Install 'hr_expense'
2) Create a new company for example 'test'
3) Enable the 'test' company on the right corner
4) Now open 'employees' and change the company of the current user(Mitchel Admin)
to the 'test'.
5) Open 'Expenses', create a new record, and change the company to 'test'.
6) Fill the required field values and save the record.
7) Now click 'My Expenses/My Expenses to report' and select all the records (Make sure
'My Expenses' filter is applied)
8) Click on the 'Create Record' button
Error:- "ValueError: Expected singleton: res.company(2, 1)"
On the '_create_sheet_from_expenses' method, the value of 'company_id' is getting
through 'self.company_id.id'.
See:-
https://github.com/odoo/odoo/blob/f910987cb4af84c1e7afabf67f05d4eebc31e765/addons/hr_expense/models/hr_expense.py#L324-L335
But when user selects multi company recordsets
'self.company_id' has multi recordsets.
When 'company_id' is getting value through 'self.company_id.id', because of
'self.company_id' has multiple records, which leads
to the above traceback.
By applying this commit will resolve the issue by raising an exception,
when user selected multi company records to create report.
sentry-4465422743
closesodoo/odoo#136695
X-original-commit: 32cb39c9f533820b5558d739d993199a9541f779
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Altaf Shaik (alsh) <alsh@odoo.com>
Create an expense sheet (report)
Add 2+ expenses with 10% included tax to the same employee
Approve expenses and post journal entries
Bill will be created
Go to the tax report
Group by "Tax > Account" or "Account > Tax"
Issue: Bill line will have the tax basis calculated incorrectly
This occurs because the bill will have 2 separate tax line and the query
does not handle this case
opw-3510371
closesodoo/odoo#136694
X-original-commit: 2ed464bc6bf4fa35e1ad2704ed9db71789c39257
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Andrea Grazioso (agr) <agr@odoo.com>
In this viewtiverse, the heroes remove the context dependencies for
`get_views`, from the views and python fields (such as domain). To reduce
inconsistencies and the number of rpc.
Current issues:
* There may be inconsistencies in views at the JavaScript level. Some
overrides modify the behavior of get_views or domains on fields via
context keys, therefore by changing the action, the rendering may be
different. However, these views are cached. However, the cache key
(Javascript) does not reflect the entire context, and requires additional
post-processing from the server.
* Multiple rpc for the same rendering. get_views being dependent on the
context, as soon as it changes, a new rpc is performed. In most cases,
when JavaScript needs the same view, there is no change depending on the
context, the rpc is useless.
* Inconsistency when rendering subviews, some views could be different
depending on the context, this context can be modified in the view itself
via the context attributes. However, the JavaScript client does not redo
an rpc for each change of these sub-contexts. Therefore the result may be
inconsistent.
Solution:
Limit as much as possible the number of context keys provided when calling
get_views, and use the context provided as a cache key. The authorized
keys are 'lang' and '*_view_ref'. For the cache key, options are added in
the get_views method.
Instead of using the context, it is inserted into python expressions.
This will be evaluated by JavaScript and thus avoids inconsistencies.
task-3414108
task-3414068
closesodoo/odoo#135145
Related: odoo/enterprise#47584
Signed-off-by: Raphael Collet <rco@odoo.com>
Fix a corner case when the expense currency doesn't update when a cost is added to the product
Steps to reproduce:
- Create an expense in a foreign currency
- Add a cost to the expense product
Before fix:
Unit amount currency stays in foreign currency
After fix:
Forces expense currency to
company currency
task-3455446
closesodoo/odoo#135570
X-original-commit: 67901a4429c69fbba96c32af5d8f58aff54f0be5
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
This commit adds a copy of the attachments from the expense report to the created journal entry.
task-3443042
closesodoo/odoo#132955
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This pr aim to improve the pdf of the expense report. we have changed the design
of the header of the report, the table and also added an annex with the
different attachments.
For the attachments, when it's a pdf it's simply merge to the actual pdf but
when it's an image we use a new template to display the name of the expense
link to that image.
closesodoo/odoo#133611
Task: 3443413
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
If we try to register payments for multiple expenses with multiple bank accounts from the expenses app, there is a traceback regarding the bank ids, as a singleton value was expected. We can do the same process from the vendor bills and the payment will be registered fine.
1. Create two expenses against two employees having different bank accounts.
2. Approve and post both of them.
3. In the 'To Pay' expense list, select the both expense reports and click on register payment.
Current Behaviour:
A traceback is thrown that a singleton value was expected. This is because there were multiple bank accounts against that payment.
Expected Behaviour:
The payment should be registered without any problem.
OPW-3272500
closesodoo/odoo#132774
X-original-commit: c7f62dca74e89659230ebc7a02d290cd62dd8323
Signed-off-by: Anh Thao Pham (pta) <pta@odoo.com>
Signed-off-by: Hamza Islam (hisl) <hisl@odoo.com>
These changes are made as a result of simplifying attrs and 'states' in
views. However, they should have remained in a separate commit. When
applying the script making the xml changes (used later for the migration
script), the script checked the definition of the python fields in order
to convert the information into a python expression. Therefore, this
commit is not applied when the script is applied to xml changes.
During this attribute deletion pre-existing errors were found. Part of
the code was using the boolean values of 'states' and another part of
the code was not. The behavior could therefore be different (in cases
where readonly on the field had the same value as the ballan in
'states').
Following the deletion of 'states' and without the application of the
view migration, the js tests (tower) were no longer functional. Tests
using the Form view suffered the same effect. There are few tests that
had to be adapted, including two tests in business accounting (updated
by the accounting team). A test for column_invisible did not work. Test
checking if the test system triggers an error if we try to write on an
invisible field. It turns out that Form was testing on the value of
invisible but not taking into account if the column was invisible. The
test system fix is applied separately because there were a lot of tests
that were incorrect.
Part-of: odoo/odoo#104741
When the partner is missing, the error message is not clear enough.
This commit adds a new error message to clarify the issue.
Task ID: 3438559
closesodoo/odoo#132029
X-original-commit: 5be853ebb6da19a4f0a147944995583e234bf1b9
Related: odoo/enterprise#45779
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Naceur Amine Saddem (sana) <sana@odoo.com>
This fixes a bug when you change currency on an already saved expense
due to the fact that the unit_amount is never recomputed but used to
generate the move line balance
Step to reproduce:
- Duplicate an existing expense paid by an employee
- Change currency + save
- create -> post expense report
- The total amount and remaining amount do not match
closesodoo/odoo#131709closesodoo/odoo#131818
X-original-commit: e0bceb37ee7656c37ab99a4a4bb3b71d85199e1b
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
before this commit, on posting journal entry from
the expense it shows a warning in the log.
*warning in the log*
Action {6: account.move(49,), 'type': 'ir.actions.act_window_close'} contains custom properties 6. Passing them via the params or context properties is recommended instead
after this commit, on posting journal entry
warning wont be displayed in the log
closesodoo/odoo#131444
X-original-commit: 00b09c548b0a01191bea20584193da6a02681a36
Signed-off-by: Laurent Smet (las) <las@odoo.com>
If you have large amount of product.template records (e.g. over 40k),
`hr_expense` module can't be installed as you would get MemoryError. It
would consume all memory while computing `can_be_expensed` field.
For that, using `_auto_init` to make it less of a memory hog.
closesodoo/odoo#131954
X-original-commit: 1138a24760ad57cb9e9895926012d269b4e2bfb0
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Cleanup alias usage and definition. Prepare code to ease future changes and
improvements. Notably
* add a 'alias_email' computed field on the mixin allowing to have the
complete alias email when set, and False in case it is inactive or linked
to an inactive alias domain;
* remove unnecessary alias_id field definition when just the help differs
from the standard definition coming from the 'mail.alias.mixin';
* use fields coming from 'inherits' instead of using alias_id and its sub-
fields; notably use 'alias_display_name' and 'alias_email' fields;
* remove useless custom code and management;
* improve alias parameters support code in configuration parameters;
Task-3453343 (Mail: Cleanup Alias Usage)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)
Part-of: odoo/odoo#130632
When paid by the company in another currency
with at least one tax, there may be
a rounding difference between the move and the expense
task-3390444
closesodoo/odoo#130397
X-original-commit: c889dcc83daeaccb09b7692e430e232778fc031d
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
The accounting date on the report sheet and the linked
moves are always set at the current date
We want the accounting date to be the expense date,
or the most recent expense date when possible
task-3390444
X-original-commit: f1d03364230058f77f23bf0083e2757c8cd98e9a
Part-of: odoo/odoo#130397
Allow sharing records between company
* accounts
* taxes
* fiscal positions
* products
* ...and some related models
These records can be read and used in children companies.
This can be used to
* have different branding for different businesses
* allow more complex security rules
* consolidate branches differently
* manage different tax reports with different tax ids in the same
country
task-3371677
closesodoo/odoo#125642
Related: odoo/enterprise#43215
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This allows the user to set the total_amount_company
Currently, when an employee set the amount
in a foreign currency, Odoo doesn't let the employee
register how much they have been charged after
conversion in their own currency
(assuming that it's the company one)
After this if the user changes the total_amount_company,
the new rate is computed and used
Task-3255758
closesodoo/odoo#127246
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Description of the issue/feature this PR addresses:
- Expenses are automatically created when uploading or scanning receipts. This is a feature often used by employees who have a lot of tickets and upload them in batch. The expenses created have a random category (product_id) specified. Companies may however want to specify the default category for accounting or management purposes. They are currently unable to do so.
Current behavior before PR:
- Companies can't specify default category for scanned/uploaded expenses
Desired behavior after PR is merged:
- In the Expenses setting, combine the "Default Journals" and "Payment" block into one and name the new block "Accounting"
- Add new setting in Expenses for specifying default category for scanned/uploaded expenses
- If that setting is set, use the value inside it for the category field of new scanned/uploaded expenses
closesodoo/odoo#124205
Task-id: 3354763
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
When an expense sheet move is created, there is only one
outstanding line, but it is usual to pay separately.
That makes the reconciliation step harder.
This makes sure one move is created per expense
Task-3328877
closesodoo/odoo#126805
Related: odoo/upgrade#4873
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Commit #2:
Splite the method `_compute_from_product_id_company_id` so each stored field has its own compute method to avoid invalidation issues.
opw-3336796
closesodoo/odoo#126529closesodoo/odoo#127794
X-original-commit: b64a378aab79ae4b6682ad66902c43a98a6f776d
Signed-off-by: William André (wan) <wan@odoo.com>
Steps to reproduce:
- install Expense and Accounting
- create 3 separate Expense categories ( this will create a related product of 'service' type) with a different Expense account and Vendor tax on it.
- Configuring different Taxes are important to replicate the issue
- Create a 'test' user who has no access to apps
- login a 'test' user and create an expense for one of the categories and save it.
- Update the expense to a different category and click 'submit to Manager'
Issue:
The account_id of the expense is not updated
Reason:
Multiple fields are computed using the same method `_compute_from_product_id_company_id`. The field being read-only=False
https://github.com/odoo/odoo/blob/c38cf4c2038d15890d5d50ec05fd5cb4f9f379b1/addons/hr_expense/views/hr_expense_views.xml#L199
It is protected during the write; that is, considered as user input
Solution:
Duplicate the field is it will not be read-only and put it as invisible
Split the compute method
opw-3336796
X-original-commit: 6664ccba5230d7890964cfe372ca863314f2fad4
Part-of: odoo/odoo#127794
Improve usability of employee form. It is confusing for end users
to create another record to encode the employee address.
Move all the private information on the hr.employee record itself.
Remove the M2O address_home_id.
TaskID: 3101400
This commit remove the forgotten '#TODO: remove in master' that
were forgotten during the FW-port
closesodoo/odoo#125887
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Allow expenses reports to generate foreign currency
payments and use foreign currency accounts when all
expense lines are of the same currency.
If the report is multi-currency the company currency
is used instead (previous behaviour)
Task-3346458
closesodoo/odoo#126836
X-original-commit: 3d6d36ac5bab95af76776f07e55f286850f22ff9
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
The customer was having an issue where they would create an expense from an email with the wrong cost on the expense.
Then when they would try to change the price on the expense record it would seem find all the way up until the journal was posted.
Issue:
When creating an expense from an email the unit_amount is updated instead of the total_amount.
This would cause issues if you had an attachment because when you would attempt to change the amount through the front-end this unit_amount would never get updated because it was set and there was an attachment (line 265).
However, when you would create a journal entry from this expense, because it has the unit_amount != 0 it would provide the unit_amount instead of the total_amount.
Thus propogating the original number from the email even if it was updated between the time of posting and the creation of the expense from the email.
Solution:
Implement an inverse function on total_amount that will update the unit_amount to total_amount_company.
This will cause the unit_amount to stay up to date with the total_amount while also taking into account currency.
opw-3286372
closesodoo/odoo#126388
X-original-commit: c2588824edc732bea40b1a8f6e5248b3d318b361
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Have an employee with payment terms set in the contact form
Create an expense for $100 for the employee
Create the expense report > Submit to manager > Approve > Post journal
entries
Issue: The bill due date is manually set to the Accounting Date.
This is not consistent with the Payment terms applied on the
bill
opw-3298981
closesodoo/odoo#124542
X-original-commit: d363aa12429768e63d0f9def7006101983fd0adc
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
Before: in the "My Expenses" statusbar, only expenses paid by the employee were shown.
Now: for the "to submit" and the "under validation" states, we show expenses paid by the employee AND the company. For the "to be reimbursed" state, we ONLY show expenses paid by the company.
task-3319115
closesodoo/odoo#121627
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
When uploading a PDF, the expense name is showing
the 1st category of expense instead of the name
of the PDF.
opw-3339756
closesodoo/odoo#123608
X-original-commit: 7ec2bb68067e49ea5ab2bbd6598264ccb78cfd70
Signed-off-by: William André (wan) <wan@odoo.com>
When an expense sheet move is created, there is only one
outstanding line, but it is usual to pay separately.
That makes the reconciliation step harder.
This makes sure one outstanding line is created per
invoice_line and then if only one payment is made
it can go through the same process as a batch payment
Task-3292188
closesodoo/odoo#120450
Related: odoo/upgrade#4625
Signed-off-by: Laurent Smet <las@odoo.com>
Previously, a user could link his own expenses to a expense sheet
of someone else.
This would not be allowed upon creation but was allowed when updating
the values of the expense.
This commit add a simple check at the beginning of the write()
closesodoo/odoo#120661
X-original-commit: 884510b1496e0a0eba7171f4ef4bb749856cb1bf
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Bugprovemnts when multi-currency is enabled, alows to
enter expenses in activated currencies. The expense is
directly converted to the company currency using same day'
rate:
- do not reset amount on currency change
- rework of the views, to show currency and related amount only
when relevant.
- remove dead code: amount_residual on expense
closesodoo/odoo#114528
Task-id: 3191597
Related: odoo/upgrade#4443
Signed-off-by: Laurent Smet <las@odoo.com>
Activate Multicurrency (USD company curr, EUR foreign currency, 1 EUR = 2 USD)
Have a Bank account in both currencies.
Create an expense of 100€, paid by company
Create report, set EUR journal as Bank Journal
Send To manager > Approve > Post Journal Entries
Open created payment
Issue:
- Payment amount is 200€
- In journal items, amount_currency and balance is 200$
Do the same with "Paid by employee".
Open the vendor bill
Issue:
- Invoice lines are expressed in the wrong currency
opw-3269009
closesodoo/odoo#119490
X-original-commit: 5eab4469d87a4d1ca80916ca5790691ffed68e38
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
When using message_post, the body format must be explicitly specified.
If html is expected, a Markup object should be used.
If text is given, the content will be escaped.
Before this PR:
message_post was unaware if the content of a message was HTML or
text. This lead to multiple situation where the content was
incorrectly considered as HTML and led to display errors.
In
self.message_post(body="Hello %s!" % self.name)
if the name contained HTML, it would be evaluated.
In
self.message_post(body="Contact Raoul <raoul@caramail.be>")
the email would not be displayed as considered as unknown HTML and
discarded by the sanitizer
Now each call must explict the type of content.
Use the escape() helper to properly combine Markup and translations.
It would also be acceptable to use Markup() to wrap a static
translation but escape is better as one can not guarantee the content
of a translation.
closesodoo/odoo#111850
Related: odoo/documentation#3612
Related: odoo/enterprise#36728
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Steps to reproduce:
- set early_pay_discount_computation on company to mixed.
- create an expense with taxes
- try to post entries from the expense
> traceback
This commit adds the missing key in the needed_terms computed
on in hr_expense. We could have bypassed the computation in the
case of expenses but simply adding the key sounds like a more
future-proof solution.
opw-3244294
closesodoo/odoo#118250
X-original-commit: 7922a7db0d840a33a3db54da1a359ac95e61cb7b
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Detry Thomas (det) <det@odoo.com>
Before this PR, the field tax_ids had no tooltip.
Since v16 we now allow the use of all taxes in the expenses module now. But, there is not much mention that price-excluded taxes will be used as price-included taxes.
In the release notes it just mentions that all taxes are usable, but there is no mention of anything else. This seems a bit confusing. Adding the tooltip will help users.
Also adding fresh exported .pot
closesodoo/odoo#117351
Task-id: 3252757
X-original-commit: df28d24699a6bfb4ea142fc07b10c1835d9d4323
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
You cannot validate and expense report having expense_line_ids of
different payment mode.
But so far, it was possible to select these lines, and it would
be blocked upon saving.
We will improve this behavior by extending the domain on the
expense_line_ids field and disallowing to add lines that would lead to
an error later in the process.
It will also correctly handle the creation of new line via the expense
report form view, and add the paid by field as optional hidden in the
view in order to allow to find more easily the expense line that are
causing issues.
task id # 3221780
closesodoo/odoo#116077
X-original-commit: ec18bd414c831a9af67802dcd5d7181ef8d43049
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Explanation:
A rework of hr_expense has been introduced in master and landed in 16.2.
https://github.com/odoo/odoo/commit/f79ff3fb374650670e89f231aaf17bb8d6596c25
There was a need to backport it to 16.0 then 16.1.
https://github.com/odoo/odoo/commit/90affb562962d0dc233526e3f15f5b60f383331d
During the backport;
- a computed fields 'journal_displayed_id' has been introduced and will need to be removed again in master.
- 2 bugs have been discovered:
-- the analytic.account were not created anymore (function not called)
-- the payment terms for expense paid by company could not be modified as a filter was missing
closesodoo/odoo#115650
X-original-commit: 672f4efd2c990ab6eef8f934c41625860b8ded46
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Detry Thomas (det) <det@odoo.com>
Steps to reproduce:
Create an expense by sending an email.
Make sure the product has a zero cost.
Issue:
The expense has no total amount even if
a unit price is detected in the subject of the mail.
Solution:
Compute a total amount if we have a unit price.
opw-3128566
closesodoo/odoo#115620
X-original-commit: eb629fa82cbf592184ed60d0bf309a26a4465b70
Signed-off-by: William André (wan) <wan@odoo.com>
Missing sudo for portal user on Invoice list.
When portal user go to his portal, to display the list of the invoices
we compute the url via get_portal_url that will call this method
`is_purchase_document` and got a traceback due to missing permission.
Now we call it with sudo to bypass the Access Right error without leaking
any extra information since it is casted as boolean later.
`get_portal_url` -> `record.access_url `-> `_compute_access_url`
account:account.move `def _compute_access_url` -> `filter(is_invoice)`
account:account.move `def is_invoice` -> `is_sale_document or is_purchase_document`
hr_expense:account.move `def is_purchase_document` -> `return bool(self.expense_sheet_id) or super()`
closesodoo/odoo#114424
X-original-commit: 01a91419f906bd8d9248e6376a0246b667218ca2
Signed-off-by: Jérémy Kersten <jke@odoo.com>
This fulfills the goal of searching and fetching fields in a single SQL
query. We introduce the new method search_fetch() for that purpose.
Also introduce method fetch() to fetch some fields for a recordset if
they are not in cache yet.
The call graph is as follows:
search() calls search_fetch()
search_read() calls search_fetch() and _read_format()
read() calls fetch() and _read_format()
search_count() calls _search()
search_fetch() calls _search() and _fetch_query()
fetch() calls _search() and _fetch_query()
The methods _search() and _fetch_query() are usually the ones to
override to implement business-specific logic. The method _search()
returns a Query object to retrieve the records that satisfy the given
domain and are accessible for reading. The method _fetch_query() uses a
Query object to retrieve fields from the database and store them in
cache.
Also use search_fetch() to save one query in search_read() and the
reading of one2many fields.
Part-of: odoo/odoo#112126
Add mail.thread.main.attachment in the inheritance chain of all models that
use the main attachment feature.
Note that we remove the main attachment from crm_case_15 of the demo data as
crm_lead doesn't use that feature.
Task-2648976
Part-of: odoo/odoo#110734
Rework of the hr.expense workflow so that:
- expenses paid by employee generate purchase.order
- expenses paid by company generate entry that look like payments
Main reason being that purchase.receipt are not active by default.
That makes the entry hard to find, holes in sequences, inconsitency
with payment states.
It also remove the refusal of expenses as this was dead / inaccessible code, only reports can be refused.
task-id: 3126550
[community](https://github.com/odoo/odoo/pull/110518)
[enterprise](https://github.com/odoo/enterprise/pull/36090)
closesodoo/odoo#110518
Related: odoo/upgrade#4266
Related: odoo/enterprise#36090
Signed-off-by: Laurent Smet <las@odoo.com>
This method is not used by rpc calls and wrongly allowed users to read the standard_price
field by calling the method through rpc.
Make it private to reduce its uses and avoid this potential leak of information.
closesodoo/odoo#113234
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Before this commit, the user had to go over each expenses to
register a payment.
He now has the possibility to do so from the expense report
tree view via the "register payment" button.
task-id: 3116195
[community](https://github.com/odoo/odoo/pull/109671)
closesodoo/odoo#109671
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
RATIONALE
Purpose of this commit is to cleanup main post helpers and have a more easy
and understandable way of calling them.
SUMMARY
We now have two main API methods, based on business flow: either posting
on documents, either sending a mass mailing. Indeed those two flows are
different
* post: create message, then launch notification process by taking into
account subtype, followers, ...
* mail: create mails in batch with recipients being based on template or
given partners. No notifications is involved, only maybe traces if a
mass mailing is linked
Delegate QWeb rendering to the render mixin (i.e. _render_template_qweb_view)
in order to have a single point to forge evaluation context and re-use
existing rendering code.
SPECIFICATIONS
Main API helpers are now
* ``message_post_with_source``: (batch) post on records, using an ir.ui.view
(given a record or its xml id) or a mail.template record (given a record or
its xml id). When using a template, a composer is called to post on each
record (as batch post is not yet supported). When using a view, a direct
call to message_post using the rendered bodies is done, one record at a
time.
* ``message_mail_with_source``: send a mass mailing on records, acting like
invoking the mail composer in mass mode. Same arguments are valid, either
a reference to a view, either a reference to a mail template.
Other helpers are
* ``_message_log_with_view``: (batch) log on records, using an ir.ui.view
to render the body using QWeb (no notification process);
* ``_message_log(_batch)``: (batch) log on records (no notification process);
* ``message_notify``: notify partners on records (creating notifications
specifically for some people while message itself is not displayed in
chatter);
Code migration
* ``message_post_with_template`` in "mass mode": use ``message_mail_with_source``
and set the template record as source;
* ``message_post_with_template`` in "comment" mode: use ``message_post_with_source``
and set the template record as source;
* ``message_post_with_view``: its main usage was to post on a document, in which
case it generally can be replaced by ``message_mail_with_source`` using
the view reference as source;
Task-2710804 (Mail: Clean MailThread Posting API)
Part-of: odoo/odoo#99482