Skip to content
Snippets Groups Projects
Commit 6299ef03 authored by Gonzalo Ajuria's avatar Gonzalo Ajuria
Browse files

Merge branch 'T8243' into '17.0'

[T8243] Change default values in account move send

See merge request !12
parents 0204753d 45821ff9
No related branches found
No related tags found
1 merge request!12[T8243] Change default values in account move send
# -*- coding: utf-8 -*-
from . import models
\ No newline at end of file
from . import models
from . import wizard
......@@ -12,6 +12,7 @@
'product',
'account',
'stock',
'l10n_ar_eynes',
],
'data': [
......
......@@ -37,6 +37,16 @@ class AccountMove(models.Model):
if sequence:
partner.customer_code = sequence.next_by_id()
def _get_mail_template(self):
"""
:return: the correct mail template based on the current move type
"""
return (
'account.email_template_edi_credit_note'
if all(move.move_type == 'out_refund' for move in self)
else 'account.email_template_edi_invoice'
)
# class AccountMoveLine(models.Model):
# _inherit = 'account.move.line'
......
# -*- coding: utf-8 -*-
from . import account_move_send
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
class AccountMoveSend(models.TransientModel):
_inherit = 'account.move.send'
def _get_default_mail_attachments_widget(self, move, mail_template):
return self._get_placeholder_mail_template_dynamic_attachments_data(move, mail_template)
def _download(self, attachment_ids, moves_data=None):
# Descarga adjunto de factura afip
if self.mode == 'invoice_single' and len(attachment_ids) == 1 and moves_data:
move = list(moves_data.keys())[0]
attachments = move.attachment_ids.filtered(lambda r: 'afip' in r.name.lower())
attachments = attachments.sorted(lambda r: r.create_date, reverse=True)
if attachments:
attachment_ids = attachments[0].ids
return super()._download(attachment_ids, moves_data)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment