Commit Graph
93 Commits
Author SHA1 Message Date
Juan José Scarafia bfedd5e4ec [FIX] l10n_ar: fix consistency of l10n_ar_currency_rate
Use the same method and date used to compute the rate on aml field currency_rate

closes odoo/odoo#136230

X-original-commit: adae60fc532cf6a853815f840cb49e93eb008cb7
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-09-22 11:56:02 +00:00
Corentin Thaon (thco) 46f1e7552c [FIX] l10n_ar, l10n_cl: Print invoice PDF foreign currency
Trying to print or send an invoice using a foreign currency leads to a traceback while generating the PDF.

Steps to reproduce:
- Install l10n_ar and step into the AR company;
- Create a new invoice using a foreign currency (e.g. USD);
- Confirm the invoice;
- Try to Send/Print the invoice.

This is also the case with l10n_cl.

opw-3477108

closes odoo/odoo#134612

X-original-commit: 9578fa9854a000a58ca6ffbdf144104d6a99c56d
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Corentin Thaon (thco) <thco@odoo.com>
2023-09-07 13:10:10 +00:00
Gorash 75a105f46a [REF] base/all: Update modifier syntax: remove 'states' from fields
These changes are made as a result of simplifying attrs and 'states' in
views. However, they should have remained in a separate commit. When
applying the script making the xml changes (used later for the migration
script), the script checked the definition of the python fields in order
to convert the information into a python expression. Therefore, this
commit is not applied when the script is applied to xml changes.

During this attribute deletion pre-existing errors were found. Part of
the code was using the boolean values of 'states' and another part of
the code was not. The behavior could therefore be different (in cases
where readonly on the field had the same value as the ballan in
'states').

Following the deletion of 'states' and without the application of the
view migration, the js tests (tower) were no longer functional. Tests
using the Form view suffered the same effect. There are few tests that
had to be adapted, including two tests in business accounting (updated
by the accounting team). A test for column_invisible did not work. Test
checking if the test system triggers an error if we try to write on an
invisible field. It turns out that Form was testing on the value of
invisible but not taking into account if the column was invisible. The
test system fix is applied separately because there were a lot of tests
that were incorrect.

Part-of: odoo/odoo#104741
2023-08-18 09:49:11 +02:00
Daniel Kosky (dako) 084408a9bb [FIX] l10n_*: set default taxes
The default taxes for most localisations have been left undefined by
default. When loading the chart template, the model generally selects
the first sales and purchase taxes, based on the order in which the
taxes appear in the csv, for the default sales and purchase taxes
respectively.

This behaviour can be confusing to those who are not yet familiar with
it. It has been decided that it is preferable instead to specify the
default tax in _get_*_res_company function on the account chart template
model, such that the default taxes are defined explicitly for every
localisation.

task-3453997

closes odoo/odoo#130733

Related: odoo/enterprise#45531
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-08-17 18:42:46 +02:00
william-andre 0479b2b594 [IMP] account,*: manage subsidiary companies
Allow sharing records between company
* accounts
* taxes
* fiscal positions
* products
* ...and some related models

These records can be read and used in children companies.

This can be used to
* have different branding for different businesses
* allow more complex security rules
* consolidate branches differently
* manage different tax reports with different tax ids in the same
  country

task-3371677

closes odoo/odoo#125642

Related: odoo/enterprise#43215
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-07-20 11:49:06 +02:00
Dylan Kiss (dyki) 094ed83d4a [FIX] l10n_*: add missing tax closing accounts
* l10n_ae, l10n_ar, l10n_at, l10n_au, l10n_bg, l10n_br, l10n_ch,
l10n_cl, l10n_dk, l10n_es, l10n_hu, l10n_in, l10n_mn, l10n_nl, l10n_no,
l10n_pt, l10n_sa, l10n_se, l10n_sg, l10n_si, l10n_uk

