Commit Graph
15909 Commits
Author SHA1 Message Date
Laurent Smet 5c1f28cce4 [FIX] account: Fix dashboard 'Oustanding' amounts with shared outstanding accounts
- Share outstanding accounts between multiple journals
- Create payment for each of them
- Go to dashboard
=> "Outstanding Payments/Receipts" amounts are wrong

closes odoo/odoo#70564

Ticket: 2517499
X-original-commit: 39fb6b2990e5d6fda0d5f12dbd64d26ef77b9d0c
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-07 17:06:02 +00:00
Achraf (abz) 4d4557b596 [FIX] account: Prevent user to change product via journal items after posting
What are the steps to reproduce your issue ?

    1. Go to Account/Journal Items
    2. Open a posted item
    3. Change product

What is currently happening ?

    The product is changed in the account move

What are you expecting to happen ?

    The account move lines cannot be changed when the status is posted

How to fix the bug ?

    Make the field read-only when the status is posted

opw-2517325

closes odoo/odoo#70533

X-original-commit: 1b8f7ad00e9274b4b8f82ef77864997286611593
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-05-07 11:59:20 +00:00
oco-odoo 995f6fbb86 [FIX] account: reconciliation models: fix priorities when matching amls from payments
Since the payment refactoring, the structured reference of a payment is stored in its ref field, not payment_reference like for invoices. This caused payments never to be matched with highest priorities, as payment_reference_flag was always false, and only communication_flag could match.

To reproduce:

- Have a reconcile model with match_total_amount=False.
- Create a statement line with communication a1b2c3 for 1000
- Create 3 payments:
> 500, with memo a1b2c3
> 500, with memo a1b2c3 (so, the same one)
> 500, with memo d1e2f3
- Open the reconciliation widget for your statement line

===> The 3 payments are matched, while only the two first ones should have been, as they were exact matches for the communication, and should hence have received higher priority.

closes odoo/odoo#70394

X-original-commit: b5800c9d2088df2bb9c4fbe0fed91c7ef24299c5
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-06 15:17:32 +00:00
oco-odoo 255c63ff26 [FIX] account: cash basis taxes: generate correct exchange difference when using the same cash basis taxes on multiple lines
To reproduce the bug:
1) Create a cash basis tax for 42%
2) Make an invoice with two lines at 100$, each using this tax
3) Post and register full payment of the invoice

==> An exchange difference has been generated, doing +100 -100. One of its two line has tax_ids set, while the other does not. This makes the base amount shown in the generic tax report wrong: 100 instead of 200.

Actually, this exchange difference entry shouldn't have existed in the first place, as there is no rounding issue to compensate for here. It happens because the grouping keys computed for the two base lines are the same, and the second line overwrites the totals of the first one instead of adding them to its own.

closes odoo/odoo#70283

X-original-commit: 60770f0b99bedd3dcb695e2191dc83c45ef0b594
Related: odoo/enterprise#18107
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-06 15:10:28 +00:00
Adrien Widart c4f9d83c25 [FIX] account: prevent creation of JE on analytic line creation
When the user creates a new account analytic line, he should not be able
to create a new journal item.

To reproduce the error:
(Use demo data)
1. In Settings, enable "Analytic Accounting"
2. Accounting > Configuration > Analytic Accounts > Administrative >
Cost/Revenue
3. Create a new one
4. Click on "Journal Item" list

Error: the list contains the "Create and Edit..." option. Such an action
should not be possible.

OPW-2481197

closes #69881

closes odoo/odoo#70399

X-original-commit: f3ef533ed18c996f7f87c9596135e450479a8c19
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-05 11:11:38 +00:00
Laurent Smet b80e214780 [FIX] account: Fix price_unit rounding issue with fpos/price included tax
- Create an invoice with an empty fiscal position
- Create a line with a product having 100.0 as sale price and 21.0% price-included tax
=> price_unit equals 99.99

This is because 100 / 1.21 ~= 82.64 but 82.64 * 1.21 ~= 99.99 != 100.0.
The bug only appears when managing a fiscal position because the code is trying to adapt the product price_unit to the newly computed taxes.

closes odoo/odoo#70276

