Openbravo Issue Tracking System - Retail Modules | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0043202 | Retail Modules | Web POS | public | 2020-02-12 17:58 | 2020-02-24 12:21 | |||||||
Reporter | guilleaer | |||||||||||
Assigned To | Retail | |||||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||||
Status | new | Resolution | open | |||||||||
Platform | OS | 5 | OS Version | |||||||||
Product Version | ||||||||||||
Target Version | Fixed in Version | |||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | ||||||||||||
OBNetwork customer | ||||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0043202: grossListPrice & priceList properties of order line model (client side) are not behaving as expected according to ERP behavior | |||||||||||
Description | In backend -> Using price including taxes GrossPriceList field of orderline stores the price of a product in the price list when the order line was created -> Using price not including taxes priceList field of orderline stores the price of a product in the price list when the order line was created The above fields are static and should not change during the different processes. All the facts explained above are true and correct. However, in the frontend side (client-side) we have properties that suggest the same behavior but they are behaving differently priceList => seems to match with OB.MobileApp.model.receipt.get('lines').at(0).get('priceList') but the behavior is not the same GrossPriceList => seems to match with OB.MobileApp.model.receipt.get('lines').at(0).get('grossListPrice') but the behavior is not the same Error 1: names of these properties are confusing Error 2: Front end does not offer a model property that represents the same concept stored in GrossPriceList, priceList which is the original price in the price list used when the order was created Update: Also the property discountPercentage is wrongly set for a layaway with manually modified price. This property is used for the column "discount" in the DB orderline (it is a percentage) When a layaway is loaded in order to pay it, if you type: OB.MobileApp.model.receipt.get('lines').at(0).get('discountPercentage') The value is right. It's the same than when first synchronized the layaway, but when you completely pay the layaway, this code is executed: discountPercentage = OB.DEC.toBigDecimal(grossListPrice) .subtract(grossUnitPrice) .multiply(new BigDecimal('100')) .divide( OB.DEC.toBigDecimal(grossListPrice), 2, BigDecimal.prototype.ROUND_HALF_UP ); Since the property grossListPrice is wrong (based on grossListPrice or priceList depending on including/excluding taxes), the discountPercentage is wrongly calculated and sent. Since this only happens for completed layaways, the orderloader doesn't put this wrong values in the DB, but they could be used by custom processes. | |||||||||||
Steps To Reproduce | [scenario 1 -> including taxes] - Go to web POS (VBS-1) which uses price including taxes) - Mark the order as layaway - add Headlamp ultralight (price in the price list = 18.90) - Manually modify that line price (click price and enter 6) - In developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('priceList') 18.9 OB.MobileApp.model.receipt.get('lines').at(0).get('grossListPrice') 18.9 Error 1: Since we are working with the price including taxes priceList should be 0 and grossPriceList = 18.90. However, when order is synchronized values are OK in the backend - layaway the ticket without adding any payment [ticket saved] - Open the menu and open recently created receipt using "Open receipt" - When the ticket is loaded using developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('priceList') 6 OB.MobileApp.model.receipt.get('lines').at(0).get('grossListPrice') 18.9 Error 2: Since we are working with the price including taxes priceList should be 0 and grossPriceList = 18.90. However, when payments are added or layaway is completed values are still correct in the backend [scenario 2 -> Not including taxes] - Go to web POS (PS-1) which uses price NOT including taxes) - Mark the order as layaway - add Headlamp ultralight (price in the price list = 18.90) - Manually modify that line price (click price and enter 6) - In developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('priceList') 18.9 OB.MobileApp.model.receipt.get('lines').at(0).get('grossListPrice') 18.9 Error 3: Since we are working with the price NOT including taxes priceList should be 18.90 and grossPriceList = 0. However, when order is synchronized values are OK in the backend - layaway the ticket without adding any payment [ticket saved] - Open the menu and open recently created receipt using "Open receipt" - When the ticket is loaded using developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('grossListPrice') 6 OB.MobileApp.model.receipt.get('lines').at(0).get('priceList') 6 Error 4: Since we are working with the price including taxes priceList should be 18.90 and grossPriceList = 0. However, when payments are added or layaway is completed values are still correct in the backend Error 5: If for any reason someone needs to check the original price list of the product included in the order line when order line was created, there is no way in the front end to do that. Update: - Go to web POS (PS-1) which uses price NOT including taxes) - Mark the order as layaway - add Headlamp ultralight (price in the price list = 18.90) - Manually modify that line price (click price and enter 6) - In developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('discountPercentage') is still not set (it's set when synchronizing the order) - Layaway the order - Load it with open receipt option - In developer tools check that OB.MobileApp.model.receipt.get('lines').at(0).get('discountPercentage') is 68.25% - Completely pay the layaway - If you put a breakpoint in the previous code: discountPercentage = OB.DEC.toBigDecimal(grossListPrice) .subtract(grossUnitPrice) .multiply(new BigDecimal('100')) .divide( OB.DEC.toBigDecimal(grossListPrice), 2, BigDecimal.prototype.ROUND_HALF_UP ); - You can check the discountPercentage is calculated based on a previously wrongly calculated grossListPrice. It is always 0. | |||||||||||
Proposed Solution | -> Rename current properties to avoid confusion since they are not working as expected -> Create properties priceList && grossListPrice which should work in the same way that they work in backend. They will just store the original price in the pricelist. This value should be loaded from backend when an order is loaded and it MUST never change Update: -> Calculate the discountPercentage based on new property officialListPrice, created in issue 43226 (only if the property exists, that is, for loaded receipts) -> In the orderloader, in the case of "ismodified", put there some exceptions that don't need to be updated i.e listPrice. Set the officialListPrice into the JSON | |||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Relationships |
| |||||||||||
Attached Files | ||||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2020-02-12 17:58 | guilleaer | New Issue | ||||||||||
2020-02-12 17:58 | guilleaer | Assigned To | => Retail | |||||||||
2020-02-12 17:58 | guilleaer | Triggers an Emergency Pack | => No | |||||||||
2020-02-12 18:05 | guilleaer | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=20365#r20365 | |||||||||
2020-02-12 22:12 | Practics | Issue Monitored: Practics | ||||||||||
2020-02-14 13:10 | joniturralde93 | Relationship added | related to 0043226 | |||||||||
2020-02-19 13:31 | joniturralde93 | Description Updated | bug_revision_view_page.php?rev_id=20408#r20408 | |||||||||
2020-02-19 13:31 | joniturralde93 | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=20409#r20409 | |||||||||
2020-02-19 13:31 | joniturralde93 | Proposed Solution updated | ||||||||||
2020-02-24 12:21 | hgbot | Checkin | ||||||||||
2020-02-24 12:21 | hgbot | Note Added: 0118047 |
Notes | |||||
|
|||||
|
|