Skip to content

Commit

Permalink
Merge pull request #14 from kmee/feature/lotqty
Browse files Browse the repository at this point in the history
[ADD] new comment vals and changes in 'Lote' expression
  • Loading branch information
corredato authored Jun 6, 2024
2 parents 232503f + db518eb commit 4148947
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
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

0 comments on commit 4148947

Please sign in to comment.