X-original-commit: 3470a3c94e06d92afcd8a8129f80e4dfea14efe4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-05-04 08:19:17 +00:00
wan efc407cacd [FIX] account: same sequence in different journal clash
When the same sequence is used in different journals (i.e. BNK1 in two
different companies), a clash might happen in the grouping optimization
of the `_compute_name`

closes odoo/odoo#70152

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-05-04 07:45:03 +00:00
wan 5b5e6943eb [REF] account: move sequence tests in a separate file
There are quite some tests related to the `sequence.mixin`.
Add some dosctring too.
2021-05-04 07:45:03 +00:00
Raphael Collet 960cd72774 [REF] core: add method get_currency_field() on Monetary to retrieve it
This replaces the setup of the attribute 'currency_field', which depends
on the presence of other fields on the model, and may therefore vary
from one registry to another.  This is necessary to make monetary fields
shareable across registries.
2021-05-03 12:33:29 +00:00
Raphael Collet 34d6f87d54 [REF] core: put field.depends on registry and make field.recursive explicit
The attributes field.depends and field.depends_context are problematic
for sharing fields across registries, because they depend on the model's
registry class, which may vary from one registry to another.  In order
to make computed fields shareable, we have to move those values away
from fields.

For the same reason, field.recursive should not be inferred, because its
value may depend on the registry, although it is generally not the case.
Moreover, the flag recursive=True is set on a field when field triggers
are determined (on the registry).  A compute method may be called before
the flag is set (if no update has been done yet), and that can lead to
incorrect computations.

This happened in test TestUsers2.test_reified_groups in module 'base'.
The user groups view was apparently determined without the flag being
set, and the view depends on the recursive field 'trans_implied_ids',
which was not correctly computed.

We thus force developers to be explicit about recursive computed fields.
The code now logs a warning when the flag is not set up properly.
2021-05-03 12:33:29 +00:00
Nicolas (vin) 3973f766cc [IMP] account_reports: carryover improvements
Implements various small improvements in order to make the carryover
functionality a bit less hidden, with a cleaner UX.

Task id #2500684

closes odoo/odoo#69762

Related: odoo/enterprise#17908
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-04-30 15:37:35 +00:00
Simon Genin (ges) ecfe85db84 [REF] web: static/src/(img|fonts) => static/(img|fonts) 2021-04-29 07:34:40 +00:00
Goffin Simonandsmetl 45710b17da [FIX] account: Wrong amount of tax with different currency
Steps to reproduce the bug:

Create an accounting entry AE with $ as default currency
Add a line L1 with 10 € and a tax of 15%
Bug:

The added tax line was 0.75€ instead of 1.5€

opw:2510338

closes odoo/odoo#69995

X-original-commit: 28e85cdbbd499b3fa826c15d4058aa4b83b993c9
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Co-authored-by: smetl <las@odoo.com>
2021-04-28 11:38:09 +00:00
Andrea Grazioso (agr-odoo) cbdb4cb8aa [FIX] account: fix fiscal position mapping in pos
Have a Fiscal position FPOS which map tax A to tax B
Have products DEMO with tax A and DEMO2
Allow FPOS in POS, Open a session, activate FPOS, sell DEMO and DEMO2
Close POS
Go to Orders, select the last one, hit return, edit, delete DEMO2 line

Tax will be wrong.
This occcur because the fiscal position mapping fail an equivalence
check with a virtual record, so the tax is calculated as A and not B

opw-2485399

closes odoo/odoo#69952

X-original-commit: 983797e626f742e84710de7ec8487824d6eaa7f1
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-04-27 17:27:04 +00:00
Nicolas (vin) b9a17c2135 [FIX] account: fix a domain in the carryover lines model
The domain for the fiscal position in the carryover lines was incorrect,
missing the required quotes.

closes odoo/odoo#69921

X-original-commit: 85c07f0f93d664bf7f6028a1dfa0f663e2999c3d
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-27 12:26:13 +00:00
wan 4865753c46 [FIX] account: remove tip on onboarding tour
Task 2352493

When the user is asked to fill in the label on the invoice, the tooltip
tells him that the label can be auto-filled by configuring its products.
This leads the user to configure products. But then, as he doesn't fill
in the label, the tour is "broken".

closes odoo/odoo#69871

