59 Commits
Author SHA1 Message Date
Brice bib Bartoletti 88f6d5dac9 [FIX] account_peppol: installation crash
The aim of this commit is to allow user to install `account_peppol`
without facing a traceback.

Context:
The commit cffd0e9dd91376dd7fe4613f4fd94e659daaeef0 introduced a check
based on a field introduced in the view by another module it depends on.

The problem is that ticking the peppol checkbox install the `account_peppol`
module but doesn't trigger an update of the `account_edi_ubl_cii`
module.

Before the commit:
Impossible to installing `account_peppol`.

After the commit:
Installing `account_peppol` will update the view
`account_edi_ubl_cii.account_move_send_form` if the field added by
commit cffd0e9dd91376dd7fe4613f4fd94e659daaeef0 can't be found.

opw-3874304

closes odoo/odoo#162677

X-original-commit: 465491d017ecf1c6efb26d3252471f17f4e9d856
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2024-04-20 01:36:05 +00:00
Brice bib Bartolettiandmoerradi 4942a5f48e [FIX] account: duplicate bill warning in edit mode
The aim of this commit is to make the duplicate bill warning works in
edit mode.
This is a backport of some fixes that were done in the following
commit: cb694599583f5df1667984fee01bbcc4c8b2d409

Before the commit:
The warning couldn't be triggered in edit mode.

After the commit:
The warning is triggered as soon as the field is unfocused.

closes odoo/odoo#151451

Task-id: None
X-original-commit: 57c51b9c7b70cbc19071a8dfb67713a674caa0a0
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Co-authored-by: moerradi <moer@odoo.com>
2024-01-27 01:29:56 +00:00
Brice bib Bartoletti be3058bfb6 [FIX] sale: downpayment invoice and credit note
The aim of this commit is to fix the computation behavior of the downpayment
line of the sale order.

Context:
Create a sale order and invoice a down payment.
Make a credit note for the downpayment invoice for a part of the
invoice's amount.

Before the commit:
The downpayment line on the sale order gets its price_unit updated to
the amount of the last credit note.

After the commit:
The downpayment line on the sale order gets its price_unit updated to
the sum of the amount of all linked invoice.

closes odoo/odoo#150274

Task-id: 3634439
X-original-commit: 48995672ed58c99b1d8b143225a6535104d3bf8d
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2024-01-20 05:31:54 +00:00
Brice bib Bartoletti 6e652c94b5 [FIX] account_report: prevent tax tag renaming
The aim of this commit is to prevent the tax tag to be renamed when the
engine and the formula are changed at the same time.

Context:
For the french report, we had to introduce new expressions and change
the existing ones.
The nex expression would have the same formula than the previous one and
the old one would change their engine and formula.

Before this commit:
The tags are renamed to match the new formula.
This would be useless as the new engine won't use those tax

After this commit:
The tags aren't renamed.

closes odoo/odoo#147392

Task-id: 3607253
X-original-commit: 659f20add8b7c9c1a342a021bfc3c80316816c22
Related: odoo/enterprise#53341
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-12-22 21:37:44 +00:00
Brice bib Bartoletti e0fb0fbc26 [FIX] PoS: payment date should be order date
The aim of this commit is to correct the date of the payment.

Context:
When creating a PoS session and a PoS order on date X
The customer gets its invoice on date Y
the payment date is printed on the invoice

Before this commit:
The payment date will always be the date of the invoice

After this commit:
The payment date will always be the date of the order, the date at which
is was really paid.

Corner case not taken care of in this commit:
Claiming the invoice after the `fiscalyear_lock_date`.
In such a case, the payment date will be set to today (the invoice_date)
again.
This should be really rare as setting that lock date in short time frame
is quite unusual.

closes odoo/odoo#146259

Task-id: 3629054
X-original-commit: 732e43d8a6d4012eafb434952ccb6609f9be8066
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-12-14 08:00:59 +00:00
Brice bib Bartoletti 73a313a0fa [FIX] account_edi_ubl_cii: test_import_tax_prediction
The aim of this commit is to fix runbot build error.

Before the commit:
The test could fail if the EUR currency was inactive

After the commit:
The test activate the currency first

closes odoo/odoo#145817

Runbot-error-build: 51509
X-original-commit: 09808f2c91985263090cb9bd38b34d3443a2d7d7
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-12-11 18:30:47 +00:00
Brice bib Bartoletti 1650252f22 [IMP] account_edi_ubl_cii: add tax prediction if available
The aim of this commit is to leverage the power of the tax prediction
when possible to improve the quality of the tax retrieval of the edi
import.

Context:
The tax prediction happens when the invoice is given manually or with
the OCR but doesn't happen when it's imported by EDI because the tax is
already set by the edi.

Before this commit:
During EDI import, the tax retrieved could always be the same even if
the user make some modification to the previous bill.

After this commit:
The tax retrieved leverage the previous data to get better quality
result regarding tax retrieval.

closes odoo/odoo#145572

Task-id: 3626501
Ticket-id: 3531473
X-original-commit: 62bd397490cfcb21c2c92d67d761f68850054039
Related: odoo/enterprise#52430
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-12-08 17:19:15 +00:00
Brice bib Bartoletti 83d551e24f [FIX] l10n_eu_oss: OSS tax on root company only
The aim of this commit is to make the OSS feature instanciate the taxes
on the the root company .

