set Default Purchase Journal for Supplier
This commit is contained in:
@@ -23,6 +23,7 @@ import com.axelor.apps.account.db.InvoicePayment;
|
||||
import com.axelor.apps.account.db.PaymentCondition;
|
||||
import com.axelor.apps.account.db.PaymentMode;
|
||||
import com.axelor.apps.account.db.PaymentVoucher;
|
||||
import com.axelor.apps.account.db.Journal;
|
||||
import com.axelor.apps.account.db.repo.InvoiceRepository;
|
||||
import com.axelor.apps.account.exception.IExceptionMessage;
|
||||
import com.axelor.apps.account.service.AccountingSituationService;
|
||||
@@ -36,6 +37,7 @@ import com.axelor.apps.base.db.BankDetails;
|
||||
import com.axelor.apps.base.db.Company;
|
||||
import com.axelor.apps.base.db.Currency;
|
||||
import com.axelor.apps.base.db.Partner;
|
||||
import com.axelor.apps.base.db.PartnerCategory;
|
||||
import com.axelor.apps.base.db.PriceList;
|
||||
import com.axelor.apps.base.db.PrintingSettings;
|
||||
import com.axelor.apps.base.db.Wizard;
|
||||
@@ -1013,5 +1015,37 @@ public class InvoiceController {
|
||||
|
||||
response.setView(ActionView.define(name).add("html", fileLink).map());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set default value for automatic invoice Journal = supplier Purchase Journal
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws AxelorException
|
||||
*/
|
||||
public void setDefaultJournalSupplier(ActionRequest request, ActionResponse response) {
|
||||
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")){
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalForeigners();
|
||||
}
|
||||
if(partnerCategory.getCode().equals("FRLOC")){
|
||||
journal = company.getAccountConfig().getSupplierPurchaseJournalLocal();
|
||||
}
|
||||
}
|
||||
response.setValue("journal", journal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
<many-to-one name="cashJournalType" ref="com.axelor.apps.account.db.JournalType" title="Cash journal type"/>
|
||||
<many-to-one name="creditNoteJournalType" ref="com.axelor.apps.account.db.JournalType" title="Credit note journal type"/>
|
||||
|
||||
|
||||
<many-to-one name="supplierPurchaseJournalLocal" ref="com.axelor.apps.account.db.Journal" title="Supplier Purchase Journal Local"/>
|
||||
<many-to-one name="supplierPurchaseJournalForeigners" ref="com.axelor.apps.account.db.Journal" title="Supplier Purchase Journal Foreigners"/>
|
||||
|
||||
<!-- ACCOUNT -->
|
||||
<many-to-one name="customerAccount" ref="com.axelor.apps.account.db.Account" title="Customer account"/>
|
||||
<many-to-one name="supplierAccount" ref="com.axelor.apps.account.db.Account" title="Supplier account"/>
|
||||
|
||||
Reference in New Issue
Block a user