Commit Graph
22 Commits
Author SHA1 Message Date
Josse Colpaert 69dbf4871c [FIX] l10n_it_edi: for foreign invoices without VAT, we need the country code
The number is set as zeros, but we should still provide
the IdPaese tag.

opw-2703669

closes odoo/odoo#82398

X-original-commit: 3e4361ff621e5458e6a2ad09610274bf33290106
Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-07 19:54:44 +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
Josse Colpaert df3ed2302c [IMP] l10n_it_edi: demo data for electronic invoicing works with IT company
Before it was only done on MyCompany, but interferes easily
with other demo data.  Better for the Italian localization
to try the demo immediately in IT Company.

We also added an Italian demo partner, so it is clear
which one can work immediately.

closes odoo/odoo#67615

X-original-commit: 91ff96a79121c1b7018f8a1f7fa9850170852c41
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-10 16:43:34 +00:00
Andrea Grazioso (agr-odoo) 3c31bceca4 [FIX] l10n_it_edi: generate xml for invoices with 0% tax only
Have an invoice with single line and 0% tax on it
As the tax has 0 amount, no related moves are created,
the e-invoice export will fail the formal compliance check as it is
missing a section

opw-2461496

closes odoo/odoo#66960

X-original-commit: 71cc7212b1c1abad5d37e29f3a1f33f6e6cd2a81
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-03-08 10:17:35 +00:00
Benjamin Frantzen (bfr) bed5c12305 [IMP] l10n_it_edi: added customer reference to FatturaPA
This is mandatory for PA customers, and required by several enterprise customers as well.

Related Ticket: 2425845

closes odoo/odoo#64443

X-original-commit: bb898e663019942a6fd99ce96ce5742a8ff7ea56
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-01-12 16:58:14 +00:00
Nicolas Martinelli 490ee8890e [FIX] l10n_it_edi: customer outside EU
- Create a partner outside Europe
- Set a VAT number
- Create an invoice for the partner
- Post the invoice

The `IdPaese` and `IdCodice` is obtained from the VAT number, but it is
not correct for partners outside Europe: the VAT number should always be
`OO99999999999`.

A workaround is to set the VAT number of the partner to
`XXOO99999999999`, where `XX` is the country code. However, in case of
multi-company with shared partners, another company might need the
proper VAT number.

In case of a customer outside EU, we:
- get the `IdPaese` from the country of the partner
- set the `IdCodice` to `OO99999999999`

We also add the `IdPaese` to customers without VAT.

opw-2355842

closes odoo/odoo#60416

X-original-commit: 35267c59c32f747351e8741cfe6011749914e809
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-21 09:19:07 +00:00
Anh Thao Pham (pta) 9ac156b777 [FIX] l10n_it_edi: fix vat code when customer has no VAT and is not from Italy
For foreign customers (out of Italy) who do not have a VAT number,
"0000000" should be used as VAT code.

opw-2325991

closes odoo/odoo#58204

X-original-commit: c5589bf8880e109990d902bb905c7de967910524
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-09-22 10:48:46 +00:00
Benjamin Frantzen (bfr) 013936261b [IMP] account_edi: added flows to manage web-services and payments.
Added edi.documents representing an electronic document for a move and an edi.format.
A format can be asynchronous if it needs to call a web-service to generate the document, it will then be generated by the CRON (otherwise it's generated in post).
The formats can support payments if needed (can be generated immediately or by the CRON).
Added support for errors and related views.
Setting defaults format on a journal can be done automatically (based on a hook).
Added tests : xml comparaison with diff and helpers to test a EDI import/export

--task: 2247368
2020-08-17 10:22:01 +00:00
Christophe Simonis 4fda0f43b7 [FIX] l10n_it_edi: use algorithmically correct VAT numbers in demo data
Avoid warnings at module install.

closes odoo/odoo#52683

X-original-commit: 5299dd45f07894d46b68feabe581fe5fbee03981
Signed-off-by: Christophe Simonis <chs@odoo.com>
2020-06-09 10:44:18 +00:00
Benjamin Frantzen (bfr) ac0381d216 [IMP] l10n_it_edi: adaptation to account_edi
- Support for account_edi workflows (only import) + fattura_pa as an account.edi.format.
- XML containing multiple invoices cannot be imported from the chatter.
2020-05-29 07:16:30 +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
jdoutreloux 52ed0be17e [IMP] uom : remove 'measure_type' field
This removes the measure_type field which has become unused and
causes issues when users try to add new uom categories.

Task-2043927

closes odoo/odoo#41056

Related: odoo/enterprise#6945
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-01-13 11:19:17 +00:00
Hardik Prajapati 907c61bc63 [IMP] l10n_it_edi: shown payment terms in electronic invoice
shown payment information along with bank details in exported
electronic invoice XML file

closes odoo/odoo#41656

Task: 1948158
X-original-commit: 7d2cf514a2443accbb9455553f27bbe2185e47a4
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-10 13:38:43 +00:00
Nicolas Martinelli 82a24aa1df [FIX] l10n_it_edi: split name
Fields `Nome` and `Cognome` cannot be identical. However, Odoo has only
a single field for name. Therefore, we split the name based on the
assumption that the name is written as 'Name Surname'.

opw-2093035

closes odoo/odoo#40209

X-original-commit: 9e8b33d61430bd834ac2970919c3df2a0bb76fa4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-13 14:49:02 +00:00
Christophe Simonis 257a382b5c [MERGE] forward port branch saas-12.3 up to dd627b9698 2019-09-25 13:43:26 +02:00
Jorge Pinna Puissant aade5792e1 [FIX] l10n_it_edi: xml without vat or codice fiscale
Since 2302386d3ea47f3160ca5857425c99e0d4bbf62a the VAT or Codice Fiscale
fields could be empty for non Italians buyers. In that cases the
generated XML must be sent a dummy Codice Fiscale (99999999999), to pass
the extra checks, see
https://www.fatturapa.gov.it/export/fatturazione/sdi/Elenco_Controlli_V1.1_EN.pdf.

opw-2045244

closes odoo/odoo#37346

X-original-commit: 98ea0872efbdb60b9dd04b31dc711b937c2195ec
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-09-24 09:33:03 +00:00
Christophe Simonis bfd34e14b1 [MERGE] forward port branch saas-12.3 up to 40e8b67179 2019-07-26 15:12:29 +02:00
Martin Trigaux beba36416f [MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c 2019-07-16 16:36:40 +02:00
RomainLibert c526715110 [FIX] l10n_*: don't write on country_id in demo
Writing the country_id of the main company in demo data disables demo
data installation if installing multiple l10n, this is caused by a wrong
check of the vat field (base_vat).

Two approaches can be used here:

- Always write on country_id in all l10n demo data
NB: this also implies writing the country_id first in order for the
vat check to be done using the right country code
- Never write on country_id in any l10n demo data

The prefered approach for the moment is to never write on the country_id
of the main company.
This approach is easier to apply as it is a mimimal diff and the first
approach would require deeper changes to the code in order to allow
writing all the information in a single `record` tag in the demo data

closes odoo/odoo#34905

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-07-16 09:58:17 +00:00
Laurent Smet beaa30a3d1 [IMP/REF] accounting-pocalypse yeaaahh
This commit merges the following models
 * account.invoice and account.move
 * account.invoice.line and account.move.line
 * account.voucher and account.move
 * account.voucher.line and account.move.line

It was the opportunity for a big cleanup of the code, so it also restructures the whole account module, its different models/fields, the tests etc. for a better world and a better code readability.

==== Rationale ====
The rationale of this huge change is that we want journal entries / invoices to be easily edited, and changes reflected in the other model. It's a HUGE feature and very strategic for the fiduciary companies. For example, changing the account of a journal entry needs to be automatically reflected on the related invoice.

The same reasoning applies to sale/purchase vouchers.

==== Changes made in features =====
When creating an invoice, you are now creating a journal entry directly.
--> The object account.invoice no longer exists.
In the same fashion when creating an invoice line, you're now adding journal items directly in the journal entry representing the invoice. If this invoice line has some tax, it may create additional journal items as well.
--> The models account.invoice.line & account.invoice.tax no longer exist

Identically, when creating a sale/purchase receipt with its lines, you are now creating a journal entry directly and there's no more usability difference between encoding a receipt or an invoice.
--> The object account.voucher no longer exists.
--> The object account.voucher.line no longer exists.
--> The whole account_voucher module no longer exists.

Positive side-effects coming from these changes are
* draft invoices/bills/sale or purchase receipts now create a draft accounting entry. Validate these objects now simply post its journal entry. That means that draft invoices/bills/sale or purchase receipt can straightforwardly be included in reporting or budgets.
* opening a journal entry in form view will now always open the correct view: if it's a sale/purchase journal entry we will have a customer invoice/vendor bill view or a sale/purchase receipt view, whatever the menu we're coming from.
* code & business logic simplification. It is also condensed in a single place instead of being partially duplicated on invoices, vouchers and journal entries.

There should be no feature loss, except the one allowing to group multiple journal items together based on the same product during the invoice validation.

==== Changes made in models =====
* account.invoice: model removed. Instead, now use account.move with following mapping

field (account.invoice) 		field (account.move)
-----------------------			--------------------
name 					invoice_payment_ref
number 					name
reference 				ref
comment 				narration
user_id 				invoice_user_id
amount_					total_company_signed amount_total_signed
residual 				amount_residual
state 					state + invoice_payment_state 		/!\ selection changed
date_invoice 				invoice_date
date_due 				invoice_date_due
sent 					invoice_sent
origin 					invoice_origin
payment_term_id 			invoice_payment_term_id
partner_bank_id 			invoice_partner_bank_id
incoterm_id 				invoice_incoterm_id
vendor_bill_id 				invoice_vendor_bill_id
source_email 				invoice_source_email
vendor_display_name 			invoice_vendor_display_name
invoice_icon 				invoice_vendor_icon
cash_rounding_id 			invoice_cash_rounding_id
sequence_number_next 			invoice_sequence_number_next
sequence_number_next_prefix 		invoice_sequence_number_next_prefix

'invoices' subset of account.move can be accessed by using the selection field 'type' or one of the many helpers like is_invoice()

* account.move: now has a valid state 'cancel' that has to be excluded from all business logic
* account.move: field 'amount' renamed into 'amount_total'
* account.move: field 'reverse_entry_id' renamed into 'reversed_entry_id'
* account.move.line: now has a field 'display_type' that has to be excluded from all business logic, in order to support invoice layouting
* account.invoice.line: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.line) 		field (account.move.line)
----------------------------		-------------------------
invoice_id 				move_id
uom_id 					product_uom_id
invoice_line_tax_ids 			tax_ids
account_analytic_id 			analytic_account_id

'invoice lines' subset of all account.move.line from a journal entry can be accessed by using the boolean field 'exclude_from_invoice_tab'

* account.invoice.tax: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.tax) 		field (account.move.line)
---------------------------		-------------------------
invoice_id 				move_id
account_analytic_id 			analytic_account_id
amount 					price_unit
base 					tax_base_amount

'tax lines' subset of all account.move.line from a journal entry can be accessed by using the relational field 'tax_line_id'

* account.invoice.confirm: model removed. Instead, now use the 'post()' function of account.move
* account.invoice.refund: model removed. Instead, now use account.move.reversal to reverse the entries with the same options as we had for invoices
* account.voucher: model removed. Instead, now use account.move of type in ['out_receipt', 'in_receipt]
* account.voucher.line: model removed. Instead, now use account.move.line

==== Changes made in functions ====
* on account.move, method _run_post_draft_to_post() renamed into _autopost_draft_entries()
* on account.move, method action_account_invoice_payment() renamed into action_invoice_register_payment()
* on account.move, method action_invoice_reconcile_to_check() renamed into action_open_matching_suspense_moves()
* on account.move, method _get_domain_edition_mode_available() renamed into _get_domain_matching_supsense_moves()
* on account.move, method _get_intrastat_country_id() renamed into _get_invoice_intrastat_country_id()
* on account.move.line, method _get_domain_for_edition_mode() renamed into _get_suspense_moves_domain()
* in account.bank.statement, contextual key 'edition_mode' renamed into 'suspense_moves_mode'

Was task 1917430
2019-06-28 11:52:55 +00:00
RomainLibert baa0ce6d15 [FIX] l10n_it_edi: use a valid vat number for italy
closes odoo/odoo#34857

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-07-15 10:43:56 +00:00
jbm-odoo 3684c8a62e [ADD] l10n_it_edi: Electronic invoicing Italy
- Generate e-invoice in xml when validating invoice
- e-invoice is sent via PEC mail and attached to the invoice
- electronic vendor bills and error/receipt messages can
be received through an IMAP incoming pec server
(configured in settings > technical)

We use the pec mail system to send invoices.  We don't manage
signed invoices for B2G.

Configuration is done on the company and the receiving partners
should have the correct codice fiscale / TVA.  On the taxes,
you might need to configure the exonerations.

You will need to configure the government mail address on the
company.  (sdi01...)  You might need to modify after the first
incoming message.

closes odoo/odoo#30845
2019-02-13 08:33:06 +00:00