From cdd6a4a3aae282d4cc122fd9723943f9a656ef9c Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 14 Apr 2009 07:16:56 +0000 Subject: [PATCH] MAttributeSetInstance.create should create Lot/Serial/Guaran https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2675699&group_id=176962 --- .../org/compiere/model/MAttributeSetInstance.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/base/src/org/compiere/model/MAttributeSetInstance.java b/base/src/org/compiere/model/MAttributeSetInstance.java index c60ae53eaa..d30218bbc2 100644 --- a/base/src/org/compiere/model/MAttributeSetInstance.java +++ b/base/src/org/compiere/model/MAttributeSetInstance.java @@ -35,6 +35,9 @@ import org.compiere.util.TimeUtil; * * @author Jorg Janke * @version $Id: MAttributeSetInstance.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ + * + * @author Teo Sarca, www.arhipac.ro + *
  • BF [ 2675699 ] MAttributeSetInstance.create should create Lot/Serial/Guaran */ public class MAttributeSetInstance extends X_M_AttributeSetInstance { @@ -378,7 +381,8 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance } /** - * Create & save a new ASI for given product + * Create & save a new ASI for given product. + * Automatically creates Lot#, Serial# and Guarantee Date. * @param ctx * @param product * @param trxName @@ -389,6 +393,14 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance MAttributeSetInstance asi = new MAttributeSetInstance(ctx, 0, trxName); asi.setClientOrg(product.getAD_Client_ID(), 0); asi.setM_AttributeSet_ID(product.getM_AttributeSet_ID()); + // Create new Lot, Serial# and Guarantee Date + if (asi.getM_AttributeSet_ID() > 0) + { + asi.getLot(true, product.get_ID()); + asi.getSerNo(true); + asi.getGuaranteeDate(true); + } + // asi.saveEx(); return asi; }