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

[ADD] new comment vals and changes in 'Lote' expression #14

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<odoo noupdate="1">
<record id="product_lot_fiscal_comment" model="l10n_br_fiscal.comment">
<field name="name">Lote</field>
<field name="comment">LOTE: ${ lot }</field>
<field name="comment">${ lot if lot else '' }</field>
<field name="comment_type">fiscal</field>
<field name="object">l10n_br_fiscal.document.line.mixin</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections import defaultdict

from odoo import models


Expand All @@ -6,7 +8,28 @@ class FiscalDocumentLineMixinMethods(models.AbstractModel):

def __document_comment_vals(self):
res = super(FiscalDocumentLineMixinMethods, self).__document_comment_vals()
res["lot"] = ", ".join(
self.account_line_ids.mapped("prod_lot_ids").mapped("name")
)

lot_info = []
lot_quantities = defaultdict(float)
lot_uom = {}

for line in self.account_line_ids:
line_lot_quantities = line.lots_grouped_by_quantity()
for lot_name, qty in line_lot_quantities.items():
lot_quantities[lot_name] += qty

if lot_name not in lot_uom:
lot_uom[lot_name] = (
line.product_uom_id.code if line.product_uom_id else ""
)

for lot_name, qty in lot_quantities.items():
lot_product_uom = lot_uom.get(lot_name, "")
lot_info.append(f"{lot_name}, {qty}, {lot_product_uom}")

if lot_info:
res["lot"] = "LOTE(S): " + "; ".join(lot_info)
else:
res["lot"] = ""

return res
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
Loading