Commit Graph
40 Commits
Author SHA1 Message Date
Yannick Tivisse a93472a4b2 [FIX] l10n_ch: Unlink res.config.settings after init
Purpose
=======

If not unlinked, it could make it impossible to create a not null
constraint on columns that are installed after l10n_ch before the
garbage collector dropped the existing wizard, leading to an error
like the following:

Table 'res_config_settings': unable to set NOT NULL on column 'ebay_currency'

Part-of: odoo/odoo#105119
2023-08-25 13:58:23 +02: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
Denis Ledoux b4a7996e96 [IMP] base, *: change the API of init hooks to pass env
This is mostly a cleaning/refactoring change.

The current API for init hooks (pre, post, uninstall) is to pass
`cr, registry`.
But the first thing which was done by most
post init and uninstall hooks was to create an env using
the cr passed
e.g.
`env = api.Environment(cr, SUPERUSER_ID, {})`
and the `registry` argument was unused in all these hooks,
completely.

By changing the API of hooks to pass `env` instead
of `cr, registry`, we gain in average two lines in every
hooks:
- the line creating the env `env = api.Environment(cr, SUPERUSER_ID, {})`
- the line importing `api` and `SUPERUSER_ID`

Therefore removing ~250 lines of repeated code lines accross odoo/odoo and
odoo/enterprise.
In addition to these lines removed,
it also ease the API of init hooks for Odoo developers,
who are used to that `env` and not so much how to create an `env`
from a cursor.

Part-of: odoo/odoo#108254
2023-02-01 10:25:01 +01:00
momegahed 7171d60e44 [FIX] l10n_ch: QR-Invoice don't work for LI customers
Issue :
- Liechtenstein adapted the same QR-Invoice as Switzerland.
However, Odoo only allows the issuance of QR-Invoices to
swiss customers

https://www.llb.li/en/private/paying-and-saving/payment-services/qr-bill#:~:text=Standing%20orders%20based%20on%20orange%20payment%20slips%20can%20no%20longer%20be%20processed%20after%2030%20September%202022.%20Therefore%2C%20these%20standing%20orders%20need%20to%20be%20newly%20set%20up%20on%20the%20basis%20of%20QR%20bills.

Fix:
- Allow LI users to be issued QR-Invoices

OPW-2977644

closes odoo/odoo#106239

X-original-commit: 634c7bbe687c850b23e811b4b7e7b7da77313d99
Related: odoo/enterprise#34234
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
2022-11-22 19:09:57 +01:00
oco-odoo d9c97e8cd1 [REM] l10n_ch_qr_iban: merge module into l10n_ch
This module had been introduced in stable to add a field to store the QR-IBAN in case it differed from the regular account number. We now merge it into the original module and make it so that the only way to define a QR-IBAN is to populate this field (no more magic with account number).
2021-04-01 17:06:11 +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
fw-bot 3349940157 [FIX] l10n_ch: make QR-bill and ISR generation disjoint
QR-bills could only be generated for ISR-compliant invoices, which is wrong and would have caused issues in the future, as ISR will slowly disappear.

Furthermore, doing it this way avoids raising an error after commit 719f087 , when trying to print an ISR-compliant invoice if the module hadn't been updated (it used to raise because the QR-bill report didn't exist, and it tried generating it).

closes odoo/odoo#51858

Forward-port-of: #51340
Forward-port-of: #50744
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-05-28 11:43:30 +00:00
Florian Gilbert a77d80a48d [FIX] account & l10n_ch: fix l10n_ch installation on a company
And a compute field.

closes odoo/odoo#37497

Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2019-09-27 14:14:18 +00:00
Laurent Smet fe2bdc2649 [FIX] l10n_ch: fix missing renaming of settings
account.config.settings has been renamed by res.config.settings, see 781a03b2bc
2017-09-05 15:02:30 +02:00
Laurent Smet aee43c0d14 [ADD] account: add cash rounding managment
In some countries, we need to be able to make appear on an invoice a rounding line, appearing there only because the smallest
    coinage has been removed from the circulation.
    For example, in Switerzland invoices have to be rounded to 0.05 CHF because coins of 0.01 CHF and 0.02 CHF aren't used anymore.

    Was PR #15231
    Was task 30904
2017-09-01 18:23:45 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Olivier Colson 5169b50efe [IMP] l10n_ch
Add a new button to generate the ISR and remove the "double generation" of reports on 'Print invoice' button. This modification brings the code back to its original version and hence fixes the javascript bugs that occured with less than 3 workers running on the server and with Google Chrome when triggering multiple downloads simultaneously.

[ADD] account

Add a identifier to the 'register payment' button in order to reference it more easily and add the 'Print ISR' next to it.

[FIX] l10n_ch

The module did not install itself anymore, an import was missing.

