Bladeren bron

Fixed missing PurchaseGLs / CostCentres / Descriptions when adding products to Purchase orders and Bills

frogsoftware 10 maanden geleden
bovenliggende
commit
ff6cc038c4

+ 14 - 10
prs.desktop/Panels/PurchaseOrders/SupplierPurchaseOrderItemOneToMany.cs

@@ -587,26 +587,27 @@ public class SupplierPurchaseOrderItemOneToMany : DynamicOneToManyGrid<PurchaseO
                 if (sp != null)
                 {
                     var poi = CreateItem();
-                    poi.Product.ID = sp.Product.ID;
-                    poi.Product.Synchronise(sp.Product);
-                    poi.Style.ID = sp.Style.ID;
-                    poi.Style.Synchronise(sp.Style);
+                    poi.Product.CopyFrom(sp.Product);
+                    poi.Style.CopyFrom(sp.Style);
                     poi.Dimensions.CopyFrom(sp.Dimensions);
-                    poi.Job.ID = sp.Job.ID;
-                    poi.Job.Synchronise(sp.Job);
+                    poi.Job.CopyFrom(sp.Job);
                     poi.ForeignCurrencyCost = sp.ForeignCurrencyPrice;
                     poi.Cost = sp.CostPrice;
+                    poi.CostCentre.CopyFrom(sp.Product.CostCentre);
+                    poi.PurchaseGL.CopyFrom(sp.Product.PurchaseGL);
+                    poi.Description = sp.Product.Name;
                     result.Add(poi);
                 }
                 else if (pi != null)
                 {
                     var poi = CreateItem();
-                    poi.Product.ID = pi.Product.ID;
-                    poi.Product.Synchronise(pi.Product);
-                    poi.Style.ID = pi.Style.ID;
-                    poi.Style.Synchronise(pi.Style);
+                    poi.Product.CopyFrom(pi.Product);
+                    poi.Style.CopyFrom(pi.Style);
                     poi.Dimensions.CopyFrom(pi.Dimensions);
                     poi.Cost = pi.NettCost;
+                    poi.CostCentre.CopyFrom(pi.Product.CostCentre);
+                    poi.PurchaseGL.CopyFrom(pi.Product.PurchaseGL);
+                    poi.Description = pi.Product.Name;
                     result.Add(poi);
                 }
                 return result;
@@ -662,6 +663,9 @@ public class SupplierPurchaseOrderItemOneToMany : DynamicOneToManyGrid<PurchaseO
                     poi.Job.Synchronise(sp.Job);
                     poi.ForeignCurrencyCost = sp.ForeignCurrencyPrice;
                     poi.Cost = sp.CostPrice;
+                    poi.CostCentre.CopyFrom(sp.Product.CostCentre);
+                    poi.PurchaseGL.CopyFrom(sp.Product.PurchaseGL);
+                    poi.Description = sp.Product.Name;
                     result.Add(poi);
                 }
                 return result;

+ 7 - 11
prs.desktop/Panels/Suppliers/Bills/SupplierBillLineGrid.cs

@@ -324,9 +324,9 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
                     .Add(x => x.Product.PurchaseGL.ID)
                     .Add(x => x.Product.PurchaseGL.Code)
                     .Add(x => x.Product.PurchaseGL.Description)
-                    .Add(x => x.Product.PurchaseGL.ID)
-                    .Add(x => x.Product.PurchaseGL.Code)
-                    .Add(x => x.Product.PurchaseGL.Description)
+                    .Add(x => x.Product.CostCentre.ID)
+                    .Add(x => x.Product.CostCentre.Code)
+                    .Add(x => x.Product.CostCentre.Description)
             );
             query.Query();
 
@@ -339,14 +339,10 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
                 {
 
                     var line = CreateItem();
-                    line.Product.ID = item.Product.ID;
-                    line.Product.Synchronise(item.Product);
-                    line.PurchaseGL.ID = item.Product.PurchaseGL.ID;
-                    line.PurchaseGL.Synchronise(item.Product.PurchaseGL);
-                    line.CostCentre.ID = item.Product.CostCentre.ID;
-                    line.CostCentre.Synchronise(item.Product.CostCentre);
-                    line.TaxCode.ID = item.Product.TaxCode.ID;
-                    line.TaxCode.Synchronise(item.Product.TaxCode);
+                    line.Product.CopyFrom(item.Product);
+                    line.PurchaseGL.CopyFrom(item.Product.PurchaseGL);
+                    line.CostCentre.CopyFrom(item.Product.CostCentre);
+                    line.TaxCode.CopyFrom(item.Product.TaxCode);
                     line.ExTax = item.NettCost;
                     lines.Add(line);
                 }