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

🐛 (generation) Correu asincron #161

Merged
merged 3 commits into from
Jan 28, 2025
Merged
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
13 changes: 11 additions & 2 deletions som_generationkwh/investment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@ def send_mail(self, cursor, uid, id, model, template, investment_id=None, contex
PEAccounts = self.pool.get('poweremail.core_accounts')
MailMockup = self.pool.get('generationkwh.mailmockup')
IrModelData = self.pool.get('ir.model.data')
PoweremailSendWizard = self.pool.get('poweremail.send.wizard')

if not investment_id:
investment_id = id
Expand All @@ -1654,7 +1655,7 @@ def send_mail(self, cursor, uid, id, model, template, investment_id=None, contex
('name','=','Generation kWh')
])
else:
from_id = from_id[:1]
from_id = from_id[0]

ctx = context.copy()
ctx.update({
Expand All @@ -1665,6 +1666,7 @@ def send_mail(self, cursor, uid, id, model, template, investment_id=None, contex
'from': from_id,
'state': 'single',
'priority': '0',
'template_id': template_id,
})

with AsyncMode('sync') as asmode:
Expand All @@ -1676,7 +1678,14 @@ def send_mail(self, cursor, uid, id, model, template, investment_id=None, contex
from_id = from_id,
).dump())
else:
PETemplate.generate_mail(cursor, uid, template_id, id, context=ctx)
params = {
'state': 'single',
'priority': '0',
'from': ctx['from']
}

poweremail_wizard_id = PoweremailSendWizard.create(cursor, uid, params, context=ctx)
PoweremailSendWizard.send_mail(cursor, uid, [poweremail_wizard_id], context=ctx)

def cancel(self,cursor,uid, ids, context=None):
User = self.pool.get('res.users')
Expand Down
Loading