X-original-commit: 78b5536a4c6fa7a20d8fd182fcd85726c2a8555f
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-26 17:43:31 +00:00
Goffin Simon d14299bc7b [FIX] account: Access error in multi companies
Steps to reproduce the bug:

- Let's consider two companies C1, C2 and a partner P in C2
- Let's consider an customner invoice I in C1 with P as customer
- Go to Accounting > Accounting > Partner Ledger and select I
- Click on Reconcie

Bug:

An access error was raised due to the ir.rule res.partner company

opw:2446242

closes odoo/odoo#69833

X-original-commit: 2279d84b4aefc8e488ccc33c30b816e988867589
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-04-26 10:42:22 +00:00
Anh Thao Pham (pta) e09cb7a27d [FIX] account: display credit notes on portal
- Create an invoice for a portal user
- Add a credit note for that invoice
- Connect with portal user
- On Invoices & Bills menu, the correct count is displayed (i.e. 2)
- Open Invoices & Bills page
The "All" filter only displays out_invoice and in_invoice, making impossible to view
the other types (out_refund, in_refund, out_receipt, in_receipt).

opw-2486471

closes odoo/odoo#69792

X-original-commit: 159bc7b0c081fd54df2f2396b18e9a63892caa2e
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-23 17:11:09 +00:00
wan 002f89bd84 [FIX] account: never set default for invoice_date
For customer invoices:
* do not set default date because if you prepare an invoice (and it gets
  a default date), then validate it the next day, the date will be wrong
* set the date when posting if it wasn't set, because why not?

For vendor bills:
* do not set default date because you rarely encode a bill at the bill
  date. Forcing the user to enter it reduces risks of user error
  (duplicated vendor bill)
* do not set it when posting, same reason.

opw-2492862
Related #68368
Closes #68367

closes odoo/odoo#69639

X-original-commit: 41041d8016d11f017d92d28f32ab2cf42f1349a9
Related: odoo/enterprise#17866
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-22 08:16:08 +00:00
Goffin Simon 71301b8bbf [FIX] account_batch_payment: Payment method on payment not available
Steps to reproduce the bug:

    - Let's consider a journal J with inbound payment methods PM1 and PM2
    - Create an inbound batch payment with Bank = J
    - The default payment method will be PM2, change it to PM1
    - Create a payment P in the batch content (payment_ids)
    - Save

Bug:

    A UserError was raised: The batch must have the same type as the payments it contains.
    because when setting a partner on P the function _compute_payment_method_id defined in module account_check_printing
    was triggered and the first available payment method was set.

opw:2495487

closes odoo/odoo#69683

X-original-commit: 683c3fd267162c93cb278fd903152ac387e6aba6
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-04-22 12:16:29 +00:00
oco-odoo f8ca384ba7 [IMP] account: error message when no country can be inferred for taxes when installing the CoA
Generic chart of accounts such as Syscohada don't have any country_id set. When installing them on a company without any account_fiscal_country_id, no country could be assigned to the account.tax being created, hence crashing, as country_id is required on account.tax. We now prevent that by raising a more comprehensive error.

closes odoo/odoo#69593

X-original-commit: a253bf331b2448194106523b9c3d753fb6ddd04a
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-04-21 09:42:22 +00:00
jbw 79d7f1edab [FIX] account_payment: remove double country_code field in account_payment
There were 2 country_code fieldss in account_payment. Probably the result of
faulty rebase.

closes odoo/odoo#69530

X-original-commit: 0f4932c1b9b8c7201d175fff7e78bb1cecc98971
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: jbw-odoo <jbw-odoo@users.noreply.github.com>
2021-04-20 11:13:09 +00:00
Noe Antoine fd36f91540 [IMP] - account, * : clarify the UX of warnings on partner.
*, purchase, sale, stock.

Before, the warning messages, if any, were always visible below the
warning option (emplty selection, No message, Warning, Blocking Message),
making it unclear for the user when selecting No message and seeing
the error message just below (as readonly).

Now, make the message invisible if the message option is empty or No Message.
Therefore the user is not confused by not relevant message, and it eases
the message editing process (before, user could see readonly message and
change selection field value before editing).

