Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ivess/addons
1 result
Show changes
Commits on Source (2)
# -*- 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)