-
-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDEMPIERE-5836 Adding support for stocked expense product #2039
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SELECT register_migration_script('202309291327_IDEMPIERE-5836.sql') FROM dual; | ||
SET SQLBLANKLINES ON | ||
SET DEFINE OFF | ||
|
||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
-- Aug 8, 2023, 1:27:56 PM IST | ||
UPDATE AD_Field SET DisplayLogic='@IsSummary@=''N'' & @ProductType@=I | @ProductType@=E', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2023-08-08 13:27:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1026 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic here is wrong, is showing the Stocked flag when the product is marked as Summary and Expense. You need to add parenthesis on the OR condition, or reorder it to check the IsSummary at the end |
||
; | ||
|
||
-- Aug 8, 2023, 1:29:13 PM IST | ||
UPDATE AD_Column SET ReadOnlyLogic='@ProductType@=R | @ProductType@=O',Updated=TO_DATE('2023-08-08 13:29:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1761 | ||
; | ||
|
||
-- Oct 2, 2023, 3:38:33 PM IST | ||
UPDATE AD_Column SET Callout='org.compiere.model.CalloutProduct.productType',Updated=TO_TIMESTAMP('2023-10-02 15:38:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7795 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CalloutProduct class is missing on the pull request |
||
; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
SELECT register_migration_script('202309291327_IDEMPIERE-5836.sql') FROM dual; | ||
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator | ||
-- Aug 8, 2023, 1:27:56 PM IST | ||
UPDATE AD_Field SET DisplayLogic='@IsSummary@=''N'' & @ProductType@=I | @ProductType@=E', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2023-08-08 13:27:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=1026 | ||
; | ||
|
||
-- Aug 8, 2023, 1:29:13 PM IST | ||
UPDATE AD_Column SET ReadOnlyLogic='@ProductType@=R | @ProductType@=O',Updated=TO_TIMESTAMP('2023-08-08 13:29:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1761 | ||
; | ||
|
||
-- Oct 2, 2023, 3:38:33 PM IST | ||
UPDATE AD_Column SET Callout='org.compiere.model.CalloutProduct.productType',Updated=TO_TIMESTAMP('2023-10-02 15:38:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=7795 | ||
; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,11 @@ public ArrayList<Fact> createFacts (MAcctSchema as) | |
Map<String, BigDecimal> batchLotCostMap = null; | ||
DocLine_InOut line = (DocLine_InOut) p_lines[i]; | ||
MProduct product = line.getProduct(); | ||
//If expense type stocked product, no impact on COGS as it not deducting inventory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when doing a manual material receipt - is complaining with "No Costs for ..." - if the expense product is not to be posted, then the posting must not throw error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We were creating cost. now creating new PR which has no cost created at all and so it will not throw any error. |
||
if(MProduct.PRODUCTTYPE_ExpenseType.equals(product.getProductType()) && product.isStocked()) { | ||
continue; | ||
} | ||
|
||
BigDecimal costs = null; | ||
if (!isReversal(line)) | ||
{ | ||
|
@@ -430,6 +435,11 @@ else if ( getDocumentType().equals(DOCTYPE_MatReceipt) && isSOTrx() ) | |
{ | ||
DocLine_InOut line = (DocLine_InOut) p_lines[i]; | ||
MProduct product = line.getProduct(); | ||
//If expense type stocked product, no impact on COGS as it not deducting inventory | ||
if(MProduct.PRODUCTTYPE_ExpenseType.equals(product.getProductType()) && product.isStocked()) { | ||
continue; | ||
} | ||
|
||
BigDecimal costs = null; | ||
Map<String, BigDecimal> batchLotCostMap = null; | ||
if (!isReversal(line)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,6 +245,11 @@ else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(costingLevel)) | |
} | ||
else | ||
{ | ||
//if product type expense and stocked, then no needs to do posting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Posting an Internal Use Inventory is throwing this error: |
||
if(MProduct.PRODUCTTYPE_ExpenseType.equals(product.getProductType()) && product.isStocked()) { | ||
continue; | ||
} | ||
|
||
if (!isReversal(line)) | ||
{ | ||
product = line.getProduct(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,7 +595,7 @@ public boolean isItem() | |
@Override | ||
public boolean isStocked () | ||
{ | ||
return super.isStocked() && isItem(); | ||
return super.isStocked() && (isItem() || PRODUCTTYPE_ExpenseType.equals(getProductType())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change the javadoc accordingly |
||
} // isStocked | ||
|
||
/** | ||
|
@@ -698,7 +698,7 @@ protected boolean beforeSave (boolean newRecord) | |
|
||
// Reset Stocked if not Item | ||
//AZ Goodwill: Bug Fix isStocked always return false | ||
if (!PRODUCTTYPE_Item.equals(getProductType())) | ||
if (!PRODUCTTYPE_Item.equals(getProductType()) && !PRODUCTTYPE_ExpenseType.equals(getProductType())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change the comment too. Also, please check line 666 of MProduct, there is a validation and storage managing code when changing from Item to not-Item, not sure about the effect, probably changing from Item to Expense doesn't matter now if the Stocked flag is maintained. Line 918 (beforeDelete) has also a validation about storage |
||
setIsStocked(false); | ||
|
||
// UOM reset | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 5 is wrong "I forgot to set the DICTIONARY_ID_COMMENTS System Configurator" better to delete it or make it correct