diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 4f757ef6d0d7..998b39cecb91 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -20,7 +20,7 @@ "l10n_it_withholding_tax_reason", ], "data": [ - 'views/account_invoice_it_dati_ritenuta.xml' + "views/account_invoice_it_dati_ritenuta.xml", ], "installable": True, "auto_install": True, diff --git a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst index 45de63c47513..1783ba4797f0 100644 --- a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst +++ b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst @@ -1,2 +1,2 @@ * Sergio Corato -* Ciro Urselli \ No newline at end of file +* Ciro Urselli diff --git a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py index b6a557a7f4ad..b9d140d2fcde 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -5,10 +5,43 @@ class TestInvoiceWT(FatturaPACommon): def setUp(self): - super(TestInvoiceWT, self).setUp() + super().setUp() + + ### + # XXX this should really be in FatturaPACommon + # tested 2021/08/06 @TheMule71 + + # XXX - a company named "YourCompany" alread exists + # we move it out of the way but we should do better here + self.env.company.sudo().search([("name", "=", "YourCompany")]).write( + {"name": "YourCompany_"} + ) + self.env.company.name = "YourCompany" + self.env.company.vat = "IT06363391001" + self.env.company.fatturapa_art73 = True + self.env.company.partner_id.street = "Via Milano, 1" + self.env.company.partner_id.city = "Roma" + self.env.company.partner_id.state_id = self.env.ref("base.state_us_2").id + self.env.company.partner_id.country_id = self.env.ref("base.it").id + self.env.company.partner_id.zip = "00100" + self.env.company.partner_id.phone = "06543534343" + self.env.company.email = "info@yourcompany.example.com" + self.env.company.fatturapa_fiscal_position_id = self.env.ref( + "l10n_it_fatturapa.fatturapa_RF01" + ).id + self.env["decimal.precision"].search( + [("name", "=", "Product Unit of Measure")] + ).digits = 3 + self.env["uom.uom"].search([("name", "=", "Units")]).name = "Unit(s)" + ### + type_payable = self.env.ref("account.data_account_type_payable") type_receivable = self.env.ref("account.data_account_type_receivable") - self.tax_0 = self.env.ref("l10n_it_fatturapa.tax_00_enas") + self.tax_0 = ( + self.env.ref("l10n_it_fatturapa.tax_00_enas") + .sudo() + .copy({"company_id": self.env.company.id}) + ) self.wt_account_payable = self.env["account.account"].create( { "name": "Debiti per ritenute da versare", @@ -32,8 +65,7 @@ def setUp(self): "name": "", "line_ids": [(0, 0, {"value": "balance", "days": 15})], } - self.payment_term_15 = self.env["account.payment.term"].create( - vals_payment) + self.payment_term_15 = self.env["account.payment.term"].create(vals_payment) wt_vals = { "name": "Code 1040", "code": "1040", @@ -42,8 +74,7 @@ def setUp(self): "account_payable_id": self.wt_account_payable.id, "journal_id": self.journal_misc.id, "payment_term": self.payment_term_15.id, - "causale_pagamento_id": self.env.ref( - "l10n_it_causali_pagamento.a").id, + "payment_reason_id": self.env.ref("l10n_it_payment_reason.a").id, "rate_ids": [ ( 0, @@ -64,8 +95,7 @@ def setUp(self): "journal_id": self.journal_misc.id, "wt_types": "enasarco", "payment_term": self.payment_term_15.id, - "causale_pagamento_id": self.env.ref( - "l10n_it_causali_pagamento.a").id, + "payment_reason_id": self.env.ref("l10n_it_payment_reason.a").id, "rate_ids": [ ( 0, @@ -86,8 +116,7 @@ def setUp(self): "journal_id": self.journal_misc.id, "wt_types": "enasarco", "payment_term": self.payment_term_15.id, - "causale_pagamento_id": self.env.ref( - "l10n_it_causali_pagamento.a").id, + "payment_reason_id": self.env.ref("l10n_it_payment_reason.a").id, "rate_ids": [ ( 0, @@ -103,15 +132,16 @@ def setUp(self): def test_e_invoice_wt(self): self.set_sequences(13, "2019-01-07") + invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "name": "INV/2019/0013", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -121,19 +151,17 @@ def test_e_invoice_wt(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_22.id])], - "invoice_line_tax_wt_ids": [ - (6, 0, [self.wt1040.id]) - ], + "tax_ids": [(6, 0, [self.tax_22.id])], + "invoice_line_tax_wt_ids": [(6, 0, [self.wt1040.id])], }, ), ], } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -151,13 +179,13 @@ def test_e_invoice_wt_enas_0(self): self.set_sequences(14, "2019-01-07") invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "name": "INV/2019/0014", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -167,9 +195,9 @@ def test_e_invoice_wt_enas_0(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_22.id])], + "tax_ids": [(6, 0, [self.tax_22.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -186,7 +214,7 @@ def test_e_invoice_wt_enas_0(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -209,13 +237,13 @@ def test_e_invoice_wt_enas_1(self): self.enasarco.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "name": "INV/2019/0015", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -225,9 +253,9 @@ def test_e_invoice_wt_enas_1(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_22.id])], + "tax_ids": [(6, 0, [self.tax_22.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -244,7 +272,7 @@ def test_e_invoice_wt_enas_1(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -268,13 +296,13 @@ def test_e_invoice_wt_enas_2(self): self.enasarco.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "name": "INV/2019/0016", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -284,9 +312,9 @@ def test_e_invoice_wt_enas_2(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_0.id])], + "tax_ids": [(6, 0, [self.tax_0.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -303,7 +331,7 @@ def test_e_invoice_wt_enas_2(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -322,13 +350,12 @@ def test_e_invoice_wt_inps_0(self): self.set_sequences(17, "2019-01-07") invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -338,9 +365,9 @@ def test_e_invoice_wt_inps_0(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_22.id])], + "tax_ids": [(6, 0, [self.tax_22.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -357,7 +384,7 @@ def test_e_invoice_wt_inps_0(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -366,8 +393,7 @@ def test_e_invoice_wt_inps_0(self): # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, "IT06363391001_00017.xml", - module_name="l10n_it_fatturapa_out_wt" + xml_content, "IT06363391001_00017.xml", module_name="l10n_it_fatturapa_out_wt" ) @@ -380,13 +406,12 @@ def test_e_invoice_wt_inps_1(self): self.inps.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -396,9 +421,9 @@ def test_e_invoice_wt_inps_1(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_22.id])], + "tax_ids": [(6, 0, [self.tax_22.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -415,7 +440,7 @@ def test_e_invoice_wt_inps_1(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -424,8 +449,7 @@ def test_e_invoice_wt_inps_1(self): # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, "IT06363391001_00018.xml", - module_name="l10n_it_fatturapa_out_wt" + xml_content, "IT06363391001_00018.xml", module_name="l10n_it_fatturapa_out_wt" ) @@ -439,13 +463,12 @@ def test_e_invoice_wt_inps_2(self): self.inps.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create( { - "date_invoice": "2019-01-07", + "invoice_date": "2019-01-07", "partner_id": self.res_partner_fatturapa_2.id, "journal_id": self.sales_journal.id, - "account_id": self.a_recv.id, - "payment_term_id": self.account_payment_term.id, + "invoice_payment_term_id": self.account_payment_term.id, "user_id": self.user_demo.id, - "type": "out_invoice", + "move_type": "out_invoice", "currency_id": self.EUR.id, "invoice_line_ids": [ ( @@ -455,9 +478,9 @@ def test_e_invoice_wt_inps_2(self): "account_id": self.a_sale.id, "name": "Service", "quantity": 1, - "uom_id": self.product_uom_unit.id, + "product_uom_id": self.product_uom_unit.id, "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_0.id])], + "tax_ids": [(6, 0, [self.tax_0.id])], "invoice_line_tax_wt_ids": [ ( 6, @@ -474,7 +497,7 @@ def test_e_invoice_wt_inps_2(self): } ) invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() + invoice.action_post() res = self.run_wizard(invoice.id) attachment = self.attach_model.browse(res["res_id"]) @@ -483,6 +506,5 @@ def test_e_invoice_wt_inps_2(self): # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, "IT06363391001_00019.xml", - module_name="l10n_it_fatturapa_out_wt" + xml_content, "IT06363391001_00019.xml", module_name="l10n_it_fatturapa_out_wt" ) diff --git a/l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml b/l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml index 22613bfa9335..d4310470ec74 100644 --- a/l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml +++ b/l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml @@ -1,74 +1,107 @@ -