diff --git a/l10n_fr_das2/models/l10n_fr_das2.py b/l10n_fr_das2/models/l10n_fr_das2.py index 36a0aae3a..a7c86c772 100644 --- a/l10n_fr_das2/models/l10n_fr_das2.py +++ b/l10n_fr_das2/models/l10n_fr_das2.py @@ -175,10 +175,17 @@ def name_get(self): return res def done(self): - self.write({"state": "done"}) + vals = {"state": "done"} + if self.line_ids: + attach = self.generate_file() + vals["attachment_id"] = attach.id + self.write(vals) return def back2draft(self): + if self.attachment_id: + self.attachment_id.unlink() + self.message_post(body=_("DAS2 file deleted.")) self.write({"state": "draft"}) return @@ -692,8 +699,8 @@ def generate_file(self): "datas": base64.encodebytes(file_content_encoded), } ) - self.attachment_id = attach.id self.message_post(body=_("DAS2 file generated.")) + return attach def button_lines_fullscreen(self): self.ensure_one() diff --git a/l10n_fr_das2/readme/USAGE.rst b/l10n_fr_das2/readme/USAGE.rst index 5eb3d5429..b83b182df 100644 --- a/l10n_fr_das2/readme/USAGE.rst +++ b/l10n_fr_das2/readme/USAGE.rst @@ -7,7 +7,7 @@ Then click on the button *Generate Lines*. Check and edit the generated lines. Y You should also have a look in the chatter: you may have a message that warn you about suppliers that have expenses recorded in accounts such as 622100 Commissions et courtages sur achats, 622200 Commissions et courtages sur ventes, 622600 Honoraires, 622800 Rémunérations d'intermédiaires divers, 653000 Jetons de présence, 651600 Droits d'auteur et de reproduction and are not configured for DAS2. -Once your declaration is OK, click on the button *Generate File* and download the generated file. +Once your declaration is OK, click on the button *Done*: it will generate the DAS2 file and set the declaration to *Done* state (all the fields become readonly). Connect to DAS2_declaration_, select *Transmission par internet des fichiers TD/bilatéral* and type your login and password (the credentials are specific to this website; their are not the same as on *impots.gouv.fr*). Then follow the online declaration process and upload the file generated by Odoo. diff --git a/l10n_fr_das2/views/l10n_fr_das2.xml b/l10n_fr_das2/views/l10n_fr_das2.xml index 965f7c641..9ce545351 100644 --- a/l10n_fr_das2/views/l10n_fr_das2.xml +++ b/l10n_fr_das2/views/l10n_fr_das2.xml @@ -20,12 +20,12 @@ states="draft" class="btn-primary" /> -