diff --git a/account_banking_pain_base/models/account_payment_line.py b/account_banking_pain_base/models/account_payment_line.py index 589c3617b..e90f40630 100644 --- a/account_banking_pain_base/models/account_payment_line.py +++ b/account_banking_pain_base/models/account_payment_line.py @@ -55,6 +55,111 @@ class AccountPaymentLine(models.Model): ], string="Category Purpose", help="If neither your bank nor your local regulations oblige you to " "set the category purpose, leave the field empty.") + purpose = fields.Selection( + # Full category purpose list found on: + # https://www.iso20022.org/external_code_list.page + # Document "External Code Sets spreadsheet" version 31 August, 2018 + selection=[ + ('ACCT', 'Account Management'), + ('CASH', 'Cash Management Transfer'), + ('COLL', 'Collection Payment'), + ('INTC', 'Intra Company Payment'), + ('LIMA', 'Liquidity Management'), + ('NETT', 'Netting'), + ('AGRT', 'Agricultural Transfer'), + ('BEXP', 'Business Expenses'), + ('COMC', 'Commercial Payment'), + ('CPYR', 'Copyright'), + ('GDDS', 'Purchase Sale Of Goods'), + ('LICF', 'License Fee'), + ('ROYA', 'Royalties'), + ('SCVE', 'Purchase Sale Of Services'), + ('SUBS', 'Subscription'), + ('SUPP', 'Supplier Payment'), + ('TRAD', 'Trade Services'), + ('CHAR', 'Charity Payment'), + ('COMT', 'Consumer Third Party Consolidated Payment'), + ('CLPR', 'Car Loan Principal Repayment'), + ('GOVI', 'Government Insurance'), + ('HLRP', 'Housing Loan Repayment'), + ('INSU', 'Insurance Premium'), + ('INTE', 'Interest'), + ('LBRI', 'Labor Insurance'), + ('LIFI', 'Life Insurance'), + ('LOAN', 'Loan'), + ('LOAR', 'Loan Repayment'), + ('PPTI', 'Property Insurance'), + ('RINP', 'Recurring Installment Payment'), + ('TRFD', 'Trust Fund'), + ('ADVA', 'Advance Payment'), + ('CCRD', 'Credit Card Payment '), + ('CFEE', 'Cancellation Fee'), + ('COST', 'Costs'), + ('DCRD', 'Debit Card Payment'), + ('GOVT', 'Government Payment'), + ('IHRP', 'Instalment Hire Purchase Agreement'), + ('INSM', 'Installment'), + ('MSVC', 'Multiple Service Types'), + ('NOWS', 'Not Otherwise Specified'), + ('OFEE', 'Opening Fee'), + ('OTHR', 'Other'), + ('PADD', 'Preauthorized debit'), + ('PTSP', 'Payment Terms'), + ('RCPT', 'Receipt Payment'), + ('RENT', 'Rent'), + ('STDY', 'Study'), + ('ANNI', 'Annuity'), + ('CMDT', 'Commodity Transfer'), + ('DERI', 'Derivatives'), + ('DIVD', 'Dividend'), + ('FREX', 'Foreign Exchange'), + ('HEDG', 'Hedging'), + ('PRME', 'Precious Metal'), + ('SAVG', 'Savings'), + ('SECU', 'Securities'), + ('TREA', 'Treasury Payment'), + ('ANTS', 'Anesthesia Services'), + ('CVCF', 'Convalescent Care Facility'), + ('DMEQ', 'Durable Medicale Equipment'), + ('DNTS', 'Dental Services'), + ('HLTC', 'Home Health Care'), + ('HLTI', 'Health Insurance'), + ('HSPC', 'Hospital Care'), + ('ICRF', 'Intermediate Care Facility'), + ('LTCF', 'Long Term Care Facility'), + ('MDCS', 'Medical Services'), + ('VIEW', 'Vision Care'), + ('ALMY', 'Alimony Payment'), + ('BECH', 'Child Benefit'), + ('BENE', 'Unemployment Disability Benefit'), + ('BONU', 'Bonus Payment.'), + ('COMM', 'Commission'), + ('PENS', 'Pension Payment'), + ('PRCP', 'Price Payment'), + ('SALA', 'Salary Payment'), + ('SSBE', 'Social Security Benefit'), + ('ESTX', 'Estate Tax'), + ('HSTX', 'Housing Tax'), + ('INTX', 'Income Tax'), + ('TAXS', 'Tax Payment'), + ('VATX', 'Value Added Tax Payment'), + ('AIRB', 'Air'), + ('BUSB', 'Bus'), + ('FERB', 'Ferry'), + ('RLWY', 'Railway'), + ('CBTV', 'Cable TV Bill'), + ('ELEC', 'Electricity Bill'), + ('ENRG', 'Energies'), + ('GASB', 'Gas Bill'), + ('NWCH', 'Network Charge'), + ('NWCM', 'Network Communication'), + ('OTLC', 'Other Telecom Related Bill'), + ('PHON', 'Telephone Bill'), + ('WTER', 'Water Bill'), + ], + help="If neither your bank nor your local regulations oblige you to " + "set the category purpose, leave the field empty.", + ) # PAIN allows 140 characters communication = fields.Char(size=140) # The field struct_communication_type has been dropped in v9 diff --git a/account_banking_pain_base/models/bank_payment_line.py b/account_banking_pain_base/models/bank_payment_line.py index 809f75dbb..f08ddcdd3 100644 --- a/account_banking_pain_base/models/bank_payment_line.py +++ b/account_banking_pain_base/models/bank_payment_line.py @@ -14,10 +14,12 @@ class BankPaymentLine(models.Model): string='Local Instrument') category_purpose = fields.Selection( related='payment_line_ids.category_purpose', string='Category Purpose') + purpose = fields.Selection( + related='payment_line_ids.purpose') @api.model def same_fields_payment_line_and_bank_payment_line(self): res = super(BankPaymentLine, self).\ same_fields_payment_line_and_bank_payment_line() - res += ['priority', 'local_instrument', 'category_purpose'] + res += ['priority', 'local_instrument', 'category_purpose', 'purpose'] return res diff --git a/account_banking_pain_base/views/account_payment_line.xml b/account_banking_pain_base/views/account_payment_line.xml index 8f8b154df..88104f1a7 100644 --- a/account_banking_pain_base/views/account_payment_line.xml +++ b/account_banking_pain_base/views/account_payment_line.xml @@ -15,6 +15,7 @@ + diff --git a/account_banking_pain_base/views/bank_payment_line_view.xml b/account_banking_pain_base/views/bank_payment_line_view.xml index 5ed993f0e..85e85e310 100644 --- a/account_banking_pain_base/views/bank_payment_line_view.xml +++ b/account_banking_pain_base/views/bank_payment_line_view.xml @@ -15,6 +15,7 @@ + diff --git a/account_banking_sepa_credit_transfer/models/account_payment_order.py b/account_banking_sepa_credit_transfer/models/account_payment_order.py index f39f046e3..44de57d54 100644 --- a/account_banking_sepa_credit_transfer/models/account_payment_order.py +++ b/account_banking_sepa_credit_transfer/models/account_payment_order.py @@ -153,6 +153,10 @@ class AccountPaymentOrder(models.Model): self.generate_party_block( credit_transfer_transaction_info, 'Cdtr', 'C', line.partner_bank_id, gen_args, line) + if line.purpose: + purpose = etree.SubElement( + credit_transfer_transaction_info, 'Purp') + etree.SubElement(purpose, 'Cd').text = line.purpose self.generate_remittance_info_block( credit_transfer_transaction_info, line, gen_args) if not pain_flavor.startswith('pain.001.001.02'): diff --git a/account_banking_sepa_direct_debit/models/account_payment_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py index e8d3b97ad..4e92c1260 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_order.py +++ b/account_banking_sepa_direct_debit/models/account_payment_order.py @@ -215,6 +215,11 @@ class AccountPaymentOrder(models.Model): dd_transaction_info, 'Dbtr', 'C', line.partner_bank_id, gen_args, line) + if line.purpose: + purpose = etree.SubElement( + dd_transaction_info, 'Purp') + etree.SubElement(purpose, 'Cd').text = line.purpose + self.generate_remittance_info_block( dd_transaction_info, line, gen_args)