From cd6b5bbd2ab32d8aada49811c95c7cb526c6b118 Mon Sep 17 00:00:00 2001 From: Parthiv Patel Date: Sun, 26 Feb 2023 08:34:36 +0000 Subject: [PATCH] [PATCH] Upstream patch - 26022023 --- .../models/account_payment.py | 2 +- .../tests/test_print_check.py | 16 ++++ .../base_automation/models/base_automation.py | 7 +- addons/l10n_ch/models/account_invoice.py | 2 + addons/l10n_ch/models/mail_template.py | 10 +-- addons/l10n_ch/views/account_invoice_view.xml | 28 ------ .../data/account_account_tags_data.xml | 12 ++- .../3.1/post-migrate_update_taxes.py | 2 +- .../l10n_it_edi/models/account_edi_format.py | 10 +-- addons/l10n_it_edi/tools/remove_signature.py | 6 +- .../models/account_edi_format.py | 1 + .../models/account_invoice.py | 8 +- addons/mrp/models/mrp_unbuild.py | 19 +--- .../js/Screens/ReceiptScreen/ReceiptScreen.js | 6 +- addons/product/models/product_template.py | 4 +- addons/purchase_stock/models/stock_rule.py | 5 +- .../tests/test_purchase_lead_time.py | 13 ++- .../tests/test_reordering_rule.py | 86 +++++++++++++++++++ .../wizard/snailmail_letter_format_error.py | 4 +- addons/stock/models/stock_picking.py | 4 +- addons/transifex/models/ir_translation.py | 9 +- addons/website/models/assets.py | 7 ++ 22 files changed, 178 insertions(+), 83 deletions(-) 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 @@ -