#4432 invalid c_doctype_id

R2.5.3
closed
5
2007-05-31
2007-05-03
surasak_w
No

in "Import Inventory" screen (menu/general rules/data/data import/import inventory)

when i input a record and press "Import Inventory" button
program will be save record and give c_doctype_id = 1000070
(but 1000070 that mean "Internal Use Inventory" is not correct , the correct is 1000021(1000021 that mean "Physical Inventory"))

after i read a compiere source code i found
the program will call beforesave function in minventory.java
the content is

protected boolean beforeSave (boolean newRecord)
{
if (getC_DocType_ID() == 0)
{
MDocType types[] = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialPhysicalInventory);

if (types.length > 0)
{
//get value doctype id row 0 ==> 1000070 but i need 1000021
setC_DocType_ID(types[0].getC_DocType_ID());
}
else
{
log.saveError("Error", Msg.parseTranslation(getCtx(), "@NotFound@ @C_DocType_ID@"));
return false;
}
}
return true;
}//beforeSave

in line
MDocType types[] = MDocType.getOfDocBaseType(getCtx(), MDocType.DOCBASETYPE_MaterialPhysicalInventory);

the program will call getOfDocBaseType from mdoctype.java
in this function i found sql statement
"String sql = "SELECT * FROM C_DocType WHERE AD_Client_ID=? AND DocBaseType=?";

in my case AD_Client_ID=1000000 AND DocBaseType=MMI
after execute statement, recordset will return 2 records
in row(0) c_doctype_id is 1000070

in row(1) c_doctype_id is 1000021

in line
setC_DocType_ID(types[0].getC_DocType_ID());
i will get 1000070 value

but its not correct

so i will change sql statement by order clause
"String sql = "SELECT * FROM C_DocType WHERE AD_Client_ID=? AND DocBaseType=? order by c_doctype_id ";"

the output was correct

but i want to knowed its true way or not?
and what the effect about this action

Discussion

  • Yves Sandfort

    Yves Sandfort - 2007-05-03

    Logged In: YES
    user_id=467647
    Originator: NO

    *** Status set to PENDING *** If the issue solved, please CLOSE
    this request - otherwise set the status back to OPEN (we only
    check OPEN items). If there is no reaction within a week, the
    system will automatically CLOSE it. To speed up response time,
    you may want to consider a support agreement.
    ***

     
  • Yves Sandfort

    Yves Sandfort - 2007-05-03
    • status: open --> pending
     
  • Yves Sandfort

    Yves Sandfort - 2007-05-03

    Logged In: YES
    user_id=467647
    Originator: NO

    Do you actually set the doctype on import?

     
  • surasak_w

    surasak_w - 2007-05-04
    • status: pending --> open
     
  • surasak_w

    surasak_w - 2007-05-04

    Logged In: YES
    user_id=1784100
    Originator: YES

    accualy 1000070 is a new doctype id for internal used (created by myself)
    my project need new doctype id to seperate between internal used and physical inventory

     
  • Kathy Pink

    Kathy Pink - 2007-05-07
    • assigned_to: kmpink --> nobody
     
  • Kai Egbert

    Kai Egbert - 2007-05-08
    • assigned_to: nobody --> kviiksaar
     
  • Yves Sandfort - Compiere EMEA

    • assigned_to: kviiksaar --> jjanke
     
  • Jorg Janke

    Jorg Janke - 2007-05-14

    Logged In: YES
    user_id=87038
    Originator: NO

    Code updated.

    Well, If you have two Document types, you need to define it if you want to select a special Document type. So, I suggest that you explicitly set the C_DocType_ID value - you might also not like the oldest one.

     
  • Jorg Janke

    Jorg Janke - 2007-05-14
    • status: open --> pending
     
  • surasak_w

    surasak_w - 2007-05-15

    Logged In: YES
    user_id=1784100
    Originator: YES

    how to explicitly set ..?

    in present, i solve a ploblem by add new method has keep sql + orderby clause
    and change its to call new method
    (old method i not change anything)

     
  • surasak_w

    surasak_w - 2007-05-15
    • status: pending --> open
     
  • Jorg Janke

    Jorg Janke - 2007-05-23
    • status: open --> pending
     
  • Jorg Janke

    Jorg Janke - 2007-05-23

    Logged In: YES
    user_id=87038
    Originator: NO

    ... you define it as constant in the import format.

     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    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 7 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks