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] purchase_order_line_qty_by_packaging: Improve module line… #2708

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
4 changes: 2 additions & 2 deletions purchase_order_line_qty_by_packaging/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"version": "16.0.1.1.0",
"category": "Inventory/Purchase",
"license": "AGPL-3",
"author": "https://github.com/avanzosc/odoo-addons",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/odoo-addons",
"depends": [
"purchase",
"purchase_stock",
],
"data": [
"views/purchase_order_views.xml",
Expand Down
22 changes: 13 additions & 9 deletions purchase_order_line_qty_by_packaging/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-19 07:30+0000\n"
"PO-Revision-Date: 2023-01-19 07:30+0000\n"
"POT-Creation-Date: 2024-07-18 08:38+0000\n"
"PO-Revision-Date: 2024-07-18 08:38+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_qty
msgid "Pack. Quantity"
msgstr "Emp. Cantidad"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_id
msgid "Packaging"
msgstr "Empaquetado"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model,name:purchase_order_line_qty_by_packaging.model_purchase_order
msgid "Purchase Order"
msgstr "Pedido de compra"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model,name:purchase_order_line_qty_by_packaging.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de pedido de compra"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_qty
msgid "Pack. Quantity"
msgstr "Emp. Cantidad"

Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-19 07:30+0000\n"
"PO-Revision-Date: 2023-01-19 07:30+0000\n"
"POT-Creation-Date: 2024-07-18 08:38+0000\n"
"PO-Revision-Date: 2024-07-18 08:38+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_qty
msgid "Pack. Quantity"
msgstr ""

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_id
msgid "Packaging"
msgstr ""

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model,name:purchase_order_line_qty_by_packaging.model_purchase_order_line
msgid "Purchase Order Line"
#: model:ir.model,name:purchase_order_line_qty_by_packaging.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_order_line_qty_by_packaging
#: model:ir.model.fields,field_description:purchase_order_line_qty_by_packaging.field_purchase_order_line__product_packaging_qty
msgid "Pack. Quantity"
#: model:ir.model,name:purchase_order_line_qty_by_packaging.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

18 changes: 16 additions & 2 deletions purchase_order_line_qty_by_packaging/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,23 @@ def _onchange_product_qty(self):

@api.onchange("product_id")
def onchange_product_id(self):
result = super().onchange_product_id()
res = super().onchange_product_id()
if self.product_id and self.product_id.packaging_ids:
packagings = self.product_id.packaging_ids.filtered(lambda x: x.purchase)
if packagings:
self.product_packaging_id = packagings[0].id
return result
return res

def _prepare_stock_move_vals(
self, picking, price_unit, product_uom_qty, product_uom
):
res = super()._prepare_stock_move_vals(
picking, price_unit, product_uom_qty, product_uom
)
if self.product_packaging_id:
res.update(
{
"product_packaging_id": self.product_packaging_id.id,
}
)
return res
Loading