Task ID - 2481450
COM PR - odoo/odoo#68417

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-13 09:49:54 +00:00
Laurent Smet 53913adfc1 [FIX] account,point_of_sale: Allow mixing 'affect base' price-included/price-excluded taxes
Before this commit, such configuration wasn't allowed.
However, in some countries, this is mandatory, when dealing with eco-tax for example:

Suppose t1, t2 being taxes where:
- t1 is include_base_amount, price_excluded, fixed tax of 10 (eco-tax)
- t2 is include_base_amount, price_included, percent of 21%

The computation on 1210 should be:
price_excluded: 1210 / 1.21 = 1000
price_included: (1000 + 10) * 1.21 = 1222.1

closes odoo/odoo#69449

X-original-commit: 2bb9e68b546db191b2a88b787a865548d8107bcd
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-19 09:26:17 +00:00
Swapnesh ccba1ce694 [FIX]account: process one record to set debit/credit
Before this commit, There would be Expected singleton error
on changing Credit/Debit for multile account in single call.

Now, We are proocess one record to set `_set_opening_debit_credit`

closes odoo/odoo#69474

X-original-commit: 8fe9f552ed4591795b449f4d1e32e1563ce43ca2
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-19 12:22:14 +00:00
jbw a7e221ae62 [FIX] account: fix small view bugs with pre 14.3 payments
- Hide "A second payment will be created automatically in the destination journal." message when
  a payment is posted. Used to only check if payment has a paired_internal_transfer_payment_id,
  but posted pre14.3 do not have a value for this field.
- Render "destination_journal_id" only required when payment is draft. As it might be NULL on
  pre 14.3 payments, and trigger “invalid fields” error when the user interacts with the view.

closes odoo/odoo#69410

X-original-commit: f942e132dc3b5a37f649e0ab2c11627b497d641c
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-16 15:00:09 +00:00
Raf Geens fc41a4a6c9 [FIX] account: Traceback on multiple auto-validation candidates
When an auto-validating reconciliation model is defined for matching
bank statement lines to invoices, it was possible to get a traceback
when the bank statement lines were in a certain order and matched in a
certain way.

In particular, if the first bank statement line is priority 3
(communication_flag True) and the amount is an exact match with the
invoice, it will be instantly reconciled. If there's a second line
that's a priority 5 match, it crashed because _filter_candidates didn't
take into account that candidates_by_priority could be empty if the
candidates were already reconciled.

Instead we just return an empty list of candidates and priorities when
this happens.

closes odoo/odoo#69331

Ticket: 2507189
X-original-commit: e9538d9cee092e034b85187a2eae857349f42ce7
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-15 15:07:21 +00:00
Julien CHEVREAU (JCU) d5270c1c8a [IMP] account: check non reconcilable accounts for configured journals
Beforehand, users could configure an account as non reconcilable
even when it was configured as a payment credit or debit account
in a journal. This prevented journal items to be reconciled

Now, when a user tries to set an account as non reconcilable,
we check if there is no journal with a payment credit or debit account
set to this particular account. If there is at least one journal,
then we display an error message stating the journals names and ids
that the user would have to modify before changing the account
configuration.

closes odoo/odoo#69317

X-original-commit: 87c207f3a408abb93d9b8378ef4aa1744935d86d
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Julien CHEVREAU <Julien-CHEVREAU@users.noreply.github.com>
2021-04-15 12:40:17 +00:00
Julien CHEVREAU (JCU) 0cf8df4f3f [FIX] account: Check Move Status Before Posting
Beforehand, if two users independently opened a draft
invoice on their respective sessions, then both of them
clicked on the "Post" button, then the invoice was
posted twice.
On a more general aspect, the view currently "prevents" users
from posting moves several times, but technically speaking,
nothing stops users from posting moves several times.

Now, after checking that the user indeed has the right to post
a move, the next check is about verifying that the move is
not already posted.

opw-2479201

closes odoo/odoo#69178

X-original-commit: b7db7db283d7b9d167201b791e6282b022d59c40
Related: odoo/enterprise#17658
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Julien CHEVREAU <Julien-CHEVREAU@users.noreply.github.com>
2021-04-14 08:37:32 +00:00
Andrea Grazioso (agr-odoo) 1cf1445d3b [FIX] account: count in dashboard statement lines marked 'to_check'
1. Reconcile of a bank statement, checking the "To
check" box on the manual operation before validation
2. Go to accounting dashboard

