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

[FIX] stock: print the delivery address on slip when using packages #165194

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/stock/models/stock_package_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _generate_moves(self):
'location_dest_id': package_level.location_dest_id.id,
'package_level_id': package_level.id,
'company_id': package_level.company_id.id,
'partner_id': package_level.picking_id.partner_id.id,
})

@api.model
Expand Down
25 changes: 25 additions & 0 deletions addons/stock/tests/test_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,31 @@ def test_pick_another_pack(self):
{'package_id': pack2.id, 'state': 'assigned', 'is_done': False},
])

def test_should_print_delivery_address_with_package(self):
"""Test that should_print_delivery_address in stock_picking returns true if a delivery contains only a package."""
pack = self.env['stock.quant.package'].create({'name': 'New Package'})
self.env['stock.quant']._update_available_quantity(self.productA, self.stock_location, 5, package_id=pack)

picking = self.env['stock.picking'].create({
'location_id': self.stock_location.id,
'location_dest_id': self.ref('stock.stock_location_customers'),
'picking_type_id': self.ref('stock.picking_type_out'),
'partner_id': self.env['res.partner'].create({'name': 'Test Partner'}).id,
})

package_level = self.env['stock.package_level'].create({
'package_id': pack.id,
'picking_id': picking.id,
'location_dest_id': picking.location_dest_id.id,
'company_id': picking.company_id.id,
})

picking.action_confirm()
package_level.is_done = True
picking.button_validate()

self.assertTrue(picking.should_print_delivery_address())

@odoo.tests.tagged('post_install', '-at_install')
class TestPackagePropagation(TestPackingCommon):

Expand Down