Commit Graph
15678 Commits
Author SHA1 Message Date
Laurent Smet 6d03583a82 [FIX] account,l10n_: Restore journal liquidity account hook
The overrides in l10n_ modules are broken since 14.0 because the hook no longer exists.

closes odoo/odoo#61610

X-original-commit: 1fe852e032876f2f3212a43fc3115e49f4de618d
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-10 16:55:31 +00:00
Martin TrigauxandXavier Morel 49838338e0 [FIX] *: sanitize action content reading
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.

closes odoo/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>
2020-11-10 16:04:29 +00:00
Andrea Grazioso (agr-odoo) 4a0054a409 [FIX] account: fix total recomputation when having 100% tax
Create a tax as follows:
* Tax Computation: Percentage of Price Tax Included
* Tax Scope: Purchase
* Amount: 100%
* Included in Price
* Affect Base of Subsequent Taxes
Create a vendor bill with the tax on the line
Change unit price

The total does not change

This occur because when having 100% tax debit/credit are unchanged.
So the onchange `_onchange_mark_recompute_taxes` is not triggered and
the tax lines are not updated, thus not changing the
total (as in this case the invoice total is just the tax value)

opw-2370861

closes odoo/odoo#61555

X-original-commit: 9e203cc016b45875f699ffab24fe3f8382a97303
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2020-11-09 16:04:03 +00:00
Nicolas Martinelli 5c57644ead [FIX] account: cash rounding precision
A cash rounding precision must be strictly larger than zero to follow
the restriction introduced in e270e9e0cc.

opw-2341804

closes odoo/odoo#61382

X-original-commit: 563752358d233d4fc9cf1d7e7abd0b1656dc82c1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-11-09 08:53:46 +00:00
Nicolas Martinelli 57d76c8539 [FIX] account: extract fpos recomputation logic from onchange
We extract the `price_unit` and `tax_ids` recomputation logic from the
`_onchange_product_id` method. This way, it can be called
programmatically.

opw-2371934

closes odoo/odoo#61477

X-original-commit: ca6f25bef45137c032bc5cafd336c3f16a97a929
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-06 13:01:54 +00:00
Andrea Grazioso (agr-odoo) a646326ea0 [FIX] account: fix reconciliation and inalterable hash
Create and post an invoice ('Lock Posted Entries with Hash' on the
journal)
Edit also Bank journal enabling 'Lock Posted Entries with Hash'
Create and post a corresponding bank statement:
- same setting on the journal
- same partner on the line
Reconcile

Action will be blocked because the system try to
rewrite the partner on the posted line which is locked.

For Bank/Cash journals should not be visible the lock setting.

opw-2367688

closes odoo/odoo#61284

X-original-commit: d7f92cabb4bb12fe40356c9764c8e3e7c75e4f37
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-03 15:29:48 +00:00
wan 084690edc9 [FIX] account: deduce sequence reset
The order to find when to reset the sequence needs to be the following:
* find a sequence used before the date of this move
* if there isn't any, find the sequence of any move

Because we were not looking at the second step for bank statements, we
could have an issue since we were not checking the sequence relative to
the correct date.

closes odoo/odoo#61495

X-original-commit: b863b9cfedb3e7b4d1e3d409c829ffa0bfa1d9bb
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-11-06 16:57:41 +00:00
wan beec09e27e [FIX] account: don't change the payment date
This line seems to have been copied from before the refactoring
https://github.com/odoo/odoo/commit/caeb782841fc5a7ad71a196e2c9ee67644ef9074

It didn't work at first:
https://github.com/odoo/odoo/commit/ea3e39506a2b360545ec0cd1d3235e69ad16ea6c

It conflicted with the new constraint for matching the date with the
move name `_constrains_date_sequence` on `sequence.mixin`, and was right
to conflict.

closes odoo/odoo#61465

X-original-commit: 1aa0404966c6abc89d68a5118c2742de9e6b617b
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-11-06 11:24:27 +00:00
william-andre d4b4069dec [FIX] account: prevent changing date and journal of move with name
We need to ensure the name stays consitent with the journal_id and the
date when we try to change one of those fields.

X-original-commit: 634aaeeac36d2371743338536466a0bcc9ad6c69
2020-11-06 11:24:26 +00:00
Goffin Simon 49afd2f807 [FIX] account: Impossible to import a camt file with Stmt Id > 2147483647
Steps to reproduce:

- Let's consider a camt file F with Stmt Id > 2147483647
- Import F

