Skip to content

Commit

Permalink
[ADD] edoc send email in move mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
corredato authored and mileo committed Sep 15, 2024
1 parent 6544103 commit 14a8457
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions l10n_br_account/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,8 @@ def action_document_back2draft(self):
if self.move_ids:
self.move_ids.button_draft()
return result

def _edoc_subscribe(self):
if self.move_ids:
self.move_ids._edoc_subscribe()
return

Check warning on line 188 in l10n_br_account/models/document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/document.py#L187-L188

Added lines #L187 - L188 were not covered by tests
7 changes: 1 addition & 6 deletions l10n_br_fiscal/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,7 @@ def send_email(self):

email_template_id = self._get_email_template()
if email_template_id:
partner_ids = self.partner_id.filtered("edoc_send_email")
partner_child_ids = self.partner_id.child_ids.filtered("edoc_send_email")
all_partner_ids = partner_ids | partner_child_ids

self.message_subscribe(partner_ids=all_partner_ids.ids)

self._edoc_subscribe()
attachment_ids = []
if self.authorization_file_id:
attachment_ids.append(self.authorization_file_id.id)
Expand Down
7 changes: 7 additions & 0 deletions l10n_br_fiscal/models/document_move_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,10 @@ def _onchange_fiscal_operation_id(self):
)
self.document_subsequent_ids = subsequent_documents
return result

def _edoc_subscribe(self):
partner_ids = self.partner_id.filtered("edoc_send_email")
partner_child_ids = self.partner_id.child_ids.filtered("edoc_send_email")
all_partner_ids = partner_ids | partner_child_ids

self.message_subscribe(partner_ids=all_partner_ids.ids)

0 comments on commit 14a8457

Please sign in to comment.