Some localizations do not have any default account for tax closing.
This leads to the opening of a RedirectWarning when trying to do a tax
closing.

task-3082332

closes odoo/odoo#124003

X-original-commit: 14abe7acb11d522fb2b4a274ac0eb06d41e637ed
Related: odoo/enterprise#42071
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2023-06-07 08:59:00 +02:00
william-andre 8e6a3d7269 [REF] l10n_*: clean code
A lot of the separate files were kept up to now because it made the
process easier while applying the script to rebase.
The files can now be merged.

Some code is also cleaned by using CSV instead of a python dict.

Part-of: odoo/odoo#114164
2023-03-06 23:34:49 +01:00
Katherine Zaoral 17d7b5199f [ADD] l10n_ar: Liquido Product document management
* Add refunds with liquido docs
* Add Is AFIP POS field (l10n_ar_is_pos)
* Adapt letter mapping
* Add unit test

closes odoo/odoo#111076

Related: odoo/enterprise#36322
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-03-03 19:10:01 +01:00
Maximilien (malb) d1b04bdf7e [IMP] l10n_ar: translation
Before this PR, all this localisation was written in Spanish, but all the localisation have to be written in english and then translated back in the native language. This PR correct that.

closes odoo/odoo#112803

Task-id: 3179209
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-02-24 10:06:18 +01:00
william-andre d782b8b925 [IMP] l10n_*: convert CoA in new format
Converted using https://github.com/william-andre/transform_coa

closes odoo/odoo#110016

Related: odoo/enterprise#35836
Related: odoo/documentation#3336
Related: odoo/upgrade#4276
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-17 19:30:40 +01:00
wan 5125748616 [REF] account: remove chart template
Rewrite the whole chart template mechanism, removing the templates
stored in the database. The new format will mainly use CSV.

Speed up install time
---------------------

* About half of the time of installing a localization for the first time is
  taken by creating the template records. This new in code format gets
  completely rid of this.
* Creating the template records could often not be done in batch because
  of parent/children relations.
* The instanciation of the accounts on the company has been entirely
  reworked too, by
  - optimizing the order of creation of records to avoid UPDATE queries
  - using precomputed fields to avoid UPDATE queries
  - updating the translation in batch
  - deactivating logging in the chatter
  - avoiding access rights checks by checking the rights at the start

Overall, when installing a chart template for the first time, it is 4
times faster because half of the time spent on saving the template in
the database is not done at all anymore, and the instanciation on the
company is more than twice as fast.

Reduce technical debt
---------------------

There is no need to synchronize the templates with the real records
anymore. No need to use hooks to copy the data from one to the other.

It is easier to change a template in a stable version, which can often
be necessary due to legal reasons (i.e. a change of tax rates, reporting
tags,...)

Two modules have been removed:
* `l10n_generic_coa`: since there is nothing left datawise in this
  module, it can be integrated in `account` for free. It is just code
  and CSV.
* `l10n_multilang`: the fields that this module modified to be
  translatable are now always translatable:
  - there was an issue when updating modules that deleted all the
    translations because the fields were not translatable at some point
    during the loading of the registry, then they because translatable
    again but lost all translations because of the column type change.
  - most devs are not able to understand all the languages needed for
    all the localization available. Therefore, english has been added in
    the sources in most localization to understand better issues while
    debugging.
  - no need to call post init hooks anymore, doing the sync with the
    templates.
  - more: see "Translations" section

Because most of the data is now in CSV, it is also easier for product
owners to edit, audit, modify files themselves, removing one layer
during trivial development processes when only data should be changed.

More flexibility for declaration
--------------------------------

The data declaration can now be done easily in python or CSV.
A nice feature is that you can declare everything at once, even for some
more complex chart of accounts:
* if you have to set default taxes on accounts, would need to
  - declare the accounts because accounts are required on the taxes
  - declare the taxes
  - declare the taxes to put on the accounts
  This would lead to scatter information in multiple files. Now,
  everything can be declared in the same place and the loading of the
  chart of accounts will do the 3 steps automatically.
