Commit Graph
21 Commits
Author SHA1 Message Date
Paolo Gatti (pgi) 43fc30a3f7 [IMP] account_*: Proxy user refactor
- Proxy user is no longer a computed store=True field, but a proper one.
  The type cannot be deduced just by some field on the company.
  A company may be Italian and also use Peppol, so the two Proxy Users
  must be different.
- The Proxy user `get_proxy_identification` method needs a proxy_type
  argument, otherwise the method won't know if the current override
  is to be applied or not. It cannot be handled by a field of the user
  itself because it is also used contextually to the user creation.
- new `_get_default_enable_send_by_post` function on the Send and Print
  wizard, so that it can be overridden by the features of the move
- Renamed `_compute_send_mail_extra_fields`
  to `_compute_fields_from_moves_state`

Part-of: odoo/odoo#122194
2023-09-19 16:37:09 +00:00
aliya 2d051168a4 [FIX] account_peppol: fix migration key, sql constraints
Currently, the migration key is stored through a workaround as a config parameter,
because the behaviour needed to be changed in stable.
Now, several things can be fixed:
- `account_peppol_migration_key` is now a field on `res.company`, not `account_edi_proxy_client.user`
- `account_peppol_attachment_ids` can be removed as the specs changed and it's no longer necessary
- `peppol_proxy_state` can be removed as it's no longer useful after `enable_peppol` was added
- SQL constraints need to be changed to only include active users.
  This allows users to deregister/migrate away from Peppol and then re-register later, with their previous edi user being archived

closes odoo/odoo#129595

Related: odoo/upgrade#4980
Signed-off-by: Laurent Smet (las) <las@odoo.com>
2023-08-03 08:26:28 +02:00
aliya be00ef8e37 [ADD] account_peppol: send and receive invoice via peppol
This commits adds `account_peppol` module that allows:
- Registering as an account edi user and send an application to the peppol proxy,
  where the participant can be approved or rejected after reviewing the documents attached.
- Sending invoices by selecting 'Send via Peppol' option in the send & print wizard.
- Receiving peppol documents.

task-3159912

closes odoo/odoo#119120

Signed-off-by: Laurent Smet <las@odoo.com>
2023-05-11 18:25:03 +02:00
aliya 8590c6a929 [IMP] account_edi_proxy_client,l10n_it_edi: remove edi format dependency
Edi format is going to be removed eventually - `account_edi_proxy_client` should not depend on it and be more flexible in general.

This commit:
- Removes edi_format field from `account_edi_proxy_client.user` model. We still have to add them in `l10n_it_edi` as it still heavily relies on edi format for now.
- Adds a way to have a unique edi user per company, proxy user, edi mode combination.

This is a necessary step before adding peppol, which will also depend on the account_edi_proxy_client

closes odoo/odoo#116059

Related: odoo/upgrade#4458
Signed-off-by: Laurent Smet <las@odoo.com>
2023-04-17 16:34:44 +02:00
Paolo Gatti (pgi) 2a3d65e3e9 [IMP] account_edi_proxy_client: Debug views added
Added views and menuitems for account_edi.document
and account_edi_proxy_client.user, so that our technical team
will be autonomous in its investigations.

Task link: https://www.odoo.com/web#model=project.task&id=3204255
Task-3204255

closes odoo/odoo#115751

X-original-commit: 5e771b131e85b42a747936daf698f62fe2b125b5
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2023-03-18 03:32:40 +01:00
Paolo Gatti (pgi) a03549d771 [IMP] account, account_edi, l10n_it_edi: allow link from imported VB to PO, fixes
Every imported vendor bill now will have the chance to make its invoice_origin linked to a Purchase Order.
The function is moved from account_journal to account_edi_format to allow the link being done from all webservices, thread attachments and upload.

- Avoid mocking the proxy testing

The test on the check that the same attachment is coming twice from the proxy doesn't actually need to test the proxy. By splitting the function, we avoid mocking the proxy for no added value. Added an ir.rule for companies to only look for their account_edi_proxy_client.users

- PA Index label should be Destination Code

PA Index is a completely wrong description. This is the destination "address" of the partner at which our EDI documents (invoices) should be directed to inside the SdI e-invoicing system, much like an IP address. It's not an index, doesn't have much to share with the Public Administration. The correct literal translation of the name should be "Destination Code"
for Codice Destinatario. We have clients opening tickets because they don't recognize this field on the partner form because of the wrong translation.

