[IMP] stock_move_value_report: black, isort, prettier

This commit is contained in:
CarlosRoca13
2022-02-17 12:28:18 +01:00
committed by Vincent Van Rossem
parent 76dc7bfcec
commit 1e3fa8ae0d
7 changed files with 256 additions and 122 deletions

View File

@@ -5,20 +5,17 @@
"version": "12.0.1.1.0",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-reporting",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"stock_account",
],
"depends": ["stock_account"],
"data": [
'report/stock_value_report.xml',
'report/stock_move_line_value_report.xml',
'report/stock_move_value_report.xml',
'report/stock_picking_value_report.xml',
'report/stock_scrap_value_report.xml',
'report/stock_inventory_value_report.xml',
"report/stock_value_report.xml",
"report/stock_move_line_value_report.xml",
"report/stock_move_value_report.xml",
"report/stock_picking_value_report.xml",
"report/stock_scrap_value_report.xml",
"report/stock_inventory_value_report.xml",
],
}

View File

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_stock_inventory_value_document">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h1 class="mt0 float-left">Inventory <t t-esc="inventory.name"/></h1>
<div class="clearfix"/>
<h1 class="mt0 float-left">Inventory <t
t-esc="inventory.name"
/></h1>
<div class="clearfix" />
<table class="table table-sm">
<thead>
<tr>
@@ -18,28 +20,40 @@
<tbody>
<tr>
<td>
<span t-field="inventory.location_id.name"/>
<span t-field="inventory.location_id.name" />
</td>
<td>
<span t-field="inventory.state"/>
<span t-field="inventory.state" />
</td>
<td name="td_date">
<span t-field="inventory.date"/>
<span t-field="inventory.date" />
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<br />
<br />
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="inventory.mapped('move_ids.move_line_ids')"/>
<t t-set="currency_id" t-value="inventory.company_id.currency_id"/>
<t
t-set="move_lines"
t-value="inventory.mapped('move_ids.move_line_ids')"
/>
<t
t-set="currency_id"
t-value="inventory.company_id.currency_id"
/>
</t>
<br/>
<br />
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="inventory.mapped('move_ids.move_line_ids')"/>
<t t-set="currency_id" t-value="inventory.company_id.currency_id"/>
<t
t-set="move_lines"
t-value="inventory.mapped('move_ids.move_line_ids')"
/>
<t
t-set="currency_id"
t-value="inventory.company_id.currency_id"
/>
</t>
</div>
</t>
@@ -48,7 +62,7 @@
<template id="report_stock_inventory_value">
<t t-foreach="docs" t-as="inventory">
<t t-call="stock_move_value_report.report_stock_inventory_value_document"/>
<t t-call="stock_move_value_report.report_stock_inventory_value_document" />
</t>
</template>

View File

