Commit Graph
19 Commits
Author SHA1 Message Date
Antoine Boonen 5e2e842d7e [IMP] product: Keep expense and income accounts empty at product creation.
Problem
---------
Before 16.2, the fields were empty, which meant that the expense and
income accounts of the chosen category could be used.
Since 16.2, when a product is created, the expense and income accounts
are automatically pre-filled.

Objective
---------
This task aims at retrieving the old behavior to allow using category 
accounts.

Solution
---------
Remove the `property_account_expense_id` &
`property_account_income_id keys` in `_get_xx_template_data` in all
localization packages that define them.

task-3438931

closes odoo/odoo#134796

X-original-commit: dae46c926d5e63683968107f06bf2bfb8e07d267
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Antoine Boonen (aboo) <aboo@odoo.com>
2023-09-08 11:12:41 +00: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
Luis Torres 355250d062 [IMP] l10n_pe_edi: Improve sales invoice document type selection
The domain to document type on the invoice  has been updated to filter
based on the partner's identification type.

If the partner identification type is RUC, the default document type is
set to 'Factura', but allows assign Boleta if its necessary; for all other
partner identification types, the domain document type only allows 'Boleta'.

Task latam:
https://latam-localizations.odoo.com/web#id=916&menu_id=88&cids=1&action=188&model=project.task&view_type=form

closes odoo/odoo#126760

Related: odoo/enterprise#44302
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-07-19 00:35:21 +02:00
Luis Torres 365017a950 [IMP] l10n_pe: Welcome PLE reports
Complement module to allow generate the PLE reports.

- Missing purchase tax groups and taxes added to complete the vendor
  bills flow
- Demo data completed to has data to allow generate the PLE reports
- Document types for vendor bills completed in the data
- Method to improve the domain in document types for customer invoices
  added
- Extend method to autocomplete the number on vendor bills with the
  standard expected by the document type.

closes odoo/odoo#124595

X-original-commit: 821d313a5de857a4903bb35aaea49c3a35f8781e
Related: odoo/enterprise#42345
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-06-12 17:41:22 +02:00
desdelinux 27d9f5c8ff [FIX] l10n_pe_edi: Gain and Loss exchange rate accounts are on the opposite field by default
Issue:

When activating the multicurrency in PE, the default exchange rate accounts are placed in the opposite fields (gain account should be an income account and loss account should be an expense), currently they're the other way around.

Fix:

Change the default account so Odoo created the journal entries for exchange rate differences the correct way.

Task Latam: https://latam-localizations.odoo.com/web#id=967&menu_id=88&cids=1&action=188&model=project.task&view_type=form

Reference:

https://www.noticierocontable.com/diferencia-de-cambio-venta/
https://www.noticierocontable.com/asiento-contable-perdida-diferencia-cambio/

closes odoo/odoo#117745