- Fixes on taxes import

Lines didn't have their taxes cleared, so invoices actually added the taxes in the XML to the default supplier taxes of the product VAT taxes on import search was conflicting with actual withholding / pension fund taxes, so extra conditions are added in the search if withholding / pension fund fields are not specified

Task link: https://www.odoo.com/web#id=3175353&model=project.task
Task-3175353

closes odoo/odoo#114870

Forward-port-of: #111365
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-03-15 16:08:08 +01:00
Xavier-Do cd765440b3 [FIX] account_edi_proxy_client: truncate invalid constraints name
closes odoo/odoo#109065

Related: odoo/enterprise#35424
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-01-16 09:32:51 +01:00
Laurent Desausoi 7593c073d2 [IMP] core: use inert SQL based neutralization
Before this commit the neutralize system introduced in v16 was using ORM
methods in order to change appropriate records. Although flexible, this approach
could lead to call some methods with side effects while neutralizing
(eg: overloads of write).

This patch converts the neutralize system to a safer "inert" SQL based approach
by migrating the generic method _neutralize to SQL files exposed in the
data folder.

Task id: 2961687

closes odoo/odoo#102792

X-original-commit: e5dbded9bb363351feff7ca8a56c7f8a6860f492
Related: odoo/enterprise#32580
Signed-off-by: Fabien Meghazi <fme@odoo.com>
2022-10-09 22:04:00 +02:00
Fabien Pinckaers 781a771295 [IMP] remove duplicated index
The following indexes were in double:
- ir_module_module_name_index, ir_module_module_name_uniq
- ir_model_obj_name_uniq, ir_model_model_index
- ir_config_parameter_key_index, ir_config_parameter_key_uniq
- decimal_precision_name_index, decimal_precision_name_uniq
- account_edi_proxy_client_user_id_client_index, account_edi_proxy_client_user_unique_id_client
- mail_channel_rtc_session_channel_member_id_index, mail_channel_rtc_session_channel_member_unique
- loyalty_card_code_index, loyalty_card_card_code_unique

Part-of: odoo/odoo#99795
2022-09-08 12:46:50 +02:00
Raphael Collet 6cf8db906f [REF] *: adapt code to new flush API
closes odoo/odoo#87527

Related: odoo/upgrade#3497
Related: odoo/enterprise#26939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-05-25 18:00:47 +02:00
dbkosky 57874da264 [FIX] account_edi_proxy_user: update test server url
The proxy test server has been updated, and there is a new url, this
commit updates the default server constant in the code to match the new
url.

closes odoo/odoo#87271

X-original-commit: d1485227096a6bf1d473c6d3c26ca54dbffbe3e0
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
2022-03-29 10:56:30 +02:00
dbkosky dae20acffb [FIX] l10n_it_edi_sdicoop: adapt user registration on res_config_settings
To properly register account_edi_proxy_client.user when saving the res
config settings page, the radio buttons needed to be modified, and the
'register' button was adapted to be a checkbox instead.

Registering multiple demo proxy clients lead to an error, as it is
asserted that id_client should be unique, and the demo client has
'id_client': 'demo'.
To fix this, the id of a demo client is 'demo' + the company id.
Searching for demo clients is adapted to search on the first four
characters.

closes odoo/odoo#85794

X-original-commit: 54e54466f0858d4b19fa8f61ff2b927e00f8f5a8
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
2022-03-09 11:21:47 +00:00
Josse Colpaert 54dea0d81a [FIX] l10n_it_edi_sdicoop: fix access rights so demo user can send invoices
As the proxy client user can only be accessed by base.group_system,
we need a sudo() to make it possible for a regular user to send
invoices.

closes odoo/odoo#85566

X-original-commit: 79a076b832a785b78ed6d73d539d3eae6eb2fd02
Signed-off-by: William André (wan) <wan@odoo.com>
2022-03-01 03:23:05 +00:00
Josse Colpaert 8e6595857c [FIX] account_edi_proxy_client, l10n_it_edi_sdicoop: timeouts and concurrency
- Sometimes the refresh_token is not saved in the db because the code
after it fails (timeout).  We also want to avoid 2 processes
trying to renew the token at the same time (=> avoid desynchronization
of the refresh_token)

So, we added a locking mechanism and do a commit after we refresh the
token.

