mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[14.0][IMP] stock_card_report, add origin to display_name on report
This commit is contained in:
@@ -20,6 +20,16 @@ class StockCardView(models.TransientModel):
|
||||
is_initial = fields.Boolean()
|
||||
product_in = fields.Float()
|
||||
product_out = fields.Float()
|
||||
picking_id = fields.Many2one(comodel_name="stock.picking")
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for rec in self:
|
||||
name = rec.reference
|
||||
if rec.picking_id.origin:
|
||||
name = "{} ({})".format(name, rec.picking_id.origin)
|
||||
result.append((rec.id, name))
|
||||
return result
|
||||
|
||||
|
||||
class StockCardReport(models.TransientModel):
|
||||
@@ -55,7 +65,8 @@ class StockCardReport(models.TransientModel):
|
||||
then move.product_qty end as product_in,
|
||||
case when move.location_id in %s
|
||||
then move.product_qty end as product_out,
|
||||
case when move.date < %s then True else False end as is_initial
|
||||
case when move.date < %s then True else False end as is_initial,
|
||||
move.picking_id
|
||||
FROM stock_move move
|
||||
WHERE (move.location_id in %s or move.location_dest_id in %s)
|
||||
and move.state = 'done' and move.product_id in %s
|
||||
|
||||
@@ -140,8 +140,8 @@
|
||||
<div class="act_as_row labels">
|
||||
<div class="act_as_cell">Date</div>
|
||||
<div class="act_as_cell">Reference</div>
|
||||
<div class="act_as_cell">Input</div>
|
||||
<div class="act_as_cell">Output</div>
|
||||
<div class="act_as_cell">In</div>
|
||||
<div class="act_as_cell">Out</div>
|
||||
<div class="act_as_cell">Balance</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,7 +153,7 @@
|
||||
<t t-esc="product_line.date.strftime('%Y-%m-%d')" />
|
||||
</div>
|
||||
<div class="act_as_cell left">
|
||||
<t t-esc="product_line.reference" />
|
||||
<t t-esc="product_line.display_name" />
|
||||
</div>
|
||||
<div class="act_as_cell right">
|
||||
<t t-esc="'{0:,.3f}'.format(product_line.product_in)" />
|
||||
|
||||
@@ -82,12 +82,12 @@ class ReportStockCardReportXlsx(models.AbstractModel):
|
||||
"width": 25,
|
||||
},
|
||||
"3_input": {
|
||||
"header": {"value": "Input"},
|
||||
"header": {"value": "In"},
|
||||
"data": {"value": self._render("input")},
|
||||
"width": 25,
|
||||
},
|
||||
"4_output": {
|
||||
"header": {"value": "Output"},
|
||||
"header": {"value": "Out"},
|
||||
"data": {"value": self._render("output")},
|
||||
"width": 25,
|
||||
},
|
||||
@@ -177,7 +177,7 @@ class ReportStockCardReportXlsx(models.AbstractModel):
|
||||
col_specs_section="data",
|
||||
render_space={
|
||||
"date": line.date or "",
|
||||
"reference": line.reference or "",
|
||||
"reference": line.display_name or "",
|
||||
"input": line.product_in or 0,
|
||||
"output": line.product_out or 0,
|
||||
"balance": balance,
|
||||
|
||||
Reference in New Issue
Block a user