Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic module to compute the stock quantity available to promise #5

Merged
merged 6 commits into from Feb 26, 2015

Conversation

@clonedagain
Copy link

commented Jul 29, 2014

Commit 1: Main module + option to exclude incoming deliveries

The "quantity available to promise" is the quantity of a product that you can commit to deliver to a customer.
Depending on the business, it may depend on expected deliveries, manufacturing, expected sales, or many other parameters.
To handle this concept in a modular and configurable way, @lbellier and I add a generic module to compute the stock quantity available to promise, and a 3 pluggable implementations that users can choose from. All implementations can be used at the same time.

Code trick: function field modularity

By default function fields are not very modular (you need to redefine the whole field to override the method). stock_available takes care of this by making the function fields call the pool instead, so that stock_available_immediately and other future implementations need only override the function _product_available.

Changes to stock_available_immediately

The existing module stock_available_immediately by @guewen and @sebastienbeau is turned into the first optional implementation.
stock_available_immediately is rewritten to compute "virtual - incoming" instead of "real - outgoing", which should be mostly the same except for rounding.
The field name "immediately_usable_qty" is unchanged for compatibility, but the field is now called "Available to promise" in the views and help texts (this wording seems more widespread).

Commit 2: option to include products that can be readily manufactured

The module stock_available_mrp takes immediate manufacturing capability into account in the stock quantity available to promise.
We consider a product can be readily manufactured if all its direct components are available.

Commit 3: option to exclude products already proposed in sale quotations

The module stock_available_sale takes sale quotations into account in the stock quantity available to promise, so that sales persons don't include the same products in 2 quotations.

@clonedagain

This comment has been minimized.

Copy link
Author

commented Jul 30, 2014

There is a small problem with the "context trick", some fields are not computed. I'll fix it and rebase the branch but please keep reviewing in the meantime.

@clonedagain

This comment has been minimized.

Copy link
Author

commented Jul 30, 2014

Fixed the context trick. It does have a small side effect (adds values to the caller's field_names) that I documented, and I think it's safe.

@guewen

This comment has been minimized.

Copy link
Member

commented Aug 13, 2014

Wow, impressive. I will try to take some time soon for a review.
Meantime, can you rebase from the 7.0 branch so Travis will check your PR please?

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch 3 times, most recently from 646ca46 to 20cf709 Sep 11, 2014

@coveralls

This comment has been minimized.

Copy link

commented Sep 11, 2014

Coverage Status

Coverage increased (+2.76%) when pulling 20cf709 on numerigraphe:7.0-add-stock-available into 316d391 on OCA:7.0.

@clonedagain

This comment has been minimized.

Copy link
Author

commented Sep 11, 2014

The tests pass, so it's ready for you to review.
Rebased and re-flake8'ed.
I also fixed a small bug (the sale module was not considering the production capability).

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch from 20cf709 to c5439f1 Sep 12, 2014

@coveralls

This comment has been minimized.

Copy link

commented Sep 12, 2014

Coverage Status

Coverage increased (+2.8%) when pulling c5439f1 on numerigraphe:7.0-add-stock-available into 316d391 on OCA:7.0.

@clonedagain

This comment has been minimized.

Copy link
Author

commented Sep 12, 2014

There was a small bug that became visible because of last fix (used to product wrong warning messages, now triggered an endless recursion).
It's fixed now and rebased.

@gurneyalex

This comment has been minimized.

Copy link
Member

commented Oct 7, 2014

@clonedagain what is your opinion regarding this PR and #2559: is it blocking? Something we can fix in OCB if official is buggy?

@gurneyalex gurneyalex added the question label Oct 7, 2014

@clonedagain

This comment has been minimized.

Copy link
Author

commented Oct 7, 2014

Fixing this in OCB would not be fair to users who stick to the official branch. Our users were pretty unhappy when the onchange broke, and it was rather hard to track down.

@gurneyalex gurneyalex added work in progress and removed question labels Oct 8, 2014

@gurneyalex

This comment has been minimized.

Copy link
Member

commented Oct 8, 2014

OK, thanks (and apologies for the long delay on considering this PR...).

I've set things as work in progress, and asked for an update on the official addon issue.

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch from c5439f1 to 48bb4a4 Oct 20, 2014

@clonedagain

This comment has been minimized.

Copy link
Author

commented Oct 20, 2014

Rebased to avoid conflicts due to recent flake8ification.

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch from 48bb4a4 to 66c7b1f Nov 28, 2014

Lionel Sausin (Numérigraphe)
[ADD] stock_available
Generic module to compute the stock quantity available to promise using several implementations.
stock_available_immediatly is changed to become the first optional implementation.

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch from 66c7b1f to d06e36e Nov 28, 2014

@clonedagain clonedagain referenced this pull request Nov 28, 2014
1 of 2 tasks complete

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch 2 times, most recently from 0a4400a to 19182aa Dec 1, 2014

@coveralls

This comment has been minimized.

Copy link

commented Dec 1, 2014

Coverage Status

Coverage decreased (-3.02%) when pulling 19182aa on numerigraphe:7.0-add-stock-available into 23f8a9b on OCA:7.0.

@clonedagain

This comment has been minimized.

Copy link
Author

commented Dec 1, 2014

I've split this PR in 2, so now the blocking part is isolated in #25.
Travis build passed (the errors in the log seem unrelated): can you please tag "needs review"?

@clonedagain clonedagain force-pushed the numerigraphe:7.0-add-stock-available branch from 19182aa to 6610473 Dec 1, 2014

Lionel Sausin (Numérigraphe)
[ADD] stock_available_mrp
Module to take immediate manufaturing capability into account in the stock quantity available to promise.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 6, 2015
Lionel Sausin
stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 6, 2015
Lionel Sausin
stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 6, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 6, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 6, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 9, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 9, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 9, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 9, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 9, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 10, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Now computes potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Now takes all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Tests rewritten in python and improved.
Code now adheres to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 10, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 19, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Browse mrp.bom as current user: sudo is not required since mrp.bom are readable to groups with access to the qty_x fields on a product. Moreover using sudo to retrive the bom will ignore the company_id defined on the bom
Improve tests, rewritten in python.
Adhere to new file/manifest conventions.
Simplify copyright headers
lmignon added a commit to acsone/stock-logistics-warehouse that referenced this pull request Nov 20, 2015
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 20, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 20, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Nov 25, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
clonedagain pushed a commit to numerigraphe/stock-logistics-warehouse that referenced this pull request Dec 1, 2015
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
cyrilgdn pushed a commit to cyrilgdn/stock-logistics-warehouse that referenced this pull request Mar 21, 2016
Lionel Sausin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
cyrilgdn pushed a commit to cyrilgdn/stock-logistics-warehouse that referenced this pull request Mar 21, 2016
Lionel Sausin Cyril Gaudin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
cyrilgdn pushed a commit to cyrilgdn/stock-logistics-warehouse that referenced this pull request Mar 21, 2016
Lionel Sausin Cyril Gaudin
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
yk2kus pushed a commit to thinkopensolutions/oca-stock-logistics-warehouse that referenced this pull request Mar 16, 2017
tschanzt added a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Apr 25, 2018
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
tschanzt added a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Apr 26, 2018
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
tschanzt added a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Jan 4, 2019
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
florian-dacosta added a commit to akretion/stock-logistics-warehouse that referenced this pull request Jul 4, 2019
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
florian-dacosta added a commit to akretion/stock-logistics-warehouse that referenced this pull request Jul 6, 2019
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
osi-scampbell added a commit to ursais/stock-logistics-warehouse that referenced this pull request Jul 12, 2019
# This is a combination of 7 commits.
# This is the 1st commit message:

[IMP] Stock Request Order Bypass Submitted

[IMP] stock_request: Add group to bypass submission (OCA#595)

[IMP] Flake8

[IMP] Migration Script

[IMP] Add Direction Functionality

[IMP] stock_request: Add group to bypass submission (OCA#595)

# This is the commit message #2:

[IMP] Fix Indent

# This is the commit message #3:

[IMP] Expected Date

# This is the commit message #4:

[IMP] Remove Warning Depricated Method Name

# This is the commit message OCA#5:

[IMP] Add Test Location_id Outbound

# This is the commit message OCA#6:

[IMP] Flake8 Line Too Long

# This is the commit message OCA#7:

[IMP] Indent, Expected Date
OCA-git-bot added a commit that referenced this pull request Aug 31, 2019
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in #5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
pedrobaeza added a commit to akretion/stock-logistics-warehouse that referenced this pull request Aug 31, 2019
[MIGR] stock_available_mrp: migrate to v8
Compute potential quantities for both product templates and variants. To keep the code simple, only the biggest potential of any single variant is accounted for in the template's potential.
Take all levels of phantom BoM into account, respects validity dates etc. thanks to the use of the standard method _bom_explode, as suggested by @gdgellatly in OCA#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.