Commit Graph
222 Commits
Author SHA1 Message Date
Cédric Krier 88b96f2990 Raise a single warning for moves without origin
issue6764
review41551002
2017-09-26 01:31:25 +02:00
Cédric Krier 60108d24cf Allow user to set effective date of the move
issue6764
review41551002
2017-09-26 01:30:42 +02:00
Cédric Krier ef9d0a87da Allow to cancel staging move
issue6708
review44261002
2017-08-28 18:28:27 +02:00
Cédric Krier 6b9a3b1666 Improve performance of average cost price computation
- Save the move state only when a second same products is going to be
  proceeded.
- Write the new cost prices when the moves are saved.
- Use get_multivalue with extensible pattern using explicit company value.
- Rename _update_product_cost_price into _compute_product_cost_price
- Use grouped instances of moves with the right context to avoid to
  instantiate a product on each call to _compute_product_cost_price.

issue6626
review36431002
2017-08-02 23:03:38 +02:00
Cédric Krier 6d28c7e369 Allow to delete staging move
issue6056
review38461002
2017-07-19 00:10:50 +02:00
Cédric Krier 4356a58019 Allow to deactivate only empty locations
issue6590
review37491002
2017-07-12 19:55:02 +02:00
Cédric Krier ced86b3910 Compute average cost with right product quantity
The product quantity must be computed on all storage location but without
childs otherwise the children quantity are added a second time on parent by
Move._get_quantity
To allow this behaviour the Move._get_quantity and Move._search_quantity use
the 'with_childs' context. If the context is not set, the default value will
be False if there are more than one location. This provides a sane default
behaviour because the locations could be children from each others.

issue6627
review35491002
2017-07-12 19:41:52 +02:00
Cédric Krier 998c564806 Evaluate stock quantity after summing the children
The search quantity can not use an having clause because the SQL query does
not sum the children. The evaluation of the domain expression must be done
after.

issue6605
review37501002
2017-07-12 19:29:19 +02:00
Cédric Krier 675a788d03 Remove unused import 2017-07-05 18:29:51 +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
Cédric Krier 522f3938be Require unit price from supplier only to storage
issue6436
review32241002
2017-06-24 10:34:01 +02:00
Cédric Krier 7d5d54ba3d Do not need origin if both types matches
issue6436
review32241002
2017-06-24 10:33:31 +02:00
Cédric Krier 8acd609ec4 Require move assignation also on view location
issue6436
review32241002
2017-06-24 10:30:30 +02:00
Cédric Krier 1e5d079d5c Do not set effective_date on assign
When the effective date is set on assignation, if the move stays in this state
for more than 1 day, it is no more taken into account for stock quantity
computation.
But if the effective date is not set on assign, the stock quantity computation
must always include assigned moves when stock_assign is set with the exception
of delta computation which must always use the effective or planned date.

issue6371
review36261002
2017-03-29 22:44:33 +02:00
Cédric Krier e4cb95cf02 Do not assign consumable on view location
It is not allowed to assign remaining consumable on the current location if
this location is a view because the domain on location field of move does not
allow it.

issue6372
review33981002
2017-03-23 22:45:29 +01:00
Sergi Almacellas Abellana 34073750ed Avoid computation for assign_try with no moves
issue6366
review31201002
2017-03-22 11:14:45 +01:00
Cédric Krier 305cba24ce Select for update moves used to compute assignation
As a concurrent transaction could update a moves after waiting for the release
of the table lock, we must take a lock on each rows used for the computation.

issue6134
review25921002
2017-01-25 23:28:13 +01:00
Cédric Krier 7bc2bf1496 Do not increase available quantity on destination location in assign_try loop
This makes assignation behaves like compute quantity from changeset 056cbb515d4d

issue6100
review33651002
2016-12-30 22:07:19 +01:00
Cédric Krier 8db7d9bcdb Check period closed per company
issue5934
review30611002
2016-10-11 18:10:02 +02:00
Albert Cervera i Areny 2d34ff6cfd Allow using view locations in cancelled stock moves.
Since changest 29ab3d9bd918 we allow using view locations in draft and staging
moves making it possible to have a warehouse with a view location as main
storage location. But if the user wanted to cancel a shipment with such location
she would have to change the location of all moves before cancelling which is
very annoying.