* if you have a relation of child/parent, you would first need to
  declare the parents then the children, and the loading would not be
  efficient because done one by one. Now, everything is done in batch
  automatically without having to think about it.

It is also easier to update fields on records where there was no field
for that on the templates, like
* setting a restriction for journals on accounts
* setting specific values on the company
* modifying journals and linking them easily by using the xml_id instead
  of having to compute it manually

Translations
------------

Some countries have multiple languages (i.e. Belgium uses officially
French, Dutch and German, and the CoA also has an official English
version) and we must support the languages in all these countries.
All these translations are known, and hard coded without using out
translation platform (Transifex). We also like to have the English
version (even if an official one doesn't exist) so that support can be
done more easily in databases using chart templates in other languages
(especially using a non roman alphabet).

Because the translations were not on Transifex for these records, it was
really hard to maintain: the translation templates (`.pot` files) were
not easy to extract as the automatic export would give values mixing
both the CoA and the menuitmes, the fields' strings,... But we don't
want to translate the CoA as we already know the value.
Managing the translations in the `.po` files was also annoying:
- it is easy to forget that the translations need an update too
- it requires a special editor, special terminal commands that everyone
  is not familiar with
- it is easy to make mistakes in the source string

The new format is the following: `field@en_US` where `field` is the
translatable field (usually `name`) and `en_US` is the locale code.
This allows to have the whole declaration on one line, everything in one
file. It also makes the process easier when debugging: instead of
searching for the translation in the `.po` files, it directly appears
next to the configuration of the account/tax/... .

Update of the code
------------------

The code can be updated using this script
https://github.com/william-andre/transform_coa
Forward ports can be managed too by stashing/resetting/checkout the new
modules or the changes in the modules updated in the same PR.

task-2687567

Part-of: odoo/odoo#110016
2023-02-17 19:30:40 +01:00
Pablo Montenegro 1c7c29eeab [FIX] l10n_ar: total invoice amount on printed invoice
Total amount on printed electronic invoice include taxes if the electronic invoice has argentinian vat and document type 'B', 'C', 'X', 'R'. Also if the invoice mentioned before have more than one tax and one of them is different than "IVA" (argentinian vat), then is necessary not to show in the printed invoice report the amount untaxed of the invoice.

closes odoo/odoo#111776

Task: 922
X-original-commit: f5c0552a2b2e975db8745219af044638449c3312
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-02-07 16:38:28 +01:00
niyasraphy 89c95544d6 [FIX] *: make some user errors translatable
*: base, account_payment, l10n_ar, mrp_subcontracting, point_of_sale, pos_restaurant, purchase, sale

closes odoo/odoo#107264

X-original-commit: edd928cd0c63a01d1ee8b28ed344f61e9b6d0b54
Related: odoo/enterprise#34676
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-12-09 11:48:50 +01:00
Katherine Zaoral 00a88f5d98 [REF] l10n_ar: make more hederable _get_journal_codes
closes odoo/odoo#98509

X-original-commit: e4dbaa27e94a4a7667c751fa912ba49cc5907dce
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-08-19 19:10:57 +02:00
Ignacio Cainelli 7c8b51e091 [IMP] l10n_ar: change message error
The error message now shows that a VAT tax must be added to that line
and that if it is already added, it may be misconfigured. This improves
the functionality since previously it showed that there should only be
one VAT tax and that could generate confusion in some cases

[CLA] add new members to Adhoc CLA

closes odoo/odoo#97640

X-original-commit: 16200f80cd8ae7a471725833655a06fe049b5b4b
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-08-18 21:09:00 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
william 0f71c64237 [FIX] account: reduce locking on moves
By trying to avoid concurrency issues while assigning the sequence [1],
we are locking too many operations even when not in the process of
assigning a new number.
* when computing `highest_name`, we don't need to lock as this is mostly
  an information on the form that can possibly change anyway while the
  form view is open (without any lock anymore)
* when computing the accounting date, we don't need to lock, the only
  information we want is the format of the sequence (yearly, monthly, no
  reset), which is not likely to change on a same journal.
* when changing the `journal_id`, it is only a helper for encoding, if
  there is a concurrency error it will be shown during the post anyways.
  Also same argument as for `highest_name`

[1] https://github.com/odoo/odoo/commit/ba6ee0b75d66d6f22a592b1b6a7c5158461bec41

closes odoo/odoo#95480

X-original-commit: 809557cdd02fe6581ed573b58158a927aabe0694
Related: odoo/enterprise#29212
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-07 14:44:25 +02:00
Pablo Montenegro 075152d1a0 [FIX] l10n_ar: Delete “Unified Book” option on sale journals
Before this change, we bringed to the user the posibility to select the option “Unified Book” (boolean) on journals with type “Sales” and Pre-printed Invoice “AFIP POS System”. This allowed all documents with the same letter document to use the same sequence, and it does not matter if they are invoices, credit notes or debit notes for example.
Now that functionality is deleted and all documents will have their own sequence regardless of the letter document of each receipt.

closes odoo/odoo#88129

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-05-04 11:53:45 +02:00
Juan Jose Scarafia 06f08f770d [FIX] l10n_ar/cl: starting sequence
When getting l10n_ar/l10n_cl starting_squence check with the proper
company (self.company_id) and not self.env.company_id

We do not put a journal_id anymore as it should take the correct one
automatically in v15.

Original commit d6f4fee58edf103c63836ac488be240961fd671a

closes odoo/odoo#87219

X-original-commit: f2f76dfa195226b7604076830412706447c168f2
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-31 17:25:06 +02:00
Katherine Zaoral 39db0eaff4 [FIX] l10n_ar: share sequences compute sequences
Before this change, we have the errors that documents generated on
pre-printed sales journals mark as unified book were wrongly
named using the wrong doc prefix code.

This was visible thanks to the demo data were we notices that the credit
notes were having FA- doc prefix instead of NC-

This was because we are reusing the shared sequence directly, now we
check and fix the doc prefix for those cases and all documents generated
on shared sequences are properly named.

closes odoo/odoo#86612

X-original-commit: df5bfd22c20d3a3bd72b04acbdae63657e025ce3
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-31 17:25:02 +02:00
william-andre beb6e17066 [FIX] account: remove dead code complete_tax_set
This field was used in version 9.0 [1] to allow users to select their
tax rate, but it was removed in version 12 [2]

[1] https://github.com/odoo/odoo/commit/c04065abd8f62c9a211c8fa824f5eecf68e61b73
[2] https://github.com/odoo/odoo/commit/87f0d2eefb77bfc6a9a0fa7f7dcd1475c7c34639

closes odoo/odoo#80185

Related: odoo/enterprise#22441
Related: odoo/upgrade#3057
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-03-31 17:24:55 +02:00
Laurent Smet cd6c33575b [IMP] account: Add generic methods to help the taxes computation
Unify taxes computation between 'account', 'sale' and 'purchase' including:
- computation of price_subtotal/price_total.
- computation of business models total (using the json field)

closes odoo/odoo#80231

Task: 2654784
Related: odoo/enterprise#25620
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-03-29 20:20:15 +02:00
Pablo Montenegro f0b90c9fa8 [FW][FIX] l10n_ar: AFIP currency rate.
We have a bug when we were computing the invoice rate that is used to
report to AFIP. The rate we were setting was an old rate that references
the day that the invoice was created and not the rate of the day where
the invoice was validated.  This was happening because the
l10n_ar_currency_rate field that stores this value was computed before
posting the invoice. At that time the date field store the value of the
date where the invoice was created and had not been updated yet with the
accounting date.

Moving the l10n_ar_currency_rate field calculation after the invoice
post solves the problem and now the l10n_ar_currency_rate has the rate
of the accounting date.

Part-of: odoo/odoo#84470

Original commit: aac1165655d31ba3bca4b105e0c905534e91df93

closes odoo/odoo#87163

X-original-commit: ac57ac559d973a1c4c2050fa514668d20bd610f0
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-25 10:23:16 +01:00
Katherine Zaoral 69e31db6ac [IMP] l10n_ar:_sanitize vat number method
* fix traceback when vat is not defined, return directly 0.
* remove api.model
* add ensure_one() to avoid misuse of the method

closes odoo/odoo#84952

X-original-commit: 5cd4df745462fcc12b9d92def9cf903ebd0df143
Related: odoo/enterprise#24565
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-20 20:39:50 +00:00
aliya 47cf4e8066 [FIX] l10n_ar, l10n_ec, l10n_pe: use fiscal country
Currently all latam localizations except Chile use country_id in _localization_use_documents().
account_fiscal_country_id should be used instead in all modules.

closes odoo/odoo#84756

Task: 2761248
X-original-commit: cf61089d9480d7450d2916911b0859cd5f6efcce
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Tastemirova Aliya (alta) <alta@odoo.com>
2022-02-17 09:06:57 +00:00
Katherine Zaoral 90336071a1 [FIX] l10n_ar: sign used in vat book report
closes odoo/odoo#84397

X-original-commit: 597299c191089faaaca5f421634e411a824207d1
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-10 22:53:03 +00:00
Juan Jose Scarafia e450803e63 [FW][ADD] l10n_ar: refunds with liquido docs
Manual forward port of https://github.com/odoo/odoo/pull/78269

X-original-commit: 37989efe71799bd21da00a0fb9045433d7892604
Part-of: odoo/odoo#84397
2022-02-10 22:53:03 +00:00
Augusto Weiss 75c62022da [FIX] l10n_ar: currency rate on post method
The currency rate could be different if the invoice date is different that the accounting date

Steps to reproduce:
1- Install l10n_ar
2- Create two different currency rate for foreign currency (i.e: Dollar) with also different Date
3- Create an invoice setting the currency as foreign currency (i.e: Dollar)

Current behavior before PR:
In page "Journal Items" could see that each account line use the currency rate defined by the accounting date,
however the currency rate filed (which is not visible) is defined by the invoice date.

Desired behavior after PR is merged:
Use always the accounting date to set the currency rate

+ CLA signing Augusto Weiss

closes odoo/odoo#83689

X-original-commit: 21692f28fd1db7097e1d4c23ce7dcbaa76936449
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-01-31 15:33:41 +00:00
Raphael Collet a1904aa6f6 [IMP] core: field index names
The possible index names have been renamed "btree", "btree_not_null"
(instead of "not null") and "trigram" (instead of "gin").

Task 2742526

Part-of: odoo/odoo#83274
2022-01-28 14:10:01 +00:00
Merlin (megu) eb8ed07916 [FIX] l10n_ar: use E document types for invoices and bills
E documents cannot be selected for invoices and bills which is a problem for companies in Tierra del Fuego, a fiscal exception of Argentina

Steps to reproduce:
1. Install the l10n_ar module
2. Switch to the company '(AR) Responsable Inscripto'
3. Open the Invoicing app and go to Vendors->Bills
4. Create a new Bill and select '(AR) Responsable Inscripto' as vendor
5. The document type '(19) Facturas de exportacion' is not available

Solution:
Add 'E' as journal letter for AFIP responsibility type 'IVA Responsable Inscripto'

OPW-2713805

closes odoo/odoo#83119

X-original-commit: 27edc28a2c19fad80053e668a8c72e7a629e4c1a
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-01-20 17:39:16 +00:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
Juan Jose Scarafia cbfaa94e8f [FIX] l10n_ar: vat inclusion on invoice report
Prior to this commit the line amounts on the invoice report where including the VAT always. With this change we only include VAT if invoice needs to include it (_l10n_ar_include_vat)

closes odoo/odoo#82740

X-original-commit: 47996fdd4e8c79f876d669f73b18c6046a83c95e
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-01-14 09:25:46 +00:00
Yannick Tivisse b9194406ec [IMP] account: Avoid multiple rebrowse in get_fiscal_position
+ Make it private, as it is not supposed to be called from the
webclient.
2021-12-02 12:12:01 +01:00
Bruno Zanotti (ADHOC)andJuan Jose Scarafia 33c7f7d437 [IMP] l10n_ar: calculate removed latam fields
Adapt the module to calculate removed fields from latam localization

X-original-commit: c9536ab129c96582a784efe6a5bce133cad0d650
Part-of: odoo/odoo#78296
Co-authored-by: Juan Jose Scarafia <jjs@adhoc.com.ar>
2021-10-14 16:16:04 +00:00
Bruno Zanotti c9fa9803b9 [FIX] l10n_ar: return vat info grouped by tax
In the method _get_vat(), used to inform AFIP about the vat taxes of an
invoice, we were assuming that in the journal items of the invoices
there is always one line per tax group, but if the user enables the
option "Include in Analytic Cost" of the tax, then it could create more
than one line per tax so it will return an error if you try to validate
the invoice in AFIP or upload the vat book.

closes odoo/odoo#77526

X-original-commit: 67f5f0e86f0170f6066579749895e7d1e68d664c
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-10-06 09:16:42 +00:00
Juan Jose Scarafia 22117b2311 [FIX] l10n_ar: fix l10n_ar_currency_rate
If an invoice is posted, sended back to draft and the rate was change on res.currency, we preserve the value already existing on l10n_ar_currency_rate

closes odoo/odoo#77388

X-original-commit: 820df9eef856d841863306eab1e26d0437a408b0
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-09-29 11:23:45 +00:00
wan ac09bf94e2 [FIX] l10n_ar: do not touch other countries' document types 2021-07-19 10:14:24 +00:00
Katherine Zaoral 216b07eb46 [ADD] l10n_ar: AFIP RG 5003
Be able to create letter A documents to monotributista AFIP
responsibility types.

closes odoo/odoo#72667

X-original-commit: b204f7d1b0bcaf3984600d94395377c97facf168
Signed-off-by: William André (wan) <wan@odoo.com>
2021-06-25 11:50:32 +00:00
Bruno Zanotti (ADHOC) a83e32151b [IMP] l10n_ar: electronic invoicing of docs 60 and 61
Add mapping rules to enable the electronic invoicing of document types
"CUENTAS DE VENTA Y LIQUIDO PRODUCTO A" (60) and
"CUENTAS DE VENTA Y LIQUIDO PRODUCTO B" (61).

closes odoo/odoo#72619

X-original-commit: 9fb221459e1137c0622c14a57ec408b3b5f65fe6
Signed-off-by: William André (wan) <wan@odoo.com>
2021-06-23 11:31:21 +00:00
Bruno Zanotti (ADHOC) 9cb959e952 [FIX] l10n_ar: partner with not handled responsibility type
If a partner has a not handled responsibility type return an empty list
as possibles document types instead of raising an error.

closes odoo/odoo#69010

X-original-commit: abcba544043b08de4cffcf5affd12b08afec188f
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-04-08 19:24:09 +00:00
Bruno Zanotti (ADHOC) 2d8fb8991c [FIX] l10n_ar: Responsibility type "IVA No Alcanzado"
- Add a new responsibility type "IVA No Alcanzado"
 - Update the partner "AFIP" with that responsibility

X-original-commit: e3e20fdccc2ad7bf0015d4c0a67c7ab803a97bd8
2021-04-08 19:24:09 +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
Bruno Zanotti (ADHOC) 2d0034689c [IMP] l10n_ar: original amount in VAT Book
Since AFIP requires to keep the original amounts in the txt files
for the digital VAT Book, we deprecate the option
'company_currency = True' in the methods used to prepare the data.

closes odoo/odoo#67927

Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-16 11:06:11 +00:00
Josse Colpaert cbae410ee5 [FIX] l10n_ar: wrong fw-port as l10n_latam_country_code does not exist anymore
closes odoo/odoo#68181

X-original-commit: 82788f6b6a2501412b2deff8da70867b67db4d6f
Signed-off-by: William André (wan) <wan@odoo.com>
2021-03-21 10:17:02 +00:00
fw-bot 9fd700c82c [IMP] l10n_latam_invoice_document: Remove l10n_ar constraint on base latam module
Documents with `l10n_latam_document_type_id.code == '99'` just exists on **l10n_ar**
https://github.com/odoo/odoo/blob/13.0/addons/l10n_ar/data/l10n_latam.document.type.csv#L74 making this error arise
on other localizations which don't use it.

This was mistakenly introduced on 7748e0e

This method is inherited inside l10n_ar and we add this additional validation.

Original PR: https://github.com/odoo/odoo/pull/64831

closes odoo/odoo#68066

X-original-commit: 109b4b1aaac4d76ef273fb88d27e2b648331a266
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-18 11:00:33 +00:00
Jorge Pinna Puissant 28560f2cd5 [FIX] l10n_ar: error when opening products on e-commerce
- install e-commerce and l10n_ar;
- as a Public user open a product on the shop.

Before this commit, an 403 error was raised.

Now, the public user can navigate through the products.

opw-2462477

closes odoo/odoo#66839

X-original-commit: 9a047c6a2085eab23865d3d649940f1e71c9234b
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2021-02-25 12:46:35 +00:00
Katherine Zaoral f4cb05e2f9 [ADD] l10n_ar: generic changes to use in QR code
AFIP give us new resolution 4291 that request to print QR code in
printed version of electronic invoices. For that we:

1) update the xml report footer style
2) add generic method to sanitze the identification number we are
sending, the sanitize method is added here in order to be re used for
other functionalities across electronic invoice and reports. If we are
not able to sanitize the number then we show an error to the user
3) update translations to add new raise message translated term

