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 29, 2024
1 parent e1d0e55 commit db261ba
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 89 deletions.
17 changes: 10 additions & 7 deletions delivery_package_number/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Stock Picking Package Number
============================

..
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
Expand Down Expand Up @@ -81,15 +81,18 @@ Contributors

- `Tecnativa <https://www.tecnativa.com>`__:

* Pedro M. Baeza
* David Vidal
* Carlos Roca
* Sergio Teruel
- Pedro M. Baeza
- David Vidal
- Marçal Isern
- Carlos Roca

..
- `Sygel <https://www.sygel.es>`__:

* `Sygel <https://www.sygel.es>`__:
..
* Ángel García de la Chica Herrera <[email protected]>
- Ángel García de la Chica Herrera <[email protected]>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion delivery_package_number/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "AGPL-3",
"installable": True,
"application": False,
"depends": ["delivery"],
"depends": ["stock_delivery"],
"data": [
"security/ir.model.access.csv",
"data/paperformat_data.xml",
Expand Down
11 changes: 0 additions & 11 deletions delivery_package_number/readme/CONTRIBUTORS.rst

This file was deleted.

2 changes: 1 addition & 1 deletion delivery_package_number/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro M. Baeza</li>
<li>David Vidal</li>
<li>Marçal Isern</li>
<li>Carlos Roca</li>
<li>Sergio Teruel</li>
</ul>
</li>
</ul>
Expand Down
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
1 change: 0 additions & 1 deletion delivery_package_number/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import stock_inmediate_transfer
from . import stock_backorder_confirmation
from . import stock_number_package_validate_wiz
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class StockBackorderConfirmation(models.TransientModel):
_inherit = "stock.backorder.confirmation"

def process(self):
# put context key for avoiding `base_delivery_carrier_label` auto-packaging feature
# put context key for avoiding `base_delivery_carrier_label`
# auto-packaging feature
return super(
StockBackorderConfirmation, self.with_context(set_default_package=False)
).process()
26 changes: 0 additions & 26 deletions delivery_package_number/wizard/stock_immediate_transfer_views.xml

This file was deleted.

13 changes: 0 additions & 13 deletions delivery_package_number/wizard/stock_inmediate_transfer.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def _compute_stock_number_package_validation_line_ids(self):
def process(self):
if self.number_of_packages:
self.pick_ids.write({"number_of_packages": self.number_of_packages})

Check warning on line 43 in delivery_package_number/wizard/stock_number_package_validate_wiz.py

View check run for this annotation

Codecov / codecov/patch

delivery_package_number/wizard/stock_number_package_validate_wiz.py#L43

Added line #L43 was not covered by tests
# put context key for avoiding `base_delivery_carrier_label` auto-packaging feature
# put context key for avoiding `base_delivery_carrier_label`
# auto-packaging feature
self.pick_ids.with_context(

Check warning on line 46 in delivery_package_number/wizard/stock_number_package_validate_wiz.py

View check run for this annotation

Codecov / codecov/patch

delivery_package_number/wizard/stock_number_package_validate_wiz.py#L46

Added line #L46 was not covered by tests
set_default_package=False, bypass_set_number_of_packages=True
).button_validate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@
<group>
<field
name="number_of_packages"
attrs="{'invisible': [('stock_number_package_validation_line_ids', '!=', [])]}"
invisible="stock_number_package_validation_line_ids"
/>
</group>
<group>
<field
name="stock_number_package_validation_line_ids"
attrs="{'invisible': [('stock_number_package_validation_line_ids', '=', [])]}"
nolabel="1"
>
<tree create="0" delete="0" editable="1">
<field
name="picking_id"
options="{'no_open': True}"
readonly="1"
force_save="1"
/>
<field name="number_of_packages" />
</tree>
</field>
</group>
<field
name="stock_number_package_validation_line_ids"
invisible="not stock_number_package_validation_line_ids"
nolabel="1"
>
<tree create="0" delete="0" editable="1">
<field
name="picking_id"
options="{'no_open': True}"
readonly="1"
force_save="1"
/>
<field name="number_of_packages" />
</tree>
</field>
<footer>
<button
name="process"
Expand Down

0 comments on commit db261ba

Please sign in to comment.