diff --git a/l10n_it_bill_of_entry/__init__.py b/l10n_it_bill_of_entry/__init__.py index 0ee8b5073e26..c7818ff10d29 100644 --- a/l10n_it_bill_of_entry/__init__.py +++ b/l10n_it_bill_of_entry/__init__.py @@ -1,2 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from . import models from . import tests diff --git a/l10n_it_bill_of_entry/__manifest__.py b/l10n_it_bill_of_entry/__manifest__.py index 223f763718d0..93b10284f9f5 100644 --- a/l10n_it_bill_of_entry/__manifest__.py +++ b/l10n_it_bill_of_entry/__manifest__.py @@ -1,19 +1,14 @@ -############################################################################## -# -# Copyright (C) 2013-2017 Agile Business Group sagl (http://www.agilebg.com) -# @author Alex Comba -# @author Lorenzo Battistini -# Copyright (C) 2017 CQ Creativi Quadrati (http://www.creativiquadrati.it) -# @author Diego Bruselli -# Copyright (C) 2013 -# -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -# -############################################################################## +# Copyright 2013-2017 Agile Business Group sagl (http://www.agilebg.com) +# Copyright 2013-2017 Alex Comba +# Copyright 2013-2017 Lorenzo Battistini +# Copyright 2017 CQ Creativi Quadrati (http://www.creativiquadrati.it) +# Copyright 2017 Diego Bruselli +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "ITA - Bolle doganali", - "version": "12.0.1.0.1", + "version": "14.0.1.0.0", "category": "Localization/Italy", "author": "Agile Business Group, CQ Creativi Quadrati, TAKOBI, " "Odoo Community Association (OCA)", diff --git a/l10n_it_bill_of_entry/demo/bill_of_entry_demo.xml b/l10n_it_bill_of_entry/demo/bill_of_entry_demo.xml index 0238a7ecf280..0d47029538b8 100644 --- a/l10n_it_bill_of_entry/demo/bill_of_entry_demo.xml +++ b/l10n_it_bill_of_entry/demo/bill_of_entry_demo.xml @@ -1,142 +1,138 @@ + - - - - - 280310 - ExtraEU Goods Purchase - - True - - - 280320 - Advanced Customs Expenses - - True - - - 421500 - Customs Expenses - - True - - - 421400 - Stamp Duties - - True - + + + 280310 + ExtraEU Goods Purchase + + True + + + 280320 + Advanced Customs Expenses + + True + + + 421500 + Customs Expenses + + True + + + 421400 + Stamp Duties + + True + - - 420101 - Delivery Expenses - - True - - - - - 22aExtraUE - taxes - - - Iva al 22% ExtraUE (credito) - purchase - percent - 22 - 22aExtraUE - - 99 - + + 420101 + Delivery Expenses + + True + - - - Customs - True - True - + + + 22aExtraUE + taxes + + + + Iva al 22% ExtraUE (credito) + purchase + percent + 22 + 22aExtraUE + + 99 + - - - Extra EU - + + + Customs + True + - - - Supplier Invoices ExtraUE - purchase - NOUE - True - + + + Extra EU + - - - ExtraEU Goods Purchase - - True - 1.0 - 1.0 - service - - - - - Advance Customs Expense - - True - 1.0 - 1.0 - service - - - - - Customs Expense - - True - 1.0 - 1.0 - service - - - - - Delivery Expense - - True - 1.0 - 1.0 - service - - - - - - - Stamp Duties - - True - 1.0 - 1.0 - service - - - - + + + Supplier Invoices ExtraUE + purchase + NOUE + - + + + ExtraEU Goods Purchase + + True + 1.0 + 1.0 + service + + + + + Advance Customs Expense + + True + 1.0 + 1.0 + service + + + + + Customs Expense + + True + 1.0 + 1.0 + service + + + + + Delivery Expense + + True + 1.0 + 1.0 + service + + + + + + + Stamp Duties + + True + 1.0 + 1.0 + service + + + + diff --git a/l10n_it_bill_of_entry/i18n/it.po b/l10n_it_bill_of_entry/i18n/it.po index b451b025131f..33729f085fc7 100644 --- a/l10n_it_bill_of_entry/i18n/it.po +++ b/l10n_it_bill_of_entry/i18n/it.po @@ -4,13 +4,12 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-02-03 10:17+0000\n" -"PO-Revision-Date: 2022-02-03 10:17+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2022-10-31 11:08+0000\n" +"PO-Revision-Date: 2022-10-31 11:08+0000\n" +"Last-Translator: Simone Rubino \n" "Language-Team: \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" @@ -20,32 +19,27 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:l10n_it_bill_of_entry.view_boe_config_settings msgid "" "" +"specific.\" aria-label=\"Values set here are company-specific.\" " +"groups=\"base.group_multi_company\" role=\"img\"/>" msgstr "" "" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.template,name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -#, fuzzy -msgid "Advance Customs Expense" -msgstr "IVA dogana anticipata" - -#. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice_line__advance_customs_vat +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__advance_customs_vat msgid "Advance Customs Vat" msgstr "IVA dogana anticipata" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__bill_of_entry msgid "Bill of Entry" msgstr "Bolla doganale" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__bill_of_entry_storno_id msgid "Bill of Entry Storno" msgstr "Storno bolla doganale" @@ -56,17 +50,22 @@ msgid "Bill of entries" msgstr "Bolle doganali" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_bill_of_entries_count msgid "Bill of entries for forwarder" msgstr "Bolle doganali per spedizioniere" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__bill_of_entries_count msgid "Bill of entries number" msgstr "Numero bolle doganali" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:117 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Bill of entry %s is in state %s" msgstr "La bolla doganale %s è nello stato %s" @@ -96,7 +95,8 @@ msgid "Bills of entry" msgstr "Bolle doganali" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:182 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Can't handle more than 1 tax for line %s" msgstr "Impossibile gestire più di 1 imposta per la riga %s" @@ -118,43 +118,44 @@ msgid "Customs" msgstr "Dogana" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__customs_doc_type msgid "Customs Doc Type" msgstr "Tipo doc Dogana" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.template,name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -#, fuzzy -msgid "Customs Expense" -msgstr "Spese dogana" - -#. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:160 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Customs expenses" msgstr "Spese dogana" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:171 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Customs supplier" msgstr "Fornitore dogana" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.template,name:l10n_it_bill_of_entry.product_product_delivery_product_template -msgid "Delivery Expense" -msgstr "" +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings__display_name +msgid "Display Name" +msgstr "Nome visualizzato" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:186 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Extra UE expenses" msgstr "Spese extra UE" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:236 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Extra UE supplier invoice must have no taxes" msgstr "La fattura del fornitore extra UE non deve avere imposte" @@ -165,24 +166,23 @@ msgid "Extra invoices" msgstr "Fatture extra" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.template,name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -msgid "ExtraEU Goods Purchase" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_bill_of_entry_ids msgid "Forward Bill of Entries" msgstr "Bolle doganali spedizioniere" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_invoice_id +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__forwarder_invoice msgid "Forwarder Invoice" msgstr "Fattura spedizioniere" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:144 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Forwarder invoice %s does not have lines with 'Advance Customs Vat'" msgstr "La fattura spedizioniere %s non ha righe con 'IVA dogana anticipata'" @@ -199,14 +199,22 @@ msgid "Generate bill of entry" msgstr "Generare bolla doganale" #. module: l10n_it_bill_of_entry -#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice -msgid "Invoice" -msgstr "Fattura" +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_move +msgid "Journal Entry" +msgstr "Registrazione contabile" #. module: l10n_it_bill_of_entry -#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice_line -msgid "Invoice Line" -msgstr "Riga fattura" +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_move_line +msgid "Journal Item" +msgstr "Movimento contabile" #. module: l10n_it_bill_of_entry #: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_company__bill_of_entry_journal_id @@ -216,47 +224,57 @@ msgid "Journal used for reconciliation of bill of entries" msgstr "Registro usato per la riconciliazione delle bolle doganali" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:149 +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "No Bill of entry Storno journal configured" msgstr "Nessun registro per storno della bolla doganale configurato" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:113 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "No bill of entries found for this invoice" msgstr "Nessuna bolla doganale trovata per questa fattura" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:247 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Please set 'Bill of entry partner' in accounting configuration" msgstr "Prego impostare 'Partner dogana' in configurazione contabilità" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:244 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Please set 'Bill of entry tax' in accounting configuration" -msgstr "Prego impostare 'Imposta dogana'" +msgstr "Prego impostare 'Imposta dogana' in configurazione contabilità" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "Stamp Duties" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__supplier_bill_of_entry_ids msgid "Supplier Bill of Entries" msgstr "Fornitore bolle doganali" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__supplier_invoice msgid "Supplier Invoice" msgstr "Fattura fornitore" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__supplier_invoice_ids msgid "Supplier Invoices" msgstr "Fatture fornitore" @@ -268,7 +286,9 @@ msgid "Supplier invoices" msgstr "Fatture fornitore" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__extra_supplier_invoices_count msgid "Supplier invoices number" msgstr "Numero fatture fornitore" @@ -281,6 +301,7 @@ msgstr "Fornitore usato nelle bolle doganali" #. module: l10n_it_bill_of_entry #: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_company__bill_of_entry_tax_id +#: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_config_settings__bill_of_entry_tax_id msgid "Tax used in bill of entries" msgstr "Imposta usata nelle bolle doganali" @@ -288,46 +309,14 @@ msgstr "Imposta usata nelle bolle doganali" #: model_terms:ir.ui.view,arch_db:l10n_it_bill_of_entry.view_boe_config_settings msgid "Tax used in bill of entries generation, when product is not present" msgstr "" -"Imposta usata nella generazione delle bolle doganali, quando il prodotto non " -"è presente" +"Imposta usata nella generazione delle bolle doganali, quando il prodotto non" +" è presente" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_config_settings__bill_of_entry_tax_id -msgid "Tax used in bill of entries, when product is not present" -msgstr "Imposta usata nelle bolle doganali, quando il prodotto non è presente" - -#. module: l10n_it_bill_of_entry -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_delivery_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "Unit(s)" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:241 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "You can generate bill of entry from extra UE supplier invoice only" msgstr "" "È possibile generare la bolla doganale solamente da una fattura fornitore " "extra UE" - -#. module: l10n_it_bill_of_entry -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_delivery_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "kg" -msgstr "" diff --git a/l10n_it_bill_of_entry/i18n/l10n_it_bill_of_entry.pot b/l10n_it_bill_of_entry/i18n/l10n_it_bill_of_entry.pot index ff396a1b7d32..5b4ff5400338 100644 --- a/l10n_it_bill_of_entry/i18n/l10n_it_bill_of_entry.pot +++ b/l10n_it_bill_of_entry/i18n/l10n_it_bill_of_entry.pot @@ -1,12 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_it_bill_of_entry +# * l10n_it_bill_of_entry # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2022-10-31 11:13+0000\n" +"PO-Revision-Date: 2022-10-31 11:13+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -15,27 +17,26 @@ msgstr "" #. module: l10n_it_bill_of_entry #: model_terms:ir.ui.view,arch_db:l10n_it_bill_of_entry.view_boe_config_settings -msgid "" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.template,name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -msgid "Advance Customs Expense" +msgid "" +"" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice_line__advance_customs_vat +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__advance_customs_vat msgid "Advance Customs Vat" msgstr "" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__bill_of_entry msgid "Bill of Entry" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__bill_of_entry_storno_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__bill_of_entry_storno_id msgid "Bill of Entry Storno" msgstr "" @@ -46,17 +47,22 @@ msgid "Bill of entries" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_bill_of_entries_count msgid "Bill of entries for forwarder" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__bill_of_entries_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__bill_of_entries_count msgid "Bill of entries number" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:117 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Bill of entry %s is in state %s" msgstr "" @@ -86,7 +92,8 @@ msgid "Bills of entry" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:182 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Can't handle more than 1 tax for line %s" msgstr "" @@ -108,42 +115,44 @@ msgid "Customs" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__customs_doc_type +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__customs_doc_type msgid "Customs Doc Type" msgstr "" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.template,name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -msgid "Customs Expense" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:160 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Customs expenses" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:171 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Customs supplier" msgstr "" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.template,name:l10n_it_bill_of_entry.product_product_delivery_product_template -msgid "Delivery Expense" +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company__display_name +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings__display_name +msgid "Display Name" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:186 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Extra UE expenses" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:236 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Extra UE supplier invoice must have no taxes" msgstr "" @@ -154,24 +163,23 @@ msgid "Extra invoices" msgstr "" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.template,name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -msgid "ExtraEU Goods Purchase" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_bill_of_entry_ids msgid "Forward Bill of Entries" msgstr "" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__forwarder_invoice_id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__forwarder_invoice_id +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__forwarder_invoice msgid "Forwarder Invoice" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:144 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Forwarder invoice %s does not have lines with 'Advance Customs Vat'" msgstr "" @@ -188,13 +196,21 @@ msgid "Generate bill of entry" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice -msgid "Invoice" +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company__id +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings__id +msgid "ID" +msgstr "" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_move +msgid "Journal Entry" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice_line -msgid "Invoice Line" +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_move_line +msgid "Journal Item" msgstr "" #. module: l10n_it_bill_of_entry @@ -205,47 +221,57 @@ msgid "Journal used for reconciliation of bill of entries" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:149 +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move_line____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_company____last_update +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_res_config_settings____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "No Bill of entry Storno journal configured" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:113 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "No bill of entries found for this invoice" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:247 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Please set 'Bill of entry partner' in accounting configuration" msgstr "" #. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:244 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "Please set 'Bill of entry tax' in accounting configuration" msgstr "" #. module: l10n_it_bill_of_entry -#: model:product.product,name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "Stamp Duties" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__supplier_bill_of_entry_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__supplier_bill_of_entry_ids msgid "Supplier Bill of Entries" msgstr "" #. module: l10n_it_bill_of_entry -#: selection:account.invoice,customs_doc_type:0 +#: model:ir.model.fields.selection,name:l10n_it_bill_of_entry.selection__account_move__customs_doc_type__supplier_invoice msgid "Supplier Invoice" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__supplier_invoice_ids +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__supplier_invoice_ids msgid "Supplier Invoices" msgstr "" @@ -257,7 +283,9 @@ msgid "Supplier invoices" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_invoice__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_bank_statement_line__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_move__extra_supplier_invoices_count +#: model:ir.model.fields,field_description:l10n_it_bill_of_entry.field_account_payment__extra_supplier_invoices_count msgid "Supplier invoices number" msgstr "" @@ -270,6 +298,7 @@ msgstr "" #. module: l10n_it_bill_of_entry #: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_company__bill_of_entry_tax_id +#: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_config_settings__bill_of_entry_tax_id msgid "Tax used in bill of entries" msgstr "" @@ -279,41 +308,8 @@ msgid "Tax used in bill of entries generation, when product is not present" msgstr "" #. module: l10n_it_bill_of_entry -#: model:ir.model.fields,help:l10n_it_bill_of_entry.field_res_config_settings__bill_of_entry_tax_id -msgid "Tax used in bill of entries, when product is not present" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.product,uom_name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_delivery_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -#: model:product.template,uom_name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "Unit(s)" -msgstr "" - -#. module: l10n_it_bill_of_entry -#: code:addons/l10n_it_bill_of_entry/models/account_invoice.py:241 +#: code:addons/l10n-italy/l10n_it_bill_of_entry/models/account_move.py:0 +#: code:addons/l10n_it_bill_of_entry/models/account_move.py:0 #, python-format msgid "You can generate bill of entry from extra UE supplier invoice only" msgstr "" - -#. module: l10n_it_bill_of_entry -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_customs_expense -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_delivery -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase -#: model:product.product,weight_uom_name:l10n_it_bill_of_entry.product_product_stamp_duties -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_adv_customs_expense_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_customs_expense_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_delivery_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_extraEU_purchase_product_template -#: model:product.template,weight_uom_name:l10n_it_bill_of_entry.product_product_stamp_duties_product_template -msgid "kg" -msgstr "" - diff --git a/l10n_it_bill_of_entry/migrations/13.0.1.0.0/post-migration.py b/l10n_it_bill_of_entry/migrations/13.0.1.0.0/post-migration.py new file mode 100644 index 000000000000..0bbcc4e910cc --- /dev/null +++ b/l10n_it_bill_of_entry/migrations/13.0.1.0.0/post-migration.py @@ -0,0 +1,98 @@ +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +INVOICE_LINE_FIELDS = [ + "advance_customs_vat", +] +INVOICE_FIELDS = { + "simple_fields": [ + "customs_doc_type", + "bill_of_entry_storno_id", + ], + "m2o_invoice": [ + "forwarder_invoice_id", + ], +} + + +def _get_set_clause(fields_list, table_alias): + set_fields_list = [ + "{f} = {second_table}.{f}".format( + second_table=table_alias, + f=field, + ) + for field in fields_list + ] + set_fields_clause = ", ".join(set_fields_list) + return set_fields_clause + + +def migrate_invoice_line_values(cr): + set_fields_clause = _get_set_clause(INVOICE_LINE_FIELDS, "ail") + query = """ +UPDATE account_move_line aml +SET {fields} +FROM account_invoice_line ail +WHERE aml.old_invoice_line_id = ail.id + """.format( + fields=set_fields_clause, + ) + return openupgrade.logged_query(cr, query) + + +def migrate_invoice_simple_values(cr): + set_fields_clause = _get_set_clause(INVOICE_FIELDS.get("simple_fields"), "ai") + query = """ +UPDATE account_move am +SET {fields} +FROM account_invoice ai +WHERE am.old_invoice_id = ai.id + """.format( + fields=set_fields_clause, + ) + return openupgrade.logged_query(cr, query) + + +def migrate_invoice_m2o_invoice_values(cr): + for field in INVOICE_FIELDS.get("m2o_invoice"): + query = """ +UPDATE account_move am +SET {field} = am2.id +FROM account_invoice ai +JOIN account_move am2 + ON am2.old_invoice_id = ai.{field} +WHERE am.old_invoice_id = ai.id + """.format( + field=field, + ) + openupgrade.logged_query(cr, query) + return True + + +def migrate_invoice_sboe_rel(cr): + new_table_name = "sboe_invoice_rel" + old_table_name = openupgrade.get_legacy_name(new_table_name) + query = """ +INSERT INTO {new_table_name} +SELECT + sboe_move.id as sboe_id, + invoice_move.id as invoice_id +FROM {old_table_name} old_sboe_table +JOIN account_move sboe_move + ON old_sboe_table.sboe_id = sboe_move.old_invoice_id +JOIN account_move invoice_move + ON old_sboe_table.invoice_id = invoice_move.old_invoice_id + """.format( + new_table_name=new_table_name, + old_table_name=old_table_name, + ) + return openupgrade.logged_query(cr, query) + + +def migrate(cr, installed_version): + migrate_invoice_line_values(cr) + migrate_invoice_simple_values(cr) + migrate_invoice_m2o_invoice_values(cr) + migrate_invoice_sboe_rel(cr) diff --git a/l10n_it_bill_of_entry/migrations/13.0.1.0.0/pre-migration.py b/l10n_it_bill_of_entry/migrations/13.0.1.0.0/pre-migration.py new file mode 100644 index 000000000000..d19b27900a1a --- /dev/null +++ b/l10n_it_bill_of_entry/migrations/13.0.1.0.0/pre-migration.py @@ -0,0 +1,13 @@ +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def migrate(cr, installed_version): + openupgrade.rename_tables( + cr, + [ + ("sboe_invoice_rel", None), + ], + ) diff --git a/l10n_it_bill_of_entry/models/__init__.py b/l10n_it_bill_of_entry/models/__init__.py index 8e1d75d59773..c823b99fba27 100644 --- a/l10n_it_bill_of_entry/models/__init__.py +++ b/l10n_it_bill_of_entry/models/__init__.py @@ -1,2 +1,4 @@ -from . import account_invoice +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import account_move from . import company diff --git a/l10n_it_bill_of_entry/models/account_invoice.py b/l10n_it_bill_of_entry/models/account_invoice.py deleted file mode 100644 index 6989e69f1e15..000000000000 --- a/l10n_it_bill_of_entry/models/account_invoice.py +++ /dev/null @@ -1,299 +0,0 @@ -from odoo import api, fields, models -from odoo.exceptions import UserError -from odoo.tools.translate import _ - - -class AccountInvoice(models.Model): - _inherit = "account.invoice" - - customs_doc_type = fields.Selection( - [ - ("bill_of_entry", "Bill of Entry"), - ("supplier_invoice", "Supplier Invoice"), - ("forwarder_invoice", "Forwarder Invoice"), - ], - "Customs Doc Type", - readonly=True, - ) - supplier_bill_of_entry_ids = fields.Many2many( - "account.invoice", - "sboe_invoice_rel", - "sboe_id", - "invoice_id", - "Supplier Bill of Entries", - readonly=True, - copy=False, - ) - supplier_invoice_ids = fields.Many2many( - "account.invoice", - "sboe_invoice_rel", - "invoice_id", - "sboe_id", - "Supplier Invoices", - copy=False, - ) - forwarder_invoice_id = fields.Many2one( - "account.invoice", "Forwarder Invoice", copy=False - ) - forwarder_bill_of_entry_ids = fields.One2many( - "account.invoice", - "forwarder_invoice_id", - "Forward Bill of Entries", - readonly=True, - copy=False, - ) - bill_of_entry_storno_id = fields.Many2one( - "account.move", "Bill of Entry Storno", readonly=True, copy=False - ) - bill_of_entries_count = fields.Integer( - "Bill of entries number", compute="_compute_bill_of_entries_count" - ) - extra_supplier_invoices_count = fields.Integer( - "Supplier invoices number", compute="_compute_extra_supplier_invoices_count" - ) - forwarder_bill_of_entries_count = fields.Integer( - "Bill of entries for forwarder", - compute="_compute_forwarder_bill_of_entries_count", - ) - - @api.multi - def _compute_bill_of_entries_count(self): - for inv in self: - inv.bill_of_entries_count = len(inv.supplier_bill_of_entry_ids) - - @api.multi - def _compute_extra_supplier_invoices_count(self): - for inv in self: - inv.extra_supplier_invoices_count = len(inv.supplier_invoice_ids) - - @api.multi - def _compute_forwarder_bill_of_entries_count(self): - for inv in self: - inv.forwarder_bill_of_entries_count = len(inv.forwarder_bill_of_entry_ids) - - @api.multi - def action_view_bill_of_entries(self): - boes = self.mapped("supplier_bill_of_entry_ids") - action = self.env.ref("account.action_vendor_bill_template").read()[0] - if len(boes) > 1: - action["domain"] = [("id", "in", boes.ids)] - elif len(boes) == 1: - form_view = [(self.env.ref("account.invoice_supplier_form").id, "form")] - if "views" in action: - action["views"] = form_view + [ - (state, view) for state, view in action["views"] if view != "form" - ] - else: - action["views"] = form_view - action["res_id"] = boes.ids[0] - else: - action = {"type": "ir.actions.act_window_close"} - return action - - @api.multi - def action_view_extra_supplier_invoices(self): - invoices = self.mapped("supplier_invoice_ids") - action = self.env.ref("account.action_vendor_bill_template").read()[0] - if len(invoices) > 1: - action["domain"] = [("id", "in", invoices.ids)] - elif len(invoices) == 1: - form_view = [(self.env.ref("account.invoice_supplier_form").id, "form")] - if "views" in action: - action["views"] = form_view + [ - (state, view) for state, view in action["views"] if view != "form" - ] - else: - action["views"] = form_view - action["res_id"] = invoices.ids[0] - else: - action = {"type": "ir.actions.act_window_close"} - return action - - @api.multi - def action_view_forwarder_bill_of_entries(self): - boes = self.mapped("forwarder_bill_of_entry_ids") - action = self.env.ref("account.action_vendor_bill_template").read()[0] - if len(boes) > 1: - action["domain"] = [("id", "in", boes.ids)] - elif len(boes) == 1: - form_view = [(self.env.ref("account.invoice_supplier_form").id, "form")] - if "views" in action: - action["views"] = form_view + [ - (state, view) for state, view in action["views"] if view != "form" - ] - else: - action["views"] = form_view - action["res_id"] = boes.ids[0] - else: - action = {"type": "ir.actions.act_window_close"} - return action - - @api.multi - def action_move_create(self): - res = super(AccountInvoice, self).action_move_create() - - AccountMove = self.env["account.move"] - AccountMoveLine = self.env["account.move.line"] - for invoice in self: - if invoice.customs_doc_type == "forwarder_invoice": - if not invoice.forwarder_bill_of_entry_ids: - raise UserError(_("No bill of entries found for this invoice")) - for bill_of_entry in invoice.forwarder_bill_of_entry_ids: - if bill_of_entry.state not in ("open", "paid"): - raise UserError( - _("Bill of entry %s is in state %s") - % (bill_of_entry.partner_id.name, bill_of_entry.state) - ) - advance_customs_vat_line = False - for line in invoice.invoice_line_ids: - if line.advance_customs_vat: - advance_customs_vat_line = True - break - boe_tax_rates = invoice.forwarder_bill_of_entry_ids.mapped( - "invoice_line_ids.invoice_line_tax_ids.amount" - ) - boe_amounts = invoice.forwarder_bill_of_entry_ids.mapped("amount_total") - - # In caso di dichiarazione d'intento inviata alla dogana, - # la dogana non addebita IVA. - # La bolla doganale ha righe positive e negative, il cui totale è 0 - if list(set(boe_amounts)) == [0.0]: - # Nessuna registrazione di storno è necessaria - continue - - if not advance_customs_vat_line and list(set(boe_tax_rates)) != [0.0]: - raise UserError( - _( - "Forwarder invoice %s does not have lines with " - "'Advance Customs Vat'" - ) - % invoice.number - ) - if not invoice.company_id.bill_of_entry_journal_id: - raise UserError(_("No Bill of entry Storno journal configured")) - move_vals = { - "journal_id": (invoice.company_id.bill_of_entry_journal_id.id), - "date": invoice.date_invoice, - } - move_lines = [] - for inv_line in invoice.invoice_line_ids: - if inv_line.advance_customs_vat: - line_vals = { - "name": _("Customs expenses"), - "account_id": inv_line.account_id.id, - "debit": 0.0, - "credit": inv_line.price_subtotal, - "partner_id": inv_line.partner_id.id, - } - if inv_line.product_id: - line_vals["product_id"] = inv_line.product_id.id - move_lines.append((0, 0, line_vals)) - for bill_of_entry in invoice.forwarder_bill_of_entry_ids: - line_vals = { - "name": _("Customs supplier"), - "account_id": bill_of_entry.account_id.id, - "debit": bill_of_entry.amount_total, - "credit": 0.0, - "partner_id": bill_of_entry.partner_id.id, - } - move_lines.append((0, 0, line_vals)) - for boe_line in bill_of_entry.invoice_line_ids: - if boe_line.invoice_line_tax_ids: - if len(boe_line.invoice_line_tax_ids) > 1: - raise UserError( - _("Can't handle more than 1 tax for line " "%s") - % boe_line.name - ) - - line_vals = { - "name": _("Extra UE expenses"), - "account_id": boe_line.account_id.id, - "debit": 0.0, - "credit": boe_line.price_subtotal, - "partner_id": boe_line.partner_id.id, - } - if boe_line.product_id: - line_vals["product_id"] = boe_line.product_id.id - move_lines.append((0, 0, line_vals)) - move_vals["line_ids"] = move_lines - move = AccountMove.create(move_vals) - move.action_post() - invoice.write({"bill_of_entry_storno_id": move.id}) - - reconcile_ids = [] - for move_line in move.line_ids: - for boe in invoice.forwarder_bill_of_entry_ids: - if move_line.account_id.id == boe.account_id.id: - reconcile_ids.append(move_line.id) - for boe_move_line in boe.move_id.line_ids: - if boe_move_line.account_id.id == boe.account_id.id: - reconcile_ids.append(boe_move_line.id) - - AccountMoveLine.browse(reconcile_ids).reconcile() - return res - - def action_cancel(self): - res = super(AccountInvoice, self).action_cancel() - for invoice in self: - for boe in invoice.forwarder_bill_of_entry_ids: - move = boe.move_id - rec_lines = ( - move.mapped("line_ids") - .filtered("full_reconcile_id") - .mapped("full_reconcile_id.reconciled_line_ids") - ) - rec_lines.remove_move_reconcile() - if invoice.bill_of_entry_storno_id: - invoice.bill_of_entry_storno_id.button_cancel() - invoice.bill_of_entry_storno_id.unlink() - return res - - def _check_no_taxes(self): - for line in self.invoice_line_ids: - if line.invoice_line_tax_ids: - raise UserError(_("Extra UE supplier invoice must have no taxes")) - - def generate_bill_of_entry(self): - self.ensure_one() - if self.customs_doc_type != "supplier_invoice": - raise UserError( - _("You can generate bill of entry from extra UE supplier invoice only") - ) - if not self.company_id.bill_of_entry_tax_id: - raise UserError( - _("Please set 'Bill of entry tax' in accounting configuration") - ) - if not self.company_id.bill_of_entry_partner_id: - raise UserError( - _("Please set 'Bill of entry partner' in accounting configuration") - ) - self._check_no_taxes() - boe_inv = self.copy( - default={ - "partner_id": self.company_id.bill_of_entry_partner_id.id, - "customs_doc_type": "bill_of_entry", - } - ) - for line in boe_inv.invoice_line_ids: - tax = self.company_id.bill_of_entry_tax_id - if line.product_id.supplier_taxes_id: - tax = line.product_id.supplier_taxes_id[0] - line.invoice_line_tax_ids = [(6, 0, [tax.id])] - boe_inv.supplier_invoice_ids = [(4, self.id)] - boe_inv.compute_taxes() - action = self.env.ref("account.action_vendor_bill_template").read()[0] - form_view = [(self.env.ref("account.invoice_supplier_form").id, "form")] - if "views" in action: - action["views"] = form_view + [ - (state, view) for state, view in action["views"] if view != "form" - ] - else: - action["views"] = form_view - action["res_id"] = boe_inv.ids[0] - return action - - -class AccountInvoiceLine(models.Model): - _inherit = "account.invoice.line" - - advance_customs_vat = fields.Boolean("Advance Customs Vat") diff --git a/l10n_it_bill_of_entry/models/account_move.py b/l10n_it_bill_of_entry/models/account_move.py new file mode 100644 index 000000000000..bd7f9cccd86a --- /dev/null +++ b/l10n_it_bill_of_entry/models/account_move.py @@ -0,0 +1,295 @@ +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models +from odoo.exceptions import UserError +from odoo.fields import first +from odoo.tools.translate import _ + + +class AccountMove(models.Model): + _inherit = "account.move" + + customs_doc_type = fields.Selection( + [ + ("bill_of_entry", "Bill of Entry"), + ("supplier_invoice", "Supplier Invoice"), + ("forwarder_invoice", "Forwarder Invoice"), + ], + "Customs Doc Type", + readonly=True, + ) + supplier_bill_of_entry_ids = fields.Many2many( + "account.move", + "sboe_invoice_rel", + "sboe_id", + "invoice_id", + "Supplier Bill of Entries", + readonly=True, + copy=False, + ) + supplier_invoice_ids = fields.Many2many( + "account.move", + "sboe_invoice_rel", + "invoice_id", + "sboe_id", + "Supplier Invoices", + copy=False, + ) + forwarder_invoice_id = fields.Many2one( + "account.move", "Forwarder Invoice", copy=False + ) + forwarder_bill_of_entry_ids = fields.One2many( + "account.move", + "forwarder_invoice_id", + "Forward Bill of Entries", + readonly=True, + copy=False, + ) + bill_of_entry_storno_id = fields.Many2one( + "account.move", "Bill of Entry Storno", readonly=True, copy=False + ) + bill_of_entries_count = fields.Integer( + "Bill of entries number", compute="_compute_bill_of_entries_count" + ) + extra_supplier_invoices_count = fields.Integer( + "Supplier invoices number", compute="_compute_extra_supplier_invoices_count" + ) + forwarder_bill_of_entries_count = fields.Integer( + "Bill of entries for forwarder", + compute="_compute_forwarder_bill_of_entries_count", + ) + + def _compute_bill_of_entries_count(self): + for inv in self: + inv.bill_of_entries_count = len(inv.supplier_bill_of_entry_ids) + + def _compute_extra_supplier_invoices_count(self): + for inv in self: + inv.extra_supplier_invoices_count = len(inv.supplier_invoice_ids) + + def _compute_forwarder_bill_of_entries_count(self): + for inv in self: + inv.forwarder_bill_of_entries_count = len(inv.forwarder_bill_of_entry_ids) + + def _bill_of_entry_view_bills(self): + action = self.env["ir.actions.act_window"]._for_xml_id( + "account.action_move_in_invoice_type" + ) + if len(self) > 1: + action["domain"] = [("id", "in", self.ids)] + elif len(self) == 1: + form_view = [(self.env.ref("account.view_move_form").id, "form")] + if "views" in action: + action["views"] = form_view + [ + (state, view) for state, view in action["views"] if view != "form" + ] + else: + action["views"] = form_view + action["res_id"] = self.ids[0] + else: + action = {"type": "ir.actions.act_window_close"} + return action + + def action_view_bill_of_entries(self): + sboes = self.mapped("supplier_bill_of_entry_ids") + return sboes._bill_of_entry_view_bills() + + def action_view_extra_supplier_invoices(self): + invoices = self.mapped("supplier_invoice_ids") + return invoices._bill_of_entry_view_bills() + + def action_view_forwarder_bill_of_entries(self): + fboes = self.mapped("forwarder_bill_of_entry_ids") + return fboes._bill_of_entry_view_bills() + + def _check_forwarder_invoice_advance_customs_vat_line(self, boe_tax_rates): + self.ensure_one() + advance_customs_vat_line = False + for line in self.invoice_line_ids: + if line.advance_customs_vat: + advance_customs_vat_line = True + break + if not advance_customs_vat_line and list(set(boe_tax_rates)) != [0.0]: + raise UserError( + _( + "Forwarder invoice %s does not have lines with " + "'Advance Customs Vat'" + ) + % self.name + ) + return True + + def _get_forwarder_invoice_boe_amounts(self): + self.ensure_one() + if not self.forwarder_bill_of_entry_ids: + raise UserError(_("No bill of entries found for this invoice")) + for bill_of_entry in self.forwarder_bill_of_entry_ids: + if bill_of_entry.state not in ("posted", "paid"): + raise UserError( + _("Bill of entry %s is in state %s") + % (bill_of_entry.partner_id.name, bill_of_entry.state) + ) + + boe_tax_rates = self.forwarder_bill_of_entry_ids.mapped( + "invoice_line_ids.tax_ids.amount" + ) + boe_amounts = self.forwarder_bill_of_entry_ids.mapped("amount_total") + return boe_amounts, boe_tax_rates + + def _prepare_bill_of_entry_storno(self): + self.ensure_one() + if not self.company_id.bill_of_entry_journal_id: + raise UserError(_("No Bill of entry Storno journal configured")) + move_vals = { + "customs_doc_type": False, + "move_type": "entry", + "journal_id": self.company_id.bill_of_entry_journal_id.id, + "date": self.invoice_date, + } + move_lines = [] + for inv_line in self.invoice_line_ids: + if inv_line.advance_customs_vat: + line_vals = { + "name": _("Customs expenses"), + "account_id": inv_line.account_id.id, + "debit": 0.0, + "credit": inv_line.price_subtotal, + "partner_id": inv_line.partner_id.id, + } + if inv_line.product_id: + line_vals["product_id"] = inv_line.product_id.id + move_lines.append((0, 0, line_vals)) + + for bill_of_entry in self.forwarder_bill_of_entry_ids: + boe_payable_lines = bill_of_entry.line_ids.filtered( + lambda l: l.account_internal_type == "payable" + ) + boe_account = first(boe_payable_lines).account_id + line_vals = { + "name": _("Customs supplier"), + "account_id": first(boe_account).id, + "debit": bill_of_entry.amount_total, + "credit": 0.0, + "partner_id": bill_of_entry.partner_id.id, + } + move_lines.append((0, 0, line_vals)) + for boe_line in bill_of_entry.invoice_line_ids: + if boe_line.tax_ids: + if len(boe_line.tax_ids) > 1: + raise UserError( + _("Can't handle more than 1 tax for line %s") + % boe_line.name + ) + + line_vals = { + "name": _("Extra UE expenses"), + "account_id": boe_line.account_id.id, + "debit": 0.0, + "credit": boe_line.price_subtotal, + "partner_id": boe_line.partner_id.id, + } + if boe_line.product_id: + line_vals["product_id"] = boe_line.product_id.id + move_lines.append((0, 0, line_vals)) + move_vals["line_ids"] = move_lines + return move_vals + + def _reconcile_bill_of_entry_storno(self, move): + self.ensure_one() + reconcile_ids = [] + for move_line in move.line_ids: + line_account = move_line.account_id + for boe in self.forwarder_bill_of_entry_ids: + boe_payable_lines = boe.line_ids.filtered( + lambda l: l.account_internal_type == "payable" + ) + boe_account = first(boe_payable_lines).account_id + if line_account == boe_account: + reconcile_ids.append(move_line.id) + for boe_move_line in boe.line_ids: + if boe_move_line.account_id == boe_account: + reconcile_ids.append(boe_move_line.id) + return self.env["account.move.line"].browse(reconcile_ids).reconcile() + + def action_post(self): + res = super().action_post() + + for invoice in self: + if invoice.customs_doc_type == "forwarder_invoice": + boe_amounts, boe_tax_rates = self._get_forwarder_invoice_boe_amounts() + # In caso di dichiarazione d'intento inviata alla dogana, + # la dogana non addebita IVA. + # La bolla doganale ha righe positive e negative, il cui totale è 0 + if list(set(boe_amounts)) == [0.0]: + # Nessuna registrazione di storno è necessaria + continue + + self._check_forwarder_invoice_advance_customs_vat_line(boe_tax_rates) + + move_vals = self._prepare_bill_of_entry_storno() + move = self.env["account.move"].create(move_vals) + move.action_post() + invoice.write({"bill_of_entry_storno_id": move.id}) + + self._reconcile_bill_of_entry_storno(move) + return res + + def button_cancel(self): + res = super().button_cancel() + for invoice in self: + for boe in invoice.forwarder_bill_of_entry_ids: + move = boe.move_id + rec_lines = ( + move.mapped("line_ids") + .filtered("full_reconcile_id") + .mapped("full_reconcile_id.reconciled_line_ids") + ) + rec_lines.remove_move_reconcile() + if invoice.bill_of_entry_storno_id: + invoice.bill_of_entry_storno_id.button_cancel() + invoice.bill_of_entry_storno_id.with_context(force_delete=True).unlink() + return res + + def _check_no_taxes(self): + self.ensure_one() + for line in self.invoice_line_ids: + if line.tax_ids: + raise UserError(_("Extra UE supplier invoice must have no taxes")) + + def generate_bill_of_entry(self): + self.ensure_one() + if self.customs_doc_type != "supplier_invoice": + raise UserError( + _("You can generate bill of entry from extra UE supplier invoice only") + ) + if not self.company_id.bill_of_entry_tax_id: + raise UserError( + _("Please set 'Bill of entry tax' in accounting configuration") + ) + if not self.company_id.bill_of_entry_partner_id: + raise UserError( + _("Please set 'Bill of entry partner' in accounting configuration") + ) + self._check_no_taxes() + boe_inv = self.copy( + default={ + "partner_id": self.company_id.bill_of_entry_partner_id.id, + "customs_doc_type": "bill_of_entry", + } + ) + for line in boe_inv.invoice_line_ids: + tax = self.company_id.bill_of_entry_tax_id + if line.product_id.supplier_taxes_id: + tax = line.product_id.supplier_taxes_id[0] + line.tax_ids = [(6, 0, [tax.id])] + boe_inv.supplier_invoice_ids = [(4, self.id)] + + action = boe_inv._bill_of_entry_view_bills() + return action + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + advance_customs_vat = fields.Boolean("Advance Customs Vat") diff --git a/l10n_it_bill_of_entry/models/company.py b/l10n_it_bill_of_entry/models/company.py index 4bd34089612a..26fa1f48e2ad 100644 --- a/l10n_it_bill_of_entry/models/company.py +++ b/l10n_it_bill_of_entry/models/company.py @@ -1,3 +1,6 @@ +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from odoo import fields, models @@ -27,21 +30,15 @@ class AccountConfigSettings(models.TransientModel): bill_of_entry_journal_id = fields.Many2one( "account.journal", related="company_id.bill_of_entry_journal_id", - string="Bill of entry Storno journal", readonly=False, - help="Journal used for reconciliation of bill of entries", ) bill_of_entry_tax_id = fields.Many2one( "account.tax", related="company_id.bill_of_entry_tax_id", - string="Bill of entry tax", readonly=False, - help="Tax used in bill of entries, when product is not present", ) bill_of_entry_partner_id = fields.Many2one( "res.partner", related="company_id.bill_of_entry_partner_id", - string="Bill of entry partner", readonly=False, - help="Supplier used in bill of entries", ) diff --git a/l10n_it_bill_of_entry/readme/CONTRIBUTORS.rst b/l10n_it_bill_of_entry/readme/CONTRIBUTORS.rst index f76cc6ca25f7..b942824eccd8 100644 --- a/l10n_it_bill_of_entry/readme/CONTRIBUTORS.rst +++ b/l10n_it_bill_of_entry/readme/CONTRIBUTORS.rst @@ -2,5 +2,5 @@ * `TAKOBI `_: * Lorenzo Battistini - + * Simone Rubino * Diego Bruselli diff --git a/l10n_it_bill_of_entry/tests/__init__.py b/l10n_it_bill_of_entry/tests/__init__.py index 705f4e03d7cc..ef742365d7a5 100644 --- a/l10n_it_bill_of_entry/tests/__init__.py +++ b/l10n_it_bill_of_entry/tests/__init__.py @@ -1,10 +1,3 @@ -############################################################################## -# -# Copyright (C) 2017 CQ Creativi Quadrati (http://www.creativiquadrati.it) -# @author Diego Bruselli -# -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -# -############################################################################## +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import test_bill_of_entry diff --git a/l10n_it_bill_of_entry/tests/test_bill_of_entry.py b/l10n_it_bill_of_entry/tests/test_bill_of_entry.py index 20405fedaae3..462b58bab5d8 100644 --- a/l10n_it_bill_of_entry/tests/test_bill_of_entry.py +++ b/l10n_it_bill_of_entry/tests/test_bill_of_entry.py @@ -1,63 +1,52 @@ -############################################################################## -# -# Copyright (C) 2017 CQ Creativi Quadrati (http://www.creativiquadrati.it) -# @author Diego Bruselli -# -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -# -############################################################################## - -from odoo.tests.common import TransactionCase - - -class TestBillOfEntry(TransactionCase): - def _get_invline_vals(self, product, quantity=1.0, price_unit=1.0): - vals = { - "product_id": product.id, - "quantity": quantity, - "price_unit": price_unit, - } - return vals - - def _create_invoice(self, partner, customs_doc_type, journal): - vals = { - "type": "in_invoice", - "partner_id": partner.id, - } +# Copyright 2017 CQ Creativi Quadrati (http://www.creativiquadrati.it) +# Copyright 2017 Diego Bruselli +# Copyright 2022 Simone Rubino - TAKOBI +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.exceptions import UserError +from odoo.fields import first +from odoo.tests.common import Form, tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("post_install", "-at_install") +class TestBillOfEntry(AccountTestInvoicingCommon): + def _create_invoice(self, partner, customs_doc_type, journal, products_list): + invoice = self.init_invoice( + "in_invoice", + partner=partner, + ) + invoice_form = Form(invoice) if customs_doc_type: - vals["customs_doc_type"] = customs_doc_type + invoice_form.customs_doc_type = customs_doc_type if journal: - vals["journal_id"] = journal.id - invoice = self.env["account.invoice"].create(vals) - invoice._onchange_partner_id() - invoice._onchange_journal_id() - invoice._convert_to_write(invoice._cache) - return invoice + invoice_form.journal_id = journal + for product, qty, price in products_list: + with invoice_form.invoice_line_ids.new() as line: + line.product_id = product + line.price_unit = price + line.quantity = qty - def _create_invoice_line(self, invoice, vals): - new_vals = { - "invoice_id": invoice.id, - "account_id": self.account_revenue.id, - "name": "something in", - } - vals.update(new_vals) - line = self.env["account.invoice.line"].create(vals) - line._onchange_product_id() - line._convert_to_write(line._cache) - return line + invoice = invoice_form.save() + return invoice def setUp(self): - super(TestBillOfEntry, self).setUp() + super().setUp() self.account_model = self.env["account.account"] self.tax_model = self.env["account.tax"] self.journal_model = self.env["account.journal"] - self.invoice_model = self.env["account.invoice"] - self.inv_line_model = self.env["account.invoice.line"] + self.invoice_model = self.env["account.move"] + self.inv_line_model = self.env["account.move.line"] self.move_line_model = self.env["account.move.line"] self.fp_model = self.env["account.fiscal.position"] self.fp_tax_model = self.env["account.fiscal.position.tax"] + demo_data_company = self.env.ref("base.main_company") + self.env.user.company_ids |= demo_data_company + self.env.user.company_id = demo_data_company + # Default accounts for invoice line account_id revenue_acctype_id = self.env.ref("account.data_account_type_revenue").id self.account_revenue = self.account_model.search( @@ -65,7 +54,6 @@ def setUp(self): ) # Default purchase journal self.journal = self.journal_model.search([("type", "=", "purchase")], limit=1) - self.journal.update_posted = True # Extra EU purchase journal for differentiate # extra EU purchase invoices from ordinary ones self.extra_journal = self.env.ref( @@ -78,7 +66,6 @@ def setUp(self): "name": "bill_of_entry_journal", "type": "general", "code": "BOE", - "update_posted": True, } ) self.company.bill_of_entry_journal_id = self.bill_of_entry_journal.id @@ -147,56 +134,105 @@ def setUp(self): # Extra EU supplier invoice - draft state self.supplier_invoice = self._create_invoice( - self.supplier, "supplier_invoice", self.journal_extra + self.supplier, + "supplier_invoice", + self.journal_extra, + [ + (self.product1, 1, 2500), + ], ) - line_vals = self._get_invline_vals(self.product1, 1, 2500) - self._create_invoice_line(self.supplier_invoice, line_vals) - self.supplier_invoice.compute_taxes() - # self.supplier_invoice.action_invoice_open() # Bill of Entry - draft state self.bill_of_entry = self._create_invoice( - self.customs, "bill_of_entry", self.journal + self.customs, + "bill_of_entry", + self.journal, + [ + (self.product_extra, 1, 2500), + ], ) - line_vals = self._get_invline_vals(self.product_extra, 1, 2500) - self._create_invoice_line(self.bill_of_entry, line_vals) - self.bill_of_entry.compute_taxes() - self.bill_of_entry.write( - {"supplier_invoice_ids": [(6, 0, [self.supplier_invoice.id])]} - ) - # self.bill_of_entry.action_invoice_open() + bill_of_entry_form = Form(self.bill_of_entry) + bill_of_entry_form.supplier_invoice_ids.clear() + bill_of_entry_form.supplier_invoice_ids.add(self.supplier_invoice) + bill_of_entry_form.save() # Forwarder Invoice - draft state self.forwarder_invoice = self._create_invoice( - self.forwarder, "forwarder_invoice", self.journal - ) - line_vals = self._get_invline_vals(self.product_delivery, 1, 300) - self._create_invoice_line(self.forwarder_invoice, line_vals) - line_vals = self._get_invline_vals(self.adv_customs_expense, 1, 550) - self.adv_customs_expense_line = self._create_invoice_line( - self.forwarder_invoice, line_vals - ) - self.adv_customs_expense_line.advance_customs_vat = True - self.adv_customs_expense_line.invoice_line_tax_ids = [(6, 0, [])] - self.forwarder_invoice.compute_taxes() - self.forwarder_invoice.write( + self.forwarder, + "forwarder_invoice", + self.journal, + [ + (self.product_delivery, 1, 300), + (self.adv_customs_expense, 1, 550), + ], + ) + forwarder_invoice_form = Form(self.forwarder_invoice) + with forwarder_invoice_form.invoice_line_ids.edit(1) as line: + line.advance_customs_vat = True + line.tax_ids.clear() + forwarder_invoice_form.save() + self.adv_customs_expense_line = ( + self.forwarder_invoice.invoice_line_ids.filtered("advance_customs_vat") + ) + self.forwarder_invoice.update( { "forwarder_bill_of_entry_ids": [(4, self.bill_of_entry.id)], } ) + demo_data_company.bill_of_entry_tax_id = ( + demo_data_company.account_purchase_tax_id.copy() + ) + demo_data_company.bill_of_entry_partner_id = self.env[ + "res.partner" + ].name_create("Customs") + + def test_generate_bill_of_entry_required_configurations(self): + company = self.env.company + missing_configurations_fields = [ + "bill_of_entry_tax_id", + "bill_of_entry_partner_id", + ] + fields_dict = company.fields_get( + allfields=missing_configurations_fields, + attributes=["string"], + ) + supplier_invoice = self.supplier_invoice + for field_name in missing_configurations_fields: + # Save and empty the configuration + configuration_value = company[field_name] + company[field_name] = False + + # Assert it is needed for generating the bill of entry + with self.assertRaises(UserError) as ue: + supplier_invoice.generate_bill_of_entry() + exc_message = ue.exception.args[0] + field_attributes = fields_dict.get(field_name) + self.assertIn(field_attributes.get("string"), exc_message) + + # Restore the configuration + company[field_name] = configuration_value + + def test_generate_bill_of_entry(self): + bill_of_entry_action = self.supplier_invoice.generate_bill_of_entry() + bill_of_entry_model = bill_of_entry_action.get("res_model") + bill_of_entry_id = bill_of_entry_action.get("res_id") + bill_of_entry = self.env[bill_of_entry_model].browse(bill_of_entry_id) + self.assertTrue(bill_of_entry) + self.assertEqual(bill_of_entry.state, "draft") + def test_storno_create(self): # Validate bill of entry - self.bill_of_entry.action_invoice_open() + self.bill_of_entry.action_post() # Validate forwarder invoice - self.forwarder_invoice.action_invoice_open() + self.forwarder_invoice.action_post() # Storno Bill of Entry account.move storno = self.forwarder_invoice.bill_of_entry_storno_id self.assertTrue(storno) - self.assertEqual(storno.date, self.forwarder_invoice.date_invoice) + self.assertEqual(storno.date, self.forwarder_invoice.invoice_date) # Advance Customs Expense account.move.line move_line_domain = [ @@ -210,8 +246,12 @@ def test_storno_create(self): self.assertEqual(len(adv_customs_expense_moveline), 1) # Customs Expense account.move.lines + boe_payable_lines = self.bill_of_entry.line_ids.filtered( + lambda l: l.account_internal_type == "payable" + ) + boe_account = first(boe_payable_lines).account_id move_line_domain = [ - ("account_id", "=", self.bill_of_entry.account_id.id), + ("account_id", "=", boe_account.id), ("debit", "=", self.bill_of_entry.amount_total), ("credit", "=", 0.0), ("partner_id", "=", self.bill_of_entry.partner_id.id), @@ -238,7 +278,7 @@ def test_storno_create(self): .ids ) boe_reconcile_ids = ( - self.bill_of_entry.move_id.line_ids.filtered(lambda l: l.full_reconcile_id) + self.bill_of_entry.line_ids.filtered(lambda l: l.full_reconcile_id) .mapped("full_reconcile_id") .ids ) diff --git a/l10n_it_bill_of_entry/views/account_invoice_view.xml b/l10n_it_bill_of_entry/views/account_invoice_view.xml index 80b5f771afd8..ac4c4b6c0d0a 100644 --- a/l10n_it_bill_of_entry/views/account_invoice_view.xml +++ b/l10n_it_bill_of_entry/views/account_invoice_view.xml @@ -1,75 +1,117 @@ + - invoice.supplier.boe.form - account.invoice - + account.move + - -
- - - -
-
- +
+ + + +
+