Bug:

An index out of range was raised because range of an integer type in postgresql must be
in [-2147483648, 2147483647]

opw:2372401

closes odoo/odoo#61391

X-original-commit: 953d3069fb77605a8d69f80124d011144595d459
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-11-05 11:23:54 +00:00
wan 5f5071f882 [FIX] account: filters on account.bank.statement
Task 2375107

Need to be consistant with the new states on account.bank.statement

closes odoo/odoo#61381

X-original-commit: 0719f1dd9471705c7486236adb74d5825173831b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-11-05 10:33:53 +00:00
wan c036af067f [FIX] account: do not prepend company name for mail alias
We still keep the behavior for later companies.
It was originally added here 41f119d532

closes odoo/odoo#61353

X-original-commit: 9ba396afa68884f477096d3e7f3c824ff97f3aac
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-11-04 16:50:34 +00:00
Laurent Smet 3f50f9ce39 [FIX] account,point_of_sale: Set invoice 'paid' directly when fully reconciled wo payments
When the invoice is fully reconciled but not using payments, set the 'paid' status on invoices.

closes odoo/odoo#61339

X-original-commit: 052324cca4ec8682f065a4158e86fc113b0242e0
Related: odoo/enterprise#14590
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-04 14:47:30 +00:00
Laurent Smet a498497962 [IMP] account: Allow skipping statement line on payments
A classic payment uses the outstanding account to create the line that needs to be matched later with a statement line.
In some cases, the user doesn't want to encode twice the same transaction, e.g. when encoding a cash payment, and want to create directly a payment impacting the cash account to skip the 'statement line' step.

X-original-commit: 2b472fd59e8eebbc2cf1f592cf6e657f2ae9e778
2020-11-04 14:47:29 +00:00
oco-odoo b66c4fd0f7 [FIX] account: reconciliation widget: make invoice matching reconciliation models work with write-off lines
Use case:

1) Create an invoice matching reconciliation model, matching 90% percent of the amount, with a write-off line applying a 100% write-off of the remaining amount.

2) Create a 100€ invoice

3) Create a bank statement with a 90€ statement line whose payment reference corresponds to the one of the invoice

4) Click 'reconcile' on the bank statement

On enterprise, this crashes when preparing the data to give to the reconciliation widget, as the write_off_vals key is not set properly by the call to _apply_rules.

OPW 2367754

closes odoo/odoo#61265

X-original-commit: 1dd6199519b4ad5b5b17dfa17965ededcecb6da4
Related: odoo/enterprise#14563
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-11-03 13:23:08 +00:00
IEL 3c7694b409 [FIX] *: fix image parsing error on saving res config
WHAT: apply 93a7695f65baf00d1f82481d6a2a97e6c11940a8 for all res.config.settings
menus

WHY: the same reason as in 93a7695f65baf00d1f82481d6a2a97e6c11940a8:

	When saving, a read is called. By default, read has
	bin_size to true to avoid performances issues.
	It will return the image size instead of the content

it may lead to image dissapearing or "Incorrect padding" error

HOW:

    find . -iname "*.xml"|xargs grep "\"context\".*'module'" -l | xargs sed -i "s/\(\"context\".*'module'.*\)\}/\1, 'bin_size': False}/"
    git checkout  -- addons/base_setup/views/res_config_settings_views.xml

---

PR for General Settings: https://github.com/odoo/odoo/pull/47297

opw-2346644

closes odoo/odoo#61215

X-original-commit: 7c55efa88b72bd1f3f0f32f7f738e2fda5aa4abd
Related: odoo/enterprise#14547
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2020-11-02 18:25:20 +00:00
oco-odoo 84c14fde05 [IMP] account: better handling of journal codes when duplicating
Before that, even though the code contained something about it, the duplication of account.journal objects handled their code field pretty poorly (as it was trimmed to 5 characters), leading to situations where journals could have the same code, leading to possibility for account moves to have the same name.

This commit improves the SQL constraint testing journal codes so that they  must now be unique per company. We also recompute the code in a more advanced way so that journal duplications works as smoothly as possible.

Task 2346404

closes odoo/odoo#59791

Related: odoo/enterprise#14447
Related: odoo/upgrade#1880
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-02 15:46:15 +00:00
wan be2f050993 [FIX] account: view statement correct action
The dashboard "View Statement" action on bank journals was using the
`open_action` helper, but it was badly computed for journals with
`bank_statements_source` set to `online_sync`. We were directed to the
statement lines instead of the statements; and there was no other way to
go to the list of statements.

