Skip to content

Commit

Permalink
fix(purchase): make DECIMALs compatible with PJ/GL
Browse files Browse the repository at this point in the history
Fixes the purchase table to make unit price and total DECIMAL columns
compatible with the DECIMAL values stored in the general_ledger and
posting_journal. The previous iteration made the values far too small.

Closes #4478.
  • Loading branch information
jniles committed May 11, 2020
1 parent 1f8efcd commit fcb7684
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions server/models/migrations/next/migrate.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
INSERT INTO unit VALUES
(269, 'Inventory Adjustment', 'TREE.INVENTORY_ADJUSTMENT', 'Inventory Adjustment', 160, '/modules/stock/inventory-adjustment/inventory-adjustment.html', '/stock/inventory-adjustment');

INSERT INTO flux VALUES
INSERT INTO flux VALUES
(14, 'STOCK_FLUX.INVENTORY_RESET'),
(15, 'STOCK_FLUX.INVENTORY_ADJUSTMENT');


/*
* @author: @lomamech
Expand All @@ -19,3 +19,11 @@ INSERT INTO unit VALUES

INSERT INTO `report` (`report_key`, `title_key`) VALUES
('invoicedReceivedStock', 'REPORT.COMPARE_INVOICED_RECEIVED.TITLE');


/**
@author: jniles
@date: 2020-05-11
*/
ALTER TABLE `purchase_item` MODIFY COLUMN `unit_price` DECIMAL(19,8) UNSIGNED NOT NULL DEFAULT 0.00;
ALTER TABLE `purchase_item` MODIFY COLUMN `total` DECIMAL(19,8) UNSIGNED NULL DEFAULT 0.00;
4 changes: 2 additions & 2 deletions server/models/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1413,8 +1413,8 @@ CREATE TABLE `purchase_item` (
`purchase_uuid` BINARY(16) NOT NULL,
`inventory_uuid` BINARY(16) NOT NULL,
`quantity` INT(11) NOT NULL DEFAULT 0,
`unit_price` decimal(10,4) UNSIGNED NOT NULL,
`total` decimal(10,4) UNSIGNED DEFAULT NULL,
`unit_price` DECIMAL(19,8) UNSIGNED NOT NULL DEFAULT 0.00,
`total` DECIMAL(19,8) UNSIGNED NULL DEFAULT 0.00,
PRIMARY KEY (`uuid`),
UNIQUE KEY `purchase_item_1` (`purchase_uuid`, `inventory_uuid`),
KEY `purchase_uuid` (`purchase_uuid`),
Expand Down

0 comments on commit fcb7684

Please sign in to comment.