Commit Graph
58 Commits
Author SHA1 Message Date
roen-odoo ca6cd0362e [FIX] hr_expense: Expense not cancelled
Current behavior:
When cancelling an expense payment, the expense state was not modified and was still 'paid' when it should be 'refused'.

Steps to reproduce:
- Create an expense and post the expense and register a payment for the expense.
- Then go the vendor payments and cancel the associated vendor payment.
- The expense still shows as paid in the expenses page.

opw-2711383

closes odoo/odoo#82496

X-original-commit: 16459957d23f4bdfddfe96d72ef96cbdc6fec539
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-01-11 16:18:49 +00:00
Adrien Widart 4a54a0dcb5 [FIX] hr_expense: convert base amount if different currency
In a multi-currencies environment, if the user creates an expense with a
different currency than the company's, one of the associated account
move lines will have an incorrect base amount.

To reproduce the issue:
(Need account_accountant. Let USD be the company's currency)
1. In Settings, enable "Multi-Currencies"
2. Edit the currency rates:
    - EUR: 2
    - USD: 1
3. Create an expense:
    - Currency: EUR
    - Unit Price: 700
    - tax: 15%
4. Create Report, Submit, Approve, Post Journal Entries
5. Accounting > Reporting > Tax Report, This Financial Year
6. Audit of "Tax 15.00%"

Error: Base amount of the expense is $700, which is incorrect. It should
be either 700€ or $350

OPW-2613547

closes odoo/odoo#75264

X-original-commit: d6fd7301291dfe3ffd58d33edb3f2c4270e3b8a1
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-08-18 15:14:08 +00:00
Touati Djamel (otd) 8f6e85f752 [FIX] account, hr_expense: fix reconciliation function
Steps to reproduce the bug:
- Install Accounting and Expense app
- Go to accounting settings > enable cash basis option
- Go to accounting > configuration > accounting > taxes
- Create a new tax or choose an existing one e.g “Tax abc”:
Tax Computation = `”Percentage of Price”`
Tax Type = `”Purchases”`
Choose any value for amount
Select "Based on Payment" in tax due
choose an account with the "Allow Reconciliation" option activated in the Cash Basis Transition Account field
Save

- Go to expenses > Expense Reports > All reports > Create a new one :
	- Add 2 expense and for both set up the taxes to "Tax abc" and unit price > 0
- Submit to manager
- Approve
- Post journal entries
- Register a payment

Problem:
A user error with the following message is triggered: “You are trying to reconcile some entries that are already reconciled”

In the use case we have two expenses and for each, an `" account.partial.reconcile "` will be created,
so we will loop twice and therefore add twice all the `”account.move.line”` linked to the taxes
in the dict `" to_reconcile_after "`: https://github.com/odoo/odoo/blob/beccf82e09d536255d9d9cb9bfe58ebae2559843/addons/account/models/account_partial_reconcile.py#L585

Then we loop to reconcile all the `" account.move.line "` which are in the dict `" to_reconcile_after "`,
but since we added them all twice, at each turn of the loop we give them all as a parameter
of the “reconcile” function without checking whether they are already reconciled or not.

opw-2565934

closes odoo/odoo#74432

X-original-commit: fb2b1482f5d3dec924b08e08dc915d6608c7d6b3
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-07-29 16:04:32 +00:00
Nicolas (vin) c1693581d7 [IMP] account: payment method improvements
To improve the payment method system, proceed to a few changes
such as changing the view a bit, making sure payment acquirers are not
linked to a journal by default and that only the manual payment method
type can be used multiple times in a single journal.

Task id #2573145

closes odoo/odoo#73596

X-original-commit: 9122b367baea10e59b66e45bf7c458a6f1e82efb
Related: odoo/enterprise#19623
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2021-07-12 18:10:36 +00:00
Nicolas (vin) 04522f01e6 [IMP] account: allows multiple payment acquirers on a journal.
Users may want to be able to have transactions coming from multiple
payment acquirers to be registered in the same journal.

This will allows that.

Task id #2414749

closes odoo/odoo#67331

Related: odoo/upgrade#2500
Related: odoo/enterprise#17258
Signed-off-by: William André (wan) <wan@odoo.com>
2021-06-03 10:00:26 +00:00
qdp-odoo bb1f14e728 [IMP] hr_expense: add "payment_status" field + change error msg
- 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."

closes odoo/odoo#65528

Task: 2424870
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-03-03 09:39:46 +00:00
Laurent Smet 68aa40de06 [IMP] account: introduce a new field on move lines to avoid inverting tax tags
The sign of tax tags sometimes could get inverted explicitly. It typically happened for misc operations, so :
    - manual entries
    - CABA entries
    - writeoffs created from the reconciliation widget

We had to do things this way in stable to fix those use cases, but it's not ideal, as the tags shown to the user were inverted, so it was a bit confusing, as one would have expected to see the exact same tags as on tax configuration.

We fix that by using a boolean field on account.move.line telling whether or not the sign must be inverted. This allows keeping the same tags as in the tax config, and simplifies the computation of the tax report's multiplicator, making the overall model more intuitive for both user and developper.

Task 2363287

closes #62536

closes odoo/odoo#64627

Related: odoo/enterprise#15031
Related: odoo/upgrade#1983
X-original-commit: 4e8581b6846ef8ee4601c994b0d586734a4fe117
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-15 15:40:16 +00:00
Thibault Delavallée 1404af789c [REF] various: use helper to create tests users
PURPOSE

Lessen use of mail-specific calls and variables

SPECIFICATIONS

Use mail_new_test_user tool in tests, lessening use of mail-specific context
keys in tests.

LINKS

Task ID-2326281 (context keys use cleaning)
PR odoo/odoo#56631
PR odoo/enterprise#12707

X-original-commit: 910559c092dc7dfa00b91339a5423e16cd4668e1
2020-08-28 07:59:23 +00:00
Laurent Smet 419d4bbee0 [IMP] account, *: Required currency on journal items
closes odoo/odoo#50711

Task: 1930680
Related: odoo/enterprise#10394
Related: odoo/upgrade#1147
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-08-13 11:48:06 +00:00
Laurent Smet 09afbf1608 [IMP] hr_expense,sale_expense: Remove dependency to AccountTestCommon
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.

--task: 2301180
2020-07-31 07:11:32 +00:00
Nasreddin (bon) b033244f99 [FIX] hr_expense: Fix accounting fields edition + add test
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

closes odoo/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>
2020-06-30 11:09:14 +00:00
Anh Thao Pham (pta) 3bd345597f [REF] hr*: convert onchange methods to stored-editable computed fields
Impacted modules:
hr, hr_contract, hr_recruitment, hr_payroll, fleet, hr_skills, hr_appraisal, ....

Several onchanges have been converted to computed fields in the following modules :
    Community :
        - hr
        - hr_contract
        - hr_recruitment
        - hr_work_entry
        - hr_maintenance
        - hr_expense
        - hr_expense_check
        - hr_holidays
        - sale_expense
        - account_analytic_default_hr_expense

    Enterprise:
        - hr_contract_salary
        - hr_referral
        - hr_payroll
        - hr_payroll_expense
        - test_l10n_be_hr_payroll_account

There are still 2 onchanges with complex behavior that couldn't be converted easily:
- an onchange that updates "tz" (timezone) that is defined as a related field
  to "resource_id.tz". Apparently it is useless except to initialize the default
  value of "tz".
- an onchange that updates "name" that is defined as a related field to
  "resource_id.name".
  the applicant.

closes odoo/odoo#45414

Taskid: 2169099
Related: odoo/enterprise#8572
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-20 10:32:45 +00:00
Xavier Morel 0b4cf7de5c [REM] hr_expense: leftover print in test
closes odoo/odoo#48252

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-03-24 11:46:44 +00:00
fw-bot fccaa703c4 [MERGE] project, hr_expense: Fix several multi-company issues + tests
Purpose
Fix multi-company access issues following the big changes that happened
(the 13.0). Make the usability better in order to avoid potential
multi-company issues for the user.

Specification
Check the related commits to see the different fixes that have been
made. For more information about the technical/functional considerations,
check the related task.

Taskid: 2088891
X-original-commit: 5c8df3a5e5f7960e5eab6439e0a32a06224ba826
2020-01-15 15:11:50 +01:00
Yannick Tivisse f44fbdb833 [IMP] account: Clean common tests classes 2019-11-12 11:34:36 +00:00
Yannick Tivisse 886cc7600a [IMP] hr_expense: Adapt tests to work with/without demo data 2019-11-05 13:08:03 +01:00
Julien Castiaux 4f03a5f136 [FIX] *: remove old deprecated modules/functions
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we
are also dealing with long deprecated modules, functions and aliases.

* `assert_` -> `assertTrue`
* `assertEquals` -> `assertEqual`
* `assertNotEquals` -> `assertNotEqual`
* `assertAlmostEquals` -> `assertAlmostEqual`
* `assertRaisesRegexp` -> `assertRaisesRegex`
* `assertRegexpMatches` -> `assertRegex`
* `base64.encodestring` -> `base64.encodebytes`
* `base64.decodestring` -> `base64.decodebytes`
* `inspect.getargspec` -> `inspect.signature`
* `inspect.formatargspec` -> `inspect.signature`
* `logging.warn` -> `logging.warning`

closes odoo/odoo#36863

Task: 2003936
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-09-17 11:36:42 +00:00
Christophe Simonis 5a273e74f0 [MERGE] forward port branch saas-12.4 up to fe59754c52
closes odoo/odoo#36721

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-13 13:32:51 +00:00
Christophe Simonis 51354fadb0 [MERGE] forward port branch saas-12.3 up to 50e571acf7
closes odoo/odoo#36491

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-11 09:39:33 +00:00
Christophe Simonis 9bf0b04adb [MERGE] forward port branch 12.0 up to 82a8cdd6f2 2019-09-06 17:52:48 +02:00
Christophe Simonis 82a8cdd6f2 [MERGE] forward port branch saas-11.3 up to 091aa33190 2019-09-06 16:51:57 +02:00
Christophe Simonis 091aa33190 [MERGE] forward port branch 11.0 up to f048652ca7 2019-09-06 16:08:58 +02:00
Lucas Perais (lpe) 7c28c97724 [FIX] hr_expense: sheet multi expense partial payment
Create two expense and put them into one sheet
Post the sheet

Make One partial payment with the wizard (Register Payment)
Do it again for the residual amount

Before this commit, it crashed because the second payment tried to reconcile
itself with an already reconciled line

After this commit, all the lines that need to be reconciled
actually are without crash

OPW 2065501

closes odoo/odoo#36454

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-05 09:22:20 +00:00
jem-odoo 8d0aee2293 [IMP] hr_expense: multicompany hard constraint
This commit provides hard constraints (SQL level) for expense to work in multi company
environement. This is related to a R&D task, the rest of the code need to be adapt, but
freeze is coming.
As expense implies accounting entries, it is required to generate them in the right
company, the company field should then be required.

Task-1999686

closes odoo/odoo#35953

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
2019-08-22 07:37:23 +00:00
Yannick Tivisse f5dfe4727c [IMP] api.py: Rename company_id/company_ids into company/companies
The goal is to be coherent with the user property.

Actually, company_id and company_ids on the environment are no fields.

Calling env.company_id returns a browse record, not an id.
2019-05-29 08:09:15 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
Yannick Tivisse a5b6f31cf2 [IMP] base: Contextualize the multi company
Purpose
=======

Allow the user to select the allowed companies for which he wants to see records
on top of selecting his current company.

It is confusing for users to see the records from the company he is connected to
and the records of the children companies.

Instead of using the hierarchy of companies to access records across companies,
the user can now select (from his set of allowed companies) the companies for
which he wants to access records.

/!\ This means that the user will interact with records from company A when in
company B.
Example: a SO has been created and confirmed in A. When in B, I create the
invoice from it.

Specifications
==============

1/ Deprecate the parent/children hierarchy on the res.company model. The fields are
kept on the res.company model to ensure the retro-compatibility, but won't be used
accross the standard code anymore. The only functional usage for this mechanism
was to allow to see records from several companies by creating a virtual parent
company, which will be possible with the new mechanism.

2/ By default, a user will only see the records of the company he is connected
to (or records without a company). (It is still editable by the user if needed).
For that, put this information in the user context, to allow having different
configurations on different browser tabs. Instead of having domains like
['|',
('company_id', '=', False),
('company_id', 'child_of', user.company_id.id)]
you'll have something like
['|',
('company_id', '=', False),
('company_id', 'in', company_ids)]
Note that the 'company_ids' is a value that is passed in the evaluation
context on the record rule, as we already have user, or time.
company_ids is a list of the ids of all the enabled companies in the
user's context.

3/ Out of the generic improvements brought by this task, this will illustrate
issues that could exist since several versions. For example, it should not be
possible to create a scrap order for the company A with a package of the company
B, or it should not be possible to create an invoice on the company A with
payment terms from the company B. Before the version 12.0, it was easy to
encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side
effect of the fact that the SUPERUSER_ID has become an inactive user was to
make it more difficult to introduce mismatch on the records, but haven't solved
the issue, as it was still possible to do it with parent companies
configuration. Some of these issues have been fixed in this commit, but all the
business flows should be re-tested to check if an ir.rule should be introduced
(eg: a multi company rule for stock.quand.package), if the company of a record
is correctly transfered to another record created from the first record (eg:
From a SO, create an invoice and a payment, the company of the sales order
should be transfered on the invoice and the payment, even if the company of the
sales order is A and I'm logged into the company B with the company A enabled.

4/ Currently, if I click on a button on a notification email (example 'View
Task'), I face a traceback if I'm not logged into the company of the record.
Now, if you click on a button and if you have access to the record, the correct
company will be automatically set.

5/ If I display a kanban view with several records from several companies (and
an image), all the images should be displayed.

6/ Currently if you copy paste an url, this will crash if you're not in the
correct company. This won't be fixed because it's quite impossible to do it in
a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into
the correct company, re-copy/paste -> Ok.

7/ 2 property methods have been added on the environment to retrieve the company
on which the user is logged in and the companies the user enabled, on a specific
tab.
That way, when creating a record, instead of doing
default=lambda self: self.env.user.company_id
do
default=lambda self: self.env.company_id
On the other hand, to retrieve the enabled companies, do
companies = self.env.company_ids

8/ Modify the Company Switcher widget to allow to log into another company
WITHOUT writing on the res.users (and thus bringing cache invalidation issues
and so on). Also allow to enable several companies and see records from several
companies, and independantly of the other browser's tabs.

9/ When focusing on a tab, save the current company configuration on the local
storage. That way, when doing 'CTRL+T' or a middle click, the context is
propagated to the new tab.

10/ Improve the error message in case of multi company access errors. Now, when
the user is in debug mode, display the related names of the records and the name
of the user who brings the issue.

11/ Remove the context erasing when writing on a res.users
This is probably coming from the migration to new API of the base module.
The context was not propagated at this moment, which was a common mistake at
that time. When migrating the module, probably by using the 'black box' method,
as the context was not propagated, it was erased on the new version. This is
now an issue because the context (i.e. the enabled companies) was erased when
writing on a res.users, leading to tracebacks.
See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624

12/ Fix the crash manager on redirect warnings. The issue is the following
- Create an invoice on a company without a configured CoA.
- Set a partner
- On the onchange_partner_id, a redirect warning is raised to propose you
to configure a CoA
- Click on 'Go to the configuration panel'
- A generic warning says something like 'Do you want to discard your changes?'
- Click on yes, the page refreshes, but not on the redirect action.
Now, set correctly the action on the hash, and reload instead. The breadcrumb is
lost for example, but you reach the correct action at least.

13/ Introduce a res.group to enable/disable the multi company per tab
feature.

14/ To help the users to know which tab is in which company, add the
possibility to have a favicon per company. When creating a company,
the classical 'O' icon is colored by default in a random color.

15/ Remove the company switcher on the frontend. This was mainly there
to allow a user to swicth to the company linked to the website.
This behavior is now transparent to the user. If the website A is
activated, then the company set on the context is the company of the
website.

16/ Deprecated the _company_default_get method on the res.company
model. Remove the method _get_company on the res.users model.

17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval
context. You can now use those variables on domains in the views to
access directly to the activated company.ies on the current tab.

TaskID: 1960971

closes odoo/odoo#32341

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-13 08:57:49 +00:00
jbm-odoo ec07e72845 [IMP] base,*: Reorganize access rights groups
Purpose
=======

Access group terminology is missleading. Yous have to be manager to administrate
an application. This task consists to rename groups to be understandable for everyone.

Groups should be reorganised on the users form to be more explicit.

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

1/ Rename 'Manager' to 'Administrator' in users groups.
2/ Define a hierarchy on access groups by using the category_id in the manifests
   A category 'Operations/Project' will create a category Project with a parent
   category 'Operations', and something smart is already developed (in modules/db.py)
   to avoid duplicating categories.
3/ Add a group in expenses to be able to approve expenses reports for my team.
4/ Add a group in timesheets to be able to approve timesheets for my team.
5/ Remove partially the useless crap in ir_module_category_data.xml
6/ Sort access rights groups on users form according to its parent category

closes odoo/odoo#29362

Signed-off-by: "Yannick Tivisse (yti)" <yti@odoo.com>
2019-03-05 09:08:12 +00:00
Nicolas Martinelli 44b791f5d7 [FIX] hr_expense: multi-currency
- Set your company to USD
- Create an expense in EUR:
  Amount: 100
  Tax: 15% Excluded
- Validate, post the journal entries

It crashes because of a missing `.id`, but on top of that... not a
single AML is correct.

opw-1938570

closes odoo/odoo#30987
2019-02-11 12:44:06 +00:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Nicolas Martinelli f45609d76b [FIX] hr_expense: multi-currency
- Set your company to USD
- Create an expense in EUR:
  Amount: 100
  Tax: 15% Excluded
- Validate, post the journal entries

It crashes because of a missing `.id`, but on top of that... not a
single AML is correct.

opw-1938570

Fwd-port of ab06e9cad36d7398de709d6a6c994cbbeb7737f4
2019-02-12 15:50:01 +01:00
Christophe Simonis 4ac0019bc2 [FIX] hr_expense: adapt test to new version 2018-11-28 18:20:09 +01:00
Christophe Simonis efe7ca16b7 [MERGE] forward port branch 11.0 up to bb6f6c57f9 2018-11-28 17:44:46 +01:00
Christophe Simonis 82a1e1dcc3 [FIX] hr_expense: adapt test to new demo data 2018-11-29 19:18:56 +01:00
Christophe Simonis f5c3dafb04 [MERGE] forward port branch saas-11.3 up to c0eef42711 2018-11-29 18:38:55 +01:00
Rohan PatelandLucas Lefèvre 4ba8f51d87 [IMP] hr_expense: improve mail gateaway
1/ Send mail notification if expense is registered successfully

Before this commit, when user submits the expense via email, user is not getting
information about whether expense is registered or not. After this commit user
will get a confirmation email.

Few other usability improvements,
- Improved tooltip for the field 'default_code' in expense's form and in the
'Emails' config setting.
- Added product's default code in product's kanban view
- Filtered uom based on category of product's uom.

2/ Better parsing of expense mail subject

Criteria for matching expense product from email subject is changed,
  - The product code should be the first word of the subject.
  - Only expense products are allowed, previously there was no filter and user was
    able to select any product in expense via mail.

Currency support is added,
  - Now user can specify currency symbols and ISO code in expense mail subject.
  - If subject contains multiple numbers in that case, number with currency will
    get higher priory, and it selected as an amount in expense.
  - If multi currency is active, user can use any active currency symbol/ISO code
    in mail subject. Respective currency will be selected in registered expense.
  - If multi currency is not active, user can only pass company currency. Other
    currencies are ignored and expense will be registered as default company currency
  - If user pass non active currency in subject then that currency will be ignored
    and expense will be registered as default company currency

Examples:
PROD_CODE 2 foo $1205.91 baz

Added python test cases for mail subject parsing.

Related to task #35093
closes #22168

Co-authored-by: Lucas Lefèvre <lul@odoo.com>
2019-01-24 13:08:27 +00:00
Lucas Perais (lpe) b1828c01d8 [FIX] hr_expense: create expense from email with taxes
Have an expense product with a supplier tax on it

Write an email to be caught by the thread model to create an expense for that product

Before this commit, the tax was not set up on the expense

After this commit, it is

OPW 1908596

closes odoo/odoo#29061
2018-11-27 11:00:55 +00:00
Nicolas Martinelli 014d61c875 [FIX] hr_expense: multi-currency
- Set your company to USD
- Create an expense in EUR:
  Amount: 100
  Tax: 15% Excluded
- Validate, post the journal entries

It crashes because of a missing `.id`, but on top of that... not a
single AML is correct.

opw-1938570

closes odoo/odoo#30959
2019-02-12 09:08:32 +00:00
Yannick Tivisse c3717f3018 [IMP] base: Erase user's groups if converted to public/portal 2018-09-10 14:23:43 +02:00
RomainLibert 631891dc5d [IMP] hr_expense: add draft state to expense lines
We need to be able to change an expense report before submitting it, for
this we add a new step in the expense process (a draft state for the
expense sheets).

Task #41700
Closes #24806
2018-06-07 13:55:06 +02:00
RomainLibert 5c24368e33 [IMP] hr_expense : improve access rights of manager/officer
Currently the distinction between expense officers and expense managers
doesn't make sense because they both have the same rights.

This commit aims at making a clear difference between an officer and a
manager.

After this commit the rights will look like this :

  * Expense Manager :
  	- See and approve any expense

  * Expense Officer :
  	- Can see and approve the expenses of employees in his department
	  or employees for which he is the manager (field parent_id on
	  hr_employee)

	- Cannot approve his own expenses

  * Simple user :
  	- Can only see his own expenses

	- Can only send his expenses to a manager (either the manager of
	  his department, his direct manager [parent_id field] or an
	  expense manager)

Related to task #51520
Closes #23033
2018-05-25 11:52:17 +02:00
jem-odoo 75995f5965 [IMP] sale,sale_*: correct use of expense_policy
A product can be sell or expense, but for some cases the product
configuration make both flow incompatible. Indeed, when expensing
the delivered qty was computed based on the AAL total amount, and
manually editable.
Before the delivered qty refactoring, reexpensing erased the manual
value.

This came from the fact product expense policy is wrongly used: the
delivered qty of expensable product is not manually editable, which
is a problem for milestones (and other consumable product when stock is
no installed).
The new refactoring of deli qty API force the expense line to be
completely
readonly, but the problem is not completely solved; we still can't sell
properly a expensable product.

To do so, the SO line must be flag as coming from an expense or vendor
bill, and the reinvoice product policy should only be used to calculate
the price of new SO line.

This commit:
1) reinforces the readonly caracter of expense SO line, by making the
expense policy independent of the computation method for delivered qty
on SOL.
2) prevents generate picking when updating ordered quantity on a expense
SOL with a stockable product.
3) allows service to sell a task with zero hours as ordered quantity.
(it still prevents task/project creation for expense SOL).
4) does not increment anymore an existing line when expensing product
at sales price and invoicing at 'delivered qty'. The only line to be
incremented will be the expense line (and not the native SOL).
2018-01-29 17:16:27 +01:00
jem-odoo 357a8b7292 [IMP] hr_expense: make test smarter
This commit make expense test depending on the
same common class as the other (in sale_expense).