Replace: #115361
X-original-commit: 45694e1b0eeb46a5f1b75cee738f20e9a670ae63
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-04-05 10:45:54 +02: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
Ivan Yelizariev 22efbe2cfc [FIX] l10n_pe: create related field directly to speed it up
Odoo ORM has special optimization for installing module with a stored related
fields, but it requires the final field be not computed [1] (I'm not sure why),
which is not the case for the `group_id` field. Since `account.move.line` table
may have millions of records, we have to optimize the installation and fill
`l10n_pe_group_id` via a single sql query.

[1]: https://github.com/odoo/odoo/blob/0aff8bb9484a23c0d875d3b12259dd4e0d51e716/odoo/fields.py#L818

opw-2762510

closes odoo/odoo#107157

X-original-commit: 63341b5856b4a5cbc6fda17a4cc1d40f84cf7476
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2022-12-06 17:11:56 +01:00
Julien Alardot (jual) 4562ebe983 [ADD] l10n_pe: Add COA & tax data
Add the Coa and tax data for the peruvian
localisation (in english with translations)

closes odoo/odoo#104073

Task: task-2774275
Related: odoo/enterprise#33183
Signed-off-by: Julien Alardot (jual) <jual@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-12-01 16:27:39 +01:00
Luis Torres 82ae8ba0f0 [IMP] l10n_pe: Welcome ISC tax
The SUNAT requires than when a ISC tax is used on an invoice, on the
cbc:TierRange attribute be specified the ISC type.

Now, the 3 options could be:
- 01: System to value
- 02: Application of the Fixed Amount
- 03: Retail Price System

To this, now was added a new field on the tax, with this options.

Extra, the ISC could have many amount options, for now, only is
generated a tax for 0%, that allows to the customer only change the
percentage that will to use.

Legal Reference:

Catalog No 08:  https://cpe.sunat.gob.pe/node/88

Guide for the Preparation of Electronic Invoice:
https://cpe.sunat.gob.pe/sites/default/files/inline-files/gu%C3%ADa%20xml%20para%20factura%20electr%C3%B3nica%20%28ubl%202.0%29_0.pdf

Impuesto selectivo al consumo (ISC):
https://www.gob.pe/7918-impuesto-selectivo-al-consumo-isc

closes odoo/odoo#98962

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-09-01 21:25:29 +02:00
Josse Colpaert c690c674a4 [FIX] l10n_pe: street_name and street had wrong edit/read only class
Before, if you would put Peru Street 23, it would put Peru in House number.
This is because the editable field was the street field, so behind the scenes,
Odoo will split it and according to the standard format without country,
this means Peru will go into House.

We tried first with a change inversing it, but as we are doing the change,
the best thing is to remove the split all together.  We added also onchange
logic that if you put a district it would automatically put the right city.

City or city_id should depend on the country and is correctly inherited by a
fields_view_get.

Task 2724531

closes odoo/odoo#85194

X-original-commit: 47cd0b51fb60cebb88e3a84b7e332e1ff800b0a8
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-23 12:08:57 +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
wan c92332f555 [FIX] l10n_pe: depend on l10n_latam_invoice_documents
Part of task 2124952

This is needed in order to be able to create the demo data.
It was not done earlier because of stable policy but it was added to
l10n_pe_edi instead.

closes odoo/odoo#60148

Related: odoo/enterprise#15213
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-02-17 08:39:29 +00:00
Nhomar Hernández 230014b8af [IMP] l10n_pe: demo partner, export taxes and proper fiscal positions 2021-02-01 14:49:22 +00:00
Arturo Flores 014d9fcea4 [DEL] l10n_pe: delete rounding method and let round per line be as default
closes odoo/odoo#52320

X-original-commit: ef84278ea131af2f283750c95cd389a2af1570af
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-06-03 09:55:10 +00:00
Laurent Smet caeb782841 [IMP] account,*: Improve bank statements/payments workflow
- Create journal entries as soon as bank/cash statement lines are created, temporary booked on a suspense account set on the journal.
- Simplify the management of "blue" lines in the reconciliation widget. A "blue" line is now a journal item using a temporary liquidity account (outstanding payment/receipt accounts, set on the journal).
- Adapt and simplify the bank reconciliation report.
- Remove the bank reconciliation threshold date. The reconciliation report will show the not already reconciled journal entries using a liquidity account and the not already reconciled journal entries using a temporary liquidity account. Without accounting, an account.payment will involve directly the liquidity account and then, will be considered as a statement line directly.
- Remove the post_at bank reconciliation feature. The "paid" state will be set on the invoices only if reconciled with a journal entry involving the journal's liquidity account.
    With invoicing, the payment will do that so the "in_payment" state should never be shown up.
    With accounting, only the statement lines have the power to move an invoice to the "paid" state.
- Fix various corner cases about the management of multi-currency in bank statement lines.
- Fix the conversion dates in multi-currency: Since the bank/cash is always used on the statement lines, it will use always the real "bank" date instead of the fictive payment one.
- Ensure the 'reconcile' method will raise an error if the involved moves are not posted.

related enterprise PR odoo/enterprise#7019

closes odoo/odoo#41301

--task: 2092096
Related: odoo/upgrade#1018
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-04-10 09:47:24 +00:00
fw-bot eaa094285e [FIX] l1n_pe: forward-port of fixes to l10n_pe
base_vat: Correct management of the check of peruvian VAT without prefix.
l10n_pe: Correct income account the last one is not correct.
l10n_pe: Forced Round globally for peruvian companies once l10n_pe is
installed, and with the onchange.
l10n_pe: For peruvian companies it does not make sense a sequence per
year and the year in the prefix is incorrect, we must force XXX- as
a sequence prefix.

closes odoo/odoo#38854

Forward-port-of: #38764
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-10-16 11:37:28 +00:00
Christophe Simonis 6c948c36bb [MERGE] forward port branch saas-12.5 up to 197474e5b9 2019-09-13 18:07:59 +02:00
Nhomar Hernández ff74a97450 [IMP] l10n_pe: Refactoring of the Peruvian CoA
And making ready for the future EDI modules.

- Added related account group on the move lines to
show account moves in a way Peru is used to.
As this allows to group by the account group
and to divide the hierarchical structure.
- Completely new CoA structure and tax structure
- Minimal fields for the EDI module later
- Districts and cities as we also need codes for
the EDI.
2019-08-23 14:27:33 +00:00