chore: import enterprise addons 19.0 bulk snapshot

This commit is contained in:
1b-agent committed 2026-09-16 10:13:08 +00:00
commit ca4af030d3
39951 files changed
+15570005

No files matched your search

@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_followup
from . import account_followup_report
from . import res_partner
from . import snailmail_letter
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class Account_FollowupFollowupLine(models.Model):
_inherit = 'account_followup.followup.line'
send_letter = fields.Boolean('Letter', default=False)
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
from odoo.exceptions import UserError
class AccountFollowupReport(models.AbstractModel):
_inherit = "account.followup.report"
@api.model
def _send_snailmail(self, options):
"""
Send by post the followup to the customer's followup contacts
"""
partner = self.env['res.partner'].browse(options.get('partner_id'))
followup_contacts = partner._get_all_followup_contacts() or partner
sent_at_least_once = False
for to_send_partner in followup_contacts:
letter = self.env['snailmail.letter'].create({
'state': 'pending',
'partner_id': to_send_partner.id,
'model': 'res.partner',
'res_id': partner.id,
'user_id': self.env.user.id,
'report_template': self.env.ref('account_followup.action_report_followup').id,
'company_id': to_send_partner.company_id.id or self.env.company.id,
})
# Allow snailmail_letter to generate the attachment using the followup_options
letter.with_context(followup_options=options)._snailmail_print()
if self.env['snailmail.letter']._is_valid_address(letter):
sent_at_least_once = True
if not sent_at_least_once:
raise UserError(_('You are trying to send a letter by post, but no follow-up contact has any address set'))
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class ResPartner(models.Model):
_inherit = 'res.partner'
def send_followup_snailmail(self, options):
"""
Send a follow-up report by post to customers in self
"""
for record in self:
options['partner_id'] = record.id
self.env['account.followup.report']._send_snailmail(options)
def _send_followup(self, options):
# OVERRIDE account_followup/models/res_partner.py
super()._send_followup(options)
followup_line = options.get('followup_line')
if options.get('snailmail', followup_line.send_letter):
self.send_followup_snailmail(options)
def _has_missing_followup_info(self):
res = super()._has_missing_followup_info()
followup_contacts = self._get_all_followup_contacts() or self
if self.followup_line_id.send_letter \
and not any(self.env['snailmail.letter']._is_valid_address(to_send_partner)
for to_send_partner in followup_contacts):
return True
return res
@@ -0,0 +1,13 @@
from odoo import models
class SnailmailLetter(models.Model):
_inherit = 'snailmail.letter'
def _generate_report_pdf(self, report):
followup_report = self.env.ref('account_followup.action_report_followup', raise_if_not_found=False)
if not followup_report or report != followup_report:
return super()._generate_report_pdf(report)
partner = self.env['res.partner'].browse(self.res_id)
options = self.env.context.get('followup_options')
return partner.with_context(snailmail_layout=not self.cover)._get_followup_report_pdf(options)