@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="stock_move_lines_value">
<table class="table table-sm mt4 mb0">
<t t-set="has_serial_number" t-value="move_lines.mapped('lot_id')" groups="stock.group_production_lot"/>
<t
t-set="has_serial_number"
t-value="move_lines.mapped('lot_id')"
groups="stock.group_production_lot"
/>
<thead>
<tr>
<th name="th_product">
@@ -26,22 +30,22 @@
<tbody>
<tr t-foreach="move_lines" t-as="move_line">
<td>
<span t-field="move_line.product_id"/>
<span t-field="move_line.product_id.sudo().description"/>
<span t-field="move_line.product_id" />
<span t-field="move_line.product_id.sudo().description" />
</td>
<t t-if="has_serial_number">
<td>
<table width="100%">
<tr>
<td>
<span t-field="move_line.lot_id"/>
<span t-field="move_line.lot_id" />
<t t-if="not move_line.lot_id">
<span t-field="move_line.lot_name"/>
<span t-field="move_line.lot_name" />
</t>
</td>
<td name="lot_qty">
<t t-if="move_line.product_qty">
<span t-field="move_line.product_qty"/>
<span t-field="move_line.product_qty" />
</t>
</td>
</tr>
@@ -49,14 +53,20 @@
</td>
</t>
<td class="text-center">
<span t-field="move_line.qty_done"/>
<span t-field="move_line.product_uom_id"/>
<span t-field="move_line.qty_done" />
<span t-field="move_line.product_uom_id" />
</td>
<td class="text-right">
<span t-field="move_line.move_id.price_unit" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/>
<span
t-field="move_line.move_id.price_unit"
t-options="{'widget': 'monetary', 'display_currency': currency_id}"
/>
</td>
<td class="text-right">
<span t-esc="move_line.move_id.price_unit * move_line.qty_done" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/>
<span
t-esc="move_line.move_id.price_unit * move_line.qty_done"
t-options="{'widget': 'monetary', 'display_currency': currency_id}"
/>
</td>
</tr>
</tbody>
@@ -67,11 +77,17 @@
<div class="clearfix">
<div id="total" class="row">
<div class="col-4 float-right">
<table class="table table-sm" style="min-width: 250px;max-width: 400px;page-break-inside: avoid;">
<table
class="table table-sm"
style="min-width: 250px;max-width: 400px;page-break-inside: avoid;"
>
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-esc="sum([x.move_id.price_unit * x.qty_done for x in move_lines])" t-options="{'widget': 'monetary', 'display_currency': currency_id}"/>
<span
t-esc="sum([x.move_id.price_unit * x.qty_done for x in move_lines])"
t-options="{'widget': 'monetary', 'display_currency': currency_id}"
/>
</td>
</tr>
</table>
@@ -85,54 +101,115 @@
<t t-call="web.external_layout">
<div class="page">
<h2 class="mb48">Selected operations cost value</h2>
<t t-set="ml_from_pickings" t-value="move_lines_ids.filtered('move_id.picking_id')"/>
<t t-set="ml_from_inventories" t-value="move_lines_ids.filtered('move_id.inventory_id')"/>
<t t-set="ml_from_scraps" t-value="move_lines_ids.filtered('move_id.scrapped')"/>
<t
t-set="ml_from_pickings"
t-value="move_lines_ids.filtered('move_id.picking_id')"
/>
<t
t-set="ml_from_inventories"
t-value="move_lines_ids.filtered('move_id.inventory_id')"
/>
<t
t-set="ml_from_scraps"
t-value="move_lines_ids.filtered('move_id.scrapped')"
/>
<!-- ML From Pickings -->
<t t-if="ml_from_pickings">
<t t-set="pickings" t-value="ml_from_pickings.mapped('move_id.picking_id')"/>
<t
t-set="pickings"
t-value="ml_from_pickings.mapped('move_id.picking_id')"
/>
<t t-foreach="pickings" t-as="picking">
<t t-set="picking_move_lines" t-value="ml_from_pickings.filtered(lambda x: x.picking_id == picking)"/>
<h4><span>[<t t-esc="picking.date"/>]</span> Picking <t t-esc="picking.name"/>: <t t-esc="picking.location_id.name"/> &#8594; <t t-esc="picking.location_dest_id.name"/></h4>
<t
t-set="picking_move_lines"
t-value="ml_from_pickings.filtered(lambda x: x.picking_id == picking)"
/>
<h4><span>[<t t-esc="picking.date" />]</span> Picking <t
t-esc="picking.name"
/>: <t t-esc="picking.location_id.name" /> &#8594; <t
t-esc="picking.location_dest_id.name"
/></h4>
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="picking_move_lines"/>
<t t-set="currency_id" t-value="picking.company_id.currency_id"/>
<t t-set="move_lines" t-value="picking_move_lines" />
<t
t-set="currency_id"
t-value="picking.company_id.currency_id"
/>
</t>
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="picking_move_lines"/>
<t t-set="currency_id" t-value="picking.company_id.currency_id"/>
<t
t-call="stock_move_value_report.stock_move_lines_value_total"
>
<t t-set="move_lines" t-value="picking_move_lines" />
<t
t-set="currency_id"
t-value="picking.company_id.currency_id"
/>
</t>
</t>
</t>
<!-- ML From Inventories -->
<t t-if="ml_from_inventories">
<t t-set="inventories" t-value="ml_from_inventories.mapped('move_id.inventory_id')"/>
<t
t-set="inventories"
t-value="ml_from_inventories.mapped('move_id.inventory_id')"
/>
<t t-foreach="inventories" t-as="inventory">
<t t-set="inventory_move_lines" t-value="ml_from_inventories.filtered(lambda x: x.move_id.inventory_id == inventory)"/>
<h4><span>[<t t-esc="inventory.date"/>]</span> Inventory <t t-esc="inventory.name"/>: <t t-esc="inventory.location_id.name"/></h4>
<t
t-set="inventory_move_lines"
t-value="ml_from_inventories.filtered(lambda x: x.move_id.inventory_id == inventory)"
/>
<h4><span>[<t t-esc="inventory.date" />]</span> Inventory <t
t-esc="inventory.name"
/>: <t t-esc="inventory.location_id.name" /></h4>
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="inventory_move_lines"/>
<t t-set="currency_id" t-value="inventory.company_id.currency_id"/>
<t t-set="move_lines" t-value="inventory_move_lines" />
<t
t-set="currency_id"
t-value="inventory.company_id.currency_id"
/>
</t>
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="inventory_move_lines"/>
<t t-set="currency_id" t-value="inventory.company_id.currency_id"/>
<t
t-call="stock_move_value_report.stock_move_lines_value_total"
>
<t t-set="move_lines" t-value="inventory_move_lines" />
<t
t-set="currency_id"
t-value="inventory.company_id.currency_id"
/>
</t>
</t>
</t>
<!-- ML From Scraps -->
<t t-if="ml_from_scraps">
<t t-set="scraps" t-value="move_lines_ids.mapped('move_id.scrap_ids').filtered(lambda x: x.move_id in ml_from_scraps.mapped('move_id'))"/>
<t
t-set="scraps"
t-value="move_lines_ids.mapped('move_id.scrap_ids').filtered(lambda x: x.move_id in ml_from_scraps.mapped('move_id'))"
/>
<t t-foreach="scraps" t-as="scrap">
<t t-set="scrap_move_lines" t-value="scrap.move_id.move_line_ids"/>
<h4><span>[<t t-esc="scrap.move_id.date"/>]</span> Scrap <t t-esc="scrap.name"/>: <t t-esc="scrap.location_id.name"/> &#8594; <t t-esc="scrap.scrap_location_id.name"/></h4>
<t
t-set="scrap_move_lines"
t-value="scrap.move_id.move_line_ids"
/>
<h4><span>[<t t-esc="scrap.move_id.date" />]</span> Scrap <t
t-esc="scrap.name"
/>: <t t-esc="scrap.location_id.name" /> &#8594; <t
t-esc="scrap.scrap_location_id.name"
/></h4>
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="scrap_move_lines"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t t-set="move_lines" t-value="scrap_move_lines" />
<t
t-set="currency_id"
t-value="res_company.currency_id"
/>
</t>
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="scrap_move_lines"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t
t-call="stock_move_value_report.stock_move_lines_value_total"
>
<t t-set="move_lines" t-value="scrap_move_lines" />
<t
t-set="currency_id"
t-value="res_company.currency_id"
/>
</t>
</t>
</t>
@@ -141,11 +218,18 @@
<div class="clearfix">
<div id="total" class="row">
<div class="col-4 float-right">
<table class="table table-sm" style="min-width: 250px;max-width: 400px;page-break-inside: avoid;">
<table
class="table table-sm"
style="min-width: 250px;max-width: 400px;page-break-inside: avoid;"
>
<tr class="border-black">
<td><strong>Total operations value balance</strong></td>
<td><strong
>Total operations value balance</strong></td>
<td class="text-right">
<strong t-esc="sum([x.move_id.price_unit * x.qty_done for x in move_lines_ids])" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
<strong
t-esc="sum([x.move_id.price_unit * x.qty_done for x in move_lines_ids])"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</td>
</tr>
</table>
@@ -158,8 +242,8 @@
<template id="report_stock_move_line_value">
<t t-call="stock_move_value_report.report_stock_move_value_document">
<t t-set="move_lines_ids" t-value="docs"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t t-set="move_lines_ids" t-value="docs" />
<t t-set="currency_id" t-value="res_company.currency_id" />
</t>
</template>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_stock_move_value">
<t t-call="stock_move_value_report.report_stock_move_value_document">
<t t-set="move_lines_ids" t-value="docs.mapped('move_line_ids')"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t t-set="move_lines_ids" t-value="docs.mapped('move_line_ids')" />
<t t-set="currency_id" t-value="res_company.currency_id" />
</t>
</template>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_stock_picking_value_document">
@@ -7,76 +7,106 @@
<div class="page">
<div class="row">
<div class="col-6">
<div t-if="picking.move_lines and picking.move_lines[0].partner_id and picking.move_lines[0].partner_id.id != picking.partner_id.id">
<div
t-if="picking.move_lines and picking.move_lines[0].partner_id and picking.move_lines[0].partner_id.id != picking.partner_id.id"
>
<span><strong>Delivery Address:</strong></span>
<div t-field="picking.move_lines[0].partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<div
t-field="picking.move_lines[0].partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
/>
</div>
<div t-if="picking.picking_type_id.code != 'internal' and (not picking.move_lines or not picking.move_lines[0].partner_id) and picking.picking_type_id.warehouse_id.partner_id">
<div
t-if="picking.picking_type_id.code != 'internal' and (not picking.move_lines or not picking.move_lines[0].partner_id) and picking.picking_type_id.warehouse_id.partner_id"
>
<span><strong>Warehouse Address:</strong></span>
<div t-field="picking.picking_type_id.warehouse_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<div
t-field="picking.picking_type_id.warehouse_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
/>
</div>
</div>
<div class="offset-1 col-5">
<div t-if="picking.picking_type_id.code=='incoming' and picking.partner_id">
<div
t-if="picking.picking_type_id.code=='incoming' and picking.partner_id"
>
<span><strong>Partner Address:</strong></span>
</div>
<div t-if="picking.picking_type_id.code=='internal' and picking.partner_id">
<div
t-if="picking.picking_type_id.code=='internal' and picking.partner_id"
>
<span><strong>Warehouse Address:</strong></span>
</div>
<div t-if="picking.picking_type_id.code=='outgoing' and picking.partner_id">
<div
t-if="picking.picking_type_id.code=='outgoing' and picking.partner_id"
>
<span><strong>Customer Address:</strong></span>
</div>
<div t-if="picking.partner_id" name="partner_header">
<div t-field="picking.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="picking.sudo().partner_id.vat"><t t-esc="picking.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="picking.sudo().partner_id.vat"/></p>
<div
t-field="picking.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
/>
<p t-if="picking.sudo().partner_id.vat"><t
t-esc="picking.company_id.country_id.vat_label or 'TIN'"
/>: <span
t-field="picking.sudo().partner_id.vat"
/></p>
</div>
</div>
</div>
<br/>
<h1 t-field="picking.name" class="mt0 float-left"/>
<div class="clearfix"/>
<br />
<h1 t-field="picking.name" class="mt0 float-left" />
<div class="clearfix" />
<table class="table table-sm">
<thead>
<tr>
<th t-if="picking.origin"><strong>Order (Origin)</strong></th>
<th t-if="picking.origin"><strong
>Order (Origin)</strong></th>
<th><strong>State</strong></th>
<th><strong>Commitment Date</strong></th>
<th name="td_sched_date_h"><strong>Scheduled Date</strong></th>
<th name="td_sched_date_h"><strong
>Scheduled Date</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td t-if="picking.origin">
<span t-field="picking.origin"/>
<span t-field="picking.origin" />
</td>
<td>
<span t-field="picking.state"/>
<span t-field="picking.state" />
</td>
<td>
<span t-field="picking.date"/>
<span t-field="picking.date" />
</td>
<td name="td_sched_date">
<span t-field="picking.scheduled_date"/>
<span t-field="picking.scheduled_date" />
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<h4>[<t t-esc="picking.location_id.name"/> &#8594; <t t-esc="picking.location_dest_id.name"/>]</h4>
<br />
<br />
<h4>[<t t-esc="picking.location_id.name" /> &#8594; <t
t-esc="picking.location_dest_id.name"
/>]</h4>
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="picking.move_line_ids"/>
<t t-set="currency_id" t-value="picking.company_id.currency_id"/>
<t t-set="move_lines" t-value="picking.move_line_ids" />
<t
t-set="currency_id"
t-value="picking.company_id.currency_id"
/>
</t>
<br/>
<br />
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="picking.move_line_ids"/>
<t t-set="currency_id" t-value="picking.company_id.currency_id"/>
<t t-set="move_lines" t-value="picking.move_line_ids" />
<t
t-set="currency_id"
t-value="picking.company_id.currency_id"
/>
</t>
<p t-esc="picking.note"/>
<p t-esc="picking.note" />
</div>
</t>
</t>
@@ -84,7 +114,7 @@
<template id="report_stock_picking_value">
<t t-foreach="docs" t-as="picking">
<t t-call="stock_move_value_report.report_stock_picking_value_document"/>
<t t-call="stock_move_value_report.report_stock_picking_value_document" />
</t>
</template>

View File

@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_stock_scrap_value_document">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<h1 class="mt0 float-left">Scrap <t t-esc="scrap.name"/></h1>
<div class="clearfix"/>
<h1 class="mt0 float-left">Scrap <t t-esc="scrap.name" /></h1>
<div class="clearfix" />
<table class="table table-sm">
<thead>
<tr>
<th><strong>Location</strong></th>
<th t-if="scrap.origin"><strong>Source Document</strong></th>
<th t-if="scrap.origin"><strong
>Source Document</strong></th>
<th><strong>State</strong></th>
<th><strong>Date</strong></th>
</tr>
@@ -19,30 +20,38 @@
<tbody>
<tr>
<td>
<span t-field="scrap.location_id.name"/>
<span t-field="scrap.location_id.name" />
</td>
<td t-if="scrap.origin">
<span t-field="scrap.origin"/>
<span t-field="scrap.origin" />
</td>
<td>
<span t-field="scrap.state"/>
<span t-field="scrap.state" />
</td>
<td name="td_sched_date">
<span t-esc="scrap.move_id and scrap.move_id.date"/>
<span
t-esc="scrap.move_id and scrap.move_id.date"
/>
</td>
</tr>
</tbody>
</table>
<br/>
<br/>
<br />
<br />
<t t-call="stock_move_value_report.stock_move_lines_value">
<t t-set="move_lines" t-value="scrap.mapped('move_id.move_line_ids')"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t
t-set="move_lines"
t-value="scrap.mapped('move_id.move_line_ids')"
/>
<t t-set="currency_id" t-value="res_company.currency_id" />
</t>
<br/>
<br />
<t t-call="stock_move_value_report.stock_move_lines_value_total">
<t t-set="move_lines" t-value="scrap.mapped('move_id.move_line_ids')"/>
<t t-set="currency_id" t-value="res_company.currency_id"/>
<t
t-set="move_lines"
t-value="scrap.mapped('move_id.move_line_ids')"
/>
<t t-set="currency_id" t-value="res_company.currency_id" />
</t>
</div>
</t>
@@ -51,7 +60,7 @@
<template id="report_stock_scrap_value">
<t t-foreach="docs" t-as="scrap">
<t t-call="stock_move_value_report.report_stock_scrap_value_document"/>
<t t-call="stock_move_value_report.report_stock_scrap_value_document" />
</t>
</template>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<report