Hi, I'm just checking LiberoValidator.java - I see there is a wrong usage of ModelValidator for the C_Order table.
Case:
on initialize there is this line
engine.addModelChange(MOrder.Table_Name, this);
on modelChange the check is:
if (po.get_TableName().equals(MOrder.Table_Name) && (type == TYPE_AFTER_CHANGE ))
{
MOrder order = (MOrder)po;
if(order.getDocStatus().equals(MOrder.DOCSTATUS_InProgress) || order.getDocStatus().equals(MOrder.DOCSTATUS_Completed))
MPPMRP.C_Order((MOrder)po, false);
This is incorrect and error prone - the model change is catched for ALL CHANGES. Even changing Description of a completed order will trigger this code - and will call MPPMRP.C_Order and MPPMRP.C_OrderLine
I don't know the consequences of calling this many times - after the order is completed - but the correct usage must be:
on initialize:
engine.addDocValidate(MOrder.Table_Name, this);
on docValidate:
if (po.get_TableName().equals(MOrder.Table_Name) && (timing == TIMING_BEFORE_COMPLETE ))
Cordially,
Carlos Ruiz
Same behavior found some lines below with C_OrderLine table.
Cordially,
Carlos Ruiz
Hmmm, yes and no :)
I think it's very useful to generate drafted documents and update them when C_Order/C_OrderLine changes.
The problem is (as you pointed out), there are a lot of fields that do not influence the generated document, you the "trigger" should be called just for relevant fields.
Wondering how users from similar production environment will prefer things... What do you think ?
PS: considering your suggestion, which document status transitions will you suggest ?
Best regards,
Teo Sarca - www.arhipac.ro
Hi Teo,
> I think it's very useful to generate drafted documents and update them
> when C_Order/C_OrderLine changes.
That's not the current behavior.
The modelvalidator is checking this for InProgress or Completed status.
I suppose PP_MRP is something like a read-only table. If it's not a read-only (you just created today a window, but I don't know if it's readonly or not) - then it would be dangerous to have maintenance for PP_MRP on draft status from a draft order.
Regards,
Carlos Ruiz
Revision: 6903
http://adempiere.svn.sourceforge.net/adempiere/?rev=6903&view=rev
Author: vpj-cd
Date: 2008-11-08 03:25:39 +0000 (Sat, 08 Nov 2008)
Log Message:
-----------
[ 2227586 ] Wrong usage of ModelValidator on LiberoValidator
http://sourceforge.net/tracker/?func=detail&atid=879332&aid=2227586&group_id=176962
Modified Paths:
--------------
branches/stable/base/src/org/eevolution/model/LiberoValidator.java
Hi Victor,
This is not related with manufacturing.
Could you check line 128? (Rev 6903)
While performing matching po-receipt, we got
===========> MOrderLine.saveError: Error - org.compiere.model.MOrderLine cannot be cast to org.compiere.model.MOrder [11]
I didn't know the implication, but I have replaced to MPPMRP.C_OrderLine(ol, false); and we can continue matching po-receipt.
Thanks
Bayu
http://sistematika.web.id
Fixed with revisions 6903, 6976, 7057
Regards,
Carlos Ruiz
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).