Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] l10n_fr_das2: auto-generate das2 file when draft->done #409

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions l10n_fr_das2/models/l10n_fr_das2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion l10n_fr_das2/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion l10n_fr_das2/views/l10n_fr_das2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
states="draft"
class="btn-primary"
/>
<button name="generate_file" string="Generate File" type="object" />
<button
name="back2draft"
string="Back to Draft"
type="object"
states="done"
confirm="Are you sure you want to go back to draft?"
/>
<button
name="done"
Expand Down