The statement line will not be counted in the "to check" action.
This occur because the action only filter on reconciled moves

This reverts commit 6b0017ffda.

opw-2475663

closes odoo/odoo#69135

X-original-commit: 4f2ba741af913c36dd944070b6cbe5aaf682ced6
Related: odoo/enterprise#17637
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-12 15:57:22 +00:00
emilkholod 207c4dda5c [FIX] account : Fix error on search_read for account.move.line
* If `where_clause` is empty, then there will be an error. This commit fixes that.

closes odoo/odoo#69100

X-original-commit: f0a1bb3692e17334850fed4f22444f47992adb78
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-11 11:56:15 +00:00
Nicolas (vin) 648117bb93 [FIX] account: allow to display the line currency when exporting to xlsx
Currently, when exporting move lines via for example the partner ledger,
we are not displaying the currency in any way in the xlsx.

For some company, this can be limiting since they may want to do
post-treatment inside the file after export, which can require such
information.

This change will add the 'always_set_currency_id' field as optional
into the list view of the amls, allowing to keep the information about
the currency when exporting if needed.

task id #2381355

closes odoo/odoo#68911

X-original-commit: 62bad5e50aa1fe579ecc07242a22ec6ab6031e71
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Nicolas Viseur <vin-odoo@users.noreply.github.com>
2021-04-07 15:44:23 +00:00
Nicolas (vin) a2d5c63bed [FIX] account: Fixes the losing of company_id in account move
Currently, the company_id of an account move is related to its journal.
This means that if you empty the journal field, the company_id is also
emptied.
This is then causing a traceback when adding a new line, for example.

This change will transform the related company_id in a computed field,
making sure to not lose the company_id if the journal_id is emptied.

task id #2392004

closes odoo/odoo#68886

X-original-commit: c3c6ec69a0c50daf0b33df62144b6cd2f254a4f5
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Nicolas Viseur <vin-odoo@users.noreply.github.com>
2021-04-07 12:34:08 +00:00
wan 33bba28e87 [FIX] account: resequence journal entry in purchase journal
The resequence wizard should consider that the sequence is shared for
invoices, journal entries and receipts; only refunds have a separate
sequence.
You could have journal entries in the purchase journal for expense
reports for instance. In that case, we want to be able to resequence all
of it at once.

closes odoo/odoo#68871

X-original-commit: 365da2a0aca1503133433f9dc66b6866e7867974
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-07 09:22:26 +00:00
Swapnesh Shah 71452c3873 [IMP] account: remove orphan repartition lines
When a tax is deleted,
remove the `account.tax.repartition.line` linked to it as well.

closes odoo/odoo#68847

X-original-commit: 0731976cf0e3c6d47658ed1cbfbb8ace7428994e
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-04-06 17:20:36 +00:00
Goffin Simon a9cd07585d [FIX] account: Journal Entry displayd as invoice
Steps to reproduce the bug:

1/ Create an opening balance Journal Entry with debit 100$ "121000 Account Receivable" and credit 100$ on another account
2/ Create an invoice for 150$
3/ Register a payment of 250$ for this invoice
4/ Reconcile the Journal Item of the payment (with "121000 Account Receivable" as account) with the opening balance => this line should be now fully reconcile
5/ Go to the payment and try to print the payment receipt

Bug:

The opening balance was shown as an invoice

opw:2448349

closes odoo/odoo#68809

X-original-commit: fda784cd6a831fb799767a486320574e754d20df
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-06 10:15:50 +00:00
Julien CHEVREAU (JCU) e208da9372 [FIX] account: Cash Basis - recompute tax exigibility on move creation
Beforehand, tax exigibility was not systematically recomputed upon
move creation.

Now, as soon as an account move line is created on a move, tax exigibility
is recomputed.

closes odoo/odoo#68832

X-original-commit: df14e157fc7a80a1675b9581e0105891b4228f40
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-04-06 13:29:01 +00:00
Djamel (otd) 2e1689ef47 [FIX] account: added a regex verification when adding a partner mapping
Steps to reproduce the bug :