Context: currently, when a company has a branch, the OSS feature tries
to instanciate the taxes on both the root company and the branch
company.
This was brought up by a constrains that prevents you from instanciating
2 tax with the same name on the same company.

Before the commit:
The feature tries to instanciate the OSS taxes on both the root and
branch company.

After the commit:
The taxes are only instanciated on the root company.

closes odoo/odoo#141347

Task-id: 3573252
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-11-10 13:46:57 +00:00
Brice bib Bartoletti 6a729b3f13 [REF] l10n_eu_oss: correct setUpClass
Part-of: odoo/odoo#141347
2023-11-10 13:46:57 +00:00
Brice bib Bartoletti d97a52cd1b [FIX] {l10n_}account_edi_ubl_cii/dk_oioubl/ro_edi{_tests}: remove DocumentTypeCode from standard
The aim of this commit to fix our bis3 e-invoice by setting the
DocumentTypeCode node only for the EDIs that fills its values otherwise
not setting that nodes.

Currently, we only set it for Denmark as it is mandatory, for Romania
because it was developped with it on the standard and we don't
set it for the others to be defensive. (Because it's not mandatory)

Before this commit:
All e-invoice based on BIS3 gets rejected.

After this commit:
BIS3 e-invoice pass the validation again.

Additional information:
Bis3 DocumentTypeCode node: https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-AdditionalDocumentReference/cbc-DocumentTypeCode/
UBL 2.0 DocumentTypeCode node: http://www.datypic.com/sc/ubl20/e-cbc_DocumentTypeCode.html
UBL 2.2 DocumentTypeCode node: http://www.datypic.com/sc/ubl22/e-cbc_DocumentTypeCode.html

closes odoo/odoo#139468

Task-id: 3563754
X-original-commit: 1da22571c43fceedb4ab8c13aa9d0d6a78372595
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-10-24 13:55:23 +00:00
Brice bib Bartoletti 789e17c423 [FIX] account: less restriction on tax.name
The aim of this commit is to allow having several taxes with the same
name if those taxes are from different countries.

Context:
With the new taxonomy, it was much more likely for 2 taxes to have the
same name and that was the case for several taxes.

Before this commit:
It was impossible to instantiate some foreign tax because of the unicity
on tax name constrains.

After this commit:
- Foreign tax with same name than national tax can be created again
- UX is improved by appending the country code to the tax name for
  display purpose.

closes odoo/odoo#137921

Task-id: None
X-original-commit: 502ec287590b95fdae581cc048ca25eb6699e16d
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-10-09 19:18:40 +00:00
Brice bib Bartoletti a5f01f9d7a [IMP] l10n_dk_oioubl: allow import
The aim of this commit is to allow import of OIOUBL einvoice.

Documentation source: https://oioubl.info/classes/en/index.html

The test xml files are those provided in the OIOUBL documentation.
The testing xml files are those provided by the Danish administration
with the documentation.
You can download the documentation here: https://oioubl.info/documents/en/allpdf.zip
The xml are in the folder "Eksempelfiler".

closes odoo/odoo#137758

Task-id: 3420748
X-original-commit: b6a060b60e6755af4e6029eb7b23d417a3c4a774
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-10-06 07:12:12 +00:00
Brice bib Bartoletti b818c83e9c [FIX] l10n_account_edi_ubl_cii_tests: wrong variable name
I introduced a wrong variable name in commit 70f252ed99c6c9596cd909bede8ef21cdd0df718

I believed `get_resource_path` was wrongly named and retrieved a file
but `etree.parse` is actually retrieving the file by itself.

Task-id: 3420748
X-original-commit: 3954a517eab1cef6154414fa40f8c730071b987a
Part-of: odoo/odoo#137758
2023-10-06 07:12:12 +00:00
Brice bib Bartoletti ecaa7833af [FIX] account_edi_ubl_cii: ubl2.0 import tax retrieving
During the work done on OIOUBL einvoice import, we saw that the
`Percent` node is always located below a `TaxCategory` node in UBL 2.0.

Task-id: 3420748
X-original-commit: 71d8bf93be472bdcf232e25e42f818e2df89cf8b
Part-of: odoo/odoo#137758
2023-10-06 07:12:12 +00:00
Brice bib Bartoletti 342c88e5ef [ADD] {l10n_}account_edi_ubl_cii{_tests}: OIOUBL export
The aim of this commit is to support OIOUBL format export in order to comply
with the Danish accountancy act.

Before this commit:
OIOUBL isn't a supported format in Odoo

After this commit:
It is possible to generate oioubl document for invoice and credit-note

Current limitation:
- Payment Terms: will be left empty
- Payment Means: will always be 'unknown'

Documentation:
oioubl official website: https://oioubl.info/classes/en/index.html
List of documentation: https://oioubl.info/documents/en/documentoverview.html
OIOUBL Schematron validator: https://rep.erst.dk/git/openebusiness/common/-/tree/master/resources/Schematrons/OIOUBL
Downloadable ressources: https://rep.erst.dk/git/openebusiness/common/-/tree/master/resources
Validation:
https://www.oioubl.info/validator/default.aspx
https://ecosio.com/en/peppol-and-xml-document-validator/

closes odoo/odoo#136072

Task-id: 3326977
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-09-20 17:18:09 +00:00
Brice bib Bartoletti 04a30d8091 [IMP] {l10n_}account_edi_ubl_cii{_tests},l10n_{ro,sa}_edi: add standard fields on UBL 2.0
The aim of this commit is mainly to add optional standard node directly
on UBL 2.0.
This will allow national customization of ubl to be easier to implement.

List of modification:
- Add the following nodes:
    - AddressFormatCode
    - BuildingNumber
    - PlotIdentification
    - CitySubdivisionName
    - Name under TaxScheme
    - DocumentTypeCode
- reduce zatca customization
- add attrs to several place to ease customization of attributes
- add a hook from which customization can override all decimal places to
  enforce a maximum
- add a hook to ease the modification of the `legal_monetary_total_vals`
  sub dict
- add method to allow customization to provide attributes for
  DocumentTypeCode node.

Notes:
Regarding PlotIdentification and CitySubdivisionName, I decided to not
populate some of those field for now because I didn't think of a
reliable way to get their value while zatca benefits from fields created
in l10n_sa_edi.

Task-id: 3326977
Part-of: odoo/odoo#136072
2023-09-20 17:18:09 +00:00
Brice bib Bartoletti 7e8c0846a5 [REF] account: test common improve readability
The stupid aim of this commit is to remove one line.
The smarter goal of this commit is to add a "/" for the root node and
improve the code readability.

Context:
I made an initial modification to this function and created an `AccountTools`
class. Then Laurent was bothered and changed some stuff thus the initial
commit isn't required anymore.
As he isn't bothered anymore and has too much peace of mind at the moment, I
have the responsability to entertain him to keep his brain at its full
capacity for the sake of Odoo's future.

Before the commit:
The code is complicated and LAS is in peace.

After the commit:
The code is sexier and Laurent keeps his brain sharped and entertained.

Task-id: 3326977
Part-of: odoo/odoo#136072
2023-09-20 17:18:09 +00:00
Brice bib Bartoletti 936629a51f [REF] account_edi_ubl_cii: _check_required_fields
The aim of this commit is to make method `_check_required_fields`:
- works with dict
- make the docstring more explicit

Context:
Docstring states that it works with dict and record

Before the commit:
The method was crashing when used with dict if the key wasn't in the dict

After the commit:
The method works with dict without crashing

Task-id: 3326977
Part-of: odoo/odoo#136072
2023-09-20 17:18:09 +00:00
Brice bib Bartoletti c1df741b36 [REF] account_edi_ubl_cii: remove deprecated method
The aim of this commit is to remove a deprecated method that should have
been removed in master

Task-id: 3326977
Part-of: odoo/odoo#136072
2023-09-20 17:18:09 +00:00
Brice bib Bartoletti d68367b9c4 [REF] l10n_account_edi_ubl_cii_tests: _assert_invoice_attachment
The aim of this commit is to:
1) ensure the expected file exist or make the test fail if it doesn't
2) file and file_path: switch variables names
3) allows using that method from other module

