[IMP] delivery: add an option to disable shipping while validating pickings
It allows people to only use the rating service of the sales orders
This commit is contained in:
@@ -51,6 +51,7 @@ class DeliveryCarrier(models.Model):
|
||||
price_rule_ids = fields.One2many('delivery.price.rule', 'carrier_id', 'Pricing Rules', copy=True)
|
||||
state = fields.Selection([('test', 'Testing'), ('production', 'Production')], 'State')
|
||||
fixed_price = fields.Float(compute='_compute_fixed_price', inverse='_set_product_fixed_price', store=True, string='Fixed Price',help="Keep empty if the pricing depends on the advanced pricing per destination")
|
||||
shipping_enabled = fields.Boolean(string="Shipping enabled", default=True, help="Uncheck this box to disable package shipping while validating Delivery Orders")
|
||||
|
||||
@api.depends('product_id.list_price', 'product_id.product_tmpl_id.list_price')
|
||||
def _compute_fixed_price(self):
|
||||
|
||||
@@ -73,7 +73,7 @@ class StockPicking(models.Model):
|
||||
self.ensure_one()
|
||||
res = super(StockPicking, self).do_transfer()
|
||||
|
||||
if self.carrier_id and self.carrier_id.delivery_type not in ['fixed', 'base_on_rule']:
|
||||
if self.carrier_id and self.carrier_id.delivery_type not in ['fixed', 'base_on_rule'] and self.carrier_id.shipping_enabled:
|
||||
self.send_to_shipper()
|
||||
return res
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<field name="partner_id" class="oe_inline"/>
|
||||
<field name="product_type" invisible="1"/>
|
||||
<field name="product_sale_ok" invisible="1"/>
|
||||
<field name="shipping_enabled" attrs="{'invisible': ['|', ('delivery_type', '=', 'fixed'), ('delivery_type', '=', 'base_on_rule')]}"/>
|
||||
</group>
|
||||
</div>
|
||||
<notebook>
|
||||
|
||||
Reference in New Issue
Block a user