diff --git a/account_invoice_import_facturae/wizard/account_invoice_import.py b/account_invoice_import_facturae/wizard/account_invoice_import.py index 3bf73e54246..7af11e7135f 100644 --- a/account_invoice_import_facturae/wizard/account_invoice_import.py +++ b/account_invoice_import_facturae/wizard/account_invoice_import.py @@ -97,12 +97,18 @@ def parse_facturae_invoice(self, xml_root, xsd_file): invoice.find('Items').findall('InvoiceLine') ] attachments = {} - if 'customer' in self.env.context: - account_to_be_credited = invoice.find('PaymentDetails/Installment/AccountToBeCredited/AccountNumber') - account_to_be_debited = invoice.find('PaymentDetails/Installment/AccountToBeDebited/AccountNumber') - acc_number = (account_to_be_debited is not None and account_to_be_debited.text or account_to_be_credited is not None and account_to_be_credited.text) - else: - acc_number = False + account_to_be_credited = invoice.find( + "PaymentDetails/Installment/AccountToBeCredited/AccountNumber" + ) + account_to_be_debited = invoice.find( + "PaymentDetails/Installment/AccountToBeDebited/AccountNumber" + ) + acc_number = ( + account_to_be_debited + and account_to_be_debited.text + or account_to_be_credited + and account_to_be_credited.text + ) res = { 'type': inv_type, 'partner': partner_dict,