Context:
1) When the expected_file_path doesn't point to any existing file
2) There is an ambiguity with those variable names
3) run the method from a test in another module

Before this commit:
1) The test fail with an obscure error `can't convert Boolean`.
2) `expected_file` is a path and `expected_file_path` is the file.
3) The method was always looking in `l10n_account_edi_ubl_cii_tests` to
   get its files.

After this commit:
1) The failing test clearly states the file doesn't exist.
2) `expected_file` is the file and `expected_file_path` is the file path.
3) The test method is now looking in the module from which it gets run
   to get its test files.

Task-id: 3326977
Part-of: odoo/odoo#130617
2023-09-19 16:37:12 +00:00
Brice bib Bartoletti 3de718c2e0 [FIX] l10n_at: tax template repartition lines
1) The aim of this commit is to make the tax template more consistent with
the instanciated tax.
Indeed a tax wouldn't pass the constrains if it hadn't all its
repartition line.

2) Make the refund consistent with the rest of the taxes.

closes odoo/odoo#133055

Task-id: None
X-original-commit: 2c5506a60d4245a7bf84a073d887c2f1bcd7111c
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-08-24 20:59:14 +02:00
Brice bib Bartoletti 44a9c61ea5 [FIX] l10n_gr: make tax data comply with constrains
The aim of this commit is to correct the tax data

Context:
The constrains linked to tax repartition line aren't triggered.
This resulted in some invalid data to be merged.

Before the commit:
l10n_gr contains invalid tax data

After the commit:
l10n_gr tax data are valid

closes odoo/odoo#130426

Task-id: None
X-original-commit: 671d8fc49e3386ab7117b46f03a6fd4118ac22b9
Signed-off-by: John Laterre (jol) <jol@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-08-02 06:18:50 +02:00
Brice bib Bartoletti 037fabd81e [IMP] l10n_{be/dk}: compute CVR when VAT is DK
The aim of this commit is to:
- ease the company configuration in DK
- make the feature work when the country_code prefix isn't present

Context:
The DK company registry is the CVR. The CVR is quite the same than the
VAT number.
Re-applied logic used in `l10n_be` to ease the configuration.

Before the commit:
The company registry has to be inputed.

After the commit:
The company registry don't need to inputed while a DK VAT is setup for a
DK company.

closes odoo/odoo#125058