closes odoo/odoo#61190

X-original-commit: 78286851034b8f3ef4dcab78e50b7220c0bdd213
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-11-02 15:50:34 +00:00
Goffin Simonandsmetl 0e4642db8f [FIX] account: Auto-complete with analytic account
Steps to reproduce the bug:

- Create a vendor bill VB1 with one line L1
- Set an analytic account AA on L1
- Post VB1
- Create a new vendor bill VB2
- Set VB1 on the field Auto-complete

Bug:

The created line L2 on VB2 had no analytic account

PS: In 12.0, the analytic account was kept when using Auto-complete field

opw:2359432

closes odoo/odoo#60962

X-original-commit: 5f46c50442dbe42bc534718719a6b19ee087eab0
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Co-authored-by: smetl <las@odoo.com>
2020-10-29 10:54:47 +00:00
Laurent Smet 095fb9d6c4 [FIX] account: Check the exchange diff journal only when needed
When the exchange difference journal entry shouldn't be created, don't check its configuration in order to avoid an UserError in single-currency company.

closes odoo/odoo#61047

X-original-commit: 3ab451f3c4ce8dd42337f43628c1335d2caee011
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-30 13:20:27 +00:00
Achraf (abz) 716ea67582 [FIX] account: Reconcile payment from the manual reconciliation
Issue

    - Install "Accounting"
    - Go to "Configuration/Reconciliation Models"
    - Create new reconciliation model "Test" with "620000 Bank Fees" account
    - Go to "Customers/Payments" and try to reconcile a payment via "Manual Operations"
        by clicking on "Test" button
Cause

    This instruction "st_line.company_currency_id.is_zero(residual_balance)"
    needs at least one element in st_line

Solution

    Skip this instruction if "st_line" is empty

opw-2370034

closes odoo/odoo#61045

X-original-commit: 161a6c494a412097468fca214817c42f022d29e2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-10-30 12:33:27 +00:00
Martin Trigaux c59c10f1bc [FIX] *: correct typos and bad English
Courtesy of translators
Reexport .pot of modified modules

closes odoo/odoo#61010

X-original-commit: 62a18bdb372e234107fd2099a2df5f9e3a442c96
Related: odoo/enterprise#14489
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 19:23:41 +00:00
Nathan de Pryck 8a12247211 [FIX] account: use _for_xml_id to read action
Use of '_for_xml_id' instead of read in order to avoid
access right issue on 'ir.actions.act_window'.

closes odoo/odoo#60946

X-original-commit: 4e65fbf14491ea97415ede6d10385222c8d4d074
Signed-off-by: ndeodoo <ndeodoo@users.noreply.github.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 09:15:47 +00:00
Achraf (abz) 681d0f7ec2 [FIX] account: Show the customer name instead of journal name in kanban view
Issue

    - Install "Accounting"
    - Go to "Accounting Overview/Invoices"
    - Switch to kanban view

Cause

    The wrong field ("journal_id") was present instead of "partner_id"

Solution

    Change with "partner_id"

opw-2367738

closes odoo/odoo#60970

X-original-commit: e4ac9891450d96149551d19ac2d2f74f410f877c
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-10-29 11:23:14 +00:00
oco-odoo 8b3f14087a [IMP] account: improve tests for taxes made on misc operations
- Some tax_base_amounts checks were missing
- The type of repartition used to generate tax lines was not tested; it made the test confusing (as in this case, sales taxes invert their tag, given here the impression the wrong repartition was used, and potentially shadowing a bug)

closes odoo/odoo#60966

X-original-commit: c703b3a2f5a2d4d8bfbf0bc14203dde1b1bdec23
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-29 11:06:08 +00:00
Laurent Smet 325af9e412 [FIX] account,*: Manage 'in_payment' state correctly
closes odoo/odoo#60951

X-original-commit: 0a83aa2d6811c3638db151991938473a892c5452
Related: odoo/enterprise#14473
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-29 10:05:55 +00:00
Laurent Smet 516b80fc07 [FIX] account,payment: Fix payment token flow after payment refactoring
- The field 'invoice_ids' no longer exists on account.payment.
- When registering a payment using a payment token, the payment is not posted directly but the payment transaction is processed instead.
It means the payment is not posted until the CRON call. Since 14.0, the journal items can't be reconciled if not posted and then, we can't wait the CRON to update the payment state.
- The payment token is no longer available when registering a payment for invoices.