issue5891
review29531002
2016-10-02 11:00:17 +02:00
Sergi Almacellas Abellana 82be44e56e Fix antipatern of create/write in loop
issue3516
review6891002
2016-06-23 09:40:00 +02:00
Guillem Barba 6430cf4ccf Improve Move.assign() making a single call to Move.write()
issue5155
review20581002
2016-03-21 11:06:22 +01:00
Cédric Krier c91a2409f2 Add a quick sum in compute_quantities for single location
When a single location is requested, we don't need to compute the value of all
the node of the subtree because all locations are children. So we can sum the
quantity directly as if it was for the location.

issue5297
review23781002
2016-03-04 00:21:29 +01:00
Nicolas Évrard 94b0ab55e6 Follow PEP-0249 for Transaction and backends
issue4949
review19781002
2016-03-03 21:55:39 +01:00
Cédric Krier 2e04a068ee Add Python3 support
issue3211
2016-02-26 00:04:09 +01:00
Karla Stenger 69ae155fa4 hange Uom.round into an instance method.
issue4423
review18811002
2016-01-11 10:30:50 -03:00
Cédric Krier 27e9e5f9d5 Add Function fields on Product from Template
issue5087
review23611002
2015-12-31 16:03:56 +01:00
Cédric Krier 3db856344d Improve speed of Move.assign_try
- Use a cache for the childs of locations
- Delay write and assign calls to the end and group them

issue5033
review16721002
2015-11-10 13:05:53 +01:00
Cédric Krier 8abae7a97d Add do button on stock move form & list
issue5042
review21471002
2015-11-05 23:29:59 +01:00
Raimon Esteve 8afd8034ed Keep default location order when picking product
issue5050
review15771002
2015-10-22 17:18:17 +02:00
Cédric Krier cca1c4a02d 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
review18701002
2015-10-15 00:57:30 +02:00
Sergi Almacellas Abellana f6cc35f698 Fix average cost price when product quantity is negative
issue5038
review15721002
2015-10-14 15:45:21 +02:00
Nicolas Évrard e97f7eb78f Add buttons on stock move form & list
issue3945
review8991002
2015-09-26 21:19:37 +02:00
Cédric Krier 8507f1660f Allow to use view location on staging and draft moves
issue4912
review24321002
2015-09-22 23:00:48 +02:00
Cédric Krier a2da70ea13 Use new PYSON syntax
issue2205
review16391002
2015-06-28 23:45:31 +02:00
Cédric Krier f20586adcd Use Constraint instance in ModelSQL._sql_constraints
issue4814
review15491002
2015-06-22 17:00:00 +02:00
Cédric Krier 8a5de745c4 Pass explicit move to get_key in Move.assign_try
issue4811
review8161002
2015-06-15 01:21:31 +02:00
Cédric Krier 20dfc22151 Use new Rule.query_get
issue4800
review7211003
2015-06-15 01:16:21 +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
Cédric Krier 6b8ce20a28 Fail assign_try if the remaining quantity is the rounding precision
issue4609
2015-03-09 20:44:21 +01:00
Cédric Krier 08ebed3b28 Round written quantity in assign_try
issue4609
review13051002
2015-03-09 19:36:31 +01:00
Cédric Krier a0e23f6faa Remove AS in GROUP BY of compute quantity query
It is not allowed to use alias output in the GROUP BY clause.

issue4495
review11811002
2015-01-27 22:59:44 +01:00
Cédric Krier 0a4c95ee08 staging move state should fail assignation
issue4462
review13871002
2015-01-09 19:06:36 +01:00
Cédric Krier 1014cf5400 Use price_digits
issue4438
review6791002
2015-01-06 23:31:09 +01:00
Cédric Krier bb7b385146 Add 'staging' state to stock move
issue4362
review5811002
2015-01-02 15:40:11 +01:00
Cédric Krier 88053c26bd Apply stock_assign of compute_quantity_query only on outgoing moves
It is too much optimistic to compute incoming assigned moves as done.

issue4384
review10681002
2014-12-11 22:18:32 +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 5b4b6b1558 New API for on_change
issue4203
review8581002
2014-10-29 20:40:25 +01:00
Nicolas Évrard 00505350c5 Do not filter out inactive products from stock computation
issue4240
review12621002
2014-10-24 17:28:53 +02:00