Commit Graph
62 Commits
Author SHA1 Message Date
Bernat 5fcc9ab99c Do not set fifo_quantity greater than quantity
issue9664
review328231002
2020-10-21 23:33:28 +02:00
Sergi Almacellas Abellana b6fbb99aa1 Clear fifo_quantity when copying a move
issue9554
review321981002
2020-08-25 18:06:27 +02:00
Cédric Krier 2691cb7ecf Use original cost price for returned move
and factorize the cost price of move for cost computation

issue9440
review327491003
2020-08-10 23:38:04 +02:00
Cédric Krier ed54edae30 Add unit_price_company Function field on stock move
issue9401
review290341002
2020-07-04 00:21:39 +02:00
Cédric Krier 452550c92f Enforce filling cost price of move
We set cost price only for outgoing or incoming moves.

issue9397
review321611002
2020-07-03 21:22:43 +02:00
Cédric Krier 8764236bb9 Use all moves to compute FIFO
We must consider any incoming moves (ex: inventory) for the computation of the
FIFO otherwise the back computation to find first in moves does not pick enough
moves. As not all incoming moves have a unit price, we use the current cost
price as fallback.
Also in re-computation, the in or out move test should only rely on the storage
location usage in order to properly compute the average cost.

issue9274
review321471002
2020-06-19 00:24:56 +02:00
David Harper d80d899109 Rename move state from cancel to cancelled
issue8927
review297851002
2020-06-06 10:30:11 +01:00
Cédric Krier 51ed77ee32 Add round_price
We add a common method to round prices that are stored using the price digits.
It is useless to use the digits from the field because it can not be changed in
any other way than by configuration.

issue9146
review299521002
2020-04-23 21:44:00 +02:00
Cédric Krier f5b63d4635 Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:52 +01:00
Cédric Krier e0a799df3d Use current cost price if no FIFO moves
If we can not find any FIFO moves, the products should be moved out at the
average cost price instead of zero.

issue8699
review252351002
2019-10-24 18:57:55 +02:00
Cédric Krier 397a247268 Improve selection of moves used for cost
issue8700
review282201004
2019-10-14 00:04:14 +02:00
Cédric Krier ab6d0ed7d2 Do not get product from last fifo moves but from self move
The fifo moves can be empty and so move is undefined.

issue7918
2019-04-10 09:55:06 +02:00
Cédric Krier 76a034f4ce Convert cost price into move uom to compute average cost price
The unit price is always expressed in the unit of the move but the cost price
is computed in the default uom.

issue7918
review251121002
2019-03-22 11:16:13 +01:00
Cédric Krier f77c77c78c Add ir.message and use custom exceptions
issue3672
2018-12-29 14:20:29 +01:00
Cédric Krier e8d7974991 Remove support for Python 2.7
issue7497
review53261002
2018-06-26 19:11:49 +02:00
Cédric Krier 3ff455d808 Allow to modify fifo_quantity in closed period
The FIFO quantity may need to be updated after the stock period is closed.
As it does not affect the period cache, it can be updated.

issue6883
review35721002
2017-10-30 09:55:51 +01:00
Cédric Krier 0d95669f8c Improve performance of cost price computation
- Return average cost price
- Compute average cost price with the current move

issue6626
review42501002
2017-08-02 23:04:45 +02:00
Cédric Krier 3827d940d0 Move cost price to product level instead of template
issue6515
review41321002
2017-07-05 14:51:46 +02:00
Cédric Krier 81f289aad8 Do not call write with no parameters
fifo_moves could be empty and so be also to_write but calling write without
parameter is not allowed.
This was introduced in changeset 8237f9e3afaf

issue6196
review33811002
2017-02-08 09:54:29 +01:00
Sergi Almacellas Abellana 36fb461b2d Fix antipatern of create/write in loop
issue3516
review13951002
2016-06-17 13:44:45 +02:00
Jonathan Levy 21c654800b Add Python3 support
issue3211
review17861002
2016-02-27 15:22:10 +01:00
Cédric Krier 340d5f5839 Missing conversion of unit price to company currency
The currency of unit price on move is defined by the currency field.
So to compute the cost price, it should first be converted to the company
currency.