closes odoo/odoo#60918

Task: 2352628
X-original-commit: 0ad8979cb345805b7b1bdc330621b42e1d625593
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-29 09:25:19 +00:00
oco-odoo f1f3366bc0 [FIX] account, hr_expense: show correct sign for tax_base_amounts of misc operations' lines
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.

closes odoo/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>
2020-10-28 14:56:20 +00:00
wan c514e54b9d [FIX] account: analytic default + add test
* Analytic defaults keep their old value
* The date_maturity is non-sense, it isn't set on lines needing analytic
* Analytic default should work for misc. operations too, but only for
  product/service lines on invoice documents.

closes odoo/odoo#60904

X-original-commit: 4d2b8dd1bef40c592215728fab6c31f192176e93
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-10-28 14:08:02 +00:00
Nicolas Martinelli 691c14c070 [FIX] account, purchase, sale: portal access error
- Install account / purchase / sale
- Ceate an internal user without any access rights
- Go to `/my`

A 500 error is raised because of an AccessError.

When the user has no access rights to any of the mentioned applications,
the `search` call returns an AccessError.

We prevent the access error and return 0 as a fallback.

opw-2367559

closes odoo/odoo#60849

X-original-commit: 54ef98c613219aba3bda41817f7767261b8092d2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-27 15:36:48 +00:00
Laurent Smet 422d5d3e09 [FIX] account: Fix useless test introduced by https://github.com/odoo/odoo/pull/60614
closes odoo/odoo#60766

X-original-commit: bba6f1989bedf8799e93f676e872628f884a5f4b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-26 17:03:07 +00:00
std-odoo 01ceca36b2 [IMP] digest: change the logic from "Last day" to "Last 24 hours"
Purpose
=======

Change the logic of the KPI "Day-1" to "Last 24 hours", so new freshly
created data in the free trial are included in the statistics (same for
last week and last month logic). This requires to change from date-based
computation to datetime-based.

