Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] mrp_bom_line_product_brand_info: Improve wrong commit error #512

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mrp_bom_line_product_brand_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"license": "AGPL-3",
"website": "https://github.com/avanzosc/mrp-addons",
"depends": [
"mrp",
"mrp_bom_report",
"product_brand_supplierinfo",
],
Expand Down
43 changes: 6 additions & 37 deletions mrp_bom_line_product_brand_info/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:33+0000\n"
"PO-Revision-Date: 2024-12-17 12:33+0000\n"
"POT-Creation-Date: 2024-06-03 08:34+0000\n"
"PO-Revision-Date: 2024-06-03 08:34+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,43 +20,12 @@ msgstr ""
msgid "Bill of Material Line"
msgstr "Línea de Lista de Materiales"

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__markings
msgid "Brand"
msgstr "Marcas"

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__manufacturer_codes
msgid "Brand Code"
msgid "Manufacturer codes"
msgstr "Códigos fabricación"

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__seller_id
msgid "Seller"
msgstr "Tarifa de proveedor"

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,help:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_code
msgid ""
"This vendor's product code will be used when printing a request for "
"quotation. Keep empty to use the internal one."
msgstr ""
"El código de producto de este proveedor se utilizará al imprimir "
"una solicitud de presupuesto. Mantener vacío para utilizar el interno."
#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,help:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_name
msgid ""
"This vendor's product name will be used when printing a request for "
"quotation. Keep empty to use the internal one."
msgstr ""
"El nombre de producto de este proveedor se utilizará al imprimir "
"una solicitud de presupuesto. Mantener vacío para utilizar el interno."
#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_code
msgid "Vendor Product Code"
msgstr "Código producto proveedor"

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_name
msgid "Vendor Product Name"
msgstr "Nombre producto proveedor"
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__markings
msgid "Markings"
msgstr "Marcas"
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:33+0000\n"
"PO-Revision-Date: 2024-12-17 12:33+0000\n"
"POT-Creation-Date: 2024-06-03 08:34+0000\n"
"PO-Revision-Date: 2024-06-03 08:34+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,41 +20,12 @@ msgstr ""
msgid "Bill of Material Line"
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__markings
msgid "Brand"
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__manufacturer_codes
msgid "Brand Code"
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__seller_id
msgid "Seller"
msgid "Manufacturer codes"
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,help:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_code
msgid ""
"This vendor's product code will be used when printing a request for "
"quotation. Keep empty to use the internal one."
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,help:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_name
msgid ""
"This vendor's product name will be used when printing a request for "
"quotation. Keep empty to use the internal one."
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_code
msgid "Vendor Product Code"
msgstr ""

#. module: mrp_bom_line_product_brand_info
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__product_name
msgid "Vendor Product Name"
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__markings
msgid "Markings"
msgstr ""
49 changes: 27 additions & 22 deletions mrp_bom_line_product_brand_info/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import fields, models


class MrpBomLine(models.Model):
_inherit = "mrp.bom.line"

seller_id = fields.Many2one(
comodel_name="product.supplierinfo",
domain="['|', ('product_id', '=', product_id), '&', "
"('product_tmpl_id', '=', product_tmpl_id), "
"('product_id', '=', False)]",
)
product_name = fields.Char(
related="seller_id.product_name",
store=True,
)
product_code = fields.Char(
related="seller_id.product_code",
store=True,
)
manufacturer_codes = fields.Char(related="seller_id.brand_code", store=True)
markings = fields.Many2one(
comodel_name="product.brand",
related="seller_id.product_brand_id",
store=True,
)
markings = fields.Text(compute="_compute_product_brand_info")

def _compute_product_brand_info(self):
for line in self.filtered(lambda c: c.product_tmpl_id):
markings = ""
for idx, seller in enumerate(
line.product_tmpl_id.seller_ids.filtered(lambda s: s.product_brand_id)
):
marking = seller.product_brand_id
brand_code = seller.brand_code

if brand_code:
marking_info = "[{}] {}".format(brand_code, marking.name)
else:
marking_info = "{}".format(marking.name)

if idx > 0:
markings += "\n"

markings += marking_info

line.markings = markings

def get_datas_to_print_bom(self):
result = super().get_datas_to_print_bom()
result["markings"] = self.markings
return result
29 changes: 13 additions & 16 deletions mrp_bom_line_product_brand_info/report/mrp_bom_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,30 @@
id="report_mrp_bom_customized_document"
inherit_id="mrp_bom_report.report_mrp_bom_customized_document"
>
<span id="product_name" position="after">
<!-- <span id="product_name" position="after">
<span t-if="line and 'manufacturer_codes' in line and line['manufacturer_codes']">
<br />
<span t-esc="line['manufacturer_codes']" />
</span>
</span>
</span> -->
<xpath expr="//table/thead/tr" position="inside">
<th class="text-start">Product Code</th>
<th class="text-start">Manufacturer Codes</th>
<!-- <th class="text-start">Product Code</th> -->
<th class="text-start">Brand</th>
</xpath>
<xpath expr="//table/tbody//tr" position="inside">
<td class="text-start">
<!-- <td class="text-start">
<span
t-esc="bom_line_id['product_code'] or ''"
/>
</td>
<td class="text-start">
<span
t-esc="bom_line_id['manufacturer_codes'] or ''"
/>
</td>
<td class="text-start">
<span
t-esc="bom_line_id['markings'].name if bom_line_id['markings'] else ''"
/>
</td>
</td> -->
<td class="text-start">
<t t-if="bom_line_id['markings']">
<t t-foreach="bom_line_id['markings'].split('\n')" t-as="split_line">
<span t-esc="split_line" /> <br />
</t>
</t>
</td>

</xpath>
</template>
</odoo>
7 changes: 1 addition & 6 deletions mrp_bom_line_product_brand_info/views/mrp_bom_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
<field name="inherit_id" ref="mrp.mrp_bom_line_view_form" />
<field name="arch" type="xml">
<field name="operation_id" position="after">
<field name="product_tmpl_id" invisible="1" />
<field name="seller_id" optional="show" options="{'no_create': True}" />
<field name="product_name" optional="show" />
<field name="product_code" optional="show" />
<field name="manufacturer_codes" optional="show" />
<field name="markings" optional="show" />
<field name="markings" readonly="1" />
</field>
</field>
</record>
Expand Down
7 changes: 1 addition & 6 deletions mrp_bom_line_product_brand_info/views/mrp_bom_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
expr="//field[@name='bom_line_ids']/tree/field[@name='attachments_count']"
position="after"
>
<field name="product_tmpl_id" invisible="1" />
<field name="seller_id" optional="show" options="{'no_create': True}" />
<field name="product_name" optional="show" />
<field name="product_code" optional="show" />
<field name="manufacturer_codes" optional="show" />
<field name="markings" optional="show" />
<field name="markings" optional="show" readonly="1" />
</xpath>
</field>
</record>
Expand Down
Loading