View source | View content page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Show collection (0 pages)
Collections help



This document contains the functional specification of the mass advanced payment module.


General Description

Background Information - Creating advanced payments manually in Openbravo ERP

In Openbravo ERP, users can create an advanced payment from or to a business partner by creating a settlement and recording the cash movement in a bank statement.

This can be done using one of the following two approaches:

The outcome of both of these approaches is a debt payment record that is matched to the bank statement (the money has been received) and a negative debt payment record that is not matched to any transaction. In case this debt payment is a receipt, this debt payment represents a liability (hence it is negative) as the business partner has paid money to the organization but no goods or service has been provided. When a sales invoice is created, a positive debt payment is created and it can be cancelled against the negative payment eliminating the liability.

Module Overview - Creating mass advanced payments

This module allows people to automatically create advanced payments in bulk for a number of different partners at the same time.

Additionally, if the partner is an internal organization it creates the corresponding payment in that organization:

This module will use the prefix: MADV.

This module consists of two additional screens:

The menu option for the mass advanced payment wizard can be found in the Financial Management > Receivables & Payables > Transactions menu. The menu option for the advanced payment templace can be found in the Financial Management > Receivables & Payables > Setup menu.

The functional approach chosen by this module is that, for each payment to be created, a settlement with two payments is created (the second approch described in the previous section). The bank statement is then created manually. To automate the creation of the bank statement, this module relies on the Direct Debit Form of Payment module: users can specify this form of payment in the advanced payment template and the system automatically creates and process the bank statement.

Relation to other modules

This module provides similar functionality to the Mass Invoicing module but for advanced payments. The implementation of this module can use Mass Invoicing as a pattern and replicate and adapt its code.

This module makes use of and is dependent on the multi-business-partner selector module. The business partner delivered by that module is used in the generation wizard.

In addition, this module uses the depends on the Direct Debit Form of Payment module as described in the previous section.

Mass Advanced Payments Wizard

To generate orders the user will go through a multi-step wizard:

  1. select the organization initiating the transaction as well as its bank account; select the payment date; select the business partners, amount, currency and advanced payment template
  2. review and adjust the proposed payments
  3. show the result of the generation step (payments created)

Step 1: Select Organization, bank, business partners and amount

This step allows the user to:

A first version of the user interface is shown below

Madv w1.png

The following defaulting rules should be applied to this window:

The advanced template listbox will only show order templates which are active.

The business partner selector is implemented by the multi business partner selector module. It allows filtering business partners and to select one or more business partners.

Bp selector.png

The following validations should be done in step 1 of the wizard:

The validations marked with client-side are performed on the client-side (in the browser). The remaining validations are done when the user presses next. If a validation fails the same window is displayed with all the information as entered and a message box explaining the validation failure. The validation message should show enough detail (list specific business partners for which the above check fails).

When the user is satisfied the user can select the next button to go to step 2. The information entered in step 1 is stored and the user can return back from step 2 to change the information.

Step 2: Review and adjust proposed payments

The second step uses the information from the first step to show a list of proposed payment to be executed.

This step allows to adjust the payment amount on a business partner by business partner basis.

Madv w2.png

This page consists of two tables. The tables are not rendered if they do not contain any data. In both tables, initially all records are selected and users can deselect some or all records.

The first table contains the list of proposed payments for external business partners. The amount field is defaulted from step 1 and for selected records the user can edit this value.

The second table contains the list of proposed payments for internal organizations. The bank account field contains the bank account for the target organization and it is defaulted from the first bank account in alphabetical order. The amount field is defaulted from step 1 and for selected records the user can edit this value.

IMPORTANT NOTE: if the template has Create Matching Inter-company Payment set to N, then internal organizations are treated as regualar business partners and appear in the first table. In this case, the second table is always empty and therefore not rendered.

When the user presses generate the system validates the inputs and asks for confirmation. If the user confirms then system generates the payment (see later section for a description of the generate process).

The validation, validates that each selected line has a valid amount.

If the generation fails then the step 2 window is re-shown with a detailed error message in a red message box.

Step 3: The result

In step 3 the result for the generation step is shown. The proposal is to show the following information. For each organization where a payment has been executed, a table with a list of payments with for each payment:

The document is a link to the payment itself.

Please notice that you would have more than one table only in the case of inter-company payments.

Madv w3.png

Advanced Payment Templates

In the first step of the advanced generation wizard the user can select the advanced payment template. The template defines the characteristics of the generated payments and it consists of:

Madv template.png

Table: Payment Template

To maintain and store advanced payment templates a new table is created:

Generating Advanced Payments

This section of the functional spec describes in some detail how the advanced payments are created and which information is used to set their attributes.

When the user presses the generate button the following actions are performed:

The information on the settlement header (c_settlement) is set as follows:

Column Value
c_settlement_id UUID of the record

ad_client_id the current user client
ad_org_id the organization selected in step 1
isactive Y
created, createdby, updated, updatedby current user, current date
documentno will be computed
datetrx current date
c_doctype_id the ID corresponding to document type "Debt/Payment Settlement"
processing N
processed N
posted N
c_campaign_id, c_project_id, c_activity_id, user1_id, user2_id all null
createfrom null
c_currency_id set to the value specified in step 1 of the wizard
description set from the order template

cancelednotchargedamt 0
generatedamt 0
chargedamt 0
createfile N
settlementtype C
copyfrom N
isgenerated N
istemplate N

Any other nullable column not explicitly mentioned should be set to null.

For each settlment, two records for created payments (c_debt_payment_generate) are set as follows:

Column Value
c_debt_payment_id UUID of the record
ad_client_id the current user client
ad_org_id the organization selected in step 1
isactive Y
created, createdby, updated, updatedby current user, current date
c_settlement_id the id of the settlement
description from the payment template
isreceipt from the payment template
c_invoice_id null
c_bpartner_id the business partner for which the payment is generated
c_currency_id set to the value specified in step 1 of the wizard
c_cashline_id, c_bankstatementline_id null
c_bank_account_id set to the value specified in step 1 of the wizard; if no value is specified there, then set to the value specified in the payment template
c_cashbook_id null
paymentrule from the payment template
ispaid N
amount value specified in step 2 of the wizard
writeoffamt 0
dateplanned the due date specified in step 1 of the wizard
ismanual N
isvalid Y
generate_processed N
c_glitem_id null
isdirectposting N
status from the payment template
c_project_id null
c_withholding_id null
withholdingamount null

Any other nullable column not explicitly mentioned should be set to null.

A settlement is stored in the database and directly posted using the C_SETTLEMENT_POST stored procedure.

Other considerations

Server-Side Implementation

The server-side logic to create advanced payments will be using the DAL.

Similar to Mass Invoices that added the InvoicePropertySetter class to core, this project requires the creation of the class SettlementPropertySetter. This class contains logic to set the information of a Settlement, including canceled and generated payments. This makes it much easier for application code to create settlements: just set a few mandatory field and SettlementPropertySetter does the rest. The class can be found here:

The posting of the settlements is done through a stored procedure. The implementation of this module will leverage a generic api provided by MassInvoicing for passing parameters to stored procedures and running stored procedures from Java.

Retrieved from ""

This page has been accessed 3,153 times. This page was last modified on 8 June 2012, at 05:32. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.