- Go to accounting > Configuration > Reconciliation Models
- Create a new reconciliation model
- Select the “Match existing invoices/bills” type
- In the field “Match Invoice/bill with” choose “Label”
- Add a new partner mapping > encode in "Find text in label" an erroneous regex like “*test” > choose any partner
- Go to accounting Dashboard > click on “Bank”
- Create a new Bank statement> add new transaction without selecting “Partner”
- Post the created bank statements > Reconcile it

Problem :
An error is triggered because the regex is wrong.

opw-2473973

closes odoo/odoo#68755

X-original-commit: cd9c071c9357cef14635ef094a9f14fc5431956c
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-06 09:17:03 +00:00
wan 00f1ad8d83 [FIX] account: set noupdate flag on accounting demo data
Demo data is not usually updated. It was also deleting the demo data
when doing a `-i account` when the module was already installed (or
actually the chart of accounts instantiated)

closes odoo/odoo#68802

X-original-commit: 8e4b7db8fe9f7c7cef1939938e9fa3df0dddc1f4
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-06 08:55:28 +00:00
Ivan Yelizariev 5901e7c553 [FIX] account: prevent excess calls of _get_lines_onchange_currency
That method iterates over move lines:

https://github.com/odoo/odoo/blob/7623a0c771495cd41bf40af37c0d2b6e4beb7cdc/addons/stock_account/models/account_move.py#L16-L18

So, we have O(n^2) complexity at least. It leads to timeout error on invoices
with few hundres products. After this commit it takes 70 seconds to confirm an
invoice with 450 lines:

23527 11.038 56.530
(Number of queries / Query time, sec / Remaining time, sec)

---

https://github.com/odoo/odoo/commit/9e1aec7873a935b287b4b3c5dbc2688acee5422a
opw-2488458

closes odoo/odoo#68797

X-original-commit: 176ecb1239f7e0a8e938de996d174b9c5bf930f4
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-06 07:57:30 +00:00
Jorge Pinna PuissantandLaurent Smet 76afde138f [FIX]account: error when rest bill to draft
- On accounting settings, activate 'Cash Basis';
- Select a 'Base Tax Received Account';
- Modify a purchase taxes, and set the 'Tax Due' to 'Based on Payment';
- Set a 'Cash Basis Transition Account';
- Be sure that the previously selected account allows reconciliation;
- Create a Vendors Bills, using the modified purchase tax;
- Register a payment;
- Reset to draft the vendors bill.

Before this commit, an error was raised : 'Record does not exist or has
been deleted.'

This occurs because when trying to unlink the partial reconcile, it will
first reverse and unlink the tax cash basis partial reconcile moves.
After when trying to access the partial reconcile to unlink the error is
raised because one is already unlink.

Now, the vendors bill is correctly reset to draft.

opw-2477526

closes odoo/odoo#68754

X-original-commit: 72c29b105bdb4da5b306cd3b48a1683c1bf3e620
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Laurent Smet <las@odoo.com>
2021-04-06 08:36:08 +00:00
jbw 980e8ce14d [IMP] account: move views improvement
Account move view improvement and creation of amount_total_in_currency_signed
to allow display of amounts in company currency and in move currency.

closes odoo/odoo#66069

Task: 2403336
Related: odoo/upgrade#2331
Related: odoo/enterprise#16308
Signed-off-by: William André (wan) <wan@odoo.com>
2021-04-02 06:11:11 +00:00
jbw b7b9b18ac1 [IMP] account: Payments Form View Improvement
The Payment form view is simplified for a much less cluttered screen.
A paired internal payment is now created when an internal transfer is posted.

Task: 2403336
2021-04-02 06:11:11 +00:00
oco-odoo 57ccba97ae [IMP] account: add bank account step in invoices setup bar for community
This way, the bank account can be easily and immediately configured so that QR-codes can be generated on invoices without any additional setup (for Switzerland and SEPA).

This configuration step is hidden if full accounting features are enabled, since it will then appear in the "main" setup bar, on the dashboard.

Task 2412391
2021-04-01 17:06:11 +00:00
Nicolas (vin) 39d6e3d8c0 [IMP] account_reports: allow to carry over lines between periods
In belgian accounting, some tax lines in the tax report must be carried
over to the next period if they are negative.

If the balance for the next period is positive, it will be deduced by
the maximum possible amount that is carried over. If it is negative,
the negative balance will simply be added to the carried over balance.