- If we have very big invoices to receive, they do not get imported into
the database.  At the moment we risk timeouts.

Our solution is to do a lot of intermediary commits and we link it
to a temporary account_move before doing the import logic and maybe
putting it into the definitive one.

closes odoo/odoo#85372

X-original-commit: ce47d09c05e4bcc91ee4de68db3a7a471bcb4df8
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-25 09:22:56 +00:00
dbkosky 732f21dd71 [FIX] account_edi_proxy_client, l10n_it_edi_sdicoop: adapt config params to make use of the test iap server
This commit adapts the l10n_it_edi_sdicoop and account_edi_proxy_client
modules to make use of the existing config param
'account_edi_proxy_client.demo' in order to target the correct odoo iap
server for italian edi requests.

When the config param is set to:
'prod' or False (when the config param doesn't exist): Target the
production odoo iap server (by default), which submits and collects edi from the
production channel. Though if the config parameter
'account_edi_proxy_client.edi_server_url' exists, we use the value
provided there instead.

'test': Target the test odoo iap server, which submits and collects edi
from the test channel

'demo' or anything else not above: don't send anything, and simulate the
flow of italian edi submissions in odoo

task-id 2764978

X-original-commit: 32683b70a34a900a112d19bf780446a973753ae5
Part-of: odoo/odoo#84826
2022-02-18 10:46:46 +00:00
Christophe Monniez e34430c822 [IMP] various: implement _neutralize method
As an overridable _neutralize model method was added in a previous
commit, the method is now implemented for various models.

closes odoo/odoo#67825

Related: odoo/enterprise#19042
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-02-01 09:54:08 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Paolo (pgi) ce8156d00d [IMP] account_edi_proxy_client: Making the EDI Iap server configurable
There is a test_mode to allow experimentation on the IAP server.
To be able to switch between the two, we need to make the
SERVER_URL configurable.

closes odoo/odoo#77977

X-original-commit: 11be1b25c60ae27a5e8078802883a1db867a6452
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Paolo Gatti <lordkrandel@users.noreply.github.com>
2021-10-07 14:17:34 +00:00
Paolo (pgi) 7e05dbbad0 [FIX] account_edi_proxy_client, l10n_it_edi, l10n_it_edi_sdicoop: Fixing Base64 issues
When encoding a string or bytes with base64,
the resulting byte string must be decoded
to get the string back.

* `addons/account_edi_proxy_client/models/account_edi_proxy_user.py`
  AccountEdiProxyUser._register_proxy_user()

* `addons/l10n_it_edi/models/account_invoice.py`
  AccountMove._prepare_fatturapa_export_values()

* `addons/l10n_it_edi_sdicoop/models/account_edi_format.py`
  AccountEdiFormat._l10n_it_post_invoices_step_1()

X-original-commit: 3a705d93543e910b6af4b3b4aa53c523f367782a
Part-of: odoo/odoo#77977
2021-10-07 14:17:33 +00:00
Benjamin Frantzen (bfr) 1e53f20472 [FIX] account_edi_proxy_client, l10n_it_edi_sdicoop: do not make request in demo mode
When demo data is installed, requests to the proxy are blocked and we simulate a successful result by default and the proxy.
- an account_edi_proxy_client.user is created even though it's counterpart on the proxy doesn't exist.
- sending invoices is successfull and checking the status return simulate the invoice was accepted.
- the cron checking for incoming invoice returns immediatly and no new invoice is created.

closes odoo/odoo#72092

X-original-commit: 7be2e136c5e7a62d440f8323f36076d486976825
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-06-11 17:36:39 +00:00
Benjamin Frantzen (bfr) 8eba0be6a5 [ADD] l10n_it_edi_sdicoop, account_edi_proxy_client: added support for SdiCoop webservice.
- Allows to send and receives invoices from the fatturaPA network via the webservice (SdiCoop).
- PEC mail is disabled when SdiCoop is disabled.
- Added account_edi_proxy_client, a registered user on the proxy (see l10n_it_edi_proxy on iap-apps), that features encryption. Generates a asymmetric keys, and keep the private_key to be able to decrypt file sent by the proxy (which it encrypted with the public key).
- Added a generic way to sign the requests made to the proxy.

TASK ID 2358882

closes odoo/odoo#71928

X-original-commit: 4c8afc413a8982b2e77712eab7cf7ddac9f3851f
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-06-09 18:22:33 +00:00