From 140b4c254abcc76697e3b1f97208fc94c60703f7 Mon Sep 17 00:00:00 2001 From: walid seghier Date: Tue, 24 Jan 2023 16:20:38 +0100 Subject: [PATCH] Edit = set Default Purchase Journal for Supplier --- .../com/axelor/apps/account/web/InvoiceController.java | 7 +++---- .../axelor-base/src/main/resources/domains/Partner.xml | 1 + .../axelor-base/src/main/resources/views/Selects.xml | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/web/InvoiceController.java b/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/web/InvoiceController.java index a164f7f..a7d5f95 100644 --- a/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/web/InvoiceController.java +++ b/modules/axelor-open-suite/axelor-account/src/main/java/com/axelor/apps/account/web/InvoiceController.java @@ -1067,17 +1067,16 @@ public class InvoiceController { Invoice invoice = request.getContext().asType(Invoice.class); Company company = invoice.getCompany(); Partner partner = invoice.getPartner(); - PartnerCategory partnerCategory = partner.getPartnerCategory(); Journal journal = null ; Integer operationTypeSelect = invoice.getOperationTypeSelect(); if (company != null && partner != null && operationTypeSelect != null ) { if (operationTypeSelect.intValue() == InvoiceRepository.OPERATION_TYPE_SUPPLIER_PURCHASE) { - if( partnerCategory != null){ - if(partnerCategory.getCode().equals("FRETG")){ + if( partner.getTypeOfSupplier() != null){ + if(partner.getTypeOfSupplier().equals("1")){ journal = company.getAccountConfig().getSupplierPurchaseJournalForeigners(); } - if(partnerCategory.getCode().equals("FRLOC")){ + if(partner.getTypeOfSupplier().equals("2")){ journal = company.getAccountConfig().getSupplierPurchaseJournalLocal(); } } diff --git a/modules/axelor-open-suite/axelor-base/src/main/resources/domains/Partner.xml b/modules/axelor-open-suite/axelor-base/src/main/resources/domains/Partner.xml index a7bb366..0892a54 100644 --- a/modules/axelor-open-suite/axelor-base/src/main/resources/domains/Partner.xml +++ b/modules/axelor-open-suite/axelor-base/src/main/resources/domains/Partner.xml @@ -98,6 +98,7 @@ + diff --git a/modules/axelor-open-suite/axelor-base/src/main/resources/views/Selects.xml b/modules/axelor-open-suite/axelor-base/src/main/resources/views/Selects.xml index 019efca..3579966 100644 --- a/modules/axelor-open-suite/axelor-base/src/main/resources/views/Selects.xml +++ b/modules/axelor-open-suite/axelor-base/src/main/resources/views/Selects.xml @@ -502,5 +502,10 @@ + + + + +