Task-id: 3334595
Related: odoo/enterprise#42561
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-07-07 10:52:36 +02:00
Brice bib Bartoletti 1704f0aa6f [IMP] account: make multivat great again
The aim of this commit is:
- to bring back a feature that was wiped out during the refactoring of the chart
of account instantiation in commit 5125748616
- add a test that will solidify the feature
- Improve the instantiation by installing the required l10n module
  directly instead of asking the user to install it manually

Previous to this commit:
The button instantiating the foreign taxes leads to a traceback.

After this commit:
The button instantiate the foreign taxes correctly

Note: To prevent xml_id collision on account, we prefix the xml_ids with their
module's name

closes odoo/odoo#118056

closes odoo/odoo#125950

Community-pr: https://github.com/odoo/odoo/pull/118056/
Task-id: 3196556
X-original-commit: b66ebb78ec750a4657a6de6726deb9eea7e0c7d1
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2023-06-21 20:10:29 +02:00
Brice bib Bartoletti 4e644746e9 [REF] account: centralize user creation in tests
X-original-commit: 84ffefed6deed59abb4df8627d5e3ebf970974b6
Part-of: odoo/odoo#125950
2023-06-21 20:10:29 +02:00
Brice bib Bartoletti b8a00bf9d4 [IMP] account: add company ir.rule for tax group
This commit aims to improve consistency.

Context:
- functionally:
    `account.tax.group` is company dependent and thus, it's weird to be able
    to access to other company tax group when those companies aren't
    selected.

- technically:
    In accounting apps, devs also expect company dependent field to not be
    retrieved by the `search` method and not having that ir.rule could cause
    bugs.

X-original-commit: 56f039f82afcf6c262bc5711cd28ae691cdf00e2
Part-of: odoo/odoo#125950
2023-06-21 20:10:28 +02:00
Brice bib Bartoletti d8fe293c02 [FIX] account: TestAccountComposerPerformance ubl
The aim of this commit is to make `TestAccountComposerPerformance` more robust.

Context:
In `TestAccountComposerPerformance` (account module), we are writing
on the field `checkbox_ubl_cii_xml`.
This field is instantiate by the `account_edi_ubl_cii` module which
might not be present.
This module get installed when `account` and `base_vat` are installed but
`base_vat` is conditionally installed.
(see `account/__init__.py` for the details)

We used this opportunity to also remove the call to `Form` as it wasn't
usefull.

Before the commit:
`TestAccountComposerPerformance` could fail in "weird" circumstance.

After the commit:
`TestAccountComposerPerformance` is safer

closes odoo/odoo#123218

Task-id: None
Signed-off-by: Laurent Smet <las@odoo.com>
2023-06-06 18:10:42 +02:00
Brice bib Bartoletti 24ce0949f4 [IMP] account: add activities views
This commit is adding the activity views and columns to a lot of the basic
accounting views.

closes odoo/odoo#120140

Task-id: none
Related: odoo/enterprise#40554
Signed-off-by: William André (wan) <wan@odoo.com>
2023-04-28 21:33:28 +02:00
Brice bib Bartoletti 9e949bb0bf [REF] account,l10n_eu_oss: query tag easily
The aimf of this commit is to make the query of a specific tag with a
specific sign easier by avoiding all the filtering in
`expression._get_tax_tags().filtered(lambda t: t.tax_negate)`

With this commit, we just leverage the existing filtering on domain to
only get the desired tag.

no-task

closes odoo/odoo#117167

X-original-commit: 6eb53a3802d24e283b8334b6f245ffe87dddcbe8
Related: odoo/enterprise#39044
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-03-30 16:23:10 +02:00
Brice bib Bartoletti c45a164b13 [IMP] account: tax tag on any journal item
The aim of this commit is to allow any tax tag to be set on a journal
item and to allow the user to put tax tag from foreign countries in
which they have a VAT number on any tax.

The end goal is to allow the user to impact tax reports from several
country with the same journal item, avoiding the creation of a whole
journal entry and setting the path for some more automation.

Context:
Our user has a company based in Belgium but has a warehouse in
Netherland. Thus, when the company sells anything from that warehouse, it
needs to fill the Dutch tax report directly.
Moreover, the company needs to fill a grid on the Belgian VAT tax report.
That means that the user would need to gather some journal items on both
the Belgian tax report and the Dutch tax report.

Before this commit:
The user can't set tax tag from another country on its tax nor in the same move.

After this commit:
The user can set tax tags from any country for which its company has a
foreign vat number on any tax and in a move

Task-id: 3196547
opw-2810712

closes odoo/odoo#113027

Related: odoo/enterprise#37247
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
2023-03-24 00:20:39 +01:00
Brice bib Bartoletti 43076cdd26 [FIX] account: adapt AccountMoveFormCompiler hack
The aim of this commit is to get rid of a traceback preventing the user
to switch tabs in Invoice and Bill

Context:
AccountMoveFormCompiler is a hack that allows to save the record
automatically when the user switch between tabs.
With commit 264f313012aa99449d1576ae1110252c13755142 the way to call the
compiler changed a bit but the hack wasn't.

Before the commit:
The `this` was leading nowhere in the compiler frame leading to a
traceback in OWL.

After the commit:
`this` is defined and the traceback is gone

closes odoo/odoo#110635

