Skip to content

Commit

Permalink
[MIG] delivery_package_number: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Josep-s73 authored and pablo-cort-s73 committed Nov 26, 2024
1 parent 47aaaa7 commit deaa126
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 40 deletions.
3 changes: 2 additions & 1 deletion delivery_package_number/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"license": "AGPL-3",
"installable": True,
"application": False,
"depends": ["delivery"],
"depends": ["delivery", "stock_delivery"],
"data": [
"security/ir.model.access.csv",
"data/paperformat_data.xml",
"reports/report_package_number.xml",
"views/stock_picking_type_views.xml",
"views/stock_picking_views.xml",
"wizard/stock_backorder_confirmation_views.xml",
"wizard/stock_number_package_validate_wiz_view.xml",
],
}
8 changes: 4 additions & 4 deletions delivery_package_number/tests/test_delivery_package_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def setUpClass(cls):
{
"product_id": cls.product.id,
"product_uom_id": cls.product.uom_id.id,
"qty_done": 5,
"quantity": 5,
"location_id": cls.wh1.lot_stock_id.id,
"location_dest_id": cls.wh1.wh_output_stock_loc_id.id,
"picking_id": cls.picking.id,
}
)
cls.ml2 = cls.ml1.copy({"qty_done": 0})
cls.ml2 = cls.ml1.copy({"quantity": 0})

def test_number_of_packages(self):
# By default it's computed to 0
Expand All @@ -47,7 +47,7 @@ def test_number_of_packages(self):
# We add a package and it recalculates
self.picking.action_put_in_pack()
self.assertEqual(self.picking.number_of_packages, 1)
self.ml2.qty_done = 5
self.ml2.quantity = 5
self.picking.action_put_in_pack()
self.assertEqual(self.picking.number_of_packages, 2)
# We can later set it manually if we want to
Expand All @@ -64,7 +64,7 @@ def test_backorder(self):
order = order_form.save()
order.action_confirm()
picking = order.picking_ids
picking.move_ids.quantity_done = 2
picking.move_ids.quantity = 2
picking.number_of_packages = 2
action = picking.with_context(
test_delivery_package_number=True
Expand Down
10 changes: 5 additions & 5 deletions delivery_package_number/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<odoo>
<record id="view_picking_withcarrier_out_form" model="ir.ui.view">
<field name="model">stock.picking</field>
<field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form" />
<field
name="inherit_id"
ref="stock_delivery.view_picking_withcarrier_out_form"
/>
<field name="arch" type="xml">
<xpath expr="//group[@name='carrier_data']" position="inside">
<field name="package_ids" invisible="1" />
<field
name="number_of_packages"
attrs="{'readonly': [('state', '=', 'done')]}"
/>
<field name="number_of_packages" readonly="state == 'done'" />
</xpath>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion delivery_package_number/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import stock_inmediate_transfer
from . import stock_number_package_mixin
from . import stock_backorder_confirmation
from . import stock_number_package_validate_wiz
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
<field name="arch" type="xml">
<xpath expr="//footer" position="before">
<field name="ask_number_of_packages" invisible="1" />
<group attrs="{'invisible': [('ask_number_of_packages','=',False)]}">
<group invisible="ask_number_of_packages == False">
<field name="number_of_packages" />
</group>
</xpath>
<xpath expr="//button[@special='cancel']" position="after">
<field
name="print_package_label"
widget="boolean_toggle"
attrs="{'invisible': [('ask_number_of_packages','=',False)]}"
invisible="ask_number_of_packages == False"
/>
<label
for="print_package_label"
attrs="{'invisible': [('ask_number_of_packages','=',False)]}"
invisible="ask_number_of_packages == False"
/>
</xpath>
</field>
Expand Down
26 changes: 0 additions & 26 deletions delivery_package_number/wizard/stock_immediate_transfer_views.xml

This file was deleted.

0 comments on commit deaa126

Please sign in to comment.