Skip to content

Commit

Permalink
[16.0][IMP] mrp_bom_line_product_brand_info: Change brand and codes i…
Browse files Browse the repository at this point in the history
…n bom line.
  • Loading branch information
Berezi committed Dec 17, 2024
1 parent be17141 commit 62cee92
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 52 deletions.
43 changes: 37 additions & 6 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-06-03 08:34+0000\n"
"PO-Revision-Date: 2024-06-03 08:34+0000\n"
"POT-Creation-Date: 2024-12-17 12:33+0000\n"
"PO-Revision-Date: 2024-12-17 12:33+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,12 +20,43 @@ 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 "Manufacturer codes"
msgid "Brand Code"
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__markings
msgid "Markings"
msgstr "Marcas"
#: 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"
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-06-03 08:34+0000\n"
"PO-Revision-Date: 2024-06-03 08:34+0000\n"
"POT-Creation-Date: 2024-12-17 12:33+0000\n"
"PO-Revision-Date: 2024-12-17 12:33+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -20,12 +20,41 @@ 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 "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__markings
msgid "Markings"
#: model:ir.model.fields,field_description:mrp_bom_line_product_brand_info.field_mrp_bom_line__seller_id
msgid "Seller"
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"
msgstr ""
56 changes: 19 additions & 37 deletions mrp_bom_line_product_brand_info/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,23 @@
class MrpBomLine(models.Model):
_inherit = "mrp.bom.line"

manufacturer_codes = fields.Text(
string="Manufacturer codes", compute="_compute_product_brand_info"
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):
texto = ""
markings = ""
for seller in line.product_tmpl_id.seller_ids:
partner_name = seller.partner_id.name
code = (
""
if not seller.product_brand_id.code
else seller.product_brand_id.code
)
marking = (
""
if not seller.product_brand_id.marking
else seller.product_brand_id.marking
)
if not texto:
texto = "{}: {} - {}".format(partner_name, code, marking)
else:
texto = "{} // {}: {} - {}".format(
texto, partner_name, code, marking
)
if not markings:
markings = "{}: {}".format(partner_name, marking)
else:
markings = "{} // {}: {}".format(markings, partner_name, marking)
line.manufacturer_codes = texto
line.markings = markings

def get_datas_to_print_bom(self):
result = super().get_datas_to_print_bom()
result["manufacturer_codes"] = self.manufacturer_codes
return result
8 changes: 6 additions & 2 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,8 +5,12 @@
<field name="inherit_id" ref="mrp.mrp_bom_line_view_form" />
<field name="arch" type="xml">
<field name="operation_id" position="after">
<field name="manufacturer_codes" readonly="1" />
<field name="markings" readonly="1" />
<field name="product_tmpl_id" invisible="1" />
<field name="seller_id" optional="show" />
<field name="product_name" optional="show" />
<field name="product_code" optional="show" />
<field name="manufacturer_codes" optional="show" />
<field name="markings" optional="show" />
</field>
</field>
</record>
Expand Down
8 changes: 6 additions & 2 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,8 +8,12 @@
expr="//field[@name='bom_line_ids']/tree/field[@name='attachments_count']"
position="after"
>
<field name="manufacturer_codes" optional="show" readonly="1" />
<field name="markings" optional="show" readonly="1" />
<field name="product_tmpl_id" invisible="1" />
<field name="seller_id" optional="show" />
<field name="product_name" optional="show" />
<field name="product_code" optional="show" />
<field name="manufacturer_codes" optional="show" />
<field name="markings" optional="show" />
</xpath>
</field>
</record>
Expand Down

0 comments on commit 62cee92

Please sign in to comment.