Some data were badly defined (test data), using
field only existing when sale is installed. So move
this part in sale_expense.

Expense tests now check analytic entries when
sumbitting an expense.
2018-01-15 17:16:05 +01:00
jem-odoo 35e0347e4b [IMP] account,sale,expense: test when no chart of account
Accounting tests are executed post install to be sure a chart
of account is install. However, for some case, we might want
to run test at module installation, involving accounting, without
being sure a chart of account is installed.

This commit provides a base common test class with a minimal chart
of account (some journals and accounts) allowing to start tests at
installation. this class should be extended in sale or expense for
this modules to be tests at installation. We will required this for
reinvoice test in sale later (test consumable product when sale_stock
is not installed, but maybe without a chart of account). The idea is
each test suite can call method to setup their own data.

This commit also use this common test class in sale_expense.
2017-12-19 09:14:44 +01:00
Jérome Maes c8e23968d3 [IMP] sale_expense: add test cases 2017-09-14 14:48:07 +02:00
Kinjal Mehta b0185e15cc [FIX] all: fix some common typos
Sale Order --> Sales Order
Sale Report --> Sales Report
Sale Team -> Sales Team
Payment Term --> Payment Terms
2016-12-22 13:29:38 +01:00
Thibault Delavallée 0cb0fec177 [MIG] hr_expense: migrate tests to new API 2016-08-10 15:48:07 +02:00
Thibault Delavallée c8a313d51e [IMP] various: use odoo for imports instead of openerp and update class names 2016-08-10 15:48:07 +02:00
Fabien Pinckaers 31207d82b5 [IMP] hr_expense: does not depend on workflow anymore 2016-06-23 14:27:43 -07:00
Yannick Tivisse f066b1ec4f [IMP] hr_expense: Onboarding improvement + mail gateway
1/ Modify the no content help message for hr_expense with a dynamic part
   which describe how to create a new expense by mail