Report generation was crashing due to a function's suppression.
2017-03-06 16:43:26 +01:00
qdp-odoo 1ba42a6f29 [IMP] l10n_ch: add support for ISR/BVR generation and postal bank accounts
The ISR is a payment slip report for account.invoice, that we automatically send and print with the regular invoice report (to ease usability, as these two reports usually go together).

[FIX] l10n_ch: italian translation

A field was missing for italian chart of account translation to work.
2017-03-03 16:00:05 +01:00
Rohan Patel ad7ca14d1b [MIG] l10n_* : Migrated to new API
[MIG] l10n_ae : Migrated to new API.

[MIG] l10n_ar : Migrated to new API.

[MIG] l10n_at : Migrated to new API.

[MIG] l10n_au : Migrated to new API.

[MIG] l10n_be : Migrated to new API.

[MIG] l10n_bo : Migrated to new API.

[MIG] l10n_br : Migrated to new API.

[MIG] l10n_ca : Migrated to new API.

[MIG] l10n_ch : Migrated to new API.

[MIG] l10n_cl : Migrated to new API.

[MIG] l10n_cn : Migrated to new API.

[MIG] l10n_co : Migrated to new API.

[MIG] l10n_cr : Migrated to new API.

[MIG] l10n_de : Migrated to new API.

[MIG] l10n_de_skr03 : Migrated to new API.

[MIG] l10n_de_skr04 : Migrated to new API.

[MIG] l10n_cn_small_business : Migrated to new API.

[MIG] l10n_cn_standard : Migrated to new API.

[MIG] l10n_do : Migrated to new API.

[MIG] l10n_ec : Migrated to new API.

[MIG] l10n_es : Migrated to new API.

[MIG] l10n_et : Migrated to new API.

[MIG] l10n_fr : Migrated to new API.

[MIG] l10n_generic_coa : Migrated to new API.

[MIG] l10n_gr : Migrated to new API.

[MIG] l10n_gt : Migrated to new API.

[MIG] l10n_hn : Migrated to new API.

[MIG] l10n_hr : Migrated to new API.

[MIG] l10n_hu : Migrated to new API.

[MIG] l10n_in : Migrated to new API.

[MIG] l10n_it : Migrated to new API.

[MIG] l10n_jp : Migrated to new API.

[MIG] l10n_lu : Migrated to new API.

[MIG] l10n_ma : Migrated to new API.

[MIG] l10n_mx : Migrated to new API.

[MIG] l10n_nl : Migrated to new API.

[MIG] l10n_no : Migrated to new API.

[MIG] l10n_nz : Migrated to new API.

[MIG] l10n_pa : Migrated to new API.

[MIG] l10n_pe : Migrated to new API.

[MIG] l10n_pl : Migrated to new API.

[MIG] l10n_ro : Migrated to new API.

[MIG] l10n_sa : Migrated to new API.

[MIG] l10n_sg : Migrated to new API.

[MIG] l10n_si : Migrated to new API.

[MIG] l10n_syscohada : Migrated to new API.

[MIG] l10n_th : Migrated to new API.

[MIG] l10n_tr : Migrated to new API.

[MIG] l10n_uk : Migrated to new API.

[MIG] l10n_us : Migrated to new API.

[MIG] l10n_uy : Migrated to new API.

[MIG] l10n_ve : Migrated to new API.

[MIG] l10n_vn : Migrated to new API.
2016-07-06 11:01:26 +02:00
qdp-odoo a2ff33faac [IMP] account: added some functions to help updating VAT reports in localization modules. [FIX] l10n_ch: better tags on taxes in order to have an enhanced VAT report 2016-01-21 17:35:16 +01:00
Cédric Snauwaert c2f0e915fe [FIX] l10n_multilang: module adapted to new accounting and the fact that localization modules generate the objects from the templates directly at the installation (which was before the translation were loaded for the templates in previous version). Was PR #8455 2015-09-30 09:30:46 +02:00
qdp-odoo 5baa2d19fa [FIX] l10n_ch is back, compliant with the new accounting 2015-08-18 11:59:29 +02:00
Olivier Dony 0bd4545348 [LEGAL] Use global LICENSE/COPYRIGHT files, remove boilerplate text
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
  automatically in all countries thanks to Berne Convention + WTO rules,
  and a reference to the applicable license is clear enough.
