Skip to content

Commit

Permalink
[MIG] l10n_it_fatturapa_export_zip: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed Sep 6, 2021
1 parent 2e29b7e commit 203d672
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 179 deletions.
16 changes: 8 additions & 8 deletions l10n_it_fatturapa_export_zip/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=======================================================
Italian Localization - Fattura elettronica - Export ZIP
=======================================================
======================================
ITA - Fattura elettronica - Export ZIP
======================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
Expand All @@ -14,13 +14,13 @@ Italian Localization - Fattura elettronica - Export ZIP
: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_export_zip
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_export_zip
: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_export_zip
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_export_zip
: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|
Expand All @@ -44,7 +44,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/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 <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_export_zip%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_export_zip%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -83,6 +83,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sergiocorato|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_export_zip>`_ project on GitHub.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_export_zip>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 4 additions & 3 deletions l10n_it_fatturapa_export_zip/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright 2019 Sergio Corato (https://efatto.it)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Italian Localization - Fattura elettronica - Export ZIP",
"name": "ITA - Fattura elettronica - Export ZIP",
"summary": "Permette di esportare in uno ZIP diversi file XML di "
"fatture elettroniche",
"version": "12.0.1.0.1",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "other",
"category": "Localization/Italy",
"website": "https://github.com/OCA/l10n-italy",
"author": "Efatto.it di Sergio Corato, Odoo Community Association (OCA)",
"maintainers": ["sergiocorato"],
Expand All @@ -18,6 +18,7 @@
"l10n_it_fatturapa_in",
],
"data": [
"security/ir.model.access.csv",
"wizard/export_fatturapa_view.xml",
"views/attachment_view.xml",
],
Expand Down
138 changes: 0 additions & 138 deletions l10n_it_fatturapa_export_zip/i18n/l10n_it_fatturapa_export_zip.pot

This file was deleted.

2 changes: 2 additions & 0 deletions l10n_it_fatturapa_export_zip/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_wizard_fatturapa_export_user,access_wizard_fatturapa_export_user,model_wizard_fatturapa_export,account.group_account_invoice,1,1,1,0
14 changes: 7 additions & 7 deletions l10n_it_fatturapa_export_zip/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Italian Localization - Fattura elettronica - Export ZIP</title>
<meta name="generator" content="Docutils 0.16: http://docutils.sourceforge.net/" />
<title>ITA - Fattura elettronica - Export ZIP</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,14 +360,14 @@
</style>
</head>
<body>
<div class="document" id="italian-localization-fattura-elettronica-export-zip">
<h1 class="title">Italian Localization - Fattura elettronica - Export ZIP</h1>
<div class="document" id="ita-fattura-elettronica-export-zip">
<h1 class="title">ITA - Fattura elettronica - Export ZIP</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_export_zip"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_fatturapa_export_zip"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_export_zip"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_export_zip"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Questo modulo aggiunge una procedura per esportare in uno ZIP diversi file XML di fatture elettroniche.</p>
<p><strong>English</strong></p>
Expand All @@ -389,7 +389,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_export_zip%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_fatturapa_export_zip%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -416,7 +416,7 @@ <h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/sergiocorato"><img alt="sergiocorato" src="https://github.com/sergiocorato.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/12.0/l10n_it_fatturapa_export_zip">OCA/l10n-italy</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_export_zip">OCA/l10n-italy</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
7 changes: 2 additions & 5 deletions l10n_it_fatturapa_export_zip/wizard/export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def _default_name(self):
data = fields.Binary("File", readonly=True)
name = fields.Char("Filename", default=_default_name, required=True)

@api.multi
def export_zip(self):
self.ensure_one()
attachments = self.env[self.env.context["active_model"]].browse(
Expand All @@ -32,27 +31,25 @@ def export_zip(self):
_("Attachment %s already exported. Remove ZIP file first")
% att.display_name
)
if not att.datas or not att.datas_fname:
if not att.datas or not att.name:
raise UserError(
_("Attachment %s does not have XML file") % att.display_name
)

fp = io.BytesIO()
with zipfile.ZipFile(fp, mode="w") as zf:
for att in attachments:
zf.writestr(att.datas_fname, base64.b64decode(att.datas))
zf.writestr(att.name, base64.b64decode(att.datas))
fp.seek(0)
data = fp.read()
attach_vals = {
"name": self.name + ".zip",
"datas_fname": self.name + ".zip",
"datas": base64.encodestring(data),
}
zip_att = self.env["ir.attachment"].create(attach_vals)
for att in attachments:
att.exported_zip = zip_att
return {
"view_type": "form",
"name": _("Export E-Invoices"),
"res_id": zip_att.id,
"view_mode": "form",
Expand Down
37 changes: 19 additions & 18 deletions l10n_it_fatturapa_export_zip/wizard/export_fatturapa_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@
</field>
</record>

<act_window
name="Download ZIP e-invoice XML"
res_model="wizard.fatturapa.export"
src_model="fatturapa.attachment.out"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_fatturapa_out_export"
/>
<record id="action_fatturapa_out_export" model="ir.actions.act_window">
<field name="name">Download ZIP e-invoice XML</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.fatturapa.export</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="model_fatturapa_attachment_out" />
<field name="binding_view_types">list,form</field>
</record>

<record id="action_fatturapa_in_export" model="ir.actions.act_window">
<field name="name">Download ZIP e-invoice XML</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.fatturapa.export</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="model_fatturapa_attachment_in" />
<field name="binding_view_types">list,form</field>
</record>

<act_window
name="Download ZIP e-invoice XML"
res_model="wizard.fatturapa.export"
src_model="fatturapa.attachment.in"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_fatturapa_in_export"
/>
</odoo>

0 comments on commit 203d672

Please sign in to comment.