From 1a9bcc36919bcaf71a6532e43a17e9fa195d6bac Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Fri, 18 Jan 2019 14:45:54 +0100 Subject: [PATCH 01/18] [10.0] Add ability to fatturapa to export xml with DatiRitenuta and Enasarco in AltriDatiGestionali [FIX] tax value and translation issues [FIX] set default [FIX] view --- l10n_it_fatturapa_out_wt/README.rst | 83 ++++ l10n_it_fatturapa_out_wt/__init__.py | 5 + l10n_it_fatturapa_out_wt/__manifest__.py | 28 ++ l10n_it_fatturapa_out_wt/models/__init__.py | 4 + .../models/withholding_tax.py | 16 + .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 11 + .../static/description/icon.png | Bin 0 -> 4829 bytes .../static/description/index.html | 424 ++++++++++++++++++ .../views/withholding_tax_view.xml | 19 + l10n_it_fatturapa_out_wt/wizard/__init__.py | 4 + .../wizard/wizard_export_fatturapa.py | 60 +++ 12 files changed, 655 insertions(+) create mode 100644 l10n_it_fatturapa_out_wt/README.rst create mode 100644 l10n_it_fatturapa_out_wt/__init__.py create mode 100644 l10n_it_fatturapa_out_wt/__manifest__.py create mode 100644 l10n_it_fatturapa_out_wt/models/__init__.py create mode 100644 l10n_it_fatturapa_out_wt/models/withholding_tax.py create mode 100644 l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst create mode 100644 l10n_it_fatturapa_out_wt/readme/DESCRIPTION.rst create mode 100644 l10n_it_fatturapa_out_wt/static/description/icon.png create mode 100644 l10n_it_fatturapa_out_wt/static/description/index.html create mode 100644 l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml create mode 100644 l10n_it_fatturapa_out_wt/wizard/__init__.py create mode 100644 l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py diff --git a/l10n_it_fatturapa_out_wt/README.rst b/l10n_it_fatturapa_out_wt/README.rst new file mode 100644 index 000000000000..ba09c46a3a32 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/README.rst @@ -0,0 +1,83 @@ +================================================================== +Italian Localization - Fattura elettronica - Integrazione ritenuta +================================================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-italy/tree/10.0/l10n_it_fatturapa_out_wt + :alt: OCA/l10n-italy +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-italy-10-0/l10n-italy-10-0-l10n_it_fatturapa_out_wt + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/122/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +**Italiano** + +Modulo ponte tra emissione fatture elettroniche e ritenute. + +Con questo modulo, l'elemento XML DatiRitenuta verrà correttamente valorizzato. + +**English** + +Bridge module within e-invoice emission and withholding tax. + +With this module, XML element DatiRitenuta will be correctly filled. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Sergio Corato + +Contributors +~~~~~~~~~~~~ + +* Sergio Corato + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/l10n-italy `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_out_wt/__init__.py b/l10n_it_fatturapa_out_wt/__init__.py new file mode 100644 index 000000000000..4218e821ce1c --- /dev/null +++ b/l10n_it_fatturapa_out_wt/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models +from . import wizard diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py new file mode 100644 index 000000000000..aae7a819e58e --- /dev/null +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Author(s): Andrea Colangelo (andreacolangelo@openforce.it) +# Copyright 2018 Openforce Srls Unipersonale (www.openforce.it) +# Copyright 2018 Sergio Corato (https://efatto.it) +# Copyright 2018-2019 Lorenzo Battistini +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + 'name': 'Italian Localization - Fattura elettronica - Integrazione ' + 'ritenuta', + 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', + 'version': '10.0.1.0.0', + 'development_status': 'Beta', + 'category': 'Hidden', + 'website': 'https://github.com/OCA/l10n-italy', + 'author': 'Sergio Corato, Odoo Community Association (OCA)', + 'license': 'LGPL-3', + 'depends': [ + 'l10n_it_fatturapa', + 'l10n_it_fatturapa_out', + 'l10n_it_withholding_tax', + 'l10n_it_withholding_tax_causali', + ], + 'data': [ + 'views/withholding_tax_view.xml', + ], + 'installable': True, + 'auto_install': True, +} diff --git a/l10n_it_fatturapa_out_wt/models/__init__.py b/l10n_it_fatturapa_out_wt/models/__init__.py new file mode 100644 index 000000000000..48de5b6fc21f --- /dev/null +++ b/l10n_it_fatturapa_out_wt/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import withholding_tax diff --git a/l10n_it_fatturapa_out_wt/models/withholding_tax.py b/l10n_it_fatturapa_out_wt/models/withholding_tax.py new file mode 100644 index 000000000000..eee91aa4470b --- /dev/null +++ b/l10n_it_fatturapa_out_wt/models/withholding_tax.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Author(s): Sergio Corato (https://efatto.it) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openerp import fields, models + + +class WithholdingTax(models.Model): + _inherit = 'withholding.tax' + + welfare_fund_type_id = fields.Many2one( + 'welfare.fund.type', 'Welfare Fund Type') + wt_types = fields.Selection([ + ('enasarco', 'Enasarco tax'), + ('ritenuta', 'Withholding tax'), + ], 'Withholding tax type', required=True, default='ritenuta') diff --git a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..feb5b093f570 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sergio Corato diff --git a/l10n_it_fatturapa_out_wt/readme/DESCRIPTION.rst b/l10n_it_fatturapa_out_wt/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..5d02045793b5 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/readme/DESCRIPTION.rst @@ -0,0 +1,11 @@ +**Italiano** + +Modulo ponte tra emissione fatture elettroniche e ritenute. + +Con questo modulo, l'elemento XML DatiRitenuta verrà correttamente valorizzato. + +**English** + +Bridge module within e-invoice emission and withholding tax. + +With this module, XML element DatiRitenuta will be correctly filled. diff --git a/l10n_it_fatturapa_out_wt/static/description/icon.png b/l10n_it_fatturapa_out_wt/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1f07394c3b7990a313c758a4aaf6eab53e23e072 GIT binary patch literal 4829 zcmZ`-cQ_l|7mlK0r}iEdvy_@qdlNf+Myg7cR<(%LsJ*GyUbQJj&1j93*rTe%s8D;S zipJjKm+$%h{@wSv_uS|Fb?-UveeQWroSBIpEfoh9005vh(AS0$t=Yd5c$2s$+}f)q znwyUe^|S%k|Dq66mP+(cdg|MH0|3;F|4tG>b}k#yN#SE)tV1zR!OqCaO)9&d3ji=Y zH_+CwL{4vK`zNjaQsVo-1v8L@W2O4^Z5p;2&DX5Gyfaix6NT1fn_xs1vmKA4Z}9G5*bP>lYs0l_86{-EfemL$wYtEX~XFx(6Qx0z}MQ_X8yQ)<{$_5%>mlWCZ#N>H?O@k12f83Q?X?mNv z#HYs~2E5I{ERY+ui$c)xsv0rr5R?CXO&ad@8pDIJPlO~Gq(q|8in-qU6)4=&IX}i; zt#|h_RI^AQMCQ{ncU4;^2dx;VDD1vPrkZDxBk~4#gBK*5V_Ym!YFkQ&4f6&31~h(;ym$rC=OmP`=DBt?8Ao-ms#nh zMy95W(fr=t-aoKd`jj>MTD^R{w)w(mToO`BIf5PatA7%Iz&VG>AR9T&8 z2yhq&;LfnBY{-Tvm_zT$V3L)wuCg5ZqOJ{aHYXcf+afa&DHRo3^-`G5rqgTy0RzDk zk7HzPO#3O74=9oj1siClfJx~Ol|9T*${Z_2!47+~lGtUo5=+a<4@4@A$&&LKFv!1{ zQU{Set419mRq_6+O0V)Gyc3kM#J9P&=3J6SWOxG$c7I2i7(xof!KghaePbPr%G8a8 zWgUepN_!j_n0p%KPsgqJ<75?_o-B5}z0eOWGbToYsv90}%gl>we2SSboO53xCz;-# zY6?+9%K=4q19=rj{JAc|m(bU=^lw+#)PN&Urz&R`7t$^RJ0-^;RQOX3h=#wH%4dqi zq{Mg94F~~X7*nNiMYt}eb3W)i>wWfK8YgyxtPvz|- z8-c*R@bSDGtq;x3eNveOGvbVW*EB|_+^Q^`P9-c`n&RTK0!(cAE&c@1XAtR2s;Wu# zx7i~jqG@*MS8wRcOto7N4?x4AsX)}EZX}0N3MTDW5m_|wG>PV~x zc#Eyt%|hc;IBns*wB4SGq^%fkzoFkj*W2`|Gj(kq34~2Pt!{ zj`iP0RbtSHUC_9B@|^;I5_5+s!Js2Q3Dy{L_v>};S-3~Nd;K@Vf(y10p4ytkLb$CI_D>NAOk$>2geHq)mdvkW8y1vrE^rg9^Q5O@Fgk=GR*&op| zF34^}-uNHlW0|tcZ`CeOth26g^!^NtKBR-ks(u2SlFFIelI_3^o<5elk>vODdLAs#JHfja?ri2qG96>epj}QA7bzq#5ju96?JoApY zWRplVd3YfJm&{3;yiPdAcG1&^mGPS(htpXRzb%^f@&k^wd{d~03szG-f+#)CcC1fY zLQd#wuD6bCW&JWimPI> z5!v-sgh1foS4mHQ72$m<<>T&2&+d6!E7b$zVu8<0FS;Je6^$J;m?xKdb|+tzFRmZv7(@(O$0Bwq zV`+KY|1w{!OXkINqkhV_o@*(1{i4qRefhQbXYiNrp#}RO!~E%XOY;tk);?#`K9=`_ zA+z<|`C#m=zH1c|y#cX8jRFNpzL4ASQF`JE9W(CG$LXlzUvhMw@+@a99o7c1UQ0J7 zBv%cU>h3>ybS30n%3+>smdVn7f1s@W=wZI!m9G7jVIu!V--w=eE=LLR1O9|;qgQ8n zY6E_MPZ$hJs7_oMZkZ1x_qdLz^`3hiVft4wl!Ypp;}1$8fqwt2vS8qgWO83!aPhap z+P1g&t!dqLu)+eWKp|vHD500T?PRiPZ}wph#OZZ-;^parj9>RFQFK<<=?t=K#$Nx; z63x=?8~R7xnKdUOruX4Xe>dCuewohou8zNQ*k>}_0fqjVcB{qsRi{}%Z|RUHaOL%~ zB{Ek+au1PL7VkHIY0CQq@YHw`xs-}6u@eXS6#lqA^89!~&q?s(efhY7=@U4AWZ#pFa(T^ac&Fot zW^#|>bgF(Sg3c%-rH3-ly=yAg)CDXS>j?uH#BqOtNDNcL$Zp1b20e=tR&VBt;n+%$ z#hy(hfcQGJ_)VYvdF2&f3+AAvd&~3;|LhB`$LS@Ok>Ft_o$%A!2Sb-?A7+?;tbI42 z)4dN$-qwugxmv{(xNKrRgL@H;KU|D_GtBQgZPq^OSu1#bN66T`vSq#Gp`x3_Fo$&N zy>^J<=Qe%Z1Ag%YDS5?r1oF3*dT4?$#Z>(ojSD?@4|U-8R7MAJZ)$3$uB39dQTHZx zUS467fM@)5u22-4W0Wpc7-(c$P@i9fjN_@yTdH$29!pvX*Knv!!1u6JcQg5;f^P_u z<&rLbGk<6?vt+$yLfWOZN3Rd%rr zc($V7pz(yiKE-=O_)$MvGT{ESjoIE4p5OW@S-jULdX{>hZ1`iT_#t|g6I%+Y(0@|E z&NYgLXq%6)8Z$8_TX?PjjaGP_decnl%!ZV-w5Fv<9pU$li9aH1u=kHG)u$TPQ-u-& zAoy6Ss9@K%v*Kvq%M}w(yCMWc{8IG|0Q|a83GRl{4F8?!_MOVo9irQp|0;;mx1ZmO zH?j<68%{^#LXr@8txAQF@8rynp$Xhln|~wn(@Z~*OPcYCz3vMyAwQ$N!2*AZyMYc% zuQW|d)M`dId_Xq!&GAP!J}S6>{8c5Rrk0rYM%Rh*sl-gwP!-qYv{F_dmnuTUeV?3M#yMrV$nOoWdsNmSw zS(8PkmN7!YlSOI8;~O;5VK|O8H){LM4sKRXb4hSrkNiDUf|MP9LI9hS`6o$?LXIJu6S49q>KkY&15rhx(N09=nv|2~SEf@m z;^Ey-nS%$fF&cLkwH2@NFWs)T$jGE`7j~RUa8A{q|DcfaQg;`J z59pB*N>*Otvcs&2I&c{xGzbgtc#1$IYsJtJX>;e!ovm4P>cBu;ThHpT1#p2n3AS{8 z^*sAFh11JRMDvP8RXdPC3aS+IGeFAT-!I`Rv46xTBPvEHlX3gh1iSw1hWv({na080 zuZOmYmR*K-qKQ0#QZZHb1wzouY3qn{y-IkJd}kN!U` r8aiT|hVCWM^FKV(3jG&l)t9W+$TKay + + + + + +Italian Localization - Fattura elettronica - Integrazione ritenuta + + + +
+

Italian Localization - Fattura elettronica - Integrazione ritenuta

+ + +

Beta License: LGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Italiano

+

Modulo ponte tra emissione fatture elettroniche e ritenute.

+

Con questo modulo, l’elemento XML DatiRitenuta verrà correttamente valorizzato.

+

English

+

Bridge module within e-invoice emission and withholding tax.

+

With this module, XML element DatiRitenuta will be correctly filled.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Sergio Corato
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-italy project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml b/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml new file mode 100644 index 000000000000..f4233680f6c6 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml @@ -0,0 +1,19 @@ + + + + view.withholding.tax.form.fatturapa.wt + withholding.tax + + + + + + + + + {'invisible': [('wt_types', '!=', 'ritenuta')]} + + + + + diff --git a/l10n_it_fatturapa_out_wt/wizard/__init__.py b/l10n_it_fatturapa_out_wt/wizard/__init__.py new file mode 100644 index 000000000000..be4e4d181cb5 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/wizard/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import wizard_export_fatturapa diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py new file mode 100644 index 000000000000..f6df6be13d3b --- /dev/null +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import models +from odoo.tools.translate import _ +from odoo.exceptions import Warning as UserError +from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( + DatiRitenutaType, + AltriDatiGestionaliType, +) + + +class WizardExportFatturapa(models.TransientModel): + _inherit = "wizard.export.fatturapa" + + def setDatiGeneraliDocumento(self, invoice, body): + res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento( + invoice, body) + ritenuta_lines = invoice.withholding_tax_line_ids.filtered( + lambda x: x.withholding_tax_id.wt_types == 'ritenuta') + if len(ritenuta_lines) > 1: + raise UserError( + _("More than one withholding tax in invoice!")) + for wt_line in ritenuta_lines: + if not wt_line.withholding_tax_id.causale_pagamento_id.code: + raise UserError(_('Missing causale pagamento for ' + 'withholding tax %s!') + % wt_line.withholding_tax_id.name) + body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta\ + = DatiRitenutaType( + TipoRitenuta="RT02" if invoice.partner_id.is_company + else "RT01", # RT02 persona giuridica + ImportoRitenuta='%.2f' % wt_line.tax, + AliquotaRitenuta='%.2f' % ( + wt_line.tax / wt_line.base * 100), + CausalePagamento=wt_line.withholding_tax_id. + causale_pagamento_id.code + ) + return res + + def setDettaglioLinee(self, invoice, body): + res = super(WizardExportFatturapa, self).setDettaglioLinee( + invoice, body) + enasarco_lines = invoice.withholding_tax_line_ids.filtered( + lambda x: x.withholding_tax_id.wt_types == 'enasarco') + if len(enasarco_lines) > 1: + raise UserError( + _("More than one Enasarco tax in invoice!")) + for wt_line in enasarco_lines: + # tmp put values in the first line + # todo split values for lines with withholding type enasarco + body.DatiBeniServizi.DettaglioLinee[0].AltriDatiGestionali.append( + AltriDatiGestionaliType( + TipoDato="CASSA-PREV", + RiferimentoTesto='ENASARCO %s' % wt_line. + withholding_tax_id.welfare_fund_type_id.name, + RiferimentoNumero='%.2f' % wt_line.tax, + ) + ) + return res From ead085ba8c54f14ed0c58cae24aba64a81b1cd7b Mon Sep 17 00:00:00 2001 From: Roberto Fichera Date: Mon, 16 Sep 2019 12:28:33 +0200 Subject: [PATCH 02/18] [10.0][l10n_it_withholding_tax] Move welfare fund type and withholding tax types from l10n_it_fatturapa_out_wt --- l10n_it_fatturapa_out_wt/__init__.py | 1 - l10n_it_fatturapa_out_wt/__manifest__.py | 4 +--- l10n_it_fatturapa_out_wt/models/__init__.py | 4 ---- .../models/withholding_tax.py | 16 ---------------- .../views/withholding_tax_view.xml | 19 ------------------- 5 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 l10n_it_fatturapa_out_wt/models/__init__.py delete mode 100644 l10n_it_fatturapa_out_wt/models/withholding_tax.py delete mode 100644 l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml diff --git a/l10n_it_fatturapa_out_wt/__init__.py b/l10n_it_fatturapa_out_wt/__init__.py index 4218e821ce1c..3ee39aaa7d1e 100644 --- a/l10n_it_fatturapa_out_wt/__init__.py +++ b/l10n_it_fatturapa_out_wt/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from . import models from . import wizard diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index aae7a819e58e..fb375eac679a 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -20,9 +20,7 @@ 'l10n_it_withholding_tax', 'l10n_it_withholding_tax_causali', ], - 'data': [ - 'views/withholding_tax_view.xml', - ], + 'data': [], 'installable': True, 'auto_install': True, } diff --git a/l10n_it_fatturapa_out_wt/models/__init__.py b/l10n_it_fatturapa_out_wt/models/__init__.py deleted file mode 100644 index 48de5b6fc21f..000000000000 --- a/l10n_it_fatturapa_out_wt/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from . import withholding_tax diff --git a/l10n_it_fatturapa_out_wt/models/withholding_tax.py b/l10n_it_fatturapa_out_wt/models/withholding_tax.py deleted file mode 100644 index eee91aa4470b..000000000000 --- a/l10n_it_fatturapa_out_wt/models/withholding_tax.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Author(s): Sergio Corato (https://efatto.it) -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from openerp import fields, models - - -class WithholdingTax(models.Model): - _inherit = 'withholding.tax' - - welfare_fund_type_id = fields.Many2one( - 'welfare.fund.type', 'Welfare Fund Type') - wt_types = fields.Selection([ - ('enasarco', 'Enasarco tax'), - ('ritenuta', 'Withholding tax'), - ], 'Withholding tax type', required=True, default='ritenuta') diff --git a/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml b/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml deleted file mode 100644 index f4233680f6c6..000000000000 --- a/l10n_it_fatturapa_out_wt/views/withholding_tax_view.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - view.withholding.tax.form.fatturapa.wt - withholding.tax - - - - - - - - - {'invisible': [('wt_types', '!=', 'ritenuta')]} - - - - - From 9ed9a0a8d33e5c32da436a0d9dce9f8dd35d4cbd Mon Sep 17 00:00:00 2001 From: eLBati Date: Wed, 9 Oct 2019 15:28:40 +0200 Subject: [PATCH 03/18] porting l10n_it_fatturapa_out_wt to 12 --- l10n_it_fatturapa_out_wt/__init__.py | 1 - l10n_it_fatturapa_out_wt/__manifest__.py | 3 +-- l10n_it_fatturapa_out_wt/wizard/__init__.py | 1 - l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/__init__.py b/l10n_it_fatturapa_out_wt/__init__.py index 3ee39aaa7d1e..4b25b9723083 100644 --- a/l10n_it_fatturapa_out_wt/__init__.py +++ b/l10n_it_fatturapa_out_wt/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from . import wizard diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index fb375eac679a..1b64959619f3 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Author(s): Andrea Colangelo (andreacolangelo@openforce.it) # Copyright 2018 Openforce Srls Unipersonale (www.openforce.it) # Copyright 2018 Sergio Corato (https://efatto.it) @@ -8,7 +7,7 @@ 'name': 'Italian Localization - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '10.0.1.0.0', + 'version': '12.0.1.0.0', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', diff --git a/l10n_it_fatturapa_out_wt/wizard/__init__.py b/l10n_it_fatturapa_out_wt/wizard/__init__.py index be4e4d181cb5..867b656accc2 100644 --- a/l10n_it_fatturapa_out_wt/wizard/__init__.py +++ b/l10n_it_fatturapa_out_wt/wizard/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from . import wizard_export_fatturapa diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index f6df6be13d3b..2000f64e9dde 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from odoo import models From e92d72d0ee395514be38fc2e65aca5f4a1be8a10 Mon Sep 17 00:00:00 2001 From: eLBati Date: Wed, 9 Oct 2019 17:17:04 +0200 Subject: [PATCH 04/18] REF l10n_it_withholding_tax, l10n_it_fatturapa_out_wt, l10n_it_fatturapa_in removing welfare_fund_type_id --- l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index 2000f64e9dde..e7d9f61509e0 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -51,8 +51,7 @@ def setDettaglioLinee(self, invoice, body): body.DatiBeniServizi.DettaglioLinee[0].AltriDatiGestionali.append( AltriDatiGestionaliType( TipoDato="CASSA-PREV", - RiferimentoTesto='ENASARCO %s' % wt_line. - withholding_tax_id.welfare_fund_type_id.name, + RiferimentoTesto='ENASARCO TC07', RiferimentoNumero='%.2f' % wt_line.tax, ) ) From e7e33a03359839723725ccd2dbce7cd736697a99 Mon Sep 17 00:00:00 2001 From: eLBati Date: Thu, 10 Oct 2019 08:43:29 +0200 Subject: [PATCH 05/18] REF l10n_it_fatturapa_out_wt and l10n_it_fatturapa_out to export ENASARCO lines ADD option to fill DatiCassaPrevidenziale with enasarco data ADD tests FIX payment terms FIX missing in lines --- l10n_it_fatturapa_out_wt/README.rst | 16 +- l10n_it_fatturapa_out_wt/__manifest__.py | 4 +- .../i18n/l10n_it_fatturapa_out_wt.pot | 32 +++ .../static/description/index.html | 14 +- l10n_it_fatturapa_out_wt/tests/__init__.py | 3 + .../tests/data/IT06363391001_00011.xml | 103 ++++++++ .../tests/data/IT06363391001_00014.xml | 108 +++++++++ .../tests/data/IT06363391001_00015.xml | 124 ++++++++++ .../tests/data/IT06363391001_00016.xml | 120 ++++++++++ .../tests/test_fatturapa_wt.py | 226 ++++++++++++++++++ .../wizard/wizard_export_fatturapa.py | 99 ++++++-- 11 files changed, 813 insertions(+), 36 deletions(-) create mode 100644 l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot create mode 100644 l10n_it_fatturapa_out_wt/tests/__init__.py create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py diff --git a/l10n_it_fatturapa_out_wt/README.rst b/l10n_it_fatturapa_out_wt/README.rst index ba09c46a3a32..1ac3e86aa5e9 100644 --- a/l10n_it_fatturapa_out_wt/README.rst +++ b/l10n_it_fatturapa_out_wt/README.rst @@ -1,6 +1,6 @@ -================================================================== -Italian Localization - Fattura elettronica - Integrazione ritenuta -================================================================== +================================================= +ITA - Fattura elettronica - Integrazione ritenuta +================================================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,13 +14,13 @@ Italian Localization - Fattura elettronica - Integrazione ritenuta :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-italy/tree/10.0/l10n_it_fatturapa_out_wt + :target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_out_wt :alt: OCA/l10n-italy .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-italy-10-0/l10n-italy-10-0-l10n_it_fatturapa_out_wt + :target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_fatturapa_out_wt :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/10.0 + :target: https://runbot.odoo-community.org/runbot/122/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -78,6 +78,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/l10n-italy `_ project on GitHub. +This module is part of the `OCA/l10n-italy `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 1b64959619f3..106e4e164acc 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -4,10 +4,10 @@ # Copyright 2018-2019 Lorenzo Battistini # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - 'name': 'Italian Localization - Fattura elettronica - Integrazione ' + 'name': 'ITA - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.1.0.0', + 'version': '12.0.1.1.0', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', diff --git a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot new file mode 100644 index 000000000000..68e13a53578a --- /dev/null +++ b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_out_wt +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_it_fatturapa_out_wt +#: model:ir.model,name:l10n_it_fatturapa_out_wt.model_wizard_export_fatturapa +msgid "Export E-invoice" +msgstr "" + +#. module: l10n_it_fatturapa_out_wt +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:27 +#, python-format +msgid "Missing payment reason for withholding tax %s!" +msgstr "" + +#. module: l10n_it_fatturapa_out_wt +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:24 +#, python-format +msgid "More than one withholding tax in invoice!" +msgstr "" + diff --git a/l10n_it_fatturapa_out_wt/static/description/index.html b/l10n_it_fatturapa_out_wt/static/description/index.html index d24bd6fd5301..f5d916d0f01a 100644 --- a/l10n_it_fatturapa_out_wt/static/description/index.html +++ b/l10n_it_fatturapa_out_wt/static/description/index.html @@ -3,8 +3,8 @@ - -Italian Localization - Fattura elettronica - Integrazione ritenuta + +ITA - Fattura elettronica - Integrazione ritenuta -
-

Italian Localization - Fattura elettronica - Integrazione ritenuta

+
+

ITA - Fattura elettronica - Integrazione ritenuta

-

Beta License: LGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

Italiano

Modulo ponte tra emissione fatture elettroniche e ritenute.

Con questo modulo, l’elemento XML DatiRitenuta verrà correttamente valorizzato.

@@ -391,7 +391,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -415,7 +415,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/l10n-italy project on GitHub.

+

This module is part of the OCA/l10n-italy project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/l10n_it_fatturapa_out_wt/tests/__init__.py b/l10n_it_fatturapa_out_wt/tests/__init__.py new file mode 100644 index 000000000000..596933ddb061 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from . import test_fatturapa_wt diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml new file mode 100644 index 000000000000..750a2cf681ee --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml @@ -0,0 +1,103 @@ + + + + + IT + 06363391001 + + 00011 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0013 + + RT02 + 2.00 + 20.00 + A + + 12.20 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + SI + + + 22.00 + 10.00 + 2.20 + + + + TP02 + + MP05 + 2019-02-28 + 10.20 + + + + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml new file mode 100644 index 000000000000..365f5ed0d81e --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml @@ -0,0 +1,108 @@ + + + + + IT + 06363391001 + + 00014 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0014 + + RT02 + 2.00 + 20.00 + A + + 12.20 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + SI + + CASSA-PREV + ENASARCO TC07 (8.25%) + 0.83 + + + + 22.00 + 10.00 + 2.20 + + + + TP02 + + MP05 + 2019-02-28 + 9.37 + + + + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml new file mode 100644 index 000000000000..9169c047d7c3 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml @@ -0,0 +1,124 @@ + + + + + IT + 06363391001 + + 00015 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0015 + + RT02 + 2.00 + 20.00 + A + + + TC07 + 8.25 + 0.83 + 0.00 + N2 + + 12.20 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + SI + + CASSA-PREV + ENASARCO TC07 (8.25%) + 0.83 + + + + 22.00 + 10.00 + 2.20 + + + 0.00 + N2 + 0.83 + 0.00 + Escluso Art. 13 5C DPR 633/72 + + + + TP02 + + MP05 + 2019-02-28 + 9.37 + + + + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml new file mode 100644 index 000000000000..ef6d31bbf1db --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml @@ -0,0 +1,120 @@ + + + + + IT + 06363391001 + + 00016 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0016 + + RT02 + 2.00 + 20.00 + A + + + TC07 + 8.25 + 0.83 + 0.00 + N2 + + 10.00 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 0.00 + SI + N2 + + CASSA-PREV + ENASARCO TC07 (8.25%) + 0.83 + + + + 0.00 + N2 + 10.83 + 0.00 + Escluso Art. 13 5C DPR 633/72 + + + + TP02 + + MP05 + 2019-02-28 + 7.17 + + + + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py new file mode 100644 index 000000000000..598dacd1182f --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -0,0 +1,226 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +import base64 +from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import ( + FatturaPACommon) + + +class TestInvoiceWT(FatturaPACommon): + + def setUp(self): + super(TestInvoiceWT, self).setUp() + 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.wt_account_payable = self.env['account.account'].create({ + 'name': 'Debiti per ritenute da versare', + 'code': 'WT_001', + 'user_type_id': type_payable.id, + 'reconcile': True, + }) + self.wt_account_receivable = self.env['account.account'].create({ + 'name': 'Crediti per ritenute subite', + 'code': 'WT_002', + 'user_type_id': type_receivable.id, + 'reconcile': True, + }) + self.journal_misc = self.env['account.journal'].search( + [('type', '=', 'general')])[0] + vals_payment = { + 'name': "", + 'line_ids': [(0, 0, {'value': 'balance', 'days': 15})] + } + self.payment_term_15 = self.env['account.payment.term'].create( + vals_payment) + wt_vals = { + 'name': 'Code 1040', + 'code': '1040', + 'certification': True, + 'account_receivable_id': self.wt_account_receivable.id, + '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, + 'rate_ids': [(0, 0, { + 'tax': 20, + 'base': 1, + })] + } + self.wt1040 = self.env['withholding.tax'].create(wt_vals) + wt_vals = { + 'name': 'Enasarco', + 'code': 'Enasarco', + 'account_receivable_id': self.wt_account_receivable.id, + 'account_payable_id': self.wt_account_payable.id, + 'journal_id': self.journal_misc.id, + 'wt_types': 'enasarco', + 'payment_term': self.payment_term_15.id, + 'rate_ids': [(0, 0, { + 'tax': 8.25, + 'base': 1, + })] + } + self.enasarco = self.env['withholding.tax'].create(wt_vals) + + def test_e_invoice_wt(self): + self.set_sequences(13, '2019-01-07') + invoice = self.invoice_model.create({ + 'date_invoice': '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + '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])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00011.xml') + + # XML doc to be validated + xml_content = base64.decodebytes(attachment.datas) + self.check_content( + xml_content, 'IT06363391001_00011.xml', + module_name='l10n_it_fatturapa_out_wt') + + 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', + '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + '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, + self.enasarco.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00014.xml') + + # XML doc to be validated + xml_content = base64.decodebytes(attachment.datas) + self.check_content( + xml_content, 'IT06363391001_00014.xml', + module_name='l10n_it_fatturapa_out_wt') + + def test_e_invoice_wt_enas_1(self): + """ + Fill DatiCassaPrevidenziale with Enasarco data + """ + self.set_sequences(15, '2019-01-07') + self.enasarco.use_daticassaprev_for_enasarco = True + invoice = self.invoice_model.create({ + 'date_invoice': '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + '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, + self.enasarco.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00015.xml') + + # XML doc to be validated + xml_content = base64.decodebytes(attachment.datas) + self.check_content( + xml_content, 'IT06363391001_00015.xml', + module_name='l10n_it_fatturapa_out_wt') + + def test_e_invoice_wt_enas_2(self): + """ + Fill DatiCassaPrevidenziale with Enasarco data, + when DatiRiepilogo already has 0 VAT + """ + self.set_sequences(16, '2019-01-07') + self.enasarco.use_daticassaprev_for_enasarco = True + invoice = self.invoice_model.create({ + 'date_invoice': '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + 'uom_id': self.product_uom_unit.id, + 'price_unit': 10, + 'invoice_line_tax_ids': [(6, 0, [self.tax_0.id])], + 'invoice_line_tax_wt_ids': [(6, 0, [ + self.wt1040.id, + self.enasarco.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00016.xml') + + # XML doc to be validated + xml_content = base64.decodebytes(attachment.datas) + self.check_content( + xml_content, 'IT06363391001_00016.xml', + module_name='l10n_it_fatturapa_out_wt') diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index e7d9f61509e0..f12ec8c17aaf 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -6,6 +6,8 @@ from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( DatiRitenutaType, AltriDatiGestionaliType, + DatiCassaPrevidenzialeType, + DatiRiepilogoType ) @@ -22,7 +24,7 @@ def setDatiGeneraliDocumento(self, invoice, body): _("More than one withholding tax in invoice!")) for wt_line in ritenuta_lines: if not wt_line.withholding_tax_id.causale_pagamento_id.code: - raise UserError(_('Missing causale pagamento for ' + raise UserError(_('Missing payment reason for ' 'withholding tax %s!') % wt_line.withholding_tax_id.name) body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta\ @@ -30,29 +32,88 @@ def setDatiGeneraliDocumento(self, invoice, body): TipoRitenuta="RT02" if invoice.partner_id.is_company else "RT01", # RT02 persona giuridica ImportoRitenuta='%.2f' % wt_line.tax, - AliquotaRitenuta='%.2f' % ( - wt_line.tax / wt_line.base * 100), + AliquotaRitenuta='%.2f' % wt_line.withholding_tax_id.tax, CausalePagamento=wt_line.withholding_tax_id. causale_pagamento_id.code ) + enasarco_lines = invoice.withholding_tax_line_ids.filtered( + lambda x: x.withholding_tax_id.wt_types == 'enasarco') + for enas_line in enasarco_lines: + if enas_line.withholding_tax_id.use_daticassaprev_for_enasarco: + body.DatiGenerali.DatiGeneraliDocumento.\ + DatiCassaPrevidenziale.append( + DatiCassaPrevidenzialeType( + TipoCassa='TC07', + AlCassa='%.2f' % enas_line.withholding_tax_id.tax, + ImportoContributoCassa='%.2f' % enas_line.tax, + AliquotaIVA='0.00', + Natura='N2' + ) + ) return res - def setDettaglioLinee(self, invoice, body): - res = super(WizardExportFatturapa, self).setDettaglioLinee( + def get_n2_tax_riepilogo(self, body): + for riepilogo in body.DatiBeniServizi.DatiRiepilogo: + if float(riepilogo.AliquotaIVA) == 0 and riepilogo.Natura == 'N2': + return riepilogo + + def setDatiRiepilogo(self, invoice, body): + res = super(WizardExportFatturapa, self).setDatiRiepilogo( invoice, body) - enasarco_lines = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types == 'enasarco') - if len(enasarco_lines) > 1: - raise UserError( - _("More than one Enasarco tax in invoice!")) - for wt_line in enasarco_lines: - # tmp put values in the first line - # todo split values for lines with withholding type enasarco - body.DatiBeniServizi.DettaglioLinee[0].AltriDatiGestionali.append( - AltriDatiGestionaliType( - TipoDato="CASSA-PREV", - RiferimentoTesto='ENASARCO TC07', - RiferimentoNumero='%.2f' % wt_line.tax, + enasarco_lines_to_write = invoice.withholding_tax_line_ids.filtered( + lambda x: x.withholding_tax_id.wt_types == 'enasarco' and + x.withholding_tax_id.use_daticassaprev_for_enasarco + ) + if enasarco_lines_to_write: + n2_riepilogo = self.get_n2_tax_riepilogo(body) + enasarco_base = sum(enasarco_lines_to_write.mapped('tax')) + if n2_riepilogo: + base_amount = float(n2_riepilogo.ImponibileImporto) + base_amount += enasarco_base + n2_riepilogo.ImponibileImporto = '%.2f' % base_amount + else: + riepilogo = DatiRiepilogoType( + AliquotaIVA='0.00', + ImponibileImporto='%.2f' % enasarco_base, + Imposta='0.00', + Natura='N2', + RiferimentoNormativo='Escluso Art. 13 5C DPR 633/72', ) - ) + body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) + return res + + def setDettaglioLinea( + self, line_no, line, body, price_precision, uom_precision + ): + DettaglioLinea = super(WizardExportFatturapa, self).setDettaglioLinea( + line_no, line, body, price_precision, uom_precision + ) + for wt in line.invoice_line_tax_wt_ids: + if wt.wt_types == 'enasarco': + amount = wt.compute_tax(line.price_subtotal)['tax'] + DettaglioLinea.AltriDatiGestionali.append( + AltriDatiGestionaliType( + TipoDato="CASSA-PREV", + RiferimentoTesto=('ENASARCO TC07 (%s%%)' % wt.tax), + RiferimentoNumero='%.2f' % amount, + ) + ) + else: + DettaglioLinea.Ritenuta = 'SI' + return DettaglioLinea + + def setDatiPagamento(self, invoice, body): + res = super(WizardExportFatturapa, self).setDatiPagamento( + invoice, body) + if invoice.withholding_tax_line_ids and invoice.payment_term_id: + payment_line_ids = invoice.get_receivable_line_ids() + index = 0 + rate = invoice.amount_net_pay / invoice.amount_total + move_line_pool = self.env['account.move.line'] + for move_line_id in payment_line_ids: + move_line = move_line_pool.browse(move_line_id) + body.DatiPagamento[0].DettaglioPagamento[index].\ + ImportoPagamento = '%.2f' % ( + (move_line.amount_currency or move_line.debit) * rate) + index += 1 return res From f6818d5c9e4ce9d9f5b0f4c0bb87b8b8a876cd21 Mon Sep 17 00:00:00 2001 From: eLBati Date: Tue, 14 Jan 2020 16:57:21 +0100 Subject: [PATCH 06/18] Use float_round from odoo because in python 3 "Exact halfway cases are now rounded to the nearest even result instead of away from zero". See https://docs.python.org/3/whatsnew/3.0.html#builtins Examples: >>> '%.2f' % 75.845 '75.84' >>> '%.2f' % 75.855 '75.86' >>> round(2.5) 2 >>> round(3.5) 4 --- l10n_it_fatturapa_out_wt/__manifest__.py | 2 +- .../i18n/l10n_it_fatturapa_out_wt.pot | 4 ++-- .../wizard/wizard_export_fatturapa.py | 22 +++++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 106e4e164acc..5e3375717a2f 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -7,7 +7,7 @@ 'name': 'ITA - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.1.1.0', + 'version': '12.0.1.1.1', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', diff --git a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot index 68e13a53578a..8975a8ab14b5 100644 --- a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot +++ b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot @@ -19,13 +19,13 @@ msgid "Export E-invoice" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:27 +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:28 #, python-format msgid "Missing payment reason for withholding tax %s!" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:24 +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:25 #, python-format msgid "More than one withholding tax in invoice!" msgstr "" diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index f12ec8c17aaf..a4e003f0ba15 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -3,6 +3,7 @@ from odoo import models from odoo.tools.translate import _ from odoo.exceptions import Warning as UserError +from odoo.tools.float_utils import float_round from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( DatiRitenutaType, AltriDatiGestionaliType, @@ -31,8 +32,9 @@ def setDatiGeneraliDocumento(self, invoice, body): = DatiRitenutaType( TipoRitenuta="RT02" if invoice.partner_id.is_company else "RT01", # RT02 persona giuridica - ImportoRitenuta='%.2f' % wt_line.tax, - AliquotaRitenuta='%.2f' % wt_line.withholding_tax_id.tax, + ImportoRitenuta='%.2f' % float_round(wt_line.tax, 2), + AliquotaRitenuta='%.2f' % float_round( + wt_line.withholding_tax_id.tax, 2), CausalePagamento=wt_line.withholding_tax_id. causale_pagamento_id.code ) @@ -44,8 +46,10 @@ def setDatiGeneraliDocumento(self, invoice, body): DatiCassaPrevidenziale.append( DatiCassaPrevidenzialeType( TipoCassa='TC07', - AlCassa='%.2f' % enas_line.withholding_tax_id.tax, - ImportoContributoCassa='%.2f' % enas_line.tax, + AlCassa='%.2f' % float_round( + enas_line.withholding_tax_id.tax, 2), + ImportoContributoCassa='%.2f' % float_round( + enas_line.tax, 2), AliquotaIVA='0.00', Natura='N2' ) @@ -70,11 +74,11 @@ def setDatiRiepilogo(self, invoice, body): if n2_riepilogo: base_amount = float(n2_riepilogo.ImponibileImporto) base_amount += enasarco_base - n2_riepilogo.ImponibileImporto = '%.2f' % base_amount + n2_riepilogo.ImponibileImporto = '%.2f' % float_round(base_amount, 2) else: riepilogo = DatiRiepilogoType( AliquotaIVA='0.00', - ImponibileImporto='%.2f' % enasarco_base, + ImponibileImporto='%.2f' % float_round(enasarco_base, 2), Imposta='0.00', Natura='N2', RiferimentoNormativo='Escluso Art. 13 5C DPR 633/72', @@ -95,7 +99,7 @@ def setDettaglioLinea( AltriDatiGestionaliType( TipoDato="CASSA-PREV", RiferimentoTesto=('ENASARCO TC07 (%s%%)' % wt.tax), - RiferimentoNumero='%.2f' % amount, + RiferimentoNumero='%.2f' % float_round(amount, 2), ) ) else: @@ -113,7 +117,7 @@ def setDatiPagamento(self, invoice, body): for move_line_id in payment_line_ids: move_line = move_line_pool.browse(move_line_id) body.DatiPagamento[0].DettaglioPagamento[index].\ - ImportoPagamento = '%.2f' % ( - (move_line.amount_currency or move_line.debit) * rate) + ImportoPagamento = '%.2f' % float_round( + (move_line.amount_currency or move_line.debit) * rate, 2) index += 1 return res From 4c2db2c365335e196fcaf7c08c4b92baef7e75a1 Mon Sep 17 00:00:00 2001 From: Lara Baggio Date: Wed, 13 May 2020 18:03:37 +0200 Subject: [PATCH 07/18] merge PR 1264 1717 1728 1737 1739 --- l10n_it_fatturapa_out_wt/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 5e3375717a2f..7984b17aa0ac 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -7,7 +7,7 @@ 'name': 'ITA - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.1.1.1', + 'version': '12.0.1.1.2', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', From 7469c54f103ae97c61b8fac215413d6bee034fe0 Mon Sep 17 00:00:00 2001 From: eLBati Date: Thu, 10 Sep 2020 16:39:49 +0200 Subject: [PATCH 08/18] FIX license compatibility --- l10n_it_fatturapa_out_wt/README.rst | 6 +++--- l10n_it_fatturapa_out_wt/__manifest__.py | 4 ++-- l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot | 4 ++-- l10n_it_fatturapa_out_wt/static/description/index.html | 2 +- l10n_it_fatturapa_out_wt/tests/__init__.py | 1 - l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py | 1 - l10n_it_fatturapa_out_wt/wizard/__init__.py | 1 - l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py | 1 - 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/README.rst b/l10n_it_fatturapa_out_wt/README.rst index 1ac3e86aa5e9..cb8a5dac843d 100644 --- a/l10n_it_fatturapa_out_wt/README.rst +++ b/l10n_it_fatturapa_out_wt/README.rst @@ -10,9 +10,9 @@ ITA - Fattura elettronica - Integrazione ritenuta .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github :target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_out_wt :alt: OCA/l10n-italy diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 7984b17aa0ac..4c5507735bef 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -7,12 +7,12 @@ 'name': 'ITA - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.1.1.2', + 'version': '12.0.1.1.3', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', 'author': 'Sergio Corato, Odoo Community Association (OCA)', - 'license': 'LGPL-3', + 'license': 'AGPL-3', 'depends': [ 'l10n_it_fatturapa', 'l10n_it_fatturapa_out', diff --git a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot index 8975a8ab14b5..68e13a53578a 100644 --- a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot +++ b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot @@ -19,13 +19,13 @@ msgid "Export E-invoice" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:28 +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:27 #, python-format msgid "Missing payment reason for withholding tax %s!" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:25 +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:24 #, python-format msgid "More than one withholding tax in invoice!" msgstr "" diff --git a/l10n_it_fatturapa_out_wt/static/description/index.html b/l10n_it_fatturapa_out_wt/static/description/index.html index f5d916d0f01a..37e54814c979 100644 --- a/l10n_it_fatturapa_out_wt/static/description/index.html +++ b/l10n_it_fatturapa_out_wt/static/description/index.html @@ -367,7 +367,7 @@

ITA - Fattura elettronica - Integrazione ritenuta

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

Italiano

Modulo ponte tra emissione fatture elettroniche e ritenute.

Con questo modulo, l’elemento XML DatiRitenuta verrà correttamente valorizzato.

diff --git a/l10n_it_fatturapa_out_wt/tests/__init__.py b/l10n_it_fatturapa_out_wt/tests/__init__.py index 596933ddb061..0b572b5283b1 100644 --- a/l10n_it_fatturapa_out_wt/tests/__init__.py +++ b/l10n_it_fatturapa_out_wt/tests/__init__.py @@ -1,3 +1,2 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from . import test_fatturapa_wt 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 598dacd1182f..57e9f1bd2232 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -1,4 +1,3 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). import base64 from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import ( diff --git a/l10n_it_fatturapa_out_wt/wizard/__init__.py b/l10n_it_fatturapa_out_wt/wizard/__init__.py index 867b656accc2..a5be93d64228 100644 --- a/l10n_it_fatturapa_out_wt/wizard/__init__.py +++ b/l10n_it_fatturapa_out_wt/wizard/__init__.py @@ -1,3 +1,2 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from . import wizard_export_fatturapa diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index a4e003f0ba15..63d1c5c00cb6 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -1,4 +1,3 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). from odoo import models from odoo.tools.translate import _ From 53a29342b7f1b15e8a498296ffe012385eff2092 Mon Sep 17 00:00:00 2001 From: Ciro Urselli Date: Fri, 11 Sep 2020 14:19:00 +0200 Subject: [PATCH 09/18] 12.0 nuovi dati ritenuta fe (#1876) * [IMP] extend wt_types selection with new code and add tax_id for daticassa * [IMP] use causale_pagamento for all withholding tax type * [IMP] improve wizard_export_fatturapa with new 1.6 xml tack specific --- .../tests/data/IT06363391001_00014.xml | 11 +- .../tests/data/IT06363391001_00015.xml | 11 +- .../tests/data/IT06363391001_00016.xml | 11 +- .../tests/data/IT06363391001_00017.xml | 109 +++++++++++++ .../tests/data/IT06363391001_00018.xml | 125 ++++++++++++++ .../tests/data/IT06363391001_00019.xml | 121 ++++++++++++++ .../tests/test_fatturapa_wt.py | 153 +++++++++++++++++- .../wizard/wizard_export_fatturapa.py | 107 ++++++------ 8 files changed, 585 insertions(+), 63 deletions(-) create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml create mode 100644 l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml index 365f5ed0d81e..62e62d11764d 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml @@ -70,6 +70,12 @@ 20.00 A + + RT04 + 0.83 + 8.25 + A + 12.20 SI @@ -84,11 +90,6 @@ 10.00 22.00 SI - - CASSA-PREV - ENASARCO TC07 (8.25%) - 0.83 - 22.00 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml index 9169c047d7c3..499f80b90df4 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml @@ -72,6 +72,12 @@ 20.00 A + + RT04 + 0.83 + 8.25 + A + TC07 8.25 @@ -93,11 +99,6 @@ 10.00 22.00 SI - - CASSA-PREV - ENASARCO TC07 (8.25%) - 0.83 - 22.00 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml index ef6d31bbf1db..e4a0d31db6d5 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml @@ -71,6 +71,12 @@ 2.00 20.00 A + + + RT04 + 0.83 + 8.25 + A TC07 @@ -94,11 +100,6 @@ 0.00 SI N2 - - CASSA-PREV - ENASARCO TC07 (8.25%) - 0.83 - 0.00 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml new file mode 100644 index 000000000000..24d061d89797 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml @@ -0,0 +1,109 @@ + + + + + IT + 06363391001 + + 00014 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0017 + + RT02 + 2.00 + 20.00 + A + + + RT03 + 0.53 + 5.25 + A + + 12.20 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + SI + + + 22.00 + 10.00 + 2.20 + + + + TP02 + + MP05 + 2019-02-28 + 9.67 + + + + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml new file mode 100644 index 000000000000..9f83d464bfcf --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml @@ -0,0 +1,125 @@ + + + + + IT + 06363391001 + + 00015 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0018 + + RT02 + 2.00 + 20.00 + A + + + RT03 + 0.53 + 5.25 + A + + + TC22 + 5.25 + 0.53 + 0.00 + N2 + + 12.20 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 22.00 + SI + + + 22.00 + 10.00 + 2.20 + + + 0.00 + N2 + 0.83 + 0.00 + Escluso Art. 13 5C DPR 633/72 + + + + TP02 + + MP05 + 2019-02-28 + 9.67 + + + + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml new file mode 100644 index 000000000000..cb3baaf639b5 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml @@ -0,0 +1,121 @@ + + + + + IT + 06363391001 + + 00016 + FPR12 + 0000000 + + 06543534343 + info@yourcompany.example.com + + test@pec.it + + + + + IT + 06363391001 + + + YourCompany + + RF01 + + + Via Milano, 1 + 00100 + Roma + AK + IT + + + 06543534343 + info@yourcompany.example.com + + + + + + IT + 07973780013 + + 07973780013 + + B2B Customer + + + + Via Roma, 1 + 16100 + Genova + AK + IT + + + + + + + TD01 + EUR + 2019-01-07 + INV/2019/0019 + + RT02 + 2.00 + 20.00 + A + + + RT03 + 0.53 + 5.25 + A + + + TC22 + 5.25 + 0.53 + 0.00 + N2 + + 10.00 + SI + + + + + 1 + Service + 1.000 + Unit(s) + 10.00000 + 10.00 + 0.00 + SI + N2 + + + 0.00 + N2 + 10.83 + 0.00 + Escluso Art. 13 5C DPR 633/72 + + + + TP02 + + MP05 + 2019-02-28 + 7.47 + + + + \ No newline at end of file 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 57e9f1bd2232..8d6e7369d156 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -55,12 +55,30 @@ 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, 'rate_ids': [(0, 0, { 'tax': 8.25, 'base': 1, })] } self.enasarco = self.env['withholding.tax'].create(wt_vals) + wt_vals = { + 'name': 'INPS', + 'code': 'INPS', + 'account_receivable_id': self.wt_account_receivable.id, + 'account_payable_id': self.wt_account_payable.id, + '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, + 'rate_ids': [(0, 0, { + 'tax': 5.25, + 'base': 1, + })] + } + self.inps = self.env['withholding.tax'].create(wt_vals) def test_e_invoice_wt(self): self.set_sequences(13, '2019-01-07') @@ -142,7 +160,8 @@ def test_e_invoice_wt_enas_1(self): Fill DatiCassaPrevidenziale with Enasarco data """ self.set_sequences(15, '2019-01-07') - self.enasarco.use_daticassaprev_for_enasarco = True + self.enasarco.use_daticassaprev = True + self.enasarco.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create({ 'date_invoice': '2019-01-07', 'partner_id': self.res_partner_fatturapa_2.id, @@ -186,7 +205,8 @@ def test_e_invoice_wt_enas_2(self): when DatiRiepilogo already has 0 VAT """ self.set_sequences(16, '2019-01-07') - self.enasarco.use_daticassaprev_for_enasarco = True + self.enasarco.use_daticassaprev = True + self.enasarco.daticassprev_tax_id = self.tax_0 invoice = self.invoice_model.create({ 'date_invoice': '2019-01-07', 'partner_id': self.res_partner_fatturapa_2.id, @@ -223,3 +243,132 @@ def test_e_invoice_wt_enas_2(self): self.check_content( xml_content, 'IT06363391001_00016.xml', module_name='l10n_it_fatturapa_out_wt') + +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', + '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + '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, + self.inps.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00017.xml') + + # 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') + +def test_e_invoice_wt_inps_1(self): + """ + Fill DatiCassaPrevidenziale with INPS data + """ + self.set_sequences(18, '2019-01-07') + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create({ + 'date_invoice': '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + '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, + self.inps.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00018.xml') + + # 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') + +def test_e_invoice_wt_inps_2(self): + """ + Fill DatiCassaPrevidenziale with INPS data, + when DatiRiepilogo already has 0 VAT + """ + self.set_sequences(19, '2019-01-07') + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create({ + 'date_invoice': '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, + 'user_id': self.user_demo.id, + 'type': 'out_invoice', + 'currency_id': self.EUR.id, + 'invoice_line_ids': [ + (0, 0, { + 'account_id': self.a_sale.id, + 'name': 'Service', + 'quantity': 1, + 'uom_id': self.product_uom_unit.id, + 'price_unit': 10, + 'invoice_line_tax_ids': [(6, 0, [self.tax_0.id])], + 'invoice_line_tax_wt_ids': [(6, 0, [ + self.wt1040.id, + self.inps.id, + ])] + }), + ], + }) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) + + attachment = self.attach_model.browse(res['res_id']) + self.set_e_invoice_file_id(attachment, 'IT06363391001_00019.xml') + + # 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') + \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index 63d1c5c00cb6..5f397dfe0997 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -10,77 +10,102 @@ DatiRiepilogoType ) +WT_TAX_CODE = { + 'inps': 'RT03', + 'enasarco': 'RT04', + 'enpam': 'RT05', + 'other': 'RT06' +} + +TC_CODE = { + 'inps': 'TC22', + 'enasarco': 'TC07', + 'enpam': 'TC09', +} class WizardExportFatturapa(models.TransientModel): _inherit = "wizard.export.fatturapa" - + + def getTipoRitenuta(self, wt_types, partner): + if wt_types == 'ritenuta': + if partner.is_company: + tipoRitenuta = 'RT02' + else: + tipoRitenuta = 'RT01' + else: + tipoRitenuta = WT_TAX_CODE[wt_types] + return tipoRitenuta + def setDatiGeneraliDocumento(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento( invoice, body) - ritenuta_lines = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types == 'ritenuta') - if len(ritenuta_lines) > 1: - raise UserError( - _("More than one withholding tax in invoice!")) + ritenuta_lines = invoice.withholding_tax_line_ids + # if len(ritenuta_lines) > 1: + # raise UserError( + # _("More than one withholding tax in invoice!")) for wt_line in ritenuta_lines: if not wt_line.withholding_tax_id.causale_pagamento_id.code: raise UserError(_('Missing payment reason for ' 'withholding tax %s!') % wt_line.withholding_tax_id.name) - body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta\ - = DatiRitenutaType( - TipoRitenuta="RT02" if invoice.partner_id.is_company - else "RT01", # RT02 persona giuridica + tipoRitenuta = self.getTipoRitenuta( + wt_line.withholding_tax_id.wt_types, + invoice.partner_id + ) + body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta.append( + DatiRitenutaType( + TipoRitenuta=tipoRitenuta, ImportoRitenuta='%.2f' % float_round(wt_line.tax, 2), AliquotaRitenuta='%.2f' % float_round( wt_line.withholding_tax_id.tax, 2), CausalePagamento=wt_line.withholding_tax_id. causale_pagamento_id.code - ) - enasarco_lines = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types == 'enasarco') - for enas_line in enasarco_lines: - if enas_line.withholding_tax_id.use_daticassaprev_for_enasarco: + )) + if wt_line.withholding_tax_id.use_daticassaprev: + tax_id = wt_line.withholding_tax_id.daticassprev_tax_id + tax_kind = tax_id.kind_id.code body.DatiGenerali.DatiGeneraliDocumento.\ DatiCassaPrevidenziale.append( DatiCassaPrevidenzialeType( - TipoCassa='TC07', + TipoCassa=TC_CODE[wt_line.withholding_tax_id.wt_types], AlCassa='%.2f' % float_round( - enas_line.withholding_tax_id.tax, 2), + wt_line.withholding_tax_id.tax, 2), ImportoContributoCassa='%.2f' % float_round( - enas_line.tax, 2), + wt_line.tax, 2), AliquotaIVA='0.00', - Natura='N2' + Natura=tax_kind, ) ) return res - def get_n2_tax_riepilogo(self, body): + def get_tax_riepilogo(self, body, tax_id): for riepilogo in body.DatiBeniServizi.DatiRiepilogo: - if float(riepilogo.AliquotaIVA) == 0 and riepilogo.Natura == 'N2': + if float(riepilogo.AliquotaIVA) == 0.0 \ + and riepilogo.Natura == tax_id.kind_id.code: return riepilogo def setDatiRiepilogo(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiRiepilogo( invoice, body) - enasarco_lines_to_write = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types == 'enasarco' and - x.withholding_tax_id.use_daticassaprev_for_enasarco + wt_lines_to_write = invoice.withholding_tax_line_ids.filtered( + lambda x: x.withholding_tax_id.wt_types not in ('ritenuta', 'other') + and x.withholding_tax_id.use_daticassaprev ) - if enasarco_lines_to_write: - n2_riepilogo = self.get_n2_tax_riepilogo(body) - enasarco_base = sum(enasarco_lines_to_write.mapped('tax')) - if n2_riepilogo: - base_amount = float(n2_riepilogo.ImponibileImporto) - base_amount += enasarco_base - n2_riepilogo.ImponibileImporto = '%.2f' % float_round(base_amount, 2) + for wt_line in wt_lines_to_write: + tax_id = wt_line.withholding_tax_id.daticassprev_tax_id + tax_riepilogo = self.get_tax_riepilogo(body, tax_id) + if tax_riepilogo: + base_amount = float(tax_riepilogo.ImponibileImporto) + base_amount += wt_line.tax + tax_riepilogo.ImponibileImporto = '%.2f' % float_round( + base_amount, 2) else: riepilogo = DatiRiepilogoType( AliquotaIVA='0.00', - ImponibileImporto='%.2f' % float_round(enasarco_base, 2), + ImponibileImporto='%.2f' % float_round(wt_line.tax, 2), Imposta='0.00', - Natura='N2', - RiferimentoNormativo='Escluso Art. 13 5C DPR 633/72', + Natura=tax_id.kind_id.code, + RiferimentoNormativo=tax_id.law_reference, ) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return res @@ -91,18 +116,8 @@ def setDettaglioLinea( DettaglioLinea = super(WizardExportFatturapa, self).setDettaglioLinea( line_no, line, body, price_precision, uom_precision ) - for wt in line.invoice_line_tax_wt_ids: - if wt.wt_types == 'enasarco': - amount = wt.compute_tax(line.price_subtotal)['tax'] - DettaglioLinea.AltriDatiGestionali.append( - AltriDatiGestionaliType( - TipoDato="CASSA-PREV", - RiferimentoTesto=('ENASARCO TC07 (%s%%)' % wt.tax), - RiferimentoNumero='%.2f' % float_round(amount, 2), - ) - ) - else: - DettaglioLinea.Ritenuta = 'SI' + if any([wt for wt in line.invoice_line_tax_wt_ids]): + DettaglioLinea.Ritenuta = 'SI' return DettaglioLinea def setDatiPagamento(self, invoice, body): From 440b674afef2b1e4be06c45e2beaac37ee507a1e Mon Sep 17 00:00:00 2001 From: Sergio Corato Date: Fri, 18 Sep 2020 12:31:00 +0200 Subject: [PATCH 10/18] [12.0][FIX] fatturapa withholding tax invoice received e-invoice 1.6 (#1878) * [12.0][FIX] fatturapa withholding tax invoice received - e-invoice 1.6 * [FIX] l10n_it_fatturapa_out_wt pep8 fixes This reverts commit 421ef9e51634383263638e9b52ea4038829f62ec. * [IMP] migration script * [FIX] l10n_it_fatturapa_out_wt: Fixed ordering in DatiRitenuta generation, according to XML test file. Otherwise: 2020-09-17 07:34:14,789 7808 ERROR openerp_test odoo.addons.l10n_it_fatturapa_out_wt.tests.test_fatturapa_wt: ` AssertionError: b'RT022.00' != b'RT040.83' Co-authored-by: SimoRubi --- l10n_it_fatturapa_out_wt/__manifest__.py | 2 +- .../i18n/l10n_it_fatturapa_out_wt.pot | 8 +------ .../tests/test_fatturapa_wt.py | 22 ++++++++++--------- .../wizard/wizard_export_fatturapa.py | 17 +++++++------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 4c5507735bef..e784fcba3ad1 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -7,7 +7,7 @@ 'name': 'ITA - Fattura elettronica - Integrazione ' 'ritenuta', 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.1.1.3', + 'version': '12.0.2.0.0', 'development_status': 'Beta', 'category': 'Hidden', 'website': 'https://github.com/OCA/l10n-italy', diff --git a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot index 68e13a53578a..92b3c46337c4 100644 --- a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot +++ b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot @@ -19,14 +19,8 @@ msgid "Export E-invoice" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:27 +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:47 #, python-format msgid "Missing payment reason for withholding tax %s!" msgstr "" -#. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:24 -#, python-format -msgid "More than one withholding tax in invoice!" -msgstr "" - 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 8d6e7369d156..bb975efe5a3d 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -58,9 +58,9 @@ def setUp(self): 'causale_pagamento_id': self.env.ref( 'l10n_it_causali_pagamento.a').id, 'rate_ids': [(0, 0, { - 'tax': 8.25, - 'base': 1, - })] + 'tax': 8.25, + 'base': 1, + })] } self.enasarco = self.env['withholding.tax'].create(wt_vals) wt_vals = { @@ -74,9 +74,9 @@ def setUp(self): 'causale_pagamento_id': self.env.ref( 'l10n_it_causali_pagamento.a').id, 'rate_ids': [(0, 0, { - 'tax': 5.25, - 'base': 1, - })] + 'tax': 5.25, + 'base': 1, + })] } self.inps = self.env['withholding.tax'].create(wt_vals) @@ -243,7 +243,8 @@ def test_e_invoice_wt_enas_2(self): self.check_content( xml_content, 'IT06363391001_00016.xml', module_name='l10n_it_fatturapa_out_wt') - + + def test_e_invoice_wt_inps_0(self): self.set_sequences(17, '2019-01-07') invoice = self.invoice_model.create({ @@ -282,7 +283,8 @@ def test_e_invoice_wt_inps_0(self): self.check_content( xml_content, 'IT06363391001_00017.xml', module_name='l10n_it_fatturapa_out_wt') - + + def test_e_invoice_wt_inps_1(self): """ Fill DatiCassaPrevidenziale with INPS data @@ -326,7 +328,8 @@ def test_e_invoice_wt_inps_1(self): self.check_content( xml_content, 'IT06363391001_00018.xml', module_name='l10n_it_fatturapa_out_wt') - + + def test_e_invoice_wt_inps_2(self): """ Fill DatiCassaPrevidenziale with INPS data, @@ -371,4 +374,3 @@ def test_e_invoice_wt_inps_2(self): self.check_content( xml_content, 'IT06363391001_00019.xml', module_name='l10n_it_fatturapa_out_wt') - \ No newline at end of file diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index 5f397dfe0997..3fed0f0cd457 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -5,7 +5,6 @@ from odoo.tools.float_utils import float_round from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( DatiRitenutaType, - AltriDatiGestionaliType, DatiCassaPrevidenzialeType, DatiRiepilogoType ) @@ -23,9 +22,10 @@ 'enpam': 'TC09', } + class WizardExportFatturapa(models.TransientModel): _inherit = "wizard.export.fatturapa" - + def getTipoRitenuta(self, wt_types, partner): if wt_types == 'ritenuta': if partner.is_company: @@ -35,14 +35,13 @@ def getTipoRitenuta(self, wt_types, partner): else: tipoRitenuta = WT_TAX_CODE[wt_types] return tipoRitenuta - + def setDatiGeneraliDocumento(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento( invoice, body) - ritenuta_lines = invoice.withholding_tax_line_ids - # if len(ritenuta_lines) > 1: - # raise UserError( - # _("More than one withholding tax in invoice!")) + # Get consistent ordering for file generation for compare with test XML + ritenuta_lines = invoice.withholding_tax_line_ids.sorted( + key=lambda l: l.withholding_tax_id.code) for wt_line in ritenuta_lines: if not wt_line.withholding_tax_id.causale_pagamento_id.code: raise UserError(_('Missing payment reason for ' @@ -81,14 +80,14 @@ def setDatiGeneraliDocumento(self, invoice, body): def get_tax_riepilogo(self, body, tax_id): for riepilogo in body.DatiBeniServizi.DatiRiepilogo: if float(riepilogo.AliquotaIVA) == 0.0 \ - and riepilogo.Natura == tax_id.kind_id.code: + and riepilogo.Natura == tax_id.kind_id.code: return riepilogo def setDatiRiepilogo(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiRiepilogo( invoice, body) wt_lines_to_write = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types not in ('ritenuta', 'other') + lambda x: x.withholding_tax_id.wt_types not in ('ritenuta', 'other') and x.withholding_tax_id.use_daticassaprev ) for wt_line in wt_lines_to_write: From fe6fd7f8c9eaaba716d38f0d7607f3adf3cbaf18 Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Thu, 4 Feb 2021 12:42:57 +0100 Subject: [PATCH 11/18] [FIX] demo nature data remove no more selectable --- .../tests/data/IT06363391001_00015.xml | 6 +++--- .../tests/data/IT06363391001_00016.xml | 8 ++++---- .../tests/data/IT06363391001_00018.xml | 6 +++--- .../tests/data/IT06363391001_00019.xml | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml index 499f80b90df4..1c71b747f7e8 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml @@ -83,7 +83,7 @@ 8.25 0.83 0.00 - N2 + N2.2 12.20 SI @@ -107,7 +107,7 @@ 0.00 - N2 + N2.2 0.83 0.00 Escluso Art. 13 5C DPR 633/72 @@ -122,4 +122,4 @@ - \ No newline at end of file + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml index e4a0d31db6d5..aedfe4b84235 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml @@ -83,7 +83,7 @@ 8.25 0.83 0.00 - N2 + N2.2 10.00 SI @@ -99,11 +99,11 @@ 10.00 0.00 SI - N2 + N2.2 0.00 - N2 + N2.2 10.83 0.00 Escluso Art. 13 5C DPR 633/72 @@ -118,4 +118,4 @@ - \ No newline at end of file + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml index 9f83d464bfcf..8c0ee6a0ad2f 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml @@ -83,7 +83,7 @@ 5.25 0.53 0.00 - N2 + N2.2 12.20 SI @@ -107,7 +107,7 @@ 0.00 - N2 + N2.2 0.83 0.00 Escluso Art. 13 5C DPR 633/72 @@ -122,4 +122,4 @@ - \ No newline at end of file + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml index cb3baaf639b5..b7371ebfed45 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml @@ -83,7 +83,7 @@ 5.25 0.53 0.00 - N2 + N2.2 10.00 SI @@ -99,11 +99,11 @@ 10.00 0.00 SI - N2 + N2.2 0.00 - N2 + N2.2 10.83 0.00 Escluso Art. 13 5C DPR 633/72 @@ -118,4 +118,4 @@ - \ No newline at end of file + From 3cd15a142f737c92adfaeaf49f32fd124567b6ff Mon Sep 17 00:00:00 2001 From: Sergio Corato Date: Mon, 31 May 2021 17:25:37 +0000 Subject: [PATCH 12/18] Added translation using Weblate (Italian) --- l10n_it_fatturapa_out_wt/i18n/it.po | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 l10n_it_fatturapa_out_wt/i18n/it.po diff --git a/l10n_it_fatturapa_out_wt/i18n/it.po b/l10n_it_fatturapa_out_wt/i18n/it.po new file mode 100644 index 000000000000..a9e84217b808 --- /dev/null +++ b/l10n_it_fatturapa_out_wt/i18n/it.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_it_fatturapa_out_wt +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: l10n_it_fatturapa_out_wt +#: model:ir.model,name:l10n_it_fatturapa_out_wt.model_wizard_export_fatturapa +msgid "Export E-invoice" +msgstr "" + +#. module: l10n_it_fatturapa_out_wt +#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:47 +#, python-format +msgid "Missing payment reason for withholding tax %s!" +msgstr "" From 76d41bfe540c4f3b7eb51494143e1a448cdd38df Mon Sep 17 00:00:00 2001 From: Sergio Corato Date: Mon, 31 May 2021 17:26:26 +0000 Subject: [PATCH 13/18] Translated using Weblate (Italian) Currently translated at 100.0% (2 of 2 strings) Translation: l10n-italy-12.0/l10n-italy-12.0-l10n_it_fatturapa_out_wt Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_fatturapa_out_wt/it/ --- l10n_it_fatturapa_out_wt/i18n/it.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/i18n/it.po b/l10n_it_fatturapa_out_wt/i18n/it.po index a9e84217b808..ff89d7dc2134 100644 --- a/l10n_it_fatturapa_out_wt/i18n/it.po +++ b/l10n_it_fatturapa_out_wt/i18n/it.po @@ -6,21 +6,23 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2021-05-31 19:48+0000\n" +"Last-Translator: Sergio Corato \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: l10n_it_fatturapa_out_wt #: model:ir.model,name:l10n_it_fatturapa_out_wt.model_wizard_export_fatturapa msgid "Export E-invoice" -msgstr "" +msgstr "Esporta E-fattura" #. module: l10n_it_fatturapa_out_wt #: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:47 #, python-format msgid "Missing payment reason for withholding tax %s!" -msgstr "" +msgstr "Causale di pagamento mancante per la ritenuta d'acconto %s!" From 8d336f574bfd0eac9556f7e1471dad1c4921274f Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Wed, 29 Jun 2022 16:31:37 +0200 Subject: [PATCH 14/18] [IMP] l10n_it_fatturapa_out_wt: black, isort, prettier --- l10n_it_fatturapa_out_wt/__manifest__.py | 33 +- l10n_it_fatturapa_out_wt/tests/__init__.py | 1 - .../tests/data/IT06363391001_00011.xml | 5 +- .../tests/data/IT06363391001_00014.xml | 7 +- .../tests/data/IT06363391001_00015.xml | 8 +- .../tests/data/IT06363391001_00016.xml | 8 +- .../tests/data/IT06363391001_00017.xml | 7 +- .../tests/data/IT06363391001_00018.xml | 8 +- .../tests/data/IT06363391001_00019.xml | 8 +- .../tests/test_fatturapa_wt.py | 695 ++++++++++-------- l10n_it_fatturapa_out_wt/wizard/__init__.py | 1 - .../wizard/wizard_export_fatturapa.py | 117 ++- 12 files changed, 503 insertions(+), 395 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index e784fcba3ad1..ceeb5720521e 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -4,22 +4,21 @@ # Copyright 2018-2019 Lorenzo Battistini # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - 'name': 'ITA - Fattura elettronica - Integrazione ' - 'ritenuta', - 'summary': 'Modulo ponte tra emissione fatture elettroniche e ritenute.', - 'version': '12.0.2.0.0', - 'development_status': 'Beta', - 'category': 'Hidden', - 'website': 'https://github.com/OCA/l10n-italy', - 'author': 'Sergio Corato, Odoo Community Association (OCA)', - 'license': 'AGPL-3', - 'depends': [ - 'l10n_it_fatturapa', - 'l10n_it_fatturapa_out', - 'l10n_it_withholding_tax', - 'l10n_it_withholding_tax_causali', + "name": "ITA - Fattura elettronica - Integrazione " "ritenuta", + "summary": "Modulo ponte tra emissione fatture elettroniche e ritenute.", + "version": "12.0.2.0.0", + "development_status": "Beta", + "category": "Hidden", + "website": "https://github.com/OCA/l10n-italy", + "author": "Sergio Corato, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "l10n_it_fatturapa", + "l10n_it_fatturapa_out", + "l10n_it_withholding_tax", + "l10n_it_withholding_tax_causali", ], - 'data': [], - 'installable': True, - 'auto_install': True, + "data": [], + "installable": True, + "auto_install": True, } diff --git a/l10n_it_fatturapa_out_wt/tests/__init__.py b/l10n_it_fatturapa_out_wt/tests/__init__.py index 0b572b5283b1..b980725c5efc 100644 --- a/l10n_it_fatturapa_out_wt/tests/__init__.py +++ b/l10n_it_fatturapa_out_wt/tests/__init__.py @@ -1,2 +1 @@ - from . import test_fatturapa_wt diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml index 750a2cf681ee..3fd495be61f7 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00011.xml @@ -1,4 +1,7 @@ - + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml index 62e62d11764d..98e59404a04c 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00014.xml @@ -1,4 +1,7 @@ - + @@ -106,4 +109,4 @@ - \ No newline at end of file + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml index 1c71b747f7e8..10540db330ee 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00015.xml @@ -1,6 +1,7 @@ + xmlns:ns1="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" + versione="FPR12" +> @@ -110,7 +111,8 @@ N2.2 0.83 0.00 - Escluso Art. 13 5C DPR 633/72 + Escluso Art. 13 5C DPR 633/72 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml index aedfe4b84235..b681bab41589 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00016.xml @@ -1,6 +1,7 @@ + xmlns:ns1="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" + versione="FPR12" +> @@ -106,7 +107,8 @@ N2.2 10.83 0.00 - Escluso Art. 13 5C DPR 633/72 + Escluso Art. 13 5C DPR 633/72 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml index 24d061d89797..8085a287fea8 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml @@ -1,4 +1,7 @@ - + @@ -106,4 +109,4 @@ - \ No newline at end of file + diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml index 8c0ee6a0ad2f..17e4438e7fa7 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml @@ -1,6 +1,7 @@ + xmlns:ns1="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" + versione="FPR12" +> @@ -110,7 +111,8 @@ N2.2 0.83 0.00 - Escluso Art. 13 5C DPR 633/72 + Escluso Art. 13 5C DPR 633/72 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml index b7371ebfed45..2121e0b77bd5 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml @@ -1,6 +1,7 @@ + xmlns:ns1="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2" + versione="FPR12" +> @@ -106,7 +107,8 @@ N2.2 10.83 0.00 - Escluso Art. 13 5C DPR 633/72 + Escluso Art. 13 5C DPR 633/72 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 bb975efe5a3d..fb473b7ecf65 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -1,376 +1,479 @@ - import base64 -from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import ( - FatturaPACommon) +from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import FatturaPACommon -class TestInvoiceWT(FatturaPACommon): +class TestInvoiceWT(FatturaPACommon): def setUp(self): super(TestInvoiceWT, self).setUp() - 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.wt_account_payable = self.env['account.account'].create({ - 'name': 'Debiti per ritenute da versare', - 'code': 'WT_001', - 'user_type_id': type_payable.id, - 'reconcile': True, - }) - self.wt_account_receivable = self.env['account.account'].create({ - 'name': 'Crediti per ritenute subite', - 'code': 'WT_002', - 'user_type_id': type_receivable.id, - 'reconcile': True, - }) - self.journal_misc = self.env['account.journal'].search( - [('type', '=', 'general')])[0] - vals_payment = { - 'name': "", - 'line_ids': [(0, 0, {'value': 'balance', 'days': 15})] + 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.wt_account_payable = self.env["account.account"].create( + { + "name": "Debiti per ritenute da versare", + "code": "WT_001", + "user_type_id": type_payable.id, + "reconcile": True, + } + ) + self.wt_account_receivable = self.env["account.account"].create( + { + "name": "Crediti per ritenute subite", + "code": "WT_002", + "user_type_id": type_receivable.id, + "reconcile": True, } - self.payment_term_15 = self.env['account.payment.term'].create( - vals_payment) + ) + self.journal_misc = self.env["account.journal"].search( + [("type", "=", "general")] + )[0] + vals_payment = { + "name": "", + "line_ids": [(0, 0, {"value": "balance", "days": 15})], + } + self.payment_term_15 = self.env["account.payment.term"].create(vals_payment) wt_vals = { - 'name': 'Code 1040', - 'code': '1040', - 'certification': True, - 'account_receivable_id': self.wt_account_receivable.id, - '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, - 'rate_ids': [(0, 0, { - 'tax': 20, - 'base': 1, - })] + "name": "Code 1040", + "code": "1040", + "certification": True, + "account_receivable_id": self.wt_account_receivable.id, + "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, + "rate_ids": [ + ( + 0, + 0, + { + "tax": 20, + "base": 1, + }, + ) + ], } - self.wt1040 = self.env['withholding.tax'].create(wt_vals) + self.wt1040 = self.env["withholding.tax"].create(wt_vals) wt_vals = { - 'name': 'Enasarco', - 'code': 'Enasarco', - 'account_receivable_id': self.wt_account_receivable.id, - 'account_payable_id': self.wt_account_payable.id, - '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, - 'rate_ids': [(0, 0, { - 'tax': 8.25, - 'base': 1, - })] - } - self.enasarco = self.env['withholding.tax'].create(wt_vals) + "name": "Enasarco", + "code": "Enasarco", + "account_receivable_id": self.wt_account_receivable.id, + "account_payable_id": self.wt_account_payable.id, + "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, + "rate_ids": [ + ( + 0, + 0, + { + "tax": 8.25, + "base": 1, + }, + ) + ], + } + self.enasarco = self.env["withholding.tax"].create(wt_vals) wt_vals = { - 'name': 'INPS', - 'code': 'INPS', - 'account_receivable_id': self.wt_account_receivable.id, - 'account_payable_id': self.wt_account_payable.id, - '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, - 'rate_ids': [(0, 0, { - 'tax': 5.25, - 'base': 1, - })] - } - self.inps = self.env['withholding.tax'].create(wt_vals) + "name": "INPS", + "code": "INPS", + "account_receivable_id": self.wt_account_receivable.id, + "account_payable_id": self.wt_account_payable.id, + "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, + "rate_ids": [ + ( + 0, + 0, + { + "tax": 5.25, + "base": 1, + }, + ) + ], + } + self.inps = self.env["withholding.tax"].create(wt_vals) def test_e_invoice_wt(self): - self.set_sequences(13, '2019-01-07') - invoice = self.invoice_model.create({ - 'date_invoice': '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - '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])] - }), - ], - }) + self.set_sequences(13, "2019-01-07") + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "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])], + }, + ), + ], + } + ) invoice._onchange_invoice_line_wt_ids() invoice.action_invoice_open() res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00011.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00011.xml") # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, 'IT06363391001_00011.xml', - module_name='l10n_it_fatturapa_out_wt') + xml_content, + "IT06363391001_00011.xml", + module_name="l10n_it_fatturapa_out_wt", + ) 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', - '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - '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, - self.enasarco.id, - ])] - }), - ], - }) + self.set_sequences(14, "2019-01-07") + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "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, + self.enasarco.id, + ], + ) + ], + }, + ), + ], + } + ) invoice._onchange_invoice_line_wt_ids() invoice.action_invoice_open() res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00014.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00014.xml") # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, 'IT06363391001_00014.xml', - module_name='l10n_it_fatturapa_out_wt') + xml_content, + "IT06363391001_00014.xml", + module_name="l10n_it_fatturapa_out_wt", + ) def test_e_invoice_wt_enas_1(self): """ Fill DatiCassaPrevidenziale with Enasarco data """ - self.set_sequences(15, '2019-01-07') + self.set_sequences(15, "2019-01-07") self.enasarco.use_daticassaprev = True self.enasarco.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create({ - 'date_invoice': '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - '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, - self.enasarco.id, - ])] - }), - ], - }) + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "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, + self.enasarco.id, + ], + ) + ], + }, + ), + ], + } + ) invoice._onchange_invoice_line_wt_ids() invoice.action_invoice_open() res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00015.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00015.xml") # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, 'IT06363391001_00015.xml', - module_name='l10n_it_fatturapa_out_wt') + xml_content, + "IT06363391001_00015.xml", + module_name="l10n_it_fatturapa_out_wt", + ) def test_e_invoice_wt_enas_2(self): """ Fill DatiCassaPrevidenziale with Enasarco data, when DatiRiepilogo already has 0 VAT """ - self.set_sequences(16, '2019-01-07') + self.set_sequences(16, "2019-01-07") self.enasarco.use_daticassaprev = True self.enasarco.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create({ - 'date_invoice': '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - 'uom_id': self.product_uom_unit.id, - 'price_unit': 10, - 'invoice_line_tax_ids': [(6, 0, [self.tax_0.id])], - 'invoice_line_tax_wt_ids': [(6, 0, [ - self.wt1040.id, - self.enasarco.id, - ])] - }), - ], - }) + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "uom_id": self.product_uom_unit.id, + "price_unit": 10, + "invoice_line_tax_ids": [(6, 0, [self.tax_0.id])], + "invoice_line_tax_wt_ids": [ + ( + 6, + 0, + [ + self.wt1040.id, + self.enasarco.id, + ], + ) + ], + }, + ), + ], + } + ) invoice._onchange_invoice_line_wt_ids() invoice.action_invoice_open() res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00016.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00016.xml") # XML doc to be validated xml_content = base64.decodebytes(attachment.datas) self.check_content( - xml_content, 'IT06363391001_00016.xml', - module_name='l10n_it_fatturapa_out_wt') + xml_content, + "IT06363391001_00016.xml", + module_name="l10n_it_fatturapa_out_wt", + ) 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', - '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - '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, - self.inps.id, - ])] - }), + self.set_sequences(17, "2019-01-07") + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "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, + self.inps.id, + ], + ) + ], + }, + ), ], - }) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00017.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00017.xml") - # 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 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" + ) def test_e_invoice_wt_inps_1(self): - """ - Fill DatiCassaPrevidenziale with INPS data - """ - self.set_sequences(18, '2019-01-07') - self.inps.use_daticassaprev = True - self.inps.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create({ - 'date_invoice': '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - '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, - self.inps.id, - ])] - }), + """ + Fill DatiCassaPrevidenziale with INPS data + """ + self.set_sequences(18, "2019-01-07") + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "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, + self.inps.id, + ], + ) + ], + }, + ), ], - }) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00018.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00018.xml") - # 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 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" + ) def test_e_invoice_wt_inps_2(self): - """ - Fill DatiCassaPrevidenziale with INPS data, - when DatiRiepilogo already has 0 VAT - """ - self.set_sequences(19, '2019-01-07') - self.inps.use_daticassaprev = True - self.inps.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create({ - 'date_invoice': '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, - 'user_id': self.user_demo.id, - 'type': 'out_invoice', - 'currency_id': self.EUR.id, - 'invoice_line_ids': [ - (0, 0, { - 'account_id': self.a_sale.id, - 'name': 'Service', - 'quantity': 1, - 'uom_id': self.product_uom_unit.id, - 'price_unit': 10, - 'invoice_line_tax_ids': [(6, 0, [self.tax_0.id])], - 'invoice_line_tax_wt_ids': [(6, 0, [ - self.wt1040.id, - self.inps.id, - ])] - }), + """ + Fill DatiCassaPrevidenziale with INPS data, + when DatiRiepilogo already has 0 VAT + """ + self.set_sequences(19, "2019-01-07") + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create( + { + "date_invoice": "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, + "user_id": self.user_demo.id, + "type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "uom_id": self.product_uom_unit.id, + "price_unit": 10, + "invoice_line_tax_ids": [(6, 0, [self.tax_0.id])], + "invoice_line_tax_wt_ids": [ + ( + 6, + 0, + [ + self.wt1040.id, + self.inps.id, + ], + ) + ], + }, + ), ], - }) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_invoice_open() + res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res['res_id']) - self.set_e_invoice_file_id(attachment, 'IT06363391001_00019.xml') + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00019.xml") - # 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 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" + ) diff --git a/l10n_it_fatturapa_out_wt/wizard/__init__.py b/l10n_it_fatturapa_out_wt/wizard/__init__.py index a5be93d64228..5196bb6ea240 100644 --- a/l10n_it_fatturapa_out_wt/wizard/__init__.py +++ b/l10n_it_fatturapa_out_wt/wizard/__init__.py @@ -1,2 +1 @@ - from . import wizard_export_fatturapa diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index 3fed0f0cd457..6208ebfbea8f 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -1,25 +1,20 @@ - from odoo import models -from odoo.tools.translate import _ from odoo.exceptions import Warning as UserError from odoo.tools.float_utils import float_round +from odoo.tools.translate import _ + from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( - DatiRitenutaType, DatiCassaPrevidenzialeType, - DatiRiepilogoType + DatiRiepilogoType, + DatiRitenutaType, ) -WT_TAX_CODE = { - 'inps': 'RT03', - 'enasarco': 'RT04', - 'enpam': 'RT05', - 'other': 'RT06' -} +WT_TAX_CODE = {"inps": "RT03", "enasarco": "RT04", "enpam": "RT05", "other": "RT06"} TC_CODE = { - 'inps': 'TC22', - 'enasarco': 'TC07', - 'enpam': 'TC09', + "inps": "TC22", + "enasarco": "TC07", + "enpam": "TC09", } @@ -27,67 +22,65 @@ class WizardExportFatturapa(models.TransientModel): _inherit = "wizard.export.fatturapa" def getTipoRitenuta(self, wt_types, partner): - if wt_types == 'ritenuta': + if wt_types == "ritenuta": if partner.is_company: - tipoRitenuta = 'RT02' + tipoRitenuta = "RT02" else: - tipoRitenuta = 'RT01' + tipoRitenuta = "RT01" else: tipoRitenuta = WT_TAX_CODE[wt_types] return tipoRitenuta def setDatiGeneraliDocumento(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento( - invoice, body) + res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento(invoice, body) # Get consistent ordering for file generation for compare with test XML ritenuta_lines = invoice.withholding_tax_line_ids.sorted( - key=lambda l: l.withholding_tax_id.code) + key=lambda l: l.withholding_tax_id.code + ) for wt_line in ritenuta_lines: if not wt_line.withholding_tax_id.causale_pagamento_id.code: - raise UserError(_('Missing payment reason for ' - 'withholding tax %s!') - % wt_line.withholding_tax_id.name) - tipoRitenuta = self.getTipoRitenuta( - wt_line.withholding_tax_id.wt_types, - invoice.partner_id + raise UserError( + _("Missing payment reason for " "withholding tax %s!") + % wt_line.withholding_tax_id.name ) + tipoRitenuta = self.getTipoRitenuta( + wt_line.withholding_tax_id.wt_types, invoice.partner_id + ) body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta.append( DatiRitenutaType( TipoRitenuta=tipoRitenuta, - ImportoRitenuta='%.2f' % float_round(wt_line.tax, 2), - AliquotaRitenuta='%.2f' % float_round( - wt_line.withholding_tax_id.tax, 2), - CausalePagamento=wt_line.withholding_tax_id. - causale_pagamento_id.code - )) + ImportoRitenuta="%.2f" % float_round(wt_line.tax, 2), + AliquotaRitenuta="%.2f" + % float_round(wt_line.withholding_tax_id.tax, 2), + CausalePagamento=wt_line.withholding_tax_id.causale_pagamento_id.code, + ) + ) if wt_line.withholding_tax_id.use_daticassaprev: tax_id = wt_line.withholding_tax_id.daticassprev_tax_id tax_kind = tax_id.kind_id.code - body.DatiGenerali.DatiGeneraliDocumento.\ - DatiCassaPrevidenziale.append( - DatiCassaPrevidenzialeType( - TipoCassa=TC_CODE[wt_line.withholding_tax_id.wt_types], - AlCassa='%.2f' % float_round( - wt_line.withholding_tax_id.tax, 2), - ImportoContributoCassa='%.2f' % float_round( - wt_line.tax, 2), - AliquotaIVA='0.00', - Natura=tax_kind, - ) - ) + body.DatiGenerali.DatiGeneraliDocumento.DatiCassaPrevidenziale.append( + DatiCassaPrevidenzialeType( + TipoCassa=TC_CODE[wt_line.withholding_tax_id.wt_types], + AlCassa="%.2f" % float_round(wt_line.withholding_tax_id.tax, 2), + ImportoContributoCassa="%.2f" % float_round(wt_line.tax, 2), + AliquotaIVA="0.00", + Natura=tax_kind, + ) + ) return res def get_tax_riepilogo(self, body, tax_id): for riepilogo in body.DatiBeniServizi.DatiRiepilogo: - if float(riepilogo.AliquotaIVA) == 0.0 \ - and riepilogo.Natura == tax_id.kind_id.code: + if ( + float(riepilogo.AliquotaIVA) == 0.0 + and riepilogo.Natura == tax_id.kind_id.code + ): return riepilogo def setDatiRiepilogo(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiRiepilogo( - invoice, body) + res = super(WizardExportFatturapa, self).setDatiRiepilogo(invoice, body) wt_lines_to_write = invoice.withholding_tax_line_ids.filtered( - lambda x: x.withholding_tax_id.wt_types not in ('ritenuta', 'other') + lambda x: x.withholding_tax_id.wt_types not in ("ritenuta", "other") and x.withholding_tax_id.use_daticassaprev ) for wt_line in wt_lines_to_write: @@ -96,41 +89,39 @@ def setDatiRiepilogo(self, invoice, body): if tax_riepilogo: base_amount = float(tax_riepilogo.ImponibileImporto) base_amount += wt_line.tax - tax_riepilogo.ImponibileImporto = '%.2f' % float_round( - base_amount, 2) + tax_riepilogo.ImponibileImporto = "%.2f" % float_round(base_amount, 2) else: riepilogo = DatiRiepilogoType( - AliquotaIVA='0.00', - ImponibileImporto='%.2f' % float_round(wt_line.tax, 2), - Imposta='0.00', + AliquotaIVA="0.00", + ImponibileImporto="%.2f" % float_round(wt_line.tax, 2), + Imposta="0.00", Natura=tax_id.kind_id.code, RiferimentoNormativo=tax_id.law_reference, ) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return res - def setDettaglioLinea( - self, line_no, line, body, price_precision, uom_precision - ): + def setDettaglioLinea(self, line_no, line, body, price_precision, uom_precision): DettaglioLinea = super(WizardExportFatturapa, self).setDettaglioLinea( line_no, line, body, price_precision, uom_precision ) if any([wt for wt in line.invoice_line_tax_wt_ids]): - DettaglioLinea.Ritenuta = 'SI' + DettaglioLinea.Ritenuta = "SI" return DettaglioLinea def setDatiPagamento(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiPagamento( - invoice, body) + res = super(WizardExportFatturapa, self).setDatiPagamento(invoice, body) if invoice.withholding_tax_line_ids and invoice.payment_term_id: payment_line_ids = invoice.get_receivable_line_ids() index = 0 rate = invoice.amount_net_pay / invoice.amount_total - move_line_pool = self.env['account.move.line'] + move_line_pool = self.env["account.move.line"] for move_line_id in payment_line_ids: move_line = move_line_pool.browse(move_line_id) - body.DatiPagamento[0].DettaglioPagamento[index].\ - ImportoPagamento = '%.2f' % float_round( - (move_line.amount_currency or move_line.debit) * rate, 2) + body.DatiPagamento[0].DettaglioPagamento[ + index + ].ImportoPagamento = "%.2f" % float_round( + (move_line.amount_currency or move_line.debit) * rate, 2 + ) index += 1 return res From 4db6ca9b82086995e3eeb007c8f2ab89296e8c89 Mon Sep 17 00:00:00 2001 From: Ciro Urselli Date: Fri, 6 Aug 2021 09:56:33 +0200 Subject: [PATCH 15/18] [MIG] l10n_it_fatturapa_ou_wt: Migration to 14.0 Co-authored-by: Marco Colombo --- l10n_it_fatturapa_out_wt/README.rst | 12 +- l10n_it_fatturapa_out_wt/__init__.py | 1 - l10n_it_fatturapa_out_wt/__manifest__.py | 9 +- l10n_it_fatturapa_out_wt/i18n/it.po | 2 +- .../i18n/l10n_it_fatturapa_out_wt.pot | 30 +- .../readme/CONTRIBUTORS.rst | 2 + .../static/description/index.html | 8 +- .../tests/data/IT06363391001_00017.xml | 2 +- .../tests/data/IT06363391001_00018.xml | 4 +- .../tests/data/IT06363391001_00019.xml | 4 +- .../tests/test_fatturapa_wt.py | 424 ++++++++++-------- .../account_invoice_it_dati_ritenuta.xml | 76 ++++ .../wizard/wizard_export_fatturapa.py | 164 +++---- 13 files changed, 416 insertions(+), 322 deletions(-) create mode 100644 l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml diff --git a/l10n_it_fatturapa_out_wt/README.rst b/l10n_it_fatturapa_out_wt/README.rst index cb8a5dac843d..559d163ea58d 100644 --- a/l10n_it_fatturapa_out_wt/README.rst +++ b/l10n_it_fatturapa_out_wt/README.rst @@ -14,13 +14,13 @@ ITA - Fattura elettronica - Integrazione ritenuta :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_out_wt + :target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_out_wt :alt: OCA/l10n-italy .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_fatturapa_out_wt + :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_out_wt :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/12.0 + :target: https://runbot.odoo-community.org/runbot/122/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -64,6 +64,8 @@ Contributors ~~~~~~~~~~~~ * Sergio Corato +* Ciro Urselli +* Marco Colombo Maintainers ~~~~~~~~~~~ @@ -78,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/l10n-italy `_ project on GitHub. +This module is part of the `OCA/l10n-italy `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_out_wt/__init__.py b/l10n_it_fatturapa_out_wt/__init__.py index 4b25b9723083..78369e77d948 100644 --- a/l10n_it_fatturapa_out_wt/__init__.py +++ b/l10n_it_fatturapa_out_wt/__init__.py @@ -1,3 +1,2 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - from . import wizard diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index ceeb5720521e..998b39cecb91 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -2,11 +2,12 @@ # Copyright 2018 Openforce Srls Unipersonale (www.openforce.it) # Copyright 2018 Sergio Corato (https://efatto.it) # Copyright 2018-2019 Lorenzo Battistini +# Copyright 2021 Ciro Urselli # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "ITA - Fattura elettronica - Integrazione " "ritenuta", "summary": "Modulo ponte tra emissione fatture elettroniche e ritenute.", - "version": "12.0.2.0.0", + "version": "14.0.1.0.0", "development_status": "Beta", "category": "Hidden", "website": "https://github.com/OCA/l10n-italy", @@ -16,9 +17,11 @@ "l10n_it_fatturapa", "l10n_it_fatturapa_out", "l10n_it_withholding_tax", - "l10n_it_withholding_tax_causali", + "l10n_it_withholding_tax_reason", + ], + "data": [ + "views/account_invoice_it_dati_ritenuta.xml", ], - "data": [], "installable": True, "auto_install": True, } diff --git a/l10n_it_fatturapa_out_wt/i18n/it.po b/l10n_it_fatturapa_out_wt/i18n/it.po index ff89d7dc2134..f2f8d7b476a3 100644 --- a/l10n_it_fatturapa_out_wt/i18n/it.po +++ b/l10n_it_fatturapa_out_wt/i18n/it.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2021-05-31 19:48+0000\n" "Last-Translator: Sergio Corato \n" diff --git a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot index 92b3c46337c4..4cf1d3794a8c 100644 --- a/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot +++ b/l10n_it_fatturapa_out_wt/i18n/l10n_it_fatturapa_out_wt.pot @@ -1,26 +1,44 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_it_fatturapa_out_wt +# * l10n_it_fatturapa_out_wt # 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" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: l10n_it_fatturapa_out_wt +#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_out_wt.wt_account_invoice_it_dati_cassa_previdenziale +msgid "0.00" +msgstr "" + +#. module: l10n_it_fatturapa_out_wt +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_wt.field_wizard_export_fatturapa__display_name +msgid "Display Name" +msgstr "" + #. module: l10n_it_fatturapa_out_wt #: model:ir.model,name:l10n_it_fatturapa_out_wt.model_wizard_export_fatturapa msgid "Export E-invoice" msgstr "" #. module: l10n_it_fatturapa_out_wt -#: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:47 -#, python-format -msgid "Missing payment reason for withholding tax %s!" +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_wt.field_wizard_export_fatturapa__id +msgid "ID" msgstr "" +#. module: l10n_it_fatturapa_out_wt +#: model:ir.model.fields,field_description:l10n_it_fatturapa_out_wt.field_wizard_export_fatturapa____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_it_fatturapa_out_wt +#: model_terms:ir.ui.view,arch_db:l10n_it_fatturapa_out_wt.wt_account_invoice_line_ritenuta +msgid "SI" +msgstr "" diff --git a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst index feb5b093f570..1d21b59fc395 100644 --- a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst +++ b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst @@ -1 +1,3 @@ * Sergio Corato +* Ciro Urselli +* Marco Colombo diff --git a/l10n_it_fatturapa_out_wt/static/description/index.html b/l10n_it_fatturapa_out_wt/static/description/index.html index 37e54814c979..833b8d74ba58 100644 --- a/l10n_it_fatturapa_out_wt/static/description/index.html +++ b/l10n_it_fatturapa_out_wt/static/description/index.html @@ -367,7 +367,7 @@

ITA - Fattura elettronica - Integrazione ritenuta

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/l10n-italy Translate me on Weblate Try me on Runbot

Italiano

Modulo ponte tra emissione fatture elettroniche e ritenute.

Con questo modulo, l’elemento XML DatiRitenuta verrà correttamente valorizzato.

@@ -391,7 +391,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -406,6 +406,8 @@

Authors

Contributors

@@ -415,7 +417,7 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/l10n-italy project on GitHub.

+

This module is part of the OCA/l10n-italy project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml index 8085a287fea8..a3636b24fd27 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00017.xml @@ -8,7 +8,7 @@ IT 06363391001
- 00014 + 00017 FPR12 0000000 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml index 17e4438e7fa7..331939245ad7 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00018.xml @@ -8,7 +8,7 @@ IT 06363391001 - 00015 + 00018 FPR12 0000000 @@ -109,7 +109,7 @@ 0.00 N2.2 - 0.83 + 0.53 0.00 Escluso Art. 13 5C DPR 633/72 diff --git a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml index 2121e0b77bd5..8d22b577a6d9 100644 --- a/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml +++ b/l10n_it_fatturapa_out_wt/tests/data/IT06363391001_00019.xml @@ -8,7 +8,7 @@ IT 06363391001 - 00016 + 00019 FPR12 0000000 @@ -105,7 +105,7 @@ 0.00 N2.2 - 10.83 + 10.53 0.00 Escluso Art. 13 5C DPR 633/72 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 fb473b7ecf65..43c07b0b417c 100644 --- a/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py +++ b/l10n_it_fatturapa_out_wt/tests/test_fatturapa_wt.py @@ -1,14 +1,50 @@ import base64 +from odoo.tests import tagged + from odoo.addons.l10n_it_fatturapa_out.tests.fatturapa_common import FatturaPACommon +@tagged("post_install", "-at_install") 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", @@ -41,7 +77,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, @@ -62,7 +98,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, @@ -81,9 +117,9 @@ def setUp(self): "account_receivable_id": self.wt_account_receivable.id, "account_payable_id": self.wt_account_payable.id, "journal_id": self.journal_misc.id, - "wt_types": "enasarco", + "wt_types": "inps", "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, @@ -99,15 +135,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": [ ( @@ -117,9 +154,9 @@ 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])], + "tax_ids": [(6, 0, [self.tax_22.id])], "invoice_line_tax_wt_ids": [(6, 0, [self.wt1040.id])], }, ), @@ -127,7 +164,7 @@ def test_e_invoice_wt(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"]) @@ -145,13 +182,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": [ ( @@ -161,9 +198,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, @@ -180,7 +217,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"]) @@ -203,13 +240,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": [ ( @@ -219,9 +256,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, @@ -238,7 +275,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"]) @@ -262,13 +299,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": [ ( @@ -278,9 +315,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, @@ -297,7 +334,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"]) @@ -311,169 +348,172 @@ def test_e_invoice_wt_enas_2(self): module_name="l10n_it_fatturapa_out_wt", ) + def test_e_invoice_wt_inps_0(self): + self.set_sequences(17, "2019-01-07") + invoice = self.invoice_model.create( + { + "name": "INV/2019/0017", + "invoice_date": "2019-01-07", + "partner_id": self.res_partner_fatturapa_2.id, + "journal_id": self.sales_journal.id, + "invoice_payment_term_id": self.account_payment_term.id, + "user_id": self.user_demo.id, + "move_type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "product_uom_id": self.product_uom_unit.id, + "price_unit": 10, + "tax_ids": [(6, 0, [self.tax_22.id])], + "invoice_line_tax_wt_ids": [ + ( + 6, + 0, + [ + self.wt1040.id, + self.inps.id, + ], + ) + ], + }, + ), + ], + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_post() + res = self.run_wizard(invoice.id) -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", - "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, - "user_id": self.user_demo.id, - "type": "out_invoice", - "currency_id": self.EUR.id, - "invoice_line_ids": [ - ( - 0, - 0, - { - "account_id": self.a_sale.id, - "name": "Service", - "quantity": 1, - "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, - self.inps.id, - ], - ) - ], - }, - ), - ], - } - ) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) - - attachment = self.attach_model.browse(res["res_id"]) - self.set_e_invoice_file_id(attachment, "IT06363391001_00017.xml") - - # 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" - ) - + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00017.xml") -def test_e_invoice_wt_inps_1(self): - """ - Fill DatiCassaPrevidenziale with INPS data - """ - self.set_sequences(18, "2019-01-07") - self.inps.use_daticassaprev = True - self.inps.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create( - { - "date_invoice": "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, - "user_id": self.user_demo.id, - "type": "out_invoice", - "currency_id": self.EUR.id, - "invoice_line_ids": [ - ( - 0, - 0, - { - "account_id": self.a_sale.id, - "name": "Service", - "quantity": 1, - "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, - self.inps.id, - ], - ) - ], - }, - ), - ], - } - ) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) + # 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", + ) - attachment = self.attach_model.browse(res["res_id"]) - self.set_e_invoice_file_id(attachment, "IT06363391001_00018.xml") + def test_e_invoice_wt_inps_1(self): + """ + Fill DatiCassaPrevidenziale with INPS data + """ + self.set_sequences(18, "2019-01-07") + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create( + { + "name": "INV/2019/0018", + "invoice_date": "2019-01-07", + "partner_id": self.res_partner_fatturapa_2.id, + "journal_id": self.sales_journal.id, + "invoice_payment_term_id": self.account_payment_term.id, + "user_id": self.user_demo.id, + "move_type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "product_uom_id": self.product_uom_unit.id, + "price_unit": 10, + "tax_ids": [(6, 0, [self.tax_22.id])], + "invoice_line_tax_wt_ids": [ + ( + 6, + 0, + [ + self.wt1040.id, + self.inps.id, + ], + ) + ], + }, + ), + ], + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_post() + res = self.run_wizard(invoice.id) - # 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" - ) + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00018.xml") + # 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", + ) -def test_e_invoice_wt_inps_2(self): - """ - Fill DatiCassaPrevidenziale with INPS data, - when DatiRiepilogo already has 0 VAT - """ - self.set_sequences(19, "2019-01-07") - self.inps.use_daticassaprev = True - self.inps.daticassprev_tax_id = self.tax_0 - invoice = self.invoice_model.create( - { - "date_invoice": "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, - "user_id": self.user_demo.id, - "type": "out_invoice", - "currency_id": self.EUR.id, - "invoice_line_ids": [ - ( - 0, - 0, - { - "account_id": self.a_sale.id, - "name": "Service", - "quantity": 1, - "uom_id": self.product_uom_unit.id, - "price_unit": 10, - "invoice_line_tax_ids": [(6, 0, [self.tax_0.id])], - "invoice_line_tax_wt_ids": [ - ( - 6, - 0, - [ - self.wt1040.id, - self.inps.id, - ], - ) - ], - }, - ), - ], - } - ) - invoice._onchange_invoice_line_wt_ids() - invoice.action_invoice_open() - res = self.run_wizard(invoice.id) + def test_e_invoice_wt_inps_2(self): + """ + Fill DatiCassaPrevidenziale with INPS data, + when DatiRiepilogo already has 0 VAT + """ + self.set_sequences(19, "2019-01-07") + self.inps.use_daticassaprev = True + self.inps.daticassprev_tax_id = self.tax_0 + invoice = self.invoice_model.create( + { + "name": "INV/2019/0019", + "invoice_date": "2019-01-07", + "partner_id": self.res_partner_fatturapa_2.id, + "journal_id": self.sales_journal.id, + "invoice_payment_term_id": self.account_payment_term.id, + "user_id": self.user_demo.id, + "move_type": "out_invoice", + "currency_id": self.EUR.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "account_id": self.a_sale.id, + "name": "Service", + "quantity": 1, + "product_uom_id": self.product_uom_unit.id, + "price_unit": 10, + "tax_ids": [(6, 0, [self.tax_0.id])], + "invoice_line_tax_wt_ids": [ + ( + 6, + 0, + [ + self.wt1040.id, + self.inps.id, + ], + ) + ], + }, + ), + ], + } + ) + invoice._onchange_invoice_line_wt_ids() + invoice.action_post() + res = self.run_wizard(invoice.id) - attachment = self.attach_model.browse(res["res_id"]) - self.set_e_invoice_file_id(attachment, "IT06363391001_00019.xml") + attachment = self.attach_model.browse(res["res_id"]) + self.set_e_invoice_file_id(attachment, "IT06363391001_00019.xml") - # 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 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", + ) 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 new file mode 100644 index 000000000000..7e53db25bd4a --- /dev/null +++ b/l10n_it_fatturapa_out_wt/views/account_invoice_it_dati_ritenuta.xml @@ -0,0 +1,76 @@ + + + + + + + + + + diff --git a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py index 6208ebfbea8f..698b85d8d376 100644 --- a/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py +++ b/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py @@ -1,127 +1,79 @@ -from odoo import models -from odoo.exceptions import Warning as UserError +from odoo import api, models from odoo.tools.float_utils import float_round -from odoo.tools.translate import _ -from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import ( - DatiCassaPrevidenzialeType, - DatiRiepilogoType, - DatiRitenutaType, +from odoo.addons.l10n_it_account.tools.account_tools import encode_for_export +from odoo.addons.l10n_it_fatturapa_out.wizard.wizard_export_fatturapa import ( + format_numbers, ) -WT_TAX_CODE = {"inps": "RT03", "enasarco": "RT04", "enpam": "RT05", "other": "RT06"} - -TC_CODE = { - "inps": "TC22", - "enasarco": "TC07", - "enpam": "TC09", -} - class WizardExportFatturapa(models.TransientModel): - _inherit = "wizard.export.fatturapa" - def getTipoRitenuta(self, wt_types, partner): - if wt_types == "ritenuta": - if partner.is_company: - tipoRitenuta = "RT02" - else: - tipoRitenuta = "RT01" - else: - tipoRitenuta = WT_TAX_CODE[wt_types] - return tipoRitenuta + WT_TAX_CODE = {"inps": "RT03", "enasarco": "RT04", "enpam": "RT05", "other": "RT06"} - def setDatiGeneraliDocumento(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento(invoice, body) - # Get consistent ordering for file generation for compare with test XML - ritenuta_lines = invoice.withholding_tax_line_ids.sorted( - key=lambda l: l.withholding_tax_id.code - ) - for wt_line in ritenuta_lines: - if not wt_line.withholding_tax_id.causale_pagamento_id.code: - raise UserError( - _("Missing payment reason for " "withholding tax %s!") - % wt_line.withholding_tax_id.name - ) - tipoRitenuta = self.getTipoRitenuta( - wt_line.withholding_tax_id.wt_types, invoice.partner_id - ) - body.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta.append( - DatiRitenutaType( - TipoRitenuta=tipoRitenuta, - ImportoRitenuta="%.2f" % float_round(wt_line.tax, 2), - AliquotaRitenuta="%.2f" - % float_round(wt_line.withholding_tax_id.tax, 2), - CausalePagamento=wt_line.withholding_tax_id.causale_pagamento_id.code, - ) - ) - if wt_line.withholding_tax_id.use_daticassaprev: - tax_id = wt_line.withholding_tax_id.daticassprev_tax_id - tax_kind = tax_id.kind_id.code - body.DatiGenerali.DatiGeneraliDocumento.DatiCassaPrevidenziale.append( - DatiCassaPrevidenzialeType( - TipoCassa=TC_CODE[wt_line.withholding_tax_id.wt_types], - AlCassa="%.2f" % float_round(wt_line.withholding_tax_id.tax, 2), - ImportoContributoCassa="%.2f" % float_round(wt_line.tax, 2), - AliquotaIVA="0.00", - Natura=tax_kind, - ) - ) - return res + _inherit = "wizard.export.fatturapa" - def get_tax_riepilogo(self, body, tax_id): - for riepilogo in body.DatiBeniServizi.DatiRiepilogo: - if ( - float(riepilogo.AliquotaIVA) == 0.0 - and riepilogo.Natura == tax_id.kind_id.code - ): - return riepilogo + @api.model + def getAllTaxes(self, invoice): + def _key(tax_id): + return tax_id.id - def setDatiRiepilogo(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiRiepilogo(invoice, body) + res = super(WizardExportFatturapa, self).getAllTaxes(invoice) wt_lines_to_write = invoice.withholding_tax_line_ids.filtered( lambda x: x.withholding_tax_id.wt_types not in ("ritenuta", "other") and x.withholding_tax_id.use_daticassaprev ) for wt_line in wt_lines_to_write: tax_id = wt_line.withholding_tax_id.daticassprev_tax_id - tax_riepilogo = self.get_tax_riepilogo(body, tax_id) - if tax_riepilogo: - base_amount = float(tax_riepilogo.ImponibileImporto) - base_amount += wt_line.tax - tax_riepilogo.ImponibileImporto = "%.2f" % float_round(base_amount, 2) + key = _key(tax_id) + if key in res: + base_amount = float(res[key]["ImponibileImporto"]) + wt_line.tax + res[key]["ImponibileImporto"] = float_round(base_amount, 2) else: - riepilogo = DatiRiepilogoType( - AliquotaIVA="0.00", - ImponibileImporto="%.2f" % float_round(wt_line.tax, 2), - Imposta="0.00", - Natura=tax_id.kind_id.code, - RiferimentoNormativo=tax_id.law_reference, - ) - body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) + res[key] = { + "AliquotaIVA": format_numbers(0.0), + "Natura": tax_id.kind_id.code, + # possibile tag (non gestito) + # 'Arrotondamento':'', + "ImponibileImporto": float_round(wt_line.tax, 2), + "Imposta": 0.0, + "EsigibilitaIVA": tax_id.payability, + } + if tax_id.law_reference: + res[key]["RiferimentoNormativo"] = encode_for_export( + tax_id.law_reference, 100 + ) return res - def setDettaglioLinea(self, line_no, line, body, price_precision, uom_precision): - DettaglioLinea = super(WizardExportFatturapa, self).setDettaglioLinea( - line_no, line, body, price_precision, uom_precision + @api.model + def getPayments(self, invoice): + payments = super().getPayments(invoice) + wt_hack_rate = ( + invoice.amount_net_pay / invoice.amount_total + if invoice.withholding_tax_line_ids + else 1.0 ) - if any([wt for wt in line.invoice_line_tax_wt_ids]): - DettaglioLinea.Ritenuta = "SI" - return DettaglioLinea + for payment in payments: + payment.amount_currency *= wt_hack_rate + payment.debit *= wt_hack_rate + return payments - def setDatiPagamento(self, invoice, body): - res = super(WizardExportFatturapa, self).setDatiPagamento(invoice, body) - if invoice.withholding_tax_line_ids and invoice.payment_term_id: - payment_line_ids = invoice.get_receivable_line_ids() - index = 0 - rate = invoice.amount_net_pay / invoice.amount_total - move_line_pool = self.env["account.move.line"] - for move_line_id in payment_line_ids: - move_line = move_line_pool.browse(move_line_id) - body.DatiPagamento[0].DettaglioPagamento[ - index - ].ImportoPagamento = "%.2f" % float_round( - (move_line.amount_currency or move_line.debit) * rate, 2 - ) - index += 1 - return res + @api.model + def getWithholdingType(self, wt_types, partner): + if wt_types == "ritenuta": + if partner.is_company: + withholding_type = "RT02" + else: + withholding_type = "RT01" + else: + withholding_type = self.WT_TAX_CODE[wt_types] + return withholding_type + + @api.model + def getTemplateValues(self, template_values): + def get_withholding_type(wt_types, partner): + return self.getWithholdingType(wt_types, partner) + + template_values = super().getTemplateValues(template_values) + template_values.update({"get_withholding_type": get_withholding_type}) + return template_values From c46e7e2bc6343cc34874ce1d9fe41e8bbb68b4b4 Mon Sep 17 00:00:00 2001 From: Sergio Zanchetta Date: Tue, 8 Nov 2022 08:17:48 +0000 Subject: [PATCH 16/18] Translated using Weblate (Italian) Currently translated at 100.0% (2 of 2 strings) Translation: l10n-italy-14.0/l10n-italy-14.0-l10n_it_fatturapa_out_wt Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_out_wt/it/ --- l10n_it_fatturapa_out_wt/i18n/it.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/i18n/it.po b/l10n_it_fatturapa_out_wt/i18n/it.po index f2f8d7b476a3..e82177607235 100644 --- a/l10n_it_fatturapa_out_wt/i18n/it.po +++ b/l10n_it_fatturapa_out_wt/i18n/it.po @@ -6,20 +6,20 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-05-31 19:48+0000\n" -"Last-Translator: Sergio Corato \n" +"PO-Revision-Date: 2022-11-08 08:57+0000\n" +"Last-Translator: Sergio Zanchetta \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.14.1\n" #. module: l10n_it_fatturapa_out_wt #: model:ir.model,name:l10n_it_fatturapa_out_wt.model_wizard_export_fatturapa msgid "Export E-invoice" -msgstr "Esporta E-fattura" +msgstr "Esporta e-fattura" #. module: l10n_it_fatturapa_out_wt #: code:addons/l10n_it_fatturapa_out_wt/wizard/wizard_export_fatturapa.py:47 From 40a5c9c80c07bec7bd119d1c13d651c6744d3c8f Mon Sep 17 00:00:00 2001 From: Borruso Date: Fri, 17 Feb 2023 14:35:08 +0100 Subject: [PATCH 17/18] [IMP] l10n_it_fatturapa_out_wt: pre-commit stuff --- .../odoo/addons/l10n_it_fatturapa_out_wt | 1 + setup/l10n_it_fatturapa_out_wt/setup.py | 6 ++++++ 2 files changed, 7 insertions(+) create mode 120000 setup/l10n_it_fatturapa_out_wt/odoo/addons/l10n_it_fatturapa_out_wt create mode 100644 setup/l10n_it_fatturapa_out_wt/setup.py diff --git a/setup/l10n_it_fatturapa_out_wt/odoo/addons/l10n_it_fatturapa_out_wt b/setup/l10n_it_fatturapa_out_wt/odoo/addons/l10n_it_fatturapa_out_wt new file mode 120000 index 000000000000..9a62739d02d7 --- /dev/null +++ b/setup/l10n_it_fatturapa_out_wt/odoo/addons/l10n_it_fatturapa_out_wt @@ -0,0 +1 @@ +../../../../l10n_it_fatturapa_out_wt \ No newline at end of file diff --git a/setup/l10n_it_fatturapa_out_wt/setup.py b/setup/l10n_it_fatturapa_out_wt/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/l10n_it_fatturapa_out_wt/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 7caf705cd42744e09e869ff31c4ddd530aad1a7c Mon Sep 17 00:00:00 2001 From: Borruso Date: Fri, 17 Feb 2023 17:40:34 +0100 Subject: [PATCH 18/18] [MIG] l10n_it_fatturapa_out_wt: Migration to 16.0 --- l10n_it_fatturapa_out_wt/README.rst | 15 +++++++------ l10n_it_fatturapa_out_wt/__manifest__.py | 2 +- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 9 ++++---- .../tests/test_fatturapa_wt.py | 18 ++++----------- .../account_invoice_it_dati_ritenuta.xml | 22 +++++++++---------- 6 files changed, 30 insertions(+), 37 deletions(-) diff --git a/l10n_it_fatturapa_out_wt/README.rst b/l10n_it_fatturapa_out_wt/README.rst index 559d163ea58d..bfeb374f7c08 100644 --- a/l10n_it_fatturapa_out_wt/README.rst +++ b/l10n_it_fatturapa_out_wt/README.rst @@ -14,14 +14,14 @@ ITA - Fattura elettronica - Integrazione ritenuta :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_out_wt + :target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fatturapa_out_wt :alt: OCA/l10n-italy .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_out_wt + :target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_fatturapa_out_wt :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/14.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-italy&target_branch=16.0 + :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -66,6 +66,7 @@ Contributors * Sergio Corato * Ciro Urselli * Marco Colombo +* Giuseppe Borruso Maintainers ~~~~~~~~~~~ @@ -80,6 +81,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/l10n-italy `_ project on GitHub. +This module is part of the `OCA/l10n-italy `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_out_wt/__manifest__.py b/l10n_it_fatturapa_out_wt/__manifest__.py index 998b39cecb91..465f482d47bc 100644 --- a/l10n_it_fatturapa_out_wt/__manifest__.py +++ b/l10n_it_fatturapa_out_wt/__manifest__.py @@ -7,7 +7,7 @@ { "name": "ITA - Fattura elettronica - Integrazione " "ritenuta", "summary": "Modulo ponte tra emissione fatture elettroniche e ritenute.", - "version": "14.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Beta", "category": "Hidden", "website": "https://github.com/OCA/l10n-italy", diff --git a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst index 1d21b59fc395..835cc3728604 100644 --- a/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst +++ b/l10n_it_fatturapa_out_wt/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Sergio Corato * Ciro Urselli * Marco Colombo +* Giuseppe Borruso diff --git a/l10n_it_fatturapa_out_wt/static/description/index.html b/l10n_it_fatturapa_out_wt/static/description/index.html index 833b8d74ba58..249306dd80a3 100644 --- a/l10n_it_fatturapa_out_wt/static/description/index.html +++ b/l10n_it_fatturapa_out_wt/static/description/index.html @@ -3,7 +3,7 @@ - + ITA - Fattura elettronica - Integrazione ritenuta