Why doesn't copying project planning lines reset their picked quantity?
I noticed that when copying project tasks to a new project in Business Central 25.2, the copied planning lines won't reset their fields related to their warehouse pick ("Qty. Picked", "Completely Picked" etc). I thought this was a bug, but even 25.12 has this behavior.
This occurs in the codeunit Copy Job, specifically the procedure CopyJobPlanningLines. Here is the relevant code:
TargetJobPlanningLine.Init();
TargetJobPlanningLine.Validate("Job No.", TargetJobTask."Job No.");
TargetJobPlanningLine.Validate("Job Task No.", TargetJobTask."Job Task No.");
if NextPlanningLineNo = 0 then
NextPlanningLineNo := FindLastJobPlanningLine(TargetJobPlanningLine);
NextPlanningLineNo += 10000;
TargetJobPlanningLine.Validate("Line No.", NextPlanningLineNo);
TargetJobPlanningLine.TransferFields(SourceJobPlanningLine, false);
if not CopyPrices then
TargetJobPlanningLine.UpdateAllAmounts();
TargetJobPlanningLine."Remaining Qty." := 0;
TargetJobPlanningLine."Remaining Qty. (Base)" := 0;
TargetJobPlanningLine."Remaining Total Cost" := 0;
TargetJobPlanningLine."Remaining Total Cost (LCY)" := 0;
TargetJobPlanningLine."Remaining Line Amount" := 0;
TargetJobPlanningLine."Remaining Line Amount (LCY)" := 0;
TargetJobPlanningLine."Qty. Posted" := 0;
TargetJobPlanningLine."Qty. to Transfer to Journal" := 0;
TargetJobPlanningLine."Posted Total Cost" := 0;
TargetJobPlanningLine."Posted Total Cost (LCY)" := 0;
TargetJobPlanningLine."Posted Line Amount" := 0;
TargetJobPlanningLine."Posted Line Amount (LCY)" := 0;
TargetJobPlanningLine."Qty. to Transfer to Invoice" := 0;
TargetJobPlanningLine."Qty. to Invoice" := 0;
TargetJobPlanningLine."Ledger Entry No." := 0;
TargetJobPlanningLine."Ledger Entry Type" := TargetJobPlanningLine."Ledger Entry Type"::" ";
OnCopyJobPlanningLinesOnBeforeTargetJobPlanningLineInsert(TargetJobPlanningLine, SourceJobPlanningLine);
TargetJobPlanningLine.Insert(true);
It looks like the fields aren't being reset on purpose, but why? Since the system can only find related warehouse activity by looking for the planning line's primary key, there will be no activity despite the line saying otherwise.
Am I missing something, or is this a bug that hasn't been fixed?
Answers
-
You mean that Quantity Picked is missing here? Is that a field of the table Job Planning Line, or does it come from somewhere else? You might take a look in the table, maybe you can find a lead there?
0 -
@joostheger "Quantity Picked" is a field of the table "Job Planning Line". The problem is that it's not being reset when copied, causing BC to incorrectly report that the line already has picked quantities.
0 -
Hey Buddy @cegekaJG ,
Seems some top custom code might be impacting this, system will never copy Qty Picked. Still I tried attempting the same and behavior was all as expected. See the first one was original and last 3 copied one -
Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
@RockWithNAV, like I said, the scenario is copying project tasks to a new project, not the same one. Also, the default code implicitly copies the field "Qty. Picked" when using the following command:
TargetJobPlanningLine.TransferFields(SourceJobPlanningLine, false);
The code has to reset the fields explicitly, otherwise they will be identical to those of the original line. Since the field in question isn't being addressed, it should be the same, right?
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 333 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

