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

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
Copy link
Author

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
Copy link
Author

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
Copy link
Member

guewen 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 7.0-add-stock-available branch 3 times, most recently from 646ca46 to 20cf709 Compare September 11, 2014 16:14
@coveralls
Copy link

Coverage Status

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

@clonedagain
Copy link
Author

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).

@coveralls
Copy link

Coverage Status

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

@clonedagain
Copy link
Author

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
Copy link
Member

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

@clonedagain
Copy link
Author

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
Copy link
Member

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
Copy link
Author

Rebased to avoid conflicts due to recent flake8ification.

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 7.0-add-stock-available branch 2 times, most recently from 0a4400a to 19182aa Compare December 1, 2014 10:53
@coveralls
Copy link

Coverage Status

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

@clonedagain
Copy link
Author

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"?

Module to take immediate manufaturing capability into account in the stock quantity available to promise.
cyrilgdn pushed a commit to cyrilgdn/stock-logistics-warehouse that referenced this pull request Mar 21, 2016
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
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 pushed a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Apr 25, 2018
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 pushed a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Apr 26, 2018
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 pushed a commit to tschanzt/stock-logistics-warehouse that referenced this pull request Jan 4, 2019
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request Jul 4, 2019
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request Jul 6, 2019
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 referenced this pull request in ursais/stock-logistics-warehouse Jul 12, 2019
# 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 #5:

[IMP] Add Test Location_id Outbound

# This is the commit message #6:

[IMP] Flake8 Line Too Long

# This is the commit message #7:

[IMP] Indent, Expected Date
OCA-git-bot pushed a commit that referenced this pull request Aug 31, 2019
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request Aug 31, 2019
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Dec 19, 2019
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Jun 16, 2020
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Aug 25, 2020
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
filoquin pushed a commit to filoquin/stock-logistics-warehouse that referenced this pull request Oct 2, 2020
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Oct 21, 2020
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request Dec 24, 2020
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Jan 18, 2021
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request Feb 9, 2021
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
ps-tubtim pushed a commit to ecosoft-odoo/stock-logistics-warehouse that referenced this pull request Mar 4, 2021
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
victoralmau pushed a commit to Tecnativa/stock-logistics-warehouse that referenced this pull request May 13, 2021
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request May 27, 2021
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 pushed a commit to akretion/stock-logistics-warehouse that referenced this pull request May 27, 2021
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
RLeeOSI pushed a commit to ursais/stock-logistics-warehouse that referenced this pull request Jun 29, 2021
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
CarlosRoca13 pushed a commit to Tecnativa/stock-logistics-warehouse that referenced this pull request Aug 16, 2021
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
CarlosRoca13 pushed a commit to Tecnativa/stock-logistics-warehouse that referenced this pull request Aug 16, 2021
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
JoanMForgeFlow pushed a commit to ForgeFlow/stock-logistics-warehouse that referenced this pull request Jan 28, 2022
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
khoivo1601 pushed a commit to khoivo1601/stock-logistics-availability that referenced this pull request Mar 9, 2023
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/stock-logistics-warehouse#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
khoivo1601 pushed a commit to khoivo1601/stock-logistics-availability that referenced this pull request Mar 10, 2023
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/stock-logistics-warehouse#5 (comment)
Improve tests, rewritten in python.
Adhere to new file/manifest/README conventions.
Simplify copyright headers
bizzappdev pushed a commit to BizzAppDev-Systems/stock-logistics-availability that referenced this pull request May 10, 2024
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/stock-logistics-warehouse#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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants