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
Migrate stock_available_sale to v8 #81
Conversation
@lbellier for your information |
e77892c
to
7bff33f
Compare
The remaining failures seem unrelated to these changes, so I'd say this is ready for review. |
<field name="name">product.form.quoted_qty</field> | ||
<field name="model">product.product</field> | ||
<field name="name">Quoted quantity on product form</field> | ||
<field name="model">product.template</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not product.product
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, this view is reused for both product templates and variants so doing it on product.template serves both purposes at once.
The tree view on the other hand seems to have been specifically inherited for product.product in the standard, but I'm not adding the new field there.
@clonedagain |
@moylop260 The error seems unrelated but please double-check if you can. |
@moylop260 if you care about this PR you may want to test #80 too, which makes the product/variant situation more correct. |
@clonedagain build should be fixed by #82 |
👍 if you have the opportunity to add an automated test using the location / warehouse context it would be a very nice addition. |
@clonedagain can you rebase this PR and resolve the merge conflict? |
@gurneyalex I merged the latest 8.0 branch, I hope I didn't break anything. |
f39f26c
to
beceb9c
Compare
@gurneyalex I've improved the tests, hopefully now it's going to get the coverall quota. |
I've also removed the |
7f58b9d
to
348d420
Compare
e4daf3d
to
c2de162
Compare
f849506
to
fea9755
Compare
Travis is red on a Transifex error. Anything I can do about it? |
Retry as you have done. |
fea9755
to
f3ad27b
Compare
There are cases where we dot NOT want to simply sum the quantities of all the variants. For example when dealing with manufacturing capacities, we may have to chose between variants because we can't make ALL of them with the same components. So instead of a simple non-modular implementation, we'll let each module define his own implementation of how to compute the product template's quantity available for sale.
a6f2e42
to
09c7eb8
Compare
# Compute the quoted quantity in the product's UoM | ||
# Rounding is OK since small values have not been squashed before | ||
results += Counter({ | ||
product_id: self.env['product.uom'].sudo()._compute_qty( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmignon I'm doing a sudo
also in stock_available_sale
, do you think it could break multi-company setups like it did in stock_available_mrp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clonedagain Why do you need to use sudo()
here? product.uom
can be read by base.group_user
. Moreover, each time you use sudo()
, you build a new empty environment and the _compute_qty will need to query the database to retrieve the product, the uom, etc... IMO, you introduce here a performance issue. What do you think?
Correctly segregates templates and variants. Rewritten in new API. Uses the ORM instead of SQL calls. Conforms better to OCA standards 'Quoted qty' is now positive. Explain UoM feature drop. Added directions to block quotations using sale_exceptions Rewrote the tests in python and added new tests regarding warehouses, locations, variants and templates ; and now test the quantity available for sale. Don't use SUPERUSER privileges anymore (it's not needed, it prevents cache reuse, it may breaks multicompany features) Simplify copyright headers
09c7eb8
to
449071b
Compare
@lmignon I changed as you suggested. |
👍 (Code review) Tahnk you @clonedagain |
👍 (w/o test) |
Migrate stock_available_sale to v8
[MIG] oak_purchase
Correctly segregates templates and variants.
Rewritten in new API.
Uses the ORM instead of SQL calls.
Conforms better to OCA standards
You may be interested in this other PR too: #93