Skip to content

Commit

Permalink
[IMP] delivery: add an option to disable shipping while validating pi…
Browse files Browse the repository at this point in the history
…ckings

It allows people to only use the rating service of the sales orders
  • Loading branch information
rim-odoo committed Sep 11, 2015
1 parent aa33093 commit ca1749d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions addons/delivery/models/delivery_carrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion addons/delivery/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def do_transfer(self):
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

Expand Down
1 change: 1 addition & 0 deletions addons/delivery/views/delivery_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit ca1749d

Please sign in to comment.