[FIX] sale_purchase: do not set Drop Ship Address
- Create 2 companies A & B - Customers are not shared between companies - Intercompany transactions activated (SO/PO + automatic validation) - Create a service product P with MTO + Buy route - Company B is a supplier for the product P - Sell the product in company A to a customer C => a PO is generated in A thanks to the MTO rule - Confirm the PO => a SO is generated in company B - Set the user to have access to company B only - Open the SO An `AccessError` is raised during a `read` call on `res.partner` C. The partner C is set as a delivery address of the SO because it is set on the PO as a `dest_address_id`: https://github.com/odoo/enterprise/blob/5a841b25389106ce254828a0383b4c71987b9f3a/inter_company_rules/models/purchase_order.py#L62 Looking further, it is set on the PO in the `sale_purchase` module. Actually, there is no point of setting the field on the PO: `dest_address_id` is a Dropship address only used in Stock: https://github.com/odoo/odoo/blob/f705c4088ea7584b17769220a0a7ffcb00546e0b/addons/purchase_stock/views/purchase_views.xml#L38 Dropshipping is not supported for services. Moreover, in that specific case the picking type usage is internal, so it should be `False`: https://github.com/odoo/odoo/blob/f705c4088ea7584b17769220a0a7ffcb00546e0b/addons/purchase_stock/models/purchase.py#L55 opw-2260553 closes odoo/odoo#51888 X-original-commit: 9d6da7724a40bcc6b5c76aa733e7deee1b0ce922 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -201,7 +201,7 @@ class SaleOrderLine(models.Model):
|
||||
'partner_ref': partner_supplier.ref,
|
||||
'company_id': self.company_id.id,
|
||||
'currency_id': partner_supplier.property_purchase_currency_id.id or self.env.company.currency_id.id,
|
||||
'dest_address_id': self.order_id.partner_shipping_id.id,
|
||||
'dest_address_id': False, # False since only supported in stock
|
||||
'origin': self.order_id.name,
|
||||
'payment_term_id': partner_supplier.property_supplier_payment_term_id.id,
|
||||
'date_order': date_order,
|
||||
|
||||
Reference in New Issue
Block a user