Skip to content

Commit 71a6485

Browse files
committed
FIX aac_stk_situation: in _get_stock_valuation()
1 parent f46bf86 commit 71a6485

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

account_move_adyen_import/static/description/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
11+
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15-
Despite the name, some widely supported CSS2 features are used.
1615
1716
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1817
customize this style sheet.
@@ -275,7 +274,7 @@
275274
margin-left: 2em ;
276275
margin-right: 2em }
277276

278-
pre.code .ln { color: gray; } /* line numbers */
277+
pre.code .ln { color: grey; } /* line numbers */
279278
pre.code, code { background-color: #eeeeee }
280279
pre.code .comment, code .comment { color: #5C6576 }
281280
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +300,7 @@
301300
span.pre {
302301
white-space: pre }
303302

304-
span.problematic, pre.problematic {
303+
span.problematic {
305304
color: red }
306305

307306
span.section-subtitle {

account_stock_situation/models/company.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,11 @@ def _get_stock_valuation(self):
7171
if tools.config.get("running_env") == "dev":
7272
base_url = "http://anothercorp.localhost/"
7373
location_ids = [x.lot_stock_id.id for x in self.valued_warehouse_ids]
74-
7574
stock_quant_ids = self.env["stock.quant"].search(
7675
[("location_id", "child_of", location_ids)],
7776
)
7877
products = self.env["product.product"].browse(stock_quant_ids.product_id.ids)
7978
vals = defaultdict(list)
80-
8179
product_dict = {}
8280
for stock_quant in stock_quant_ids:
8381
if stock_quant.product_id.id not in product_dict:
@@ -86,14 +84,16 @@ def _get_stock_valuation(self):
8684
stock_quant.quantity,
8785
]
8886
else:
89-
if stock_quant.warehouse_id in product_dict[stock_quant.product_id.id]:
87+
if (
88+
stock_quant.warehouse_id
89+
in product_dict.get(stock_quant.product_id.id)[0]
90+
):
9091
product_dict[stock_quant.product_id.id][1] += stock_quant.quantity
9192
else:
9293
product_dict[stock_quant.product_id.id] += [
9394
stock_quant.warehouse_id,
9495
stock_quant.quantity,
9596
]
96-
9797
for product_id, warehouse_quantities in product_dict.items():
9898
product = products.filtered(lambda s: s.id == product_id)
9999
vals["link"].append(
@@ -103,7 +103,6 @@ def _get_stock_valuation(self):
103103
)
104104
vals["code"].append(product.default_code)
105105
vals["designation"].append(product.name)
106-
107106
for i in range(0, len(warehouse_quantities), 2):
108107
warehouse_id = warehouse_quantities[i]
109108
quantity = warehouse_quantities[i + 1]
@@ -120,7 +119,6 @@ def _get_stock_valuation(self):
120119
vals[f"qty_{warehouse.code}"].append(0)
121120

122121
vals["value"].append(round(product.standard_price))
123-
124122
df = pl.from_dict(vals)
125123
mfile = io.BytesIO()
126124
df.write_excel(workbook=mfile)
@@ -132,4 +130,4 @@ def _get_stock_valuation(self):
132130
"datas": base64.b64encode(mfile.getvalue()),
133131
}
134132
)
135-
return sum(vals["valeur"]), attach
133+
return sum(vals["value"]), attach

account_stock_situation/static/description/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
11+
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15-
Despite the name, some widely supported CSS2 features are used.
1615
1716
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1817
customize this style sheet.
@@ -275,7 +274,7 @@
275274
margin-left: 2em ;
276275
margin-right: 2em }
277276

278-
pre.code .ln { color: gray; } /* line numbers */
277+
pre.code .ln { color: grey; } /* line numbers */
279278
pre.code, code { background-color: #eeeeee }
280279
pre.code .comment, code .comment { color: #5C6576 }
281280
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +300,7 @@
301300
span.pre {
302301
white-space: pre }
303302

304-
span.problematic, pre.problematic {
303+
span.problematic {
305304
color: red }
306305

307306
span.section-subtitle {

0 commit comments

Comments
 (0)