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 Jan 28, 2025
1 parent 0281580 commit 718a4e4
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 @@ -193,6 +193,11 @@ def action_document_back2draft(self):
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 199 in l10n_br_account/models/document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/document.py#L198-L199

Added lines #L198 - L199 were not covered by tests

def exec_after_SITUACAO_EDOC_DENEGADA(self, old_state, new_state):
self.ensure_one()
models_cancel_on_deny = [MODELO_FISCAL_NFE, MODELO_FISCAL_CTE]
Expand Down
7 changes: 1 addition & 6 deletions l10n_br_fiscal/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,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 @@ -259,3 +259,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 718a4e4

Please sign in to comment.