Skip to content

Commit 47800c9

Browse files
committed
[FIX] delivery_multii_desination: set dummy product if no products from child_ids
1 parent 3395c39 commit 47800c9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

delivery_multi_destination/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"installable": True,
1414
"depends": ["delivery"],
1515
"demo": ["demo/delivery_carrier_demo.xml"],
16-
"data": ["views/delivery_carrier_view.xml"],
16+
"data": ["data/product_product.xml", "views/delivery_carrier_view.xml"],
1717
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
4+
<record model="product.product" id="dummy_shipping_product">
5+
<field name="name">DUMMY Shipping Product</field>
6+
<field name="type">service</field>
7+
<field name="categ_id" ref="delivery.product_category_deliveries" />
8+
<field name="sale_ok" eval="False" />
9+
<field name="purchase_ok" eval="False" />
10+
<field name="list_price">0.0</field>
11+
<field name="invoice_policy">order</field>
12+
</record>
13+
14+
</odoo>

delivery_multi_destination/models/delivery_carrier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DeliveryCarrier(models.Model):
3030
def _onchange_destination_type(self):
3131
"""Define the corresponding value to avoid creation error with UX."""
3232
if self.destination_type == "multi" and self.child_ids and not self.product_id:
33-
self.product_id = fields.first(self.child_ids.product_id)
33+
self.product_id = fields.first(self.child_ids.product_id) or self.env.ref('delivery_multi_destination.dummy_shipping_product')
3434

3535
def search(self, args, offset=0, limit=None, order=None, count=False):
3636
"""Don't show by default children carriers."""

0 commit comments

Comments
 (0)