Acumatica Extending PMProjectStatusEx

无人久伴 提交于 2019-12-25 00:19:27

问题


I am working on the Project Budget Screen of acumatica, the screen uses the table PMProjectStatusEx which is a Projection table of PMProjectStatus. So I extended the PMProjectStatus table and added a field in there, I also extended the PMProjectStatusEx to add the same field and added it to the screen. But unlike the standard fields that updates the physical table PMProjectStatus my added field does not update the physical table. What could be the reason for this? Below is my code

Thanks

public class PMProjectStatusExt : 
PXCacheExtension<PX.Objects.PM.PMProjectStatus>
{
  #region UsrMarkupPct
  public abstract class usrMarkupPct : PX.Data.IBqlField
  {
  }
  protected Decimal? _UsrMarkupPct;
  [PXDBDecimal(6, MinValue = 0, MaxValue = 1000)]
  //[PXDefault(TypeCode.Decimal, "0.0")]
  [PXUIField(DisplayName = "Markup %")]
  public virtual Decimal? UsrMarkupPct
  {
      get
      {
          return this._UsrMarkupPct;
      }
      set
      {
          this._UsrMarkupPct = value;
      }
  }
  #endregion


public class PMProjectStatusExExt : 
PXCacheExtension<PX.Objects.PM.PMProjectStatusEx>
  {
      #region UsrMarkupPct
      public abstract class usrMarkupPct : PX.Data.IBqlField
      {
      }
      protected Decimal? _UsrMarkupPct;
      [PXDBDecimal(6, MinValue = 0, MaxValue = 1000, BqlField = typeof(PMProjectStatusExt.usrMarkupPct))]
      [PXDefault(TypeCode.Decimal, "0.0")]
      [PXUIField(DisplayName = "Markup %")]
      public virtual Decimal? UsrMarkupPct
      {
          get
          {
              return this._UsrMarkupPct;
          }
          set
          {
              this._UsrMarkupPct = value;
          }
      }
      #endregion

回答1:


When you add fields using the DATA ACCESS section of the Project Editor it will generate DB Scripts to update the table behind the scene:

When you add fields using a DAC extension in CODE section, it will not generate the DB Scripts.

In that case you need to manually add the scripts in DB Scripts section.

EDIT

One way to manually add DB field in DB Scripts is:

IF NOT EXISTS(SELECT * FROM Sys.Columns WHERE Name = N'UsrMarkupPct' and 
              Object_ID = Object_ID(N'PMProjectStatus'))
BEGIN
    ALTER TABLE PMProjectStatus ADD UsrMarkupPct DECIMAL(19,6)
END
GO


来源:https://stackoverflow.com/questions/45542627/acumatica-extending-pmprojectstatusex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!