-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MOD]add product image to bom overview
- Loading branch information
1 parent
9aec29f
commit bbd8b0c
Showing
5 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
from odoo import models | ||
|
||
|
||
class ReportBomStructure(models.AbstractModel): | ||
_inherit = 'report.mrp.report_bom_structure' | ||
|
||
def _get_component_data(self, parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, | ||
product_info, ignore_stock=False): | ||
|
||
res = super()._get_component_data(parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, | ||
product_info, ignore_stock) | ||
res['image_component']= bom_line.product_id.image_1920 | ||
|
||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @odoo-module */ | ||
|
||
import { patch } from "@web/core/utils/patch"; | ||
import { BomOverviewLine } from "@mrp/components/bom_overview_line/mrp_bom_overview_line"; | ||
|
||
patch(BomOverviewLine.prototype, { | ||
setup() { | ||
super.setup(); | ||
this.image_data = false; | ||
if(this.data && this.data.image_component){ | ||
this.image_data = 'data:image/png;base64, ' + this.data.image_component | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates xml:space="preserve"> | ||
<t t-name="plm.BomOverviewTable" t-inherit="mrp.BomOverviewTable" t-inherit-mode="extension"> | ||
<xpath expr="//th[@name='th_mrp_bom_h']" position="before"> | ||
<th name="th_mrp_bom_p_i">Image</th> | ||
</xpath> | ||
<xpath expr="//tfoot/tr/td" position="before"> | ||
<td/> | ||
</xpath> | ||
</t> | ||
<t t-name="plm.BomOverviewLine" t-inherit="mrp.BomOverviewLine" t-inherit-mode="extension"> | ||
<xpath expr="//td" position="before"> | ||
<td name="td_mrp_bom"> | ||
<img t-if="image_data" t-att-src="this.image_data" width="50"/> | ||
</td> | ||
</xpath> | ||
</t> | ||
</templates> |