From 36895bb69ec8f22f0a54c00573e0750db0915ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Santib=C3=A1=C3=B1ez=20Polanco?= Date: Fri, 13 Sep 2024 05:11:28 -0300 Subject: [PATCH 1/5] [ADD] missed default partial account_reconcile_model --- .../scripts/account/15.0.1.2/post-migration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py index 5d889f44bc1d..daf96bb63863 100644 --- a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py @@ -74,12 +74,28 @@ def _handle_website_legal_page(env): ) view_temp.unlink() +def add_default_partial_account_reconcile_model(env): + openupgrade.logged_query( + env.cr, + """ + INSERT INTO account_reconcile_model (name, sequence, rule_type, + auto_reconcile, match_nature, match_same_currency, allow_payment_tolerance, + match_partner, company_id) + SELECT 'Invoices/Bills Partial Match if Underpaid', 2, 'invoice_matching', + FALSE, 'both', TRUE, FALSE, TRUE, arm.company_id + FROM ( + SELECT DISTINCT company_id + FROM account_reconcile_model + WHERE rule_type = 'invoice_matching' + ) AS arm + """) @openupgrade.migrate() def migrate(env, version): _fill_account_analytic_line_category(env) _fill_payment_destination_journal(env) set_res_company_account_setup_taxes_state_done(env) + add_default_partial_account_reconcile_model(env) openupgrade.load_data(env.cr, "account", "15.0.1.2/noupdate_changes.xml") openupgrade.delete_record_translations( env.cr, From e315abfe3662b471dad14c43dba94aa468bfdcfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Santib=C3=A1=C3=B1ez=20Polanco?= Date: Sat, 14 Sep 2024 11:21:28 -0300 Subject: [PATCH 2/5] Add default matching_order = 'old_first' --- .../account/15.0.1.2/post-migration.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py index daf96bb63863..e0197b053a9f 100644 --- a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py @@ -76,19 +76,19 @@ def _handle_website_legal_page(env): def add_default_partial_account_reconcile_model(env): openupgrade.logged_query( - env.cr, - """ - INSERT INTO account_reconcile_model (name, sequence, rule_type, - auto_reconcile, match_nature, match_same_currency, allow_payment_tolerance, - match_partner, company_id) - SELECT 'Invoices/Bills Partial Match if Underpaid', 2, 'invoice_matching', - FALSE, 'both', TRUE, FALSE, TRUE, arm.company_id - FROM ( - SELECT DISTINCT company_id - FROM account_reconcile_model - WHERE rule_type = 'invoice_matching' - ) AS arm - """) + env.cr, + """ + INSERT INTO account_reconcile_model (name, sequence, rule_type, + auto_reconcile, match_nature, match_same_currency, allow_payment_tolerance, + match_partner, matching_order, company_id) + SELECT 'Invoices/Bills Partial Match if Underpaid', 2, 'invoice_matching', + FALSE, 'both', TRUE, FALSE, TRUE, 'old_first', arm.company_id + FROM ( + SELECT DISTINCT company_id + FROM account_reconcile_model + WHERE rule_type = 'invoice_matching' + ) AS arm + """) @openupgrade.migrate() def migrate(env, version): From 958142da408f981d3e9fbae841bb5e64ecabbf55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Santib=C3=A1=C3=B1ez=20Polanco?= Date: Sat, 14 Sep 2024 11:30:48 -0300 Subject: [PATCH 3/5] [FIX]payment_tolerance_type = 'percentage' --- .../scripts/account/15.0.1.2/post-migration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py index e0197b053a9f..91873eaec1b0 100644 --- a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py @@ -80,15 +80,16 @@ def add_default_partial_account_reconcile_model(env): """ INSERT INTO account_reconcile_model (name, sequence, rule_type, auto_reconcile, match_nature, match_same_currency, allow_payment_tolerance, - match_partner, matching_order, company_id) + match_partner, matching_order, payment_tolerance_type, company_id) SELECT 'Invoices/Bills Partial Match if Underpaid', 2, 'invoice_matching', - FALSE, 'both', TRUE, FALSE, TRUE, 'old_first', arm.company_id + FALSE, 'both', TRUE, FALSE, TRUE, 'old_first', 'percentage', arm.company_id FROM ( SELECT DISTINCT company_id FROM account_reconcile_model WHERE rule_type = 'invoice_matching' ) AS arm - """) + """, + ) @openupgrade.migrate() def migrate(env, version): From 28c5e006f6c8107aa35569b7113e6d4d21877a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Santib=C3=A1=C3=B1ez=20Polanco?= Date: Sat, 14 Sep 2024 11:47:58 -0300 Subject: [PATCH 4/5] fix precommit --- openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py index 91873eaec1b0..1cf432ebf038 100644 --- a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py @@ -91,6 +91,7 @@ def add_default_partial_account_reconcile_model(env): """, ) + @openupgrade.migrate() def migrate(env, version): _fill_account_analytic_line_category(env) From 6370a2f3adea97fba14d5da15f63293c64b4ddbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Santib=C3=A1=C3=B1ez=20Polanco?= Date: Sat, 14 Sep 2024 12:12:16 -0300 Subject: [PATCH 5/5] [FIX]precommit --- openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py index 1cf432ebf038..37950085e528 100644 --- a/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/15.0.1.2/post-migration.py @@ -74,6 +74,7 @@ def _handle_website_legal_page(env): ) view_temp.unlink() + def add_default_partial_account_reconcile_model(env): openupgrade.logged_query( env.cr,