Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0015447Openbravo ERP08. Project and service managementpublic2010-12-15 18:322011-05-24 10:57
xabiermerino 
adrianromero 
highmajorhave not tried
closedfixed 
5
3.0RC3 
3.0RC4 
Core
No
0015447: Error in 'Create Sales Orders from Expenses'
When you try to create an order from expenses this error appears:

"ERROR: null value in column "paymentrule" violates not-null constraint".

It is necessary create a new BP, because the olds BP have a payment rule value.

- As Openbravo Admin go to Master Data Management || Business Partner
- Create a new Business Partner and go to Customer
    - Price List: Generale Sales
    - Select a payment method.
    - Select a Payment Term.
- Create a Location
- Go to Project & Service Management || Transactions || Multiphase Project
- Create a new record:
    - BP: the BP created
- Go to Project & Service Management || Transactions || Expense Sheet
- Create a new record:
    Report Date: 15-02-2010
- Go to lines:
    - Check reinvoicing
    - Product: electricity
    - Project: select the project created
    - Business Partner: It will appear the BP associated to the project (the BO created)
- Go back to the header and process
- Go to Project & Service Management || Transactions || Create Sales Orders from Expenses || Create Sales Orders from Expenses
- Date Ordered: 15-02-2010
- Process

- Realize that the error appears
closingMay2011
blocks backport 0015606 closed adrianromero Error in 'Create Sales Orders from Expenses' 
Issue History
2010-12-15 18:32xabiermerinoNew Issue
2010-12-15 18:32xabiermerinoAssigned To => adrianromero
2010-12-15 18:32xabiermerinoModules => Core
2010-12-15 18:51xabiermerinoIssue Monitored: networkb
2010-12-16 12:55adrianromeroNote Added: 0033235
2011-01-04 17:59dmitry_mezentsevNote Added: 0033524
2011-01-11 12:48adrianromeroStatusnew => scheduled
2011-01-11 12:48adrianromerofix_in_branch => pi
2011-01-11 12:48adrianromeroIssue cloned0015606
2011-01-11 12:48adrianromeroRelationship addedblocks 0015606
2011-01-11 18:33hgbotCheckin
2011-01-11 18:33hgbotNote Added: 0033591
2011-01-11 18:33hgbotStatusscheduled => resolved
2011-01-11 18:33hgbotResolutionopen => fixed
2011-01-11 18:33hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/08a7da53ce77043062a61c2d8fc82245b1727fd2 [^]
2011-01-11 18:33adrianromeroNote Added: 0033592
2011-05-24 10:03dalsasuaTag Attached: closingMay2011
2011-05-24 10:57dalsasuaStatusresolved => closed

Notes
(0033235)
adrianromero   
2010-12-16 12:55   
It has to be checked in the java process that generate orders from expenses to assign a default value for payment rule when there are the following conditions

This is the assignment of the default condition (needs to be reviewed and tested)
            if ((data1[0].paymentrule.equals("") || data1[0].paymentrule == null) && newFlow) {
                data1[0].paymentrule = "P";
            }

In this file: https://code.openbravo.com/erp/devel/pi/file/0721c4d48648/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java#l279 [^]
(0033524)
dmitry_mezentsev   
2011-01-04 17:59   
Adrian,

Just as a proposal to consider while fixing this issue.

If we are talking about 3.0 (and this is the case according to the reported product version) we can assume that APRM is always in. That means there is no need to do any checks or conditions in the 3.0 code of whether New or Old Financial Flow is used.

In general little by little where possible I would start doing some clean-ups of removing old financial flow things. For example, for this particular case maybe the fix can be (but for sure requires review, just as an idea) to allow "paymentrule" column to be null cause it is not used any more.

At the same time we need to be careful in a sense that in 3.0 we should allow for migration purposes co-existence of both flows. That means if someone is migrating from 2.50 to 3.0 they won´t be able to do new transactions in the old financial flow (only APRM one) but old completed transactions should be accessible for the reference (through old financial flow windows, reports) cause we are not going to migrate completed transactions (only open once).
(0033591)
hgbot   
2011-01-11 18:33   
Repository: erp/devel/pi
Changeset: 08a7da53ce77043062a61c2d8fc82245b1727fd2
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Tue Jan 11 18:28:52 2011 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/08a7da53ce77043062a61c2d8fc82245b1727fd2 [^]

Fixes issue 0015447: Error in Create Sales Orders from Expenses
It has been added a payment rule default value when using the new payment flow.

---
M src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
---
(0033592)
adrianromero   
2011-01-11 18:33   
* Testing the issue

Just follow the steps to reproduce and notice that now the order can be created. There has been only modified the case when the payment rule is null and there is active the new payables flow. In this case a default payment rule is assigned in the order generated.

* Other areas affected

Only the process of creating Orders from expenses has been modified. No other areas affected.