-
-
Notifications
You must be signed in to change notification settings - Fork 734
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
[ADD] stock_lot_multi_image: New module #2238
[ADD] stock_lot_multi_image: New module #2238
Conversation
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.
This is more a usage rather than configuration. Because it's not the module configuration but a general module workflow.
Please add a screenshot or screenshots for better UX. They should be no more than 800px width.
@@ -0,0 +1 @@ | |||
This module enables the addition of multiple images for each stock lot. |
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.
This module allows to add multiple images to a stock lot.
@@ -0,0 +1,3 @@ | |||
Sometimes it is necessary to have photos of a particular stock lot (item) in addition to the product-level photos (for product.template or product.variant). |
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.
Sometimes it is necessary to have pictures of a specific product that is tracked by serial numbers.
For example you manage a stock of used laptops where each model is a product variant and each laptop is an item with a unique serial number. And you would like to have photos of each specific laptop, not just the pictures of the model from the official website.
However by default in Odoo you can add pictures only to a product template or a product variant.
5b4ceb5
to
088e325
Compare
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.
Code review LGTM
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.
Functional LGTM
"stock", | ||
"base_multi_image", | ||
], | ||
# "images": ["static/description/banner.png"], |
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.
to remove?
_name = "stock.lot" | ||
_inherit = ["stock.lot", "base_multi_image.owner"] | ||
|
||
image = fields.Image(compute="_compute_image") |
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.
should we also use image.mixin
to have the option to store the main image under multiple size, then use image_1920
instead of image
as defined here? it maybe useful if someone want to display a thumbnail of the main image
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.
@hoangtrann I agree, @GabbasovDinar please add dependency on the image.mixin too.
320b333
to
e17418f
Compare
This PR has the |
for lot in self: | ||
lot.image_1920 = ( | ||
lot.image_ids | ||
and lot.with_context(bin_size=False).image_ids[0].image_1920 |
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.
and lot.with_context(bin_size=False).image_ids[0].image_1920 | |
fields.first(lot.with_context(bin_size=False).image_ids).image_1920 |
will do the job alone
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.
@rousseldenis thanks! fixed
e17418f
to
78ebc9b
Compare
Compute main image of lots | ||
""" | ||
for lot in self: | ||
lot.image_1920 = ( |
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.
Arf, I wanted to say the whole expression:
lot.image_1920 = ( | |
lot.image_1920 = fields.first(lot.with_context(bin_size=False).image_ids).image_1920 |
That's it. if image_ids is void, image_1920
will be False
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.
fixed
This module enables the addition of multiple images for each stock lot. Task: 4241
78ebc9b
to
8bc43dc
Compare
Hi @rousseldenis ! Would appreciate your final review and .... merge (if possible of course) 😄 |
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.
@GabbasovDinar @ivs-cetmix I can encourage you to check this module and all the related ones that allows to use the storage you want (S3, ...) https://github.com/OCA/storage/tree/16.0/fs_base_multi_image
/ocabot merge nobump |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at f2155bb. Thanks a lot for contributing to OCA. ❤️ |
This module enables the addition of multiple images for each stock lot.
Task: 4241