Community-pr: https://github.com/odoo/odoo/pull/110506
Task-id: no task
X-original-commit: a926071fc6944d5cd720a8849b2f31a5dd8ff4dc
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-01-21 00:57:25 +01:00
Brice bib Bartoletti d03a66c0c3 [FIX] account: prevent saving unbalanced misc
The aim of this commit is to prevent the user to save unbalanced misc entry
that wouldn't be created by adding a tax.

Context:
Since commit d8d47f9 we allow user to create unbalanced entries by
automatically balancing them on a suspense account. This isn't an issue but we
also allow to post those entries.
As the flow is smooth and fast, a quick user could just post this entries which
could be problematic.
Resetting to draft could be an option but that wouldn't be convenient if some
lines would have been reconciled. (which could have side effects in case
of there would be a cash basis tax on the line)
It's also impossible in case of a journal that would be hashed.
It also means that the problem would be delayed until the end of year
accounting processes, when accountants are tied to dead-lines.

Before this commit:
An unbalanced misc entry created manually would automatically be balanced with
a suspense account.

After this commit:
- Unbalanced misc entry can't be saved if there isn't any tax on it
- Unbalanced misc entry with a tax are balanced automatically.
- Unbalanced misc entry with a tax we are about to remove are balanced
automatically

closes odoo/odoo#110063

Community-pr: https://github.com/odoo/odoo/pull/109878
Task-id: 3129172
X-original-commit: c86786676b86381fbeeac9897508d3fe0ce77151
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-01-17 09:14:55 +01:00
Brice bib Bartoletti 55f1a6ecd7 [FIX] account,pos,stock_account:add/update indexes
1) forward-port of this PR: https://github.com/odoo/odoo/pull/97000
   commit: c9209664ce3a4b10142bba4da6afb912afc983c2

2) use btree_not_null instead of simple btree for space optimisation

closes odoo/odoo#106484

X-original-commit: b743e736f764fd7d6e232d2c8eaf6b2e314c5f31
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2022-11-24 23:18:44 +01:00
Brice bib Bartoletti ed1a35b3f8 [FIX] l10n_eu_oss: fix l10n_es test skipping
The aim of this commit is to improve the test skipping code of the oss modules
by avoiding to hardcode the chart_template_ref (xml_id) directly in the error
message.

Before this commit:
The TestOSSSpain test class was failing when the l10n_es module wasn't
installed instead of being skipped.

After this commit:
The TestOSSSpain test class is correctly skipped instead of failing.

closes odoo/odoo#102770

X-original-commit: c8018174c483183f95cda2bd805eb003e2ab90f5
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-10-08 15:20:55 +02:00
Brice bib BartolettiandCamille Casp Spiritus 5e7da9c8ca [FIX] l10n_es,l10n_eu_service: OSS with Spain
The aim of this commit is to:
- allow OSS to use tax that aren't declare by TaxReportLine
- have the oss tax automatically populated with the correct tags for spanish
  tax report
- Add taxes specific to the spanish OSS : No sujeto y acogidas a la OSS (Servicios) and No sujeto y acogidas a la OSS (Bienes)
  using the official modulo 124 tag

closes odoo/odoo#101121

Community-pr: https://github.com/odoo/odoo/pull/99273
Task: 2930758
X-original-commit: 2a21e4c084ba952eba1b4a7bb6f6ee31875d70ea
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Camille Spiritus (casp) <casp@odoo.com>
Co-authored-by: Camille Casp Spiritus <casp@odoo.com>
2022-09-26 14:43:27 +02:00
Brice bib Bartoletti dfa2130905 [IMP] base_iban: convert to owl
1) conversion to owl

2) very small improvement:
 - make the validation icon appears when starting edition

closes odoo/odoo#100435

Task-id: 2857743
Signed-off-by: William André (wan) <wan@odoo.com>
2022-09-21 01:29:59 +02:00
Brice bib Bartoletti 12cf871f8e [REF] account: structure folder to component
closes odoo/odoo#96672

Related: odoo/enterprise#30076
Signed-off-by: William André (wan) <wan@odoo.com>
2022-08-27 19:01:14 +02:00
Brice bib Bartoletti d6ab621198 [FIX] account: resequence widget template
There should be several line in t-body but not several t-body

Part-of: odoo/odoo#96672
2022-08-27 19:01:14 +02:00
Brice bib Bartoletti a3c7a06dc3 [REF] mail: remove account.move.line hack
While refactoring the move_line_list_views.js in owl, we provided the
account.move id and model + "generate" a thread in the front-end for
account.move.line instead of only providing account.move.line model and id.

This allows us to get rid of this hacky special case

Task-id: 2857743
Part-of: odoo/odoo#96672
2022-08-27 19:01:13 +02:00
Brice bib Bartoletti 25de7d3193 [IMP] account: duplicated_ref_ids for in_document
The aim of this commit is to improve UX by helping the user to find duplicate
bills in a more convenient way.

With this commit, when a user create a bill or credit note on bill that might
be a duplicate, a warning banner is displayed on the Form view of the
account.move.
On this banner there is a button that leads to the list of the duplicate
bill/credit note.

The previous warning message on post is also replaced by a RedirectWarning

Context:
Previously, the warning for duplicated bills was thrown when the bill was
saved. This was changed with https://github.com/odoo/odoo/pull/81748
It made the blocking warning being delayed until the bill is posted.

Previous to this commit:
A duplicate bill can only be detected automatically when posting the bill with
a non convenient blocking warning preventing the user to post his bill(s).