This process repeats itself from one period to the other endlessly,
until the carried over balance come back to 0.

This is done by putting the carried over balance in dedicated analytic
accounts.

task id #2271978
2021-04-01 14:57:33 +00:00
Laurent Smet 3e1d81429b [REM] account: Remove on-the-fly payments when reconciling the statement line
This option is there because it was needed by the Mexican EDI to send payments to the government.
Since the refactoring made at revision:
https://github.com/odoo/enterprise/commit/1ccb480b8e95f5702b6fb4e01446d24107514550
... this feature is no longer needed.

closes odoo/odoo#68020

Signed-off-by: William André (wan) <wan@odoo.com>
2021-03-17 13:43:15 +00:00
Laurent Smet 8992955db2 [REM] account: Remove deprecated code since https://github.com/odoo/odoo/commit/8f5e137df71f83f9baa8886aedfd123f329841d7 2021-03-17 11:06:29 +00:00
oco-odoo 17610e8ca9 [IMP] account, account_edi, l10n_*, purchase, sale: Generalize the use of account_fiscal_country_id
Before, account_fiscal_country_id was only use for tax operations; and country_id was used for all the other accounting stuff. Now, with the new ability to use foreign tax reports (with foreign VAT fiscal positions), we can generalize the fiscal country, sot that it is the one that needs to be used for the whole accounting. Since foreign tax reports were not supported before, account_fiscal_country_id is already set on existing database as the country for the "main" accounting, so the impact of this change is small.

closes odoo/odoo#68349

Related: odoo/upgrade#2322
Related: odoo/enterprise#17299
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-01 12:09:20 +00:00
oco-odoo 7d678cc7f4 [IMP] account: introduce foreign VAT fiscal positions
Such fiscal positions define an alternate VAT for a specific region. When foreign_vat is set, a country must be set on the fiscal position; it'll be used to know for which tax report the fiscal position must be available as an alternate VAT (in the tax report; see enterprise branch). Note that it is possible to defined several foreign VATs for the same country, as long as they belong to different states within that country.

Note that this new feature is only for FOREIGN stuff; so, when you have to submit a tax report in different regions than yours. For example if you have a Belgian accounting, have French customers, and have a French VAT in addition to your Belgian VAT, to submit a tax report in France. For domestic operations, simply use your the vat field of your company, just like before.

[IMP] account: add country_id on taxes and filter them on invoices

The invoices now compute the country from which they should accept the taxes: it's either the one defined by fiscal_position_id.country_id (if fiscal_position_id is a foreign VAT fiscal position, i.e. it defines a foreign_vat value), or the company's account_fiscal_country_id.

Taxes from other countries are filtered from the view; we don't want them to be available there. There is also a constraint ensuring that. Same goes for tax repartition lines and tags from other countries.

We don't want to mix taxes, tags and foreign VAT fiscal positions from different countries, as it would break the tax report in enterprise. Doing this ensures the tax report can efficiently discriminate the move lines between the different regions whose report they have to appear in.

[IMP] account: add country_id to account.chart.template

This is done so that the taxes are created in the right country, and the fiscal country is initialized in a consistent way when instantiating the CoA on the company.

[IMP] account: print foreign VAT on invoice instead of company VAT if one is defined

[IMP] web: allow forcing company vat on document templates

This is done to allow the use of foreign vat fiscal position on invoices: in that case, we don't want to use the company VAT, but the value of fiscal_position_id.foreign_vat. So, when such a value exists, the invoice simply set the force_vat variable to the right value.

[IMP] base_vat: also validate VAT of foreign VAT fiscal positions

We generalize the code formerly only done for res.partner so that the foreign_vat field of account.fiscal.position can be checked in the same way.
2021-04-01 12:09:20 +00:00
oco-odoo 8a2be06f96 [IMP] account: allow switching CoA even when draft moves have a sequence
Before, we only cheked the name to know whether or not there were moves forbidding the deletion of the whole accounting to replace the CoA. This was too strict, as an accounting with only draft moves couldn't do it if some move had a sequence number (which could happend with moves that were reset to draft). If everything is in draft, we want to allow such deletion.
2021-04-01 12:09:20 +00:00