NOTE: Fix pylint errors: This ones pop up when running this PR "Check Style'
in runbot

closes odoo/odoo#65034

Related: odoo/enterprise#15949
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-02-24 13:20:22 +00:00
wan 00ed98db4d [FIX] l10n_ar: add afip responsability for demo partner
Part of task 2124952

Populate fields that are required and added in dependencies of l10n_ar.

Remove an unused variable too as an act of kindness.
2021-02-17 08:39:29 +00:00
Juan Jose Scarafia d200931080 [FIX] l10n_ar: currency rate digits
AFIP currency rates goes up to 6 digits.
When invoicing exportation of services, AFIP requires to invoice on the exactly same rate. Without this change it was not possible for some currencies with 6 digits as CHF one.

The change takes effect without needing of updating module

closes odoo/odoo#63156

X-original-commit: 150493ca3fff8b44cf890205990dbd72cebdcb36
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-12-10 12:22:40 +00:00
Victor Feyens 1b67affe7d [FIX] *: avoid direct references to countries
Ensure the code works fine even if countries are deleted.

Also consider "re"-created countries after deletion, by only considering
the country code, not the data reference.

This should reduce support requests related to deleted countries, and
ease the resolution of such problems by the users themselves.

TASK ID - 2368842

closes odoo/odoo#60558

X-original-commit: 037012bc4e2935eb00a7f353529bb7ec55066733
Related: odoo/enterprise#14347
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-10-22 16:17:26 +00:00