After this commit:
- A warning banner is displayed on the bill form during the bill creation.
- The banner contains a button leading to the list of duplicates.
- The blocking warning is improved by providing redirections to the duplicate
move.

closes odoo/odoo#81765

Community-pr: https://github.com/odoo/odoo/pull/81765
Task: #2612299
Signed-off-by: William André (wan) <wan@odoo.com>
2022-08-25 12:04:51 +02:00
Brice bib Bartoletti c340c0ea9d [FIX] account: report_payment_receipt_document.xml
This commit fix the template "report_payment_receipt_document".

The template call the python method "_get_reconciled_invoices_partials" but
which signature was broken by https://github.com/odoo/odoo/commit/785d49f3f0a21720d8c929d597d4041918ab7f41

closes odoo/odoo#94579

Task-id: None
X-original-commit: 3ed9a07a3674d5ce5d4378acf589231a2867acc3
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-06-24 19:34:25 +02:00
Brice bib Bartoletti 96f1f1f10d [FIX] account: deterministic sorting
The aim of this commit is to make `get_lines_in_hierarchy` yielding the lines
in the same order even if 2 sequences are the same.

The additionnal diff correct the iteration to get it in the same order in copy
than in `get_lines_in_hierarchy`.

closes odoo/odoo#93156

Task: None
Pr-community: https://github.com/odoo/odoo/pull/93061
X-original-commit: decc29d59baee1398a4497097055a2332e2305d7
Signed-off-by: William André (wan) <wan@odoo.com>
2022-06-09 09:09:04 +02:00
Brice bib Bartoletti fe918d40b1 [IMP] account: faster account_move unlink
On huge DB, unlinking an account_move can take a lot of time.
Most of this time is wasted checking for foreign key constraint.

closes odoo/odoo#84817

Signed-off-by: William André (wan) <wan@odoo.com>
2022-05-09 11:25:21 +02:00
Brice bib Bartoletti 48d6015125 [FIX] account: tax details mapping with misc entry
Goal:
Fix the tax details results when interacting with misc entry containing 2
opposite lines with the same tax.

The bug:
Wrong mapping in tax details query results in wrong amount in the global tax
report.

reproduction step pre-requisite:
- a simple sale tax A
- miscellaneous contains 2 lines,
	- amount X debit with sale tax A
	- amount Y credit with purchase tax A
- 2 tax lines gets automatically created

Before this commit:
The global tax report will display a base amount of 2*(X-Y)
which is wrong.

After this commit:
The global tax report will display a base amount of (X-Y)
which is correct.

Context:
When the tax details was made, it wasn't taken into account that there
could be 2 tax line (account_move_line) for the same tax in the same
account_move if the move is a miscellaneous entry (move_type = 'entry').
As a misc can contain both refund and invoice line at the same time (Due to a
PoS order for example), there could be tax_line created by the
invoice_repartition_line and another one created by the refund_repartition_line.
This results in a mapping in which there are some wrong results that should have
been filtered out.
The wrong results are the following match:
invoice_base_line -> refund_tax_line
refund_base_line -> invoice_tax_line

Solution:

1) To avoid the confusion we just need to filter out the wrong results.
2) In a misc entry, what makes a tax considering the base line as an invoice or
a refund is its balance.
3) In a misc entry, the sign of the tax line balance is the result of a
transformation of the base line sign.

This transformation is just a multiplication by the sign of the tax rate and
the sign of the factor_percent of the tax line repartition line.
This means that we can re apply this transformation to the base_line or the
inverse of it to the tax_line and check if it matches.
If it doesn't, we can confidently discard the match because the tax_line balance
can't be the result of a transformation applied to this base_line balance.

This is only valid for misc entry. In misc entry, negative base_line and
positive base_line are segragated for their tax line creation.

Additional notes:
A test is added to the enterprise repository to check the global tax report
result.

closes odoo/odoo#90563

Ticket: 2832745
Community-pr: https://github.com/odoo/odoo/pull/90399
Enterprise-pr: https://github.com/odoo/enterprise/pull/26827
X-original-commit: 690ef4e526b26911678ca872e7eb481215017f1c
Related: odoo/enterprise#26961
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-05-04 21:24:40 +02:00
Brice bib Bartoletti b06ee24be8 [FIX] l10n_eu_oss:apply tag from localization
This commit aims to allow assigning tags to the taxes
created by the OSS feature by providing the xml_id of their
report.line in the eu_tag_map.py file.

Before this commit:
In l10n_be, the taxes created by OSS (l10n_eu_services) didn't set
the tag +47 on invoice_repartition_lines nor +49 on
refund_repartition_lines.
This make the VAT report for Belgium wrong.

After this commit:
Taxes created by OSS for a company using the belgian CoA will get
their tags set properly and thus will the taxes impact the
belgian tax report correctly.

task: 2770182
ticket: 2768622

Community-PR: https://github.com/odoo/odoo/pull/85607

Design choices:
This fix is currently solving the issue for l10n_be but we have
no doubt that it will be raised for other EU countries too.

In order to provide the tags, we decided to be consistent with
what as been done regarding the tax mapping. Thus we decided to
create and maintain a simple mapping file and to test it.

several other methods were explored:
- create a global variable and update it from all localization
modules. This method would work but is ugly and error prone.