2/ Mail gateway mechanism. New customizable email alias expense@domain
   that creates a new expense by sending an email to it. Check several things
   - Check that the email_from is the same than one of the employees or than
     on of the related users to employees. If not, send back an email to say that
     the expense will not be created.
   - If the email address is valid, check if something is between brackets '[]'
     If it is the case, check if it is linked to a product internal reference
     and set it accordingly. If nothing is found, use a default product
     'Fixed Cost'
   - If one/several float(s) are found in the mail subject, take the last
     occurence and set it as the expense total amount.
3/ If a product template is created, to not add taxes on it. We don't expect it
   to have additional taxes
4/ Under Expenses -> Configuration -> Expense Product, use a simplified product
   view with only the needed fields.
5/ When generating the account move lines, use the account defined on the expense
   line, not the sheet
6/ When creating a payment, make a reconciliation on the payable account move lines
   That way, if the total amount on the expense is paid, the expense will be set to
   paid automatically when registering a payment
7/ Add a one-page planner to explain how to use the email alias
8/ The field account_id on the expense sheet was informative. After some tests, it
   seems that it's more confusing than helping. So we removed it
9/ Add a domain on the field 'bank_journal_id' to select journals of
   type 'cash' or 'bank'
10/ If the number of expense lines is equal to 1, the expense summary on the expense
    sheet should be the same name the line. So the process can be done in one click
2016-06-21 14:09:48 +02:00