Add a selection field `l10n_mx_tax_type` on account.tax. This field is
used in the CFDI attachment. This allows to avoid relying on the name of
the repartition line tags to export and import a CFDI.
task-3388347
closesodoo/odoo#135215
Related: odoo/enterprise#47321
Related: odoo/upgrade#5136
Signed-off-by: Laurent Smet (las) <las@odoo.com>
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
closesodoo/odoo#130733
Related: odoo/enterprise#45531
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
For Mexican localization, activate by default the setting display_invoice_amount_total_words for the Mexican localization. As this localization uses its own amount to words function, the related commit enables an override of the generic function to use it correctly with Mexican localization.
For the other mentioned localizations (ua,in,dz,ma), the setting was already activated but overriding the create method was not a proper way of doing.
task - 3367243
closesodoo/odoo#124909
X-original-commit: 6ee9842764e0b1244927cb8ece1f6407ccec20d5
Related: odoo/enterprise#42510
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: hupo-odoo <hupo@odoo.com>
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
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
Install MX CoA
"Cash" and "Bank Suspense Account" are missing the tag
"Transferencias bancarias moneda extranjera" account is using the wrong
tag
opw-3033611
closesodoo/odoo#111273
X-original-commit: 4860a77a51f72bbb51b435766733b3c0a74c9a32
Related: odoo/enterprise#36422
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
This commit adapts account's model to the new report engine introduced for v16, and updates the data files accordingly.
account.report model is now declared in community, together with the other models used by the reporting. This is done so that the tax tags can properly be created by the tax report and used on tax templates. All the actual computation logic stays in enterprise.
See enterprise commit for full details.
Task 2524389
Part-of: odoo/odoo#94125
Task: 2856281
- Remove user_type_id, account.account.type model, internal_type
- Add account_type that is a simple selection field
- Move internal_group and include_initial_balance to account.account
- Because of these changes, type_control_ids on account.journal is also removed
closesodoo/odoo#93212
Related: odoo/documentation#2223
Related: odoo/upgrade#3595
Related: odoo/enterprise#28205
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Set a default tag on the bank suspense account, outstanding accounts
and transfer accounts so that they are found and used by the trial
balance and COA reports.
TAsk id #2612900closesodoo/odoo#82532
Related: odoo/enterprise#23383
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
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.
closesodoo/odoo#68349
Related: odoo/upgrade#2322
Related: odoo/enterprise#17299
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
PR #66910 has been created so the MX can print their receipts.
Eventually, this needs to be reverted since printing a receipt is
actually illegal.
closesodoo/odoo#67209
X-original-commit: 7e9261cacd9f6963dca517fe7b1f3de067af1366
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
To reproduce the error:
(Need MX configuration)
1. Go to Accounting > Customers > Receipts
2. Create a Receipt
3. Post and Print it
Error: An error message is displayed: "Only invoices could be printed."
However, MX should be allowed to print the receipts.
OPW-2456374
closesodoo/odoo#66954
X-original-commit: 0f0238c64cda308098eb5b3d30e3177cfcb4bab7
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
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
closesodoo/odoo#60558
X-original-commit: 037012bc4e2935eb00a7f353529bb7ec55066733
Related: odoo/enterprise#14347
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This module provide you a data from Mexican Bank data extracted
from `SAT Bank catalog
<http://www.sat.gob.mx/fichas_tematicas/buzon_tributario/Documents/catalogo_bancos.pdf>`_.
Additionally was added the following fields:
- ASM code in Banks: to identify banking institutions by ASM standard
- CLABE code in Bank Accounts: required to the sending and receiving
of domestic inter-bank electronic funds transfer.
closesodoo/odoo#35742
Signed-off-by: Josse Colpaert <jco@openerp.com>
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.
Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
Defined as this, the label of the selection field were translated during code
import, when building the python model, not when a user access the field values
as it should (and is already the case thanks to the ORM).
Trying to translate a string when no user-context is available is not only
useless but may cause bug on services with multiple databases (e.g. a SaaS).
In a multi-worker environment, when the code is imported, the _ method will use
multiple scenarios to detect the language and get a cursor.
As we have no available cursor in the frame (method _get_cr from GettextAlias),
the fallback is made on the cursor of the request.
In a multi-worker environment, this could be a cursor linked to a database in
another language than English.
In such scenario, the selections would be translated in the language of the
other database instead of displaying it in English
opw-1881956
When we get the existing tags to append them a new id, we don't get a
list of id but a list of tuple with one id, this only append if you have
more than one accounting of these country installed, as the first time
it will return an empty list. So the command sent to the ORM, is not
built correctly.
To fix this we just append commands '4' that will be append in a list.
When have more than one company, for all companies, the cash
basis journal set in accounting configuration will be
always the related to first company.
This issue cause the followiong error trying to validate an
invoice for a company different to fisrt one:
'Cannot create moves for different companies.'
Because exist a 'cross-configuration' in the cash basis
journal.
The solution to this issue is include the company in domain
that does the search for cash basis journal.
* Added accounts provided following the structure provided by the SAT
this accounts are only the minimal necessary ones, with the objective
to set the first easiest engagement to new users and tags will represent the actual information
from the document linked.
* The name of the tag is the concatenation of tag.code + tag.name, because the account.tag
model have not the code field.
Note: we will need more accounts but some of them for special operations
which are not basic at all, then it is better just propose the operational accounts
once we understand a proper closing process.
* Set the proper user-types on accounts in order to be able to use it with the official reports this CoA
for operational purpose.
* Added nature field and data in tags to allow set this value in electronic account report, and
set this value with data pre loaded, we did not use user.type for this due to the fact that the same user type can have different nature (if it grows for credit or debit), I do not know if this field brakes the stable rule we can discuse about that.
* Assign the account tags with in the Mexican CoA template installation, and with an onchange(account.code) when manually modifying/creating accounts.
Rationale: If the code of the accounts follows the pattern 111.00.00 or 111-00-00 then it will
set the tag 111.00 if the tag exists, if not then this will be ignored.
* Generate an account tag by each second level account in SAT catalog, and assign to the corresponding account.