- create a templating method and override it from localization
modules.
The problem is where to set the root of the template method?
The naïve solution would be to create a bridge module between
l10n_eu_services and l10n_be but that would lead to an explosion
in the number of bridge modules which we don't want.

In order to keep things simple and generic, we could put the
template method directly into the account module. But it is kind
of ugly because account shouldn't know anything about the oss
feature and it would encourage such a leaky design to happen
again in the future.

closes odoo/odoo#86314

X-original-commit: 7dcc2ae4665d2d7b577ed10160691775b86a848f
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-03-12 11:49:52 +00:00
Brice bib Bartoletti 6bd3bb4528 [IMP] l10n_eu_oss: makes code more readable
Improves l10n_eu_oss code readability

X-original-commit: aedd9bf60aa6d9eecb055e6f7871c24c8ed2e0f8
Part-of: odoo/odoo#86314
2022-03-12 11:49:52 +00:00
Brice bib Bartoletti f4c669d0e4 [FIX] account: price at 0, fixed tax price include
The aim of this commit is to correct the compute_all calculation
when it is dealing with an article with 0.00 price and having a fixed
tax included in it.

In this situation, this means the tax is directly taken as an expense
by the company that offers it to its client.

This also solves the situation in which we have a 100% discount because
discount is applied before calling `compute_all` by changing the
unit_price.

Before this commit:
Creating an invoice with a line having a price at 0 or a 100% discount
and a fixed tax price_include resulted in a really weird behavior: the
company had to reimburse the customer for the amount of the tax.
(what a lucky customer :D )

After this commit:
Customer is sad, he only gets the product for free.
The base is calculated as negative, resulting in a debit amount on the base
income line.
The tax is then counterbalance by it.

The form is displaying a negative untaxed amount, a positive tax and the
total is 0.

closes odoo/odoo#86223

Ticket: 2660808, 2637512
Community-pr: https://github.com/odoo/odoo/pull/85747
X-original-commit: 727d19cb4e012e9a24d94640987ac5ea6f452a2e
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-03-10 20:00:40 +00:00
Brice bib Bartoletti 57346c85f8 [FIX] l10n_ch,l10n_dk,l10n_fi: 0% tax fix
Every tax should have a tax repartition line even 0% tax

closes odoo/odoo#85990

X-original-commit: 17e3bd58e519bd40fdc0c7fd431cd1a8f90cf33e
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-03-07 19:15:03 +00:00
Brice bib Bartoletti 6c04a3305e [FIX] PoS: fix tag assignation with round globally
revert commit https://github.com/odoo/odoo/commit/5f25be8eef9a9efc18a995f2c6405d08a657ac96

Goal:
- Gives the expected tag to the account move line created by the PoS.
- Add tests to the PoS regarding the created account move line

Before this commit:
If the configuration was set to round_globally, a pos.order.line was processed
as a refund only if all order.lines were a refund.
This leads to unexpected results in the tax report. Indeed,
since commit https://github.com/odoo/enterprise/commit/46769076526701d96ee4f2653e44b57604cc0b7a
"Negative" line in PoS (debit) are processed as positive to give a
correct results.
This means that if a line is set as debit and is suppose to lower a
line, it makes it bigger.

Example:
aml from PoS: debit: 10 tags: +03
---> report.line [03] is suppose to make a -10 but will do a +10.
As a result, report line [03] is false.

After this commit:
PoS never use "invoice_repartition_line" to create a refund line.

closes odoo/odoo#85461

Ticket: 2718998, 2714310, 2746890
Community-pr: https://github.com/odoo/odoo/pull/85149
X-original-commit: e4dedaf08b41cf3d80bfb01e70de714c9a84167d
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-02-26 21:30:55 +00:00
Brice bib Bartoletti 4e679ab943 [IMP] PoS: test create_ui_order_data add discount
This commit gives the possibility to create pos_order_line with discount
This is needed in order to reproduce real usecase.

X-original-commit: 49bfb576a76e2ad4449326c4b12ebf57bece7069
Part-of: odoo/odoo#85461
2022-02-26 21:30:54 +00:00
Brice bib Bartoletti c11ae302fc [FIX]purchase_stock,stock_account:partner on aml
The aim of this commit is to set partner on anglosaxon
aml in order to help our client in their stock
reconciliation process in case it hasn't been done automatically.

Before this commit:
anglosaxon line were created without partner

After this commit:
A partner is set when anglosaxon line are created

closes odoo/odoo#84547

Ticket: 2692308
Community-pr: https://github.com/odoo/odoo/pull/84468
X-original-commit: abfe37fcea5b20f77799d9331d4d011530880669
Signed-off-by: William André (wan) <wan@odoo.com>
2022-02-14 19:25:06 +00:00
Brice bib Bartoletti 9a9d61f755 [IMP] l10n_dk: tax implementation, fix and last fine tuning
The aim of this commit is to:
- correct the implementation of the restaurationMoms
- add a price_include version of restauraionMoms
- make a better implementation of the energy tax

before this commit:
The implementation of the restaurationMoms is completly false.
The implementation of tax energy is quite complicated and makes
the UI display a "0 tax value".

after this commit:
2 restaurationMoms version and both are correct.
Tax energy implementation is more user-friendly and more correct
regarding information displayed by the UI.

closes odoo/odoo#84004

