From 98bd6b3ba936841161f4ba14a97f0303f8de4417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20E=2E=20G=C3=B3mez?= Date: Wed, 22 Sep 2021 19:04:47 -0500 Subject: [PATCH] [ADD] Patches for special e-invoice module --- apply_patches.sh | 7 +-- common_exclude_patterns.txt | 1 + install_odoo_code.sh | 9 ++-- ...nvoice-dian_remove-enterprise-module.patch | 3 +- ...ronic-invoice-dian_changes-after-1-8.patch | 45 +++++++++++++++++++ rejected_special_modules.txt | 1 + rejected_vendor_modules.txt | 1 - 7 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 patches/20210922_electronic-invoice-dian_changes-after-1-8.patch create mode 100644 rejected_special_modules.txt diff --git a/apply_patches.sh b/apply_patches.sh index 6a7c435..b504201 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -42,10 +42,11 @@ pt_vendor () DEST=$DESTDIR/vendor/electronic_invoice_dian/ OPTIONS="--directory=$DEST --strip=1" - patch $OPTIONS < patches/20210817_electronic-invoice-dian_sudo-in-email-sent.patch + patch $OPTIONS < patches/20210922_electronic-invoice-dian_changes-after-1-8.patch - # Now included in remote repo: - # patch $OPTIONS < patches/20210607_electronic-invoice-dian_remove-enterprise-module.patch + # Rolled-up in current patch: + # 20210607_electronic-invoice-dian_remove-enterprise-module.patch + # 20210817_electronic-invoice-dian_sudo-in-email-sent.patch } pt_special () diff --git a/common_exclude_patterns.txt b/common_exclude_patterns.txt index 1750125..deb7598 100644 --- a/common_exclude_patterns.txt +++ b/common_exclude_patterns.txt @@ -3,3 +3,4 @@ .vscode *.py[co] [^e]*.po +__pycache__ diff --git a/install_odoo_code.sh b/install_odoo_code.sh index bf6f971..36e5325 100755 --- a/install_odoo_code.sh +++ b/install_odoo_code.sh @@ -67,13 +67,14 @@ cp_vendor () REPO="Avancys v14 for Agofer" SRC=./vendor/ DEST=$DESTDIR/vendor/ + # Exclude proprietary modules and modules included in other repos: + EXCL="--exclude-from=rejected_vendor_modules.txt" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo "(selected modules)" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - # Exclude proprietary modules, and modules included in other repos. - rsync $OPTIONS --exclude-from=rejected_vendor_modules.txt $SRC $DEST + rsync $OPTIONS $EXCL $SRC $DEST } cp_special () @@ -81,12 +82,14 @@ cp_special () REPO="Special Avancys v14 electronic invoice" SRC=./special/ DEST=$DESTDIR/vendor/ + # Exclude modules included in other repos: + EXCL="--exclude-from=rejected_special_modules.txt" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo "(selected modules)" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - rsync $OPTIONS $SRC $DEST + rsync $OPTIONS $EXCL $SRC $DEST } cp_custom () diff --git a/patches/20210607_electronic-invoice-dian_remove-enterprise-module.patch b/patches/20210607_electronic-invoice-dian_remove-enterprise-module.patch index 2bf256f..ba237e2 100644 --- a/patches/20210607_electronic-invoice-dian_remove-enterprise-module.patch +++ b/patches/20210607_electronic-invoice-dian_remove-enterprise-module.patch @@ -5,9 +5,8 @@ diff -rupN electronic_invoice_dian/__manifest__.py electronic_invoice_dian.patch 'website': "http://www.avancys.com", 'category': 'Accounting/Accounting', 'version': '14.0.0.0', -- 'depends': ['account_accountant', 'sale'], + 'depends': ['account', 'sale'], - 'license': 'OEEL-1', -+ 'depends': ['account', 'sale'], + 'license': '', 'installable': True, 'data': [ diff --git a/patches/20210922_electronic-invoice-dian_changes-after-1-8.patch b/patches/20210922_electronic-invoice-dian_changes-after-1-8.patch new file mode 100644 index 0000000..bf37af2 --- /dev/null +++ b/patches/20210922_electronic-invoice-dian_changes-after-1-8.patch @@ -0,0 +1,45 @@ +diff -rupN electronic_invoice_dian.orig/__manifest__.py electronic_invoice_dian.patch/__manifest__.py +--- electronic_invoice_dian.orig/__manifest__.py 2021-09-22 18:22:44.527545853 -0500 ++++ electronic_invoice_dian.patch/__manifest__.py 2021-09-22 18:48:10.756738336 -0500 +@@ -13,7 +13,7 @@ + 'category': 'Accounting/Accounting', + 'version': '14.0.0.0', + 'depends': ['account', 'sale'], +- 'license': 'OEEL-1', ++ 'license': '', + 'installable': True, + 'data': [ + 'data/data.xml', +diff -rupN electronic_invoice_dian.orig/models/account_move.py electronic_invoice_dian.patch/models/account_move.py +--- electronic_invoice_dian.orig/models/account_move.py 2021-09-22 18:22:44.527545853 -0500 ++++ electronic_invoice_dian.patch/models/account_move.py 2021-09-22 18:42:27.141585276 -0500 +@@ -621,7 +621,7 @@ class AccountMove(models.Model): + + def valid_email_address(self): + regex = r'(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)' +- emails = self.partner_id.email or '' ++ emails = self.partner_id.ei_email or self.partner_id.email or '' + email_list = emails.split(';') + return list(filter( + lambda email: re.match(regex, email), +@@ -642,7 +642,7 @@ class AccountMove(models.Model): + continue + email_pool = email_pool + email + invoice.create_transaction_log(invoice, 'email_sent', 'OK') +- invoice.ei_email_sent = True ++ invoice.sudo().ei_email_sent = True + if force_send: + email_pool.send() + +diff -rupN electronic_invoice_dian.orig/templates/customer_acknowledge_email.xml electronic_invoice_dian.patch/templates/customer_acknowledge_email.xml +--- electronic_invoice_dian.orig/templates/customer_acknowledge_email.xml 2021-09-22 18:22:44.527545853 -0500 ++++ electronic_invoice_dian.patch/templates/customer_acknowledge_email.xml 2021-09-07 19:24:15.396238817 -0500 +@@ -6,7 +6,7 @@ + ${object.company_id.email or ''} + ${object.company_id.partner_id.ref_num};${object.company_id.partner_id.name};${object.name};${object.journal_id.resolution_id.document_type};${object.company_id.partner_id.name} + +- ${(object.partner_id.email or object.partner_id.ei_email)} ++ ${(object.partner_id.ei_email or object.partner_id.email)} + ${False} + + diff --git a/rejected_special_modules.txt b/rejected_special_modules.txt new file mode 100644 index 0000000..61e9d83 --- /dev/null +++ b/rejected_special_modules.txt @@ -0,0 +1 @@ +electronic_invoice_dian diff --git a/rejected_vendor_modules.txt b/rejected_vendor_modules.txt index 5caf4aa..04d864e 100644 --- a/rejected_vendor_modules.txt +++ b/rejected_vendor_modules.txt @@ -1,4 +1,3 @@ account_accountant mail_enterprise web_mobile -electronic_invoice_dian