issue5057
review19561002
2015-10-22 18:14:45 +02:00
Cédric Krier fc850d7560 Don't override cost_price if it is zero
Only override the cost_price if it was not set which means if it is None.

issue5034
2015-10-22 11:02:49 +02:00
Cédric Krier f481ca689a Use Constraint instance in ModelSQL._sql_constraints
issue4814
review15491002
2015-06-22 16:59:35 +02:00
Guillem Barba 702e420c52 Remove digits attribute from internal quantity fields
issue4741
review19281002
2015-06-17 08:33:26 +02:00
Cédric Krier 8c95a3bfb5 Fix most flake8 errors
review8771002
2014-12-02 12:55:33 +01:00
Cédric Krier 629d1bd34d Compute cost price one move at a time
As _update_product_cost_price uses product quantity, this quantity must be
recomputed after each move in case some are for the same products.

issue4039
review12441002
2014-08-29 16:24:28 +02:00
Cédric Krier 98c2b4873b The cancellation of move should not compute cost price
because such move can not be done (prevented by _deny_modify_done_cancel)

issue4107
review12441002
2014-08-29 16:24:01 +02:00
Albert Cervera i Areny 98d238af7b Fix stock.move delete method.
issue3282
review966002
2013-07-02 15:59:48 +02:00
Cédric Krier 820bbedab2 Call _update_fifo_out_product_cost_price for any outgoing moves
issue3138
review781002
2013-04-13 11:54:30 +02:00
Cédric Krier 7c85aca8cd Update cost price according to product quantity selected
issue3138
review781002
2013-04-13 11:53:27 +02:00
Udo Spallek ea5ba1cebb Signature of raise_user_error is tuple
issue3078
review735002
2013-03-25 10:28:28 +00:00
Cédric Krier 581c8b40ac Re-add missing update of cost_price lost in workflow migration
issue3051
review704003
2013-03-12 10:31:15 +01:00
Albert Cervera i Areny 01a908ca9d Replace _constraints with validate in ModelStorage and improve user messages.
issue2616
review371002
2013-03-07 16:55:33 +01:00
Cédric Krier 44a8fda655 Forget to remove classmethod decorator
When refactored _update_fifo_out_product_cost_price into instance method.

issue3048
2013-03-07 15:56:26 +01:00
Cédric Krier 4961fa90f5 Refactore _update_fifo_out_product_cost_price into instance method
review681002
2013-02-26 20:38:58 +01:00
Cédric Krier a1636f1f65 Fix flake8 2013-02-24 14:19:56 +01:00
Cédric Krier 23566155e9 Fix signature call to _update_product_cost_price
issue3018
2013-02-22 16:45:39 +01:00
Cédric Krier 6926419581 Fix wrong arguments for _update_fifo_out_product_cost_price
issue3007
review663003
2013-02-20 10:33:48 +01:00
Cédric Krier 380c56e1c3 Use Workflow for Stock Move
review600002
2012-12-27 21:54:05 +01:00
Oscar Andres Alvarez 760eff2bfe Active Record 2012-09-24 22:09:23 +02:00
Cédric Krier 5b2d98d4c3 Fix pep8 and pyflakes 2012-04-03 20:07:21 +02:00
Cédric Krier c6347444d1 Add support for production location in cost price computation
review295004
2012-03-25 15:45:02 +02:00
Cédric Krier aaa64fcd0c Update cost_price only from supplier to storage 2012-02-24 11:56:57 +01:00
Nicolas Évrard 6395305807 fix pyflake errors
review163010
2011-11-02 16:10:59 +01:00
Cédric Krier 65dd846757 Add test for depends 2011-08-04 16:59:28 +02:00
Cédric Krier 77aedd4eae Change Pool into a Singleton 2011-07-03 13:19:03 +02:00
Mathias Behrle 1ab97b45f1 Use effective_date to calculate currency rate for issue1746. 2011-04-13 18:13:41 +02:00
Cédric Krier f641a9f52b Fix default fifo_quantity naming 2010-12-12 16:51:12 +01:00
Cédric Krier 029078b8c4 Backed out changeset 332af0f948ab 2010-12-12 16:50:44 +01:00