Task: #2748309
Pr: https://github.com/odoo/odoo/pull/83666
X-original-commit: 7d4dcf7944cf776d74d31c80f2df15c8d44e3c5c
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-02-04 18:48:45 +00:00
Brice bib Bartoletti f5033dce60 [FW][IMP]l10n_dk: Add danish tax report
This commit is a forward port of the 2 following commits:

[IMP]l10n_dk: Add support for danish tax reporting
commit: d48433589a403754e9853b5242ec42abfafbfdea

This commit creates the basis for the danish tax report.
It creates the report and link the tags to the related taxes.

[IMP]l10n_dk: tax report and taxes impl. rework
commit: 7e4017c43a72314a5ba6da40903896f2dce4e2d5

This commit aims to:
    - implements formula in the tax report
    - shorten tag names and add context comments to the tax report
    - correct the tax implementation
    - add some fiscal position for some taxes and reorder them
    - delete a tax that doesn't make any sense

closes odoo/odoo#83376

Community-pr: https://github.com/odoo/odoo/pull/80823
Task: #2666277
X-original-commit: f8c1015841020244bae16715b0112f41b91ec72b
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-01-26 11:46:15 +00:00
Brice bib Bartoletti 65a89b4d57 [FIX] account: remove readonly on auto_post
The aim of this commit is to allow user to post a reversed entry even
when the date for the reversed has been set in the future.

before this commit:
if the move is generated using the reverse entry button and a date in
the future, the reverse entry is created with auto_post True and is
readonly in the view resulting in the user being unable to post the
move himself.

after this commit:
auto_post can be manually set to false and the user can post the move
himself.

closes odoo/odoo#83029

Task: #2522640
X-original-commit: 40b7976de1fe1cae71eb1063188eacb9a8a8fb70
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-01-19 13:15:00 +00:00
Brice bib Bartoletti 475719b101 [FIX] account: soften duplicate ref constrains
The aim of this commit is to allow EDIs to create and save account move
even if a supplier reference is duplicated.
This is achieved by delaying the moment to which the constrains is
triggered.

Before this commit:
A user can only upload a bill once. (xml ubl format for instance)
If he needs to upload it a second time, he will be forced to find a
workaround.

After this commit:
User will be able to upload as many bill as he wants but will receive a
ValidationError when trying to post the invoice if the reference is
duplicated.
The user will be able to post the bill very easily by changing the
reference a bit if he wants to pursue.

closes odoo/odoo#82303

Community-pr: https://github.com/odoo/odoo/pull/81748
Enterprise-pr: https://github.com/odoo/enterprise/pull/23255
Task: 2612299
X-original-commit: 200614876e62192e1a5ce2f30ec7aa8a1de77672
Related: odoo/enterprise#23281
Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-06 14:46:48 +00:00
Brice bib Bartoletti 078981a4c6 [FIX] stock_account:make cogs multi_company safe
The aim of this commit is to make the cogs generation multi-company
safe.

2 bugs are fixed in this forwardport commit:
- The product.valuation on the line wasn't evaluated in a company safe
way.
- cogs method weren't company safe either

Before this commit:
- When posting an invoice from company B with both company A and B
selected and A being selected as "main", the cost from company A could
be selected instead of cost from company A to create the anglosaxon
lines.

- If company B's product isn't in real time valuation, cogs aren't even
created.

After this commit:
Whatever the selected companies are, the cost selected will always be from
the company that created the invoice.

closes odoo/odoo#81492

Task: #2686104 and #2713607
X-original-commit: e34caf0ec33a3001bb6343e02d34a6edb5a9f609
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2021-12-15 22:31:24 +00:00
Brice bib Bartoletti 986b11c21f [FIX]account:reverse move condtnly hide btn and radio button
Aim of this commit:
- Hide the disabled radio button on reversal wizard when it's disabled.
(invoice residual_amount is 0)

before this commit:
- The radio buttons in the reversal wizard are visible even when it's
disabled.

after this commit:
- Radio buttons are hidden when it's disabled.

task/ticket:#2603144

closes odoo/odoo#81089

X-original-commit: e860a346ba6d7831674685817eed006dac86b264
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2021-12-09 10:26:58 +00:00
Brice bib Bartoletti cbf464898a [FIX]l10n_be: vat due tag on vat due rep line
This commit aims to make the "due and deduced" taxes more consistent by
assigning the "VAT due" tags to the "VAT due" repartition line.
This way the tag representing the due VAT will be set on the account
move line that represents the due VAT instead of the account move line
that represents the deductible VAT.

Behavior before commit:
Due VAT tags is assigned on VAT to deduce account_move_line.

Behavior after commit:
Due VAT tags is assigned to the due VAT account_move_line.

closes odoo/odoo#77891

X-original-commit: 59961cc68ef001dade87bd5ab77809efaab31a17
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Brice Bartoletti <Levizar@users.noreply.github.com>
2021-10-05 16:54:08 +00:00
Brice bib Bartoletti 8524991da3 [FIX]stock_account: copy_data safer access to prop
In l10n_latam, creating a debit note with stock_account installed ends
up in stock account checking for a property in a dictionnary that may
not exist.

Using the get property will solves this issue by providing a value.

closes odoo/odoo#73221

Ticket: opw-2580992
Bug-fix: opw-2588504
X-original-commit: 423d2d4ec62312da96c66d000eaabeac4920f68f
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Brice Bartoletti <Levizar@users.noreply.github.com>
2021-07-05 11:37:13 +00:00