diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index 803a9cc6ab..a7464b8a1b 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -55,7 +55,7 @@ class AccountPayment(models.Model): JOIN account_journal journal ON journal.id = move.journal_id, account_payment other_payment JOIN account_move other_move ON other_move.id = other_payment.move_id - WHERE payment.check_number::INTEGER = other_payment.check_number::INTEGER + WHERE payment.check_number::BIGINT = other_payment.check_number::BIGINT AND move.journal_id = other_move.journal_id AND payment.id != other_payment.id AND payment.id IN %(ids)s diff --git a/addons/account_check_printing/tests/test_print_check.py b/addons/account_check_printing/tests/test_print_check.py index 7506c4dbb3..3c4ad3aa4d 100644 --- a/addons/account_check_printing/tests/test_print_check.py +++ b/addons/account_check_printing/tests/test_print_check.py @@ -161,3 +161,19 @@ class TestPrintCheck(AccountTestInvoicingCommon): })._create_payments() self.assertEqual(set(payments.mapped('check_number')), {str(x) for x in range(11111, 11111 + nb_invoices_to_test)}) + + def test_print_great_pre_number_check(self): + """ + Make sure we can use integer of more than 2147483647 in check sequence + limit of `integer` type in psql: https://www.postgresql.org/docs/current/datatype-numeric.html + """ + payment = self.env['account.payment'].create({ + 'payment_type': 'outbound', + 'partner_type': 'supplier', + 'amount': 100.0, + 'journal_id': self.company_data['default_journal_bank'].id, + 'payment_method_id': self.payment_method_check.id, + }) + payment.action_post() + self.assertTrue(payment.write({'check_number': '2147483647'})) + self.assertTrue(payment.write({'check_number': '2147483648'})) diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index 50c4e5a46b..fba80fdfed 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -432,7 +432,12 @@ class BaseAutomation(models.Model): """ Patch method `name` on `model`, unless it has been patched already. """ if model not in patched_models[name]: patched_models[name].add(model) - model._patch_method(name, method) + ModelClass = type(model) + origin = getattr(ModelClass, name) + method.origin = origin + wrapped = api.propagate(origin, method) + wrapped.origin = origin + setattr(ModelClass, name, wrapped) # retrieve all actions, and patch their corresponding model for action_rule in self.with_context({}).search([]): diff --git a/addons/l10n_ch/models/account_invoice.py b/addons/l10n_ch/models/account_invoice.py index f0849c1f05..8863edd70d 100644 --- a/addons/l10n_ch/models/account_invoice.py +++ b/addons/l10n_ch/models/account_invoice.py @@ -285,6 +285,8 @@ class AccountMove(models.Model): def isr_print(self): """ Triggered by the 'Print ISR' button. + This button isn't available anymore and will be removed in 16.2. + This function is kept for stable policy. """ self.ensure_one() if self.l10n_ch_isr_valid: diff --git a/addons/l10n_ch/models/mail_template.py b/addons/l10n_ch/models/mail_template.py index d96888e468..ee8e10a29b 100644 --- a/addons/l10n_ch/models/mail_template.py +++ b/addons/l10n_ch/models/mail_template.py @@ -30,13 +30,6 @@ class MailTemplate(models.Model): inv_print_name = self._render_field('report_name', record.ids, compute_lang=True)[record.id] new_attachments = [] - if record.l10n_ch_isr_valid: - # We add an attachment containing the ISR - isr_report_name = 'ISR-' + inv_print_name + '.pdf' - isr_pdf = self.env.ref('l10n_ch.l10n_ch_isr_report')._render_qweb_pdf(record.ids)[0] - isr_pdf = base64.b64encode(isr_pdf) - new_attachments.append((isr_report_name, isr_pdf)) - if record.move_type == 'out_invoice' and record.partner_bank_id._eligible_for_qr_code('ch_qr', record.partner_id, record.currency_id): # We add an attachment containing the QR-bill qr_report_name = 'QR-bill-' + inv_print_name + '.pdf' @@ -49,6 +42,5 @@ class MailTemplate(models.Model): if attachments_list: attachments_list.extend(new_attachments) else: - record_dict['attachments'] = new_attachments - + record_dict['attachments'] = new_attachments return result diff --git a/addons/l10n_ch/views/account_invoice_view.xml b/addons/l10n_ch/views/account_invoice_view.xml index c3da57ad38..57ed9f2837 100644 --- a/addons/l10n_ch/views/account_invoice_view.xml +++ b/addons/l10n_ch/views/account_invoice_view.xml @@ -12,34 +12,6 @@ -