details:   https://code.openbravo.com/erp/devel/pi/rev/825bc261f63c
changeset: 25746:825bc261f63c
user:      Aaron Calero <aaron.calero <at> openbravo.com>
date:      Fri Jan 23 12:21:36 2015 +0100
summary:   Fixed issue 28722: Not possible to create invoiced receipts for 
customers created in WebPOS

Modified the event handler used to set the BP currency to work not only on 
update events, but on save events too.
Now when BPs are saved from the POS, the currency is automatically assigned to 
these business partners and they can be used to generate invoices.

diffstat:

 src/org/openbravo/event/BusinessPartnerEventHandler.java |  21 ++++++++-------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (45 lines):

diff -r 3bcb735ce063 -r 825bc261f63c 
src/org/openbravo/event/BusinessPartnerEventHandler.java
--- a/src/org/openbravo/event/BusinessPartnerEventHandler.java  Fri Jan 23 
12:02:44 2015 +0100
+++ b/src/org/openbravo/event/BusinessPartnerEventHandler.java  Fri Jan 23 
12:21:36 2015 +0100
@@ -25,6 +25,7 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
 import org.openbravo.client.kernel.event.EntityNewEvent;
+import org.openbravo.client.kernel.event.EntityPersistenceEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
 import org.openbravo.client.kernel.event.EntityUpdateEvent;
 import org.openbravo.model.common.businesspartner.BusinessPartner;
@@ -39,15 +40,7 @@
     return entities;
   }
 
-  public void onSave(@Observes
-  EntityNewEvent event) {
-    if (!isValidEvent(event)) {
-      return;
-    }
-  }
-
-  public void onUpdate(@Observes
-  EntityUpdateEvent event) {
+  public void onSave(@Observes EntityNewEvent event) {
     if (!isValidEvent(event)) {
       return;
     }
@@ -55,7 +48,15 @@
     setUpdateCurrency(event, bp);
   }
 
-  private void setUpdateCurrency(EntityUpdateEvent event, BusinessPartner bp) {
+  public void onUpdate(@Observes EntityUpdateEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    final BusinessPartner bp = (BusinessPartner) event.getTargetInstance();
+    setUpdateCurrency(event, bp);
+  }
+
+  private void setUpdateCurrency(EntityPersistenceEvent event, BusinessPartner 
bp) {
     if (bp.getCurrency() == null
         && (bp.getPriceList() != null || bp.getPurchasePricelist() != null)) {
 

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to