Commit Graph
141 Commits
Author SHA1 Message Date
Cédric Krier df8c27aba6 Do not browse records at a datetime before they were created
If user tries to get the cost price of a product before it was created, it
should return None instead of raising an access error.

issue7334
review49281002
2018-04-20 18:36:25 +02:00
Cédric Krier 101eaecb89 Check no stock move also on Product
As fields can be redefined on Product, we must check both Models.

issue7253
review41981002
2018-03-27 10:51:36 +02:00
Cédric Krier f632a9cc67 Remove product_ids from products_by_location for grouping_filter
issue7141
review44651002
2018-02-28 18:25:18 +01:00
Cédric Krier 8c326b8ae0 Ensure grouping_filter has the right length
issue7141
review40111002
2018-02-20 17:58:12 +01:00
Cédric Krier 55082d76a6 Allow to group per product columns to compute quantity
This is needed to add the quantity relates on the template form.

issue7068
review40031002
2018-02-11 14:38:33 +01:00
Cédric Krier 136fcf1824 Browse again the products to have the modified context in get_cost_value
The context is set but it has no effect if the records are not instantiated
with it.

issue7044
review43881002
2018-01-12 12:54:35 +01:00
Cédric Krier 8fdf25363b Manage negative quantity in cost re-computation the same way as on move
In case of negative quantity, the unit price is used as cost price if it is an
incoming and the cost price is kept if tit is an outgoing.

issue6770
review44311002
2017-09-26 01:36:23 +02:00
Cédric Krier f132407fc0 Move cost price to product level instead of template
issue6515
review41321002
2017-07-05 14:51:50 +02:00
Diego Abad 2b8a3909a8 Change test on recompute_cost_price because of Function field
Since changeset 578bdd3fd776, cost_price on product.product
is a function field, using TemplateFunction pattern.

It is necessary to change test on recompute_cost_price and
recompute_cost_average_price because of Function field, and
change scenario for average cost price to force to write
recomputed cost.

issue5966
review27721003
2016-10-28 23:28:58 +02:00
Sergi Almacellas Abellana b3f7f3ddda Forecast date should return a date instead of a datetime
issue5690
review32271002
2016-07-08 10:20:07 +02:00
Sergi Almacellas Abellana 7851e5aed6 Use context model in quantities computation actions
issue5541
review20181002
2016-06-15 10:45:54 +02:00
Cédric Krier 2e04a068ee Add Python3 support
issue3211
2016-02-26 00:04:09 +01:00
Cédric Krier 38df5fb1fb Write the right cost to the right product in recompute_cost_price
As some products can be skipped if they are services, the zip loop can be
shifted. So it is replaced by a dictionary which have also the advantage to
group the write of the same cost.
Also if all the products are services, the call to write is empty which is not
allowed.

issue5218
review22681002
2016-01-13 21:02:12 +01:00
Cédric Krier a6ecb53580 Use CURRENT_TIMESTAMP instead of NOW
CURRENT_TIMESTAMP is the correct SQL standard way.

issue4837
review22281002
2015-07-01 19:42:33 +02:00
Cédric Krier b677e166ca Allow to re-compute cost price
and to change unit price of move done

issue4729
review12131002
2015-06-15 00:58:00 +02:00
Marius Grigaitis a50b6f21fd Use the last cost_price of the day for cost_value calculation
issue4432
review13831002
2014-12-31 15:27:12 +01:00
Cédric Krier 994bd8a103 Fix most flake8 errors
review8771002
2014-12-02 12:56:04 +01:00
Robin Baumgartner 486006e8ff Use Null constant from python-sql for comparisons
issue4143
review13701003
2014-11-24 14:03:52 +01:00
Cédric Krier abc4bd5a96 Use context to check model and field access
issue4081
review8481002
2014-09-17 21:45:58 +02:00
Sergi Almacellas Abellana 6de834b6b8 Use grouped_slice helper.
issue3516
review10301002
2014-07-17 19:00:19 +02:00
Cédric Krier 6088cc5928 Fix values test for check of no move
The check must be performed even if the value of the field is False.