Change the URL of the "connect" button from "/web/login" to the root
URL (so the user is not stuck if he didn't activate yet his database).

Task ID-2359406

closes odoo/odoo#60166

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-27 11:11:54 +00:00
IEL 5a7deba4ff [FIX] account: show payment_reference in draft invoices
It was hidden in
https://github.com/odoo/odoo/commit/d1bbf11af27e4ce12b025ef22e397302ee6336c2

But customers actually need it.

opw-2358111

closes odoo/odoo#60746

X-original-commit: e676f5813455896b2bf853404228d11b02f58a15
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-26 14:15:43 +00:00
Nasreddin (bon) 17bee9e723 [FIX] account, l10n_ar, l10n_cl: web_studio broken due to dynamic view call
Issue

	- Install "Accounting" & "Studio" modules
	- Go to "Accounting" and switch studio editor
	- Go to "Reports" tab and select "Invoices" report
	- Click on any block to edit.

	Not possible to edit document.

Cause

	Studio cannot parse dynamic `t-call` and therefore not able
	to render the corrects hooks to edit the report.
	The issue has been introduced by this commit: https://github.com/odoo/odoo/commit/5c5710ae8ea045569fd94504f9d8dd5209f7b662

Solution

	In the corresponding localization report template,
	add an 'Inheritance Specs' (position="after") that will add a condition
	where it will retrieve the rigth report name
	in case localization enabled.

opw-2362257

closes odoo/odoo#60660

X-original-commit: ee1580a85c9942e9a98748fa568f9f664c67a320
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-10-23 17:20:09 +00:00
Laurent Smet 1738273e4a [FIX] account: Fix unbalanced journal entry when switching payment terms
When switching immediate payment term to 30% advance then back to immediate payment term, the receivable line is back to its previous value.
This is due to the '_get_fields_onchange_balance' that is not updating correctly the business fields since price_subtotal == amount_currency.
So, when `writing`, debit/credit are removed from the dictionary because the values are the same as before. However, `price_unit` hasn't be updated with the new value and remains as its previous value.
It leads to a recomputation of accounting fields regarding the business fields and then, trigger the unbalanced journal entry.

closes odoo/odoo#60654

X-original-commit: 18b5ad16a442404061b1028c2ffd82f179beaba3
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-23 15:51:28 +00:00
Laurent Smet bc76a2b9af [FIX] account: Fix reversal of journal entry with tax_ids on tax line
A tax line could have something in the `tax_ids` field.
Then, these condition needs to be inversed in order to not handle them as base lines.

closes odoo/odoo#60473

X-original-commit: eada9f91f3361f8335c23b3a27161803cfda6608
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-21 15:46:17 +00:00
Raphael Collet 8de95a3fb4 [FIX] core: validation of field parameters
The feature was actually not working as expected.  It has been fixed,
and a test now ensures it does work as expected.  This commit also fixes
some invalid parameters, hopefully nothing critical.

closes odoo/odoo#60429

X-original-commit: 231bdca3f26d96f578503694e5aec062de2317ed
Related: odoo/enterprise#14285
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-10-21 10:18:36 +00:00
Jorge Pinna Puissant 9f855ccb20 [FIX] account: duplicate method name
closes #59683

closes odoo/odoo#60343

X-original-commit: 1c0db7b2f4e5bdfba921e82e6872ac13d44f9d7a
Related: odoo/enterprise#14229
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-10-20 09:14:03 +00:00
Nicolas Galler 6c74444c96 [FIX] account: use commercial partner id for auto computed lines
Behavior before the fix:

- if you create a sales order for a customer invoice address (a child
partner record), then create the invoice for that order, the partner_id
is not consistent between the move_line (some get the child partner id,
some get the commercial partner id = the parent partner id)
- if you create the invoice directly from the accounting app for a
child partner, the commercial partner id is used consistently for all
move lines (the invoice itself keeps the child partner id)

Behavior after the fix:

- when an invoice is created from a sales order, the partner id is set
using the commercial partner id, consistently for all lines (in this way
the behavior is consistent with that of the accounting app)

It is more appropriate to use the commercial_partner_id for this purpose
as it is used pretty consistently in the account_move file

opw-2347878

closes odoo/odoo#60302

X-original-commit: cd299518ae45f2732d47788869b013be16b814e8
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-19 15:57:20 +00:00
oco-odoo ded8bb443d [FIX] account: make it possible to create tax report lines manually
It wasn't possible before that, as the report_id field did not receive its default value before being checked (as it is required), so it was always detected as missing.

Solves issue https://github.com/odoo/odoo/issues/60045

closes odoo/odoo#60286

X-original-commit: e2d873aee9d979d3369db3bd649067ec8fbc8043
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-19 14:12:37 +00:00
Laurent Smet f646b11c8d [IMP] account: Refactor ugly test introduced by https://github.com/odoo/odoo/pull/58881
All tests must use the generic sandboxed setup and must absolutely not depends of demo data.
In this case, creating a new rate is far less hacky.

[IMP] account: Fix ugly test introduced by https://github.com/odoo/odoo/pull/58798

All tests must use the generic sandboxed setup and must absolutely not depends of demo data.

forwart-port of: https://github.com/odoo/odoo/pull/59749

closes odoo/odoo#60253

X-original-commit: d577d2b53fcfdfa478d0b054768df1bcb1bf3715
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-19 10:50:13 +00:00
Wolfgang Taferner 2a7f5e25f1 [FIX] account: balance with line quantity > 1 and fiscal position
Currently the onchange is setting the price_unit to the price_subtotal to work out the proper price unit related to the tax, but does not have a different line quantity in mind.
The update of the price_unit was raising a balance difference UserError which is now resolved by the fact that we only update the price_unit if it is affected

OPW-2362066

closes odoo/odoo#60256

X-original-commit: 8c8d803992c31ba68a12801fa6dd4dcf909d9ed9
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-19 10:51:33 +00:00
Swapnesh Shah c810b903d4 [FIX] account: mandatory field journal
Before this commit, `journal_id` field was not required on model/view, Creating record without `journal_id` is not allowed since it is required on `account.move`.

Now field is required.

closes odoo/odoo#60146

X-original-commit: 7fbdfba8cbeb2ed724f2493320a5f609d07dca97
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-10-16 08:05:32 +00:00
jbw 05706dff88 [FIX] account, account_payment, sale : add support of new 'reversed' payment_state
Add handling of reversed payment state (added in odoo/enterprise#7202) in move view, portal templates and sales_team.

closes odoo/odoo#60139

X-original-commit: 2e1003a969f6fc907544e6506e1c6147e5e11d3e
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-15 20:22:55 +00:00
Arnaud Joset fb875a3852 [IMP] account: add compute_fiscalyear_dates method on res.company
[IMP] account: add compute_fiscalyear_dates method on res.company

The following commits
  https://github.com/odoo/odoo/commit/576a69e29e98532aa5de78eb3fcbff0b94cea32d
  https://github.com/odoo-dev/enterprise/commit/ed383522791276b17ba68a4f0d08f9e3ed4e783c

move the  compute_fiscalyear_dates method from the community account module to the enterprise one account_accounting.

This commit ensures that the method can be used when account_accounting is not installed.
As the fiscal year is irrelevant when account_accounting is not installed, this commit displays the calendar year.

taskid: 2329108
See also: taskid 220194

closes odoo/odoo#60140

X-original-commit: 544cb3682033e9f644b48b97dd5197eaf9282ff5
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-15 20:23:20 +00:00
Laurent Smet 423f0c7148 [FIX] account: Fix price_unit with fiscal position to price included tax
Suppose two price_included taxes: 10%, 20%, a product having a sale price of 110.0 and a fiscal position tax 10% => tax 20%:

When onchange_product_id is called, the price_unit is computed as follow:
110 / 1.1 = 100
100 * 1.2 = 120
So price_unit = 120 and balance = 100.0

But in onchange_uom_id, we do the same thing and we call _get_fields_onchange_balance_model with balance=100.0.
However, in this method, an empty dictionary is returned because price_subtotal == balance.
Then, {}.get('price_unit', price_unit) will return the original price_unit (110.0) instead of the new computed one (120.0).

closes odoo/odoo#60108

X-original-commit: f2a5476c52c1312d3dfc558f92b4a678d6aa5e25
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-15 14:19:55 +00:00
wan 1c30b8a95c [FIX] account: do not auto install modules that depend on Accounting
Moved in the post init hook of account_accountant

closes odoo/odoo#60068

X-original-commit: f997bc8f6e9d5138de6faed80e9774d359bfbe8d
Related: odoo/enterprise#14100
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-10-15 10:14:25 +00:00
Xavier Morel 23ef558689 [FIX] account: improve warnings.warn call
As-is, the warning will reports that post() is called from within
post, which is not very convenient when trying to find what calls
post() (as there are other "post" methods in the system).

By increasing the stacklevel from 1 (default) to 2, the warning will
report the method's caller, which is a lot more useful.

closes odoo/odoo#60043

X-original-commit: 5bc6eb9b387112138ac118726ff746bad6d00f8d
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-10-15 06:50:13 +00:00
Nicolas Martinelli 3319803a93 [FIX] account: wrong rounding with multi-currency
- Create a tax:
  5%
  Included in price
- Set the company currency to USD
- Set the currency rounding of CHF to 0.05
- Set the rate for CHF to 0.654065014
- Create the following invoice in CHF:
  Set a payment term
  Prod 1, 1 unit,  5.0 CHF, tax 5%
  Prod 2, 1 unit, 10.0 CHF, tax 5%
  Prod 3, 1 unit, 50.0 CHF, tax 5%

It is not possible to save the invoice because of an unbalanced journal
entry.

Indeed, the Receivable line is $99.30 while it should be $99.29. This
happens because we round the `total_balance` with the rounding precision
of the invoice currency while it is in the company currency.

closes odoo/odoo#58798

closes odoo/odoo#60035

X-original-commit: dad5e2a575448b68cc1b59880fecfe48dbe30a4e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-14 17:24:32 +00:00
Nicolas Martinelli fa60131f9c [FIX] account: wrong computation with currency rounding 0.05
- Create a tax:
  5%
  Included in price
- Set the currency rounding of the company to 0.05 (e.g. CHF)
- Create the following invoice
  Prod 1, 1 unit,  5.0 CHF, tax 5%
  Prod 2, 1 unit, 10.0 CHF, tax 5%
  Prod 3, 1 unit, 50.0 CHF, tax 5%

The total amount of the invoice is 64.95 CHF instead of 65.00 CHF, even
in a 'Round per line' configuration.

It happens because `compute_all` rounds the amounts following the number
of digits of the currency instead of using the `rounding` field.

Note that there is a discrepancy between the POS computation and the
Account computation: the POS already uses the `rounding` field instead
of the number of digits:

https://github.com/odoo/odoo/blob/80073c5430f0ab562dfc27572c108114161ebb25/addons/point_of_sale/static/src/js/models.js#L1855-L1991

opw-2341566

X-original-commit: 94353ebd6b47a286157f0559b194ff03ea49ff68
2020-10-14 17:24:31 +00:00