2015-06-02 03:16:04 +02:00
Leonardo Donelli 4a0b13ed92 [REF] remove vim modelines and resulting trailing blank lines
Let 2015 be a year without modelines!
cf #4174
2014-12-31 15:52:13 +01:00
nicolas.bessi@camptocamp.com 93cecb8f0a [FIX] update l10n_ch contributors and meta-data
bzr revid: nicolas.bessi@camptocamp.com-20130215134018-e5w25wvbf0u0cat1
2013-02-15 14:40:18 +01:00
nicolas.bessi@camptocamp.com beb774cc11 [IMP] Refactoring of l10n_ch due to the adoption of new payment standard in 2013/2014 only chart of account stays all other function are split and extracted in swiss localization project on launchpad
bzr revid: nicolas.bessi@camptocamp.com-20121218102141-vnu8n7huhty1z3ro
2012-12-18 11:21:41 +01:00
nicolas.bessi@camptocamp.com 1e08004c51 account move line removing because overriding line2bank is not needed anymore
bzr revid: nicolas.bessi@camptocamp.com-20110128105028-czxgvwh730mban0p
2011-01-28 11:50:28 +01:00
nicolas.bessi@camptocamp.com 315242ab0c [IMP] l10n_ch new version with 2011 taxes and with fixes disscussed with qdp
bzr revid: nicolas.bessi@camptocamp.com-20110114124154-zrqoqof5etn9i42r
2011-01-14 13:41:54 +01:00
nvi-openerp e380d5d55c [FIX] Corrected small things in swiss accounting
bzr revid: nicolas.vanhoren@openerp.com-20101026150632-lsvdofxrqdbnmlxh
2010-10-26 17:06:32 +02:00
nvi-openerp e6b58a33cf [IMP] Merged swiss accounting
bzr revid: nicolas.vanhoren@openerp.com-20101026150222-gieza7zn96y0pfvc
2010-10-26 17:02:22 +02:00
PAP(OpenERP) e20f4b9b37 [IMP] l10n_ch: Converted to osv memory wizards
bzr revid: mra@mra-laptop-20100819045110-xwunpbnuqr1s5h0c
2010-08-19 10:21:10 +05:30
Stephane Wirtel 5142d98b30 [FIX] Remove the executable flag on the python and xml files
bzr revid: stephane@openerp.com-20100429080154-kmn18r5kci0uq84u
2010-04-29 10:01:54 +02:00
ChristopheChauvet(syleam) 41e8ed59ef changed encoding to coding in all py files
lp bug: https://launchpad.net/bugs/357182 fixed

bzr revid: hda@tinyerp.com-20091013055837-3ntnbe8b938xmk97
2009-10-13 11:28:37 +05:30
Christophe Chauvet 28ede437d9 [IMP]
* add missing tools.translate 
 * translate all missing raise
 * add encoding: utf-8 in missing file
 * add vim comment (when missing) at the end of file
 * convert tabs to spaces (PEP8 Compliant)
 * more pythonic when concatenate value

bzr revid: christophe.chauvet@syleam.fr-20090306221824-xt1oeip60sq8fwws
2009-03-06 23:18:24 +01:00
nicolas.bessi@camptocamp.com 9f8a426388 adding swiss localisation modules
bzr revid: nicolas.bessi@camptocamp.com-20090213155346-dm090u6oqpvb3ujw
2009-02-13 16:53:46 +01:00
ced 15a2d0287a Move account chart to extra_addons repo
bzr revid: ced-a45a7ff64ec9aa763acdc006e9bfe3f7cc91b653
2007-08-10 06:56:37 +00:00
pinky c1ea220060 BVR are Ok.
bzr revid: pinky-74eb14f963b500478b874717482441d93a178c5b
2007-01-16 08:55:03 +00:00
bch 0d0207cf56 DTA debug
bzr revid: bch-53f2a82267ecb87d55dc0d732dbe679c509085e8
2007-01-12 14:49:15 +00:00
bch bc97086b30 DTA debug
bzr revid: bch-b59f834b73661c44b5e094cc897cbfbd41139079
2007-01-12 14:41:47 +00:00
bch a11c00259a suppresion des num dta et numbvr de company
bzr revid: bch-169a89a35fbba20007bfcd5a8e663cb10c0fdb38
2007-01-12 14:32:36 +00:00
bch 137aa2ce97 DTA : the dropdown in the invoice does no longer exist. The dta record type is completely defined by the bank account
bzr revid: bch-684e3b107476b43b44d1c1002551ac91a8c35664
2007-01-11 09:03:27 +00:00
pinky bc438037fd L10N_CH : DTA wizard added
bzr revid: pinky-41dc014b1293b7f02f5dd5b3f2c6a1d7f237aaad
2006-12-18 08:06:01 +00:00
pinky a33826ac52 l10n_ch : DTA and V11 first version
bzr revid: pinky-cc537050293435f32b59349ebd142bbed4482e93
2006-12-08 13:03:08 +00:00
pinky 2f9a0fcc2b NEW MODULE:
purchase_journal:
		Add journals to purchases
		Add statistics on purchases of a journal
		New reporting menu for purchases

Improvement in module l10n_ch:
	BVR print (still buggy)
	DTA generation (draft)

bzr revid: pinky-b2c5bf783db58b9b6d12cc7f2a4b9decb1bdd6f3
2006-12-08 08:31:09 +00:00
pinky a83dce15e0 New trunk
bzr revid: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
2006-12-07 13:41:40 +00:00