mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-21 07:51:59 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
1
odoo-bringout-oca-ddmrp-ddmrp/ddmrp/report/__init__.py
Normal file
1
odoo-bringout-oca-ddmrp-ddmrp/ddmrp/report/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import mrp_report_bom_structure
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
# Copyright 2017-23 ForgeFlow S.L. (http://www.forgeflow.com)
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class BomStructureReport(models.AbstractModel):
|
||||
_inherit = "report.mrp.report_bom_structure"
|
||||
|
||||
def _get_pdf_doc(self, bom_id, data, quantity, product_variant_id=None):
|
||||
doc = super()._get_pdf_doc(bom_id, data, quantity, product_variant_id)
|
||||
doc["show_buffered"] = (
|
||||
True if data and data.get("show_buffered") == "true" else False
|
||||
)
|
||||
return doc
|
||||
|
||||
@api.model
|
||||
def _get_bom_data(
|
||||
self,
|
||||
bom,
|
||||
warehouse,
|
||||
product=False,
|
||||
line_qty=False,
|
||||
bom_line=False,
|
||||
level=0,
|
||||
parent_bom=False,
|
||||
index=0,
|
||||
product_info=False,
|
||||
ignore_stock=False,
|
||||
):
|
||||
res = super(BomStructureReport, self)._get_bom_data(
|
||||
bom,
|
||||
warehouse,
|
||||
product=product,
|
||||
line_qty=line_qty,
|
||||
bom_line=bom_line,
|
||||
level=level,
|
||||
parent_bom=parent_bom,
|
||||
index=index,
|
||||
product_info=product_info,
|
||||
ignore_stock=ignore_stock,
|
||||
)
|
||||
res["is_buffered"] = bom.is_buffered
|
||||
res["dlt"] = bom.dlt
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def _get_component_data(
|
||||
self,
|
||||
parent_bom,
|
||||
warehouse,
|
||||
bom_line,
|
||||
line_quantity,
|
||||
level,
|
||||
index,
|
||||
product_info,
|
||||
ignore_stock=False,
|
||||
):
|
||||
res = super(BomStructureReport, self)._get_component_data(
|
||||
parent_bom,
|
||||
warehouse,
|
||||
bom_line,
|
||||
line_quantity,
|
||||
level,
|
||||
index,
|
||||
product_info,
|
||||
ignore_stock=ignore_stock,
|
||||
)
|
||||
if bom_line.product_id.bom_ids:
|
||||
lead_time = bom_line.product_id.produce_delay
|
||||
else:
|
||||
lead_time = (
|
||||
bom_line.product_id.seller_ids
|
||||
and bom_line.product_id.seller_ids[0].delay
|
||||
or 0.0
|
||||
)
|
||||
res["is_buffered"] = bom_line.is_buffered
|
||||
res["lead_time"] = lead_time or False
|
||||
res["dlt"] = bom_line.dlt
|
||||
return res
|
||||
|
||||
def _get_bom_array_lines(
|
||||
self, data, level, unfolded_ids, unfolded, parent_unfolded
|
||||
):
|
||||
lines = super()._get_bom_array_lines(
|
||||
data, level, unfolded_ids, unfolded, parent_unfolded
|
||||
)
|
||||
for component in data.get("components", []):
|
||||
bom_line = next(
|
||||
filter(
|
||||
lambda line: line.get("bom_id", False) == component["bom_id"]
|
||||
and line.get("name", False) == component["name"]
|
||||
and line.get("level", False) == component["level"],
|
||||
lines,
|
||||
)
|
||||
)
|
||||
if bom_line:
|
||||
bom_line["is_buffered"] = component["is_buffered"]
|
||||
bom_line["dlt"] = component["dlt"]
|
||||
return lines
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<odoo>
|
||||
<template id="report_mrp_bom_inherit_ddmrp" inherit_id="mrp.report_mrp_bom">
|
||||
<xpath expr="//th[@name='th_mrp_bom_h']" position="before">
|
||||
<th t-if="data['show_buffered']">Buffered</th>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='td_mrp_bom']" position="before">
|
||||
<td t-if="data['show_buffered']">
|
||||
<span t-if="data['is_buffered']">
|
||||
<img
|
||||
src='/ddmrp/static/img/is_buffered.png'
|
||||
style="width:30px;height:30px;padding:5px"
|
||||
/>
|
||||
</span>
|
||||
</td>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='td_mrp_bom_f']" position="before">
|
||||
<td t-if="data['show_buffered']" />
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//td[@name='td_mrp_bom_byproducts_f']" position="before">
|
||||
<td t-if="data['show_buffered']" />
|
||||
</xpath>
|
||||
|
||||
</template>
|
||||
|
||||
<template
|
||||
id="report_mrp_bom_pdf_line_inherit_ddmrp"
|
||||
inherit_id="mrp.report_mrp_bom_pdf_line"
|
||||
>
|
||||
<xpath expr="//td[@name='td_mrp_code']" position="before">
|
||||
<td t-if="data['show_buffered']">
|
||||
<span t-if="l.get('is_buffered')">
|
||||
<img
|
||||
src='/ddmrp/static/img/is_buffered.png'
|
||||
style="width:30px;height:30px;padding:5px"
|
||||
/>
|
||||
</span>
|
||||
</td>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue