Skip to content

Commit

Permalink
[MIG] stock_lot_purchase_info: Backport to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Dec 3, 2024
1 parent 19e0895 commit f1c0f0b
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 47 deletions.
7 changes: 3 additions & 4 deletions stock_lot_purchase_info/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Stock Lot Purchase Info",
"version": "16.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Inventory/Inventory",
"license": "AGPL-3",
"author": "https://github.com/avanzosc/odoo-addons",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/odoo-addons",
"depends": [
"purchase",
"stock",
"purchase_stock",
],
"data": [
"views/stock_lots_views.xml",
Expand Down
37 changes: 25 additions & 12 deletions stock_lot_purchase_info/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-23 07:03+0000\n"
"PO-Revision-Date: 2022-12-23 07:03+0000\n"
"POT-Creation-Date: 2024-11-22 12:59+0000\n"
"PO-Revision-Date: 2024-11-22 12:59+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -16,7 +16,25 @@ msgstr ""
"Plural-Forms: \n"

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_lot
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr "Última modificación el"

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lote/Número de serie"

Expand All @@ -26,20 +44,15 @@ msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Stock Move Line)"

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_lot__purchase_price
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__purchase_price
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__purchase_price_unit
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__purchase_price_unit
msgid "Purchase Price Unit"
msgstr "Precio unitario compra"

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_lot__supplier_id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__supplier_id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__supplier_id
#: model_terms:ir.ui.view,arch_db:stock_lot_purchase_info.search_product_lot_filter
#: model_terms:ir.ui.view,arch_db:stock_lot_purchase_info.stock_move_line_view_search
msgid "Supplier"
msgstr "Proveedor"

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_picking
msgid "Transfer"
msgstr "Albarán"
37 changes: 25 additions & 12 deletions stock_lot_purchase_info/i18n/stock_lot_purchase_info.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-23 07:03+0000\n"
"PO-Revision-Date: 2022-12-23 07:03+0000\n"
"POT-Creation-Date: 2024-11-22 12:59+0000\n"
"PO-Revision-Date: 2024-11-22 12:59+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -16,7 +16,25 @@ msgstr ""
"Plural-Forms: \n"

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_lot
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__display_name
msgid "Display Name"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""

Expand All @@ -26,20 +44,15 @@ msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_lot__purchase_price
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__purchase_price
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__purchase_price_unit
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__purchase_price_unit
msgid "Purchase Price Unit"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_lot__supplier_id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_move_line__supplier_id
#: model:ir.model.fields,field_description:stock_lot_purchase_info.field_stock_production_lot__supplier_id
#: model_terms:ir.ui.view,arch_db:stock_lot_purchase_info.search_product_lot_filter
#: model_terms:ir.ui.view,arch_db:stock_lot_purchase_info.stock_move_line_view_search
msgid "Supplier"
msgstr ""

#. module: stock_lot_purchase_info
#: model:ir.model,name:stock_lot_purchase_info.model_stock_picking
msgid "Transfer"
msgstr ""
12 changes: 8 additions & 4 deletions stock_lot_purchase_info/models/stock_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@


class StockLot(models.Model):
_inherit = "stock.lot"
_inherit = "stock.production.lot"

supplier_id = fields.Many2one(
string="Supplier", comodel_name="res.partner", copy=False
string="Supplier",
comodel_name="res.partner",
copy=False,
)
purchase_price = fields.Float(
string="Purchase Price Unit", digits="Product Price", copy=False
purchase_price_unit = fields.Float(
string="Purchase Price Unit",
digits="Product Price",
copy=False,
)
6 changes: 3 additions & 3 deletions stock_lot_purchase_info/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class StockMoveLine(models.Model):
store=True,
related="lot_id.supplier_id",
)
purchase_price = fields.Float(
purchase_price_unit = fields.Float(
string="Purchase Price Unit",
digits="Product Price",
copy=False,
store=True,
related="lot_id.purchase_price",
related="lot_id.purchase_price_unit",
)

def _action_done(self):
Expand All @@ -28,7 +28,7 @@ def _action_done(self):
):
line.lot_id.write(
{
"purchase_price": line.move_id.purchase_line_id.price_unit,
"purchase_price_unit": line.move_id.purchase_line_id.price_unit,
"supplier_id": line.move_id.purchase_line_id.order_id.partner_id.id,
}
)
Expand Down
12 changes: 6 additions & 6 deletions stock_lot_purchase_info/views/stock_lots_views.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_production_lot_form" model="ir.ui.view">
<field name="model">stock.lot</field>
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form" />
<field name="arch" type="xml">
<field name="ref" position="after">
<field name="supplier_id" />
<field name="purchase_price" />
<field name="purchase_price_unit" />
</field>
</field>
</record>

<record id="view_production_lot_tree" model="ir.ui.view">
<field name="model">stock.lot</field>
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_tree" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="supplier_id" optional="show" />
<field name="purchase_price" optional="show" />
<field name="supplier_id" optional="hide" />
<field name="purchase_price_unit" optional="hide" />
</field>
</field>
</record>

<record id="search_product_lot_filter" model="ir.ui.view">
<field name="model">stock.lot</field>
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.search_product_lot_filter" />
<field name="arch" type="xml">
<field name="product_id" position="after">
Expand Down
23 changes: 17 additions & 6 deletions stock_lot_purchase_info/views/stock_move_line_views.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_move_line_tree" />
<field name="arch" type="xml">
<field name="state" position="before">
<field name="supplier_id" optional="hide" />
<field name="purchase_price_unit" optional="hide" />
</field>
</field>
</record>

<record id="view_stock_move_line_operation_tree" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
<field name="arch" type="xml">
<field name="package_id" position="before">
<field name="supplier_id" optional="show" />
<field name="purchase_price" optional="show" />
<field name="supplier_id" optional="hide" />
<field name="purchase_price_unit" optional="hide" />
</field>
</field>
</record>
Expand All @@ -19,8 +30,8 @@
/>
<field name="arch" type="xml">
<field name="is_initial_demand_editable" position="before">
<field name="supplier_id" optional="show" />
<field name="purchase_price" optional="show" />
<field name="supplier_id" optional="hide" />
<field name="purchase_price_unit" optional="hide" />
</field>
</field>
</record>
Expand All @@ -31,7 +42,7 @@
<field name="arch" type="xml">
<field name="package_id" position="before">
<field name="supplier_id" />
<field name="purchase_price" />
<field name="purchase_price_unit" />
</field>
</field>
</record>
Expand All @@ -40,7 +51,7 @@
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.stock_move_line_view_search" />
<field name="arch" type="xml">
<field name="lot_id" position="after">
<field name="product_id" position="after">
<field name="supplier_id" />
</field>
<filter name="groupby_product_id" position="after">
Expand Down

0 comments on commit f1c0f0b

Please sign in to comment.