issue4057
review11371002
2014-07-17 14:30:45 +02:00
Sergi Almacellas Abellana 3b7892c15c Make warehouse required on product quantities by warehouse
issue4054
review7421002
2014-07-16 10:54:03 +02:00
Cédric Krier 0ac9fe8bd5 Use correct grouping when adding to warehouse
issue3843
review11281005
2014-05-27 22:22:28 +02:00
Cédric Krier 88935e3612 Fix context test in Product.get_cost_value
issue3868
review6311002
2014-05-27 22:21:36 +02:00
Cédric Krier ca5f2ae5a6 Fix product_by_location with stock_skip_warehouse and no product_ids
issue3843
review5171002
2014-04-18 19:30:22 +02:00
Cédric Krier c11b49fc3b Prevent changing product type if stock move exists
issue3558
review2311003
2013-12-20 14:02:53 +01:00
Cédric Krier 0ba33d88a2 Use a sequence of records, values in write
issue3499
review1641003
2013-12-19 14:45:31 +01:00
Guillem Barba 38ab876749 New methods on stock.move to compute quantities more modular
* Split products_by_location into two methods on Move:
  compute_quantities_query and compute_quantities
* Use new methods to compute quantities in StockMixin._search_quantity()

issue3201
review971002
2013-12-17 16:22:36 +01:00
Cédric Krier 97fa01f6da Generalize the modification check for no move
review2001002
2013-12-12 13:05:09 +01:00
Guillem Barba 0096fed655 Add Mixin class with helper to setup stock quantity fields
Add StockMixin class in move.py file with helper functions to be used in getter
and searcher methods of quantity fields.
Reimplemented getter and searcher of quantity/forecast_quantity fields of
Product to use these helper functions.
Add test over product's quantity fields.

issue3279
review963003
2013-09-09 14:11:53 +02:00
Cédric Krier 4f833ee812 Migration to python-sql
review1001002
2013-09-06 22:34:48 +02:00
Cédric Krier 77c5845141 Extend Lot Management
Allow to customize move creation of Inventory
Allow to customize unique constraint on Inventory
Allow specific grouping Period Cache
Add grouping on products_by_location and assign_try

review845002
2013-06-21 23:24:17 +02:00
Cédric Krier 4d8c8968be Fix date selection when using period in products_by_location
effective_date and planned_date could be both NULL so they must be considered
as date.max to be included.

review897003
2013-06-06 20:41:29 +02:00
Cédric Krier 1c7db5dd30 Use root to search on period and search on closed periods
products_by_location can be called by users without read access to period.
And only closed period has cache.

review875002
2013-05-22 19:18:43 +02:00
Cédric Krier b0ab39804c Include NULL planned_date with datetime.date.max
review790002
2013-04-16 15:31:10 +02:00
Cédric Krier b5a7415da3 Catch OverflowError in get_quantity when appending timedelta
If date is date.max then appending one day to it will raise an OverflowError.

review761002
2013-04-06 12:33:50 +02:00
Cédric Krier 388aed5112 Use forecast for quantity by warehouse to include today moves
review718002
2013-03-21 19:19:52 +01:00
Cédric Krier a81cd74495 Fix flake8 2013-02-24 16:18:17 +01:00
Cédric Krier c23a2c9808 Fix parent quantities computation
issue2694
review558002
2012-10-15 23:16:29 +02:00
Cédric Krier c5f83d3810 Active Record 2012-09-24 22:18:17 +02:00
Cédric Krier 5c89c26823 Add Product Quantities By Warehouse
review423001
2012-07-25 20:36:58 +02:00
Cédric Krier 9fe60068ee Add date on "Products by Locations" like for "Product by Locations"
review373003
2012-05-30 11:14:19 +02:00
Cédric Krier a316fa5722 Fix cost computation when date is before product creation
When product_cost_history is installed, the cost_price could be None

review373002
2012-05-22 14:31:56 +02:00
Cédric Krier bd7f66d7db Fix pep8 and pyflakes 2012-04-03 20:07:43 +02:00
Nicolas Évrard 200bd670e6 Integer, Numeric and Float allow None as value
NULL value is None and not False

issue2022
review237004
2012-03-23 18:38:54 +01:00
Cédric Krier 98417cafaa Use reduce_ids for product_ids clause
review290003
2012-03-19 14:23:22 +01:00
Nicolas Évrard 5f2b135b09 Add cost value to location / product contextualized views
review246002
2012-03-04 16:09:08 +01:00
Cédric Krier a16c147f93 Re-add rounding of quantities in products_by_location
Wrongly removed in changeset da0d4ec97240

issue2380
review222001
2012-01-27 20:17:26 +01:00
Cédric Krier 82458c020e New wizard design 2012-01-02 18:07:56 +01:00
Nicolas Évrard f6b35baa82 fix pyflake errors
review164008
2011-11-02 16:13:35 +01:00