Steps to reproduce the bug:
- Let's consider an expense E paid by the company
- Validate E and post journal entries
Bug:
Two journal entries were created:
1. Outstanding payments (debit) / Account Payable (credit) as draft
2. Expense (debit) / Outstanding payments (credit) as posted
With the this fix:
Only the second entry is created and posted
This reverts commit 25ac51e01a2084afd7a4d5e9c4c87a50ea787b93.
opw:2510663
closesodoo/odoo#73715
X-original-commit: 3add44d462deebb2b7600d0bd2d86a4af8b2ab4e
Signed-off-by: William André (wan) <wan@odoo.com>
Steps to reproduce the bug:
- Let's consider an expense E paid by the company
- Validate E and post journal entries
Bug:
Two journal entries were created:
1. Account Payable (debit) / Outstanding payments (credit) as draft
2. Expense (debit) / Outstanding payments (credit) as posted instead of Expense (debit) / Account Payable (credit) as draft
opw:2510663
closesodoo/odoo#71627
X-original-commit: 25ac51e01a2084afd7a4d5e9c4c87a50ea787b93
Signed-off-by: William André (wan) <wan@odoo.com>
Purpose
=======
When you archive an employee, if he's the manager/coach of someone else, the link is not removed.
closesodoo/odoo#71368
Taskid: 2536219
Related: odoo/enterprise#18588
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Currently, when we create an expense that is paid by company,
then create and approve a report, then post entries, 2 entries are
created. 1 is posted and is correct, the other one is in draft due to
the creation of the payment for employee and should not be there.
As when a company pays for an expense, in 99% of the cases,
it's because employees have a credit card funded by the company.
It happens often that company owners have this kind of card or even
employees but that's more common in the US. In such case,
it's just an account payable to visa or mastercard. so no need to
create a payment for the employee.
So this commit, draft entry will not be created when payment paid
by the company while posting the entries from the expense.
closesodoo/odoo#71063
Taskid: 2410551
X-original-commit: 2aedd076317b37ceffba061c48e3d4fc38f02ea9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Currently, When we create expense report from expense it will
directly create a expense report record so discard button on
top is misleading.
So in this commit, when creating the expense report from the expense
it will not create an record but set the default value in editable
form view with auto computed name based on expense.
Also create report action coming to the two places
1) in top action menu
2) on tree header
So in this commit, removed 'create report' menu from top
action bar.
Added the depends on can_reset and can_approve to compute
the value for displaying the button when record is not saved
from the 'create Expense report' button and default in submit state.
also fix the attachment_number field because expense.id is
NewId_X while passing in default_get of expense_line_ids so count was
0 without saving the expense sheet.
closesodoo/odoo#65104
Taskid: 2359834
Related: odoo/upgrade#1875
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Steps to reproduce the bug:
When trying to import or create a expense product with supplier taxes,
the supplier taxes were removed.
PS: The field vendor taxes is available in the expense product view
opw:2444551
closesodoo/odoo#65403
X-original-commit: 02d0591b73f5acd8c94e65cda3af1158c3a2254a
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Display notification to give feedback to user.
And reload the view with the params "next".
closesodoo/odoo#67219
Taskid: 2344276
X-original-commit: bd33f283a1fa39815481ca28918c65ac7b48d641
Related: odoo/enterprise#16830
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Display a confirmation dialog when a user creates duplicate expenses.
Two expenses (or more) are considered duplicates when they share the same
date, amount, product, employee, company and currency.
closesodoo/odoo#64190
Taskid: 2368636
Related: odoo/upgrade#2061
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This line was an hack to manage the custom register payment wizard of hr_expense.
Since this wizard is gone and 'payment_id' is a related stored field in account.move.line, we should not write such data explicitely.
closesodoo/odoo#67162
X-original-commit: 2d7f45e76607736bcc4f37bec480967ae2b373d7
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
- Add "payment_status" field to be more explicit.
- Turn error message "Expenses must have an expense journal specified to
generate accounting entries." into "Specify expense journal in tab
Other Info to generate accounting entries."
closesodoo/odoo#65528
Task: 2424870
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
In a multicompany environment, when a expense is created from the
expense email alias, the expense account is computed with SUPERUSER
context, so depending on the SUPERUSER set company, we could get
a mismatch of expense and employee's company and the account one, wich
causes a subsequent error when trying to post the expense.
closesodoo/odoo#65413
X-original-commit: da758c44b19a9339f0c0b1b6a74c11e3e5491a64
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Co-authored-by: simongoffin <sig@odoo.com>
In order to make the expense form more intuitive, it was necessary to distinguish between whether the product has cost different from
zero or not. Depending ot this context, some fields are shown or not. Also 'Bill Reference' is shown only to account managers.
Now the expense can be submitted in different currency and it can be reimbursed in company’s currency.
In case the latter two currencies differ from each other,
the conversion is done automatically and the rate is also displayed.
Suggestion - untaxed_amount can be removed
Task - 2366775
closesodoo/odoo#61920
Related: odoo/enterprise#14838
Related: odoo/upgrade#2028
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Currently at odoo we use expense product terminology just because it's
set up using product. Inside the expense app, there is no reason of
not using category instead of product
So in this commit, rename the product term into category for all expense
views.
closesodoo/odoo#62661
Taskid: 2391433
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The reconciliation between an expense and a bank statement does not
update the expense and its sheet.
To reproduce the error:
(Need account_accountant)
1. Go to Expenses
2. Create one (e.g. an expense of $20)
3. Save, Create Report, Approve, Post Journal Entries
4. Go to Accounting > Bank
5. Create a bank statement (e.g. $-20)
6. Save, Post, Reconcile
7. Select the expense, Validate
8. Go to Expense > The created expense
=> The expense's state is still 'Approved'. It should be 'Paid'.
Moreover, if you click on the associated report ("View Report"), the
same error appears: the sheet's state is 'Posted' instead of 'Paid'.
The problem was that the method 'action_invoice_paid' (deleted in this
commit) was never reached. Moreover, there was no way to get the
expense's residual amount.
OPW-2389414
closesodoo/odoo#63486
Signed-off-by: adwid <adwid@users.noreply.github.com>
One can leave the currency_id empty and that causes Traceback error
Task - 2409942
closesodoo/odoo#63159
X-original-commit: 7473ad44f960aa3609faafe0cee8e12a392b43a9
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: sofiagvaladze <sofiagvaladze@users.noreply.github.com>
Since commit 80c1dad, the form view of a new record was no longer
editable.
The "editability" of the expense sheet is computed based on the status
but no default value was available.
closesodoo/odoo#63049
Taskid: 2413154
X-original-commit: d0ad00fddf5c3eb05381769a4e75c93e4dcfc388
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
Otherwise, they may crash or be incorrectly verified when
creating/updating recordsets containing multiple records.
Also improve the constraint error messages to be more detailed.
When possible, use a sql constraint instead to speed up the records
validation.
Task Id: 2328664
COM PR: https://github.com/odoo/odoo/pull/55525
ENT PR: https://github.com/odoo/enterprise/pull/12250
The open_action_with_context was not using _for_xml_id, producing an
error when reading the action content.
In open_action, the action_name was taken from the context and needs
sanity checks. Ensure only actions from the account module can be
read and only if the user has access to the target model.
This is a limitation of the previous behaviour but, at the moment, all
known calls are made refering to an action from the account module.
Limit the scope of this method while the 14.0 is still early to avoid
having a door open to ready any action, and difficult to close later.
Remove old action fetching from the context in create_move that is no
longer used.
closesodoo/odoo#61602
X-original-commit: a39e94f7e4dc74e850650ac90bbc5f85af130bc8
Related: odoo/enterprise#14695
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
Before this, misc operations always used the balance of the base line as the tax_base_amount of the tax line. This was inconsistent with the invoices, for which we invert its sign when making a sale invoice or a purchase refund (as for those operations, positive amounts are put in credit). This commit should make everything behave in the same way.
closesodoo/odoo#60912
X-original-commit: 2ca3158ce2de596526067dbd86da2ef7d4ae85bd
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
When a user can edit it's employee, the field expense_manager_id is
editable but any value is ignored, and the previous manager is forced.
closesodoo/odoo#60261
X-original-commit: 41f73fe92139811bc1f43ea07ca4539768001ae5
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
If we submit an expense to the manager, a next activity is created for him.
If we reset to draft, it is not cancelled.
So if we resubmit expense, a second next activity is created for the manager.
This commit will cancel created activities when we put the expense in draft
Task id: 2350168
closesodoo/odoo#60107
X-original-commit: 107ac15687befccf59527730cc776d5ad68cac44
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
TLDR: fix a mess in journal fields check
Steps:
* Create expense "paid by Company"
* Click Post
Before:
* AttributeError: 'account.journal' object has no attribute
'default_credit_account_id'
After:
* Either posted or shows user error about journal misconfiguration
Notes:
* Field ``default_credit_account_id`` is replaced in https://github.com/odoo/odoo/commit/41f119d5325dfbbf916d1d34e63946646ed4d44c
* The error is introduced during incorrect forward-port #58852
---
task-2355177
closesodoo/odoo#59780
X-original-commit: 5c0fca662279702115b5e61c8227f82086693e38
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
PURPOSE
user with the 'team approver' or the 'all approver' access right levels
cannot approve his own expenses. However, the 'approve' button is still
being displayed, which is confusing and misleading, and an ugly user error
is thrown when the user tries to click on it
SPECIFICATIONS
Hide the 'approve' button on expense reports If the user has either the
'team approver' or 'all approver' access right levels and the employee_id
set on the report is linked to the current user
LINKS
Task-2323982
closesodoo/odoo#56784
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
PURPOSE
Clean code. Be more performance oriented.
SPECIFICATIONS
Improvements applied in this commit
* not all() --> any(not) for earlier returns;
* all([generator]) --> all(generator) to avoid unnecessary list casting.
This code construct is better managed by all;
This commit will probably not have a big performance effect on standard
production databases. However each performance and cleaning improvement
is welcomed.
LINKS
Task ID-2328619
closesodoo/odoo#56810
X-original-commit: 1cc6bb1231401ea7f501d2f5b5e9641ec8734850
Related: odoo/enterprise#12802
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
The "Incoming Emails" setting is now enabled by default and the email
address shown on the list helper.
closesodoo/odoo#56069
Taskid: 2300864
Related: odoo/enterprise#12494
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
/web/action/load is the public controller that Should be used by the
webclient to fetch actions
_for_xml_id is the default access method on actions that implements
fields filtering to avoid leaking server action code or other
information not needed by the webclient
Implementing whitelist of fields that can be access per model
- Use the one defined in the account module allowing paying multiple journal entries
and group payments together.
- Remove the hr_expense_check module that contains only duplicated features regarding the
register payment wizard.
--task: 2273528
Add an easy way to not post the entries in the future when calling
post() on it, but rather set it to be auto-posted at accounting date.
This is useful when we are creating a lot of entries in batch and some
might be in the future, some in the past, and we don't want to separate
that in two batch every time. (asset, accrual, transfer,... )
This fix will complete the task 1965890 by allowing the user with
access rights to edit fields (reference, account_id, taxes_ids
& analytic_account_id) depending the sheet state.
Also added Tests to check if access rights on expense lines are
working well depending on the expense.sheet.state and the user group.
Task ID 2226352
closesodoo/odoo#53862
X-original-commit: f42c812916a50438078210c020f6144c7417d365
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
Purpose of this task is,lots of business flows can be crashed if
the field Private Address(address_home_id) is a private address instead
of a regular contact.
so in this commit,we change the demo data for employee and set the
private type address on employee for private address and also fix
the flows on which errors could occur.
Currently billing administrator does not have right for private address
and while creating payment from expense it was going to set the
customer from the employee's private address on payment so give the
private address right to the billing adminnistrator.
Also chaned admin/demo user's private address as 'private' instead of
regular contact.
and on hr_expense use the Sudo while accessing the home address this
method is used from payslip too.
TaskID:2170016
closes odoo/odoo#46628
Closes: #46628
Related: odoo/enterprise#8924
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Wrong usage of self in for loops makes some apparently multi-friendly
methods not work correctly when called with a recordset of len > 1.
This commit replaces those references by the correct unique record
reference which should be used at this iteration of the loop, avoiding
potential exceptions or wrong behavior in the concerned methods.
closesodoo/odoo#53320
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Currently, when a user created with default access rights,
but doesn't have employee linked with user then it will generate a
traceback because if user is not linked with employee then
it will return null so due to that while rednering the template
error was generated.
So in this commit, fix the treaceback by returning default values
if the current user had no employee
closes odoo/odoo#53161
Taskid: 2262636
Closes: #51687
X-original-commit: 96de35eda1a8e6e5086eb8221e939f3f737a9a6c
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commits refactors the code of the reconciliation, in order to facilitate the process of complex use cases, namely multi-currencies or cash-basis-taxes related (see details below). It also prepares the code for a second refactoring where we will save on each journal items the amount_currency and currency_id field (even in case of operation made in company currency), also in the sake of simplification.
1) Multi-currencies:
- the account.partial.reconcile model now will have dedicated columns to specify the amount of the partial reconciliation in the debit_line_id currency and the credit_line_id currency. That comes in handy when dealing with journal items having different secondary currencies, but also allows some simplification.
- residual_amount_currency computation changed accordingly
- moved models account.full.reconcile and account.partial.reconcile in their dedicated .py file
2) Cash basis taxes
- cash basis entries now handle correctly rounding errors to make sure the exact amount of gets reported when the reconciliation becomes full.
- the account for the base amount of cash basis entries has to be set, now, on the company instead of on each cash basis tax.
- that new 'property' field can be set at the CoA installation via the field property_cash_basis_base_account_id of account.chart.template, or going through the accounting settings.
Was task task: 2243420
Was PR #50308
Related: odoo/upgrade#1121
Related: odoo/enterprise#10252
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
The `state` field of `account.payment` no longer exists and should not be set explicitely.
Set the `ref` field to the expense name instead of the `name`field.
Task ID 2266922
closesodoo/odoo#52823
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Create an expense
Click "Create report"
Save the report A (you can also submit, post inventory, ...)
Now click on Create (a new report B)
The expense in A are copied in B because default_expense_line_ids
are not cleared
Closes#52457
opw-2271851
closesodoo/odoo#52852
X-original-commit: e8cee2d8249f6c0076253f37db040eef293bb275
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Steps to reproduce:
- Create a bank journal, with "post at" = "Bank reconciliation"
- Create a new expense paid by "Company"
- Create a report and confirm
Current behavior:
- the bank move is posted
Expected behavior:
- the bank move is not posted (and i will posted during the bank reconciliation"
closesodoo/odoo#52260
X-original-commit: 0b45a8317f1e4538ad93aa169b8be08f5403340a
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Merge account_analytic_default into account
Merge account_analytic_default_hr_expense into hr
Merge account_analytic_default_purchase into purchase
Prevent having to manually install default modules after activating analytics
closesodoo/odoo#50816
Task: 2182900
Related: odoo/upgrade#1186
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>