[FIX] stock: print delivery address for outgoing picking or dropship
The delivery slip of an outgoing picking prints the warehouse address instead of the delivery address (which should be displayed as it may be different from the customer address) Steps to reproduce: 1. Install Contacts and Inventory 2. Open Contacts and add a delivery address named "delivery" to contact Azure Interior 3. Go to Inventory > Operations > Transfers 4. Create a new transfer with: - Contact: Azure Interior, delivery - Operation Type: San Fransisco: Delivery Orders - Product: Large Cabinet 5. Save the transfer and print the Delivery Slip 6. The warehouse address is displayed and there is no info about the delivery address Solution: Add a method to know if we should print the delivery address. We should print it if the picking has a delivery address and it is of type outgoing (or if it's a dropship) Problem: Printing the delivery address when the package partner is different from the picking partner is wrong because the delivery address might be different from the customer address opw-3064203 closes odoo/odoo#107355 X-original-commit: ec929f787f629940cd38a4ed25e5012335e2483d Signed-off-by: Tiffany Chang <tic@odoo.com> Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
@@ -821,6 +821,14 @@ class Picking(models.Model):
|
||||
self.write({'printed': True})
|
||||
return self.env.ref('stock.action_report_picking').report_action(self)
|
||||
|
||||
def should_print_delivery_address(self):
|
||||
self.ensure_one()
|
||||
return self.move_ids_without_package and self.move_ids_without_package[0].partner_id and self._is_to_external_location()
|
||||
|
||||
def _is_to_external_location(self):
|
||||
self.ensure_one()
|
||||
return self.picking_type_code == 'outgoing'
|
||||
|
||||
def action_confirm(self):
|
||||
self._check_company()
|
||||
self.mapped('package_level_ids').filtered(lambda pl: pl.state == 'draft' and not pl.move_ids)._generate_moves()
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
<t t-set="address">
|
||||
<div name="div_outgoing_address">
|
||||
<div name="outgoing_delivery_address"
|
||||
t-if="o.move_ids_without_package and o.move_ids_without_package[0].partner_id and o.move_ids_without_package[0].partner_id != partner">
|
||||
t-if="o.should_print_delivery_address()">
|
||||
<span><strong>Delivery Address:</strong></span>
|
||||
<div t-field="o.move_ids_without_package[0].partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
</div>
|
||||
<div name="outgoing_warehouse_address"
|
||||
t-if="o.picking_type_id.code != 'internal' and (not o.move_ids_without_package or not o.move_ids_without_package[0].partner_id or o.move_ids_without_package[0].partner_id == partner) and o.picking_type_id.warehouse_id.partner_id">
|
||||
t-elif="o.picking_type_id.code != 'internal' and o.picking_type_id.warehouse_id.partner_id">
|
||||
<span><strong>Warehouse Address:</strong></span>
|
||||
<div t-field="o.picking_type_id.warehouse_id.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
|
||||
@@ -35,6 +35,9 @@ class StockPicking(models.Model):
|
||||
for picking in self:
|
||||
picking.is_dropship = picking.location_dest_id.usage == 'customer' and picking.location_id.usage == 'supplier'
|
||||
|
||||
def _is_to_external_location(self):
|
||||
self.ensure_one()
|
||||
return super()._is_to_external_location() or self.is_dropship
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
Reference in New Issue
Block a user