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 committed Jul 29, 2024
1 parent 67239a3 commit a050017
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/fiscal_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,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 187 in l10n_br_account/models/fiscal_document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/fiscal_document.py#L186-L187

Added lines #L186 - L187 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 @@ -447,12 +447,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 @@ -253,3 +253,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 a050017

Please sign in to comment.