mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] stock_delivery_planner: per-warehouse carriers, do not allow creating carrier from selection
This commit is contained in:
@@ -48,3 +48,11 @@ class StockPicking(models.Model):
|
||||
domain.extend(tools.safe_eval(irconfig_parameter.get_param('sale.order.planner.carrier_domain')))
|
||||
|
||||
return Carrier.search(domain)
|
||||
|
||||
|
||||
class Warehouse(models.Model):
|
||||
_inherit = 'stock.warehouse'
|
||||
|
||||
delivery_planner_carrier_ids = fields.Many2many('delivery.carrier',
|
||||
string='Delivery Planner Base Carriers',
|
||||
help='Overrides the global carriers.')
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
For example, you should add 1 FedEx carrier here and let us build up the
|
||||
rates for your other FedEx shipping methods.
|
||||
</div>
|
||||
<field name="stock_delivery_planner_base_carrier_ids" class="oe_inline" />
|
||||
<field name="stock_delivery_planner_base_carrier_ids" class="oe_inline" options="{'no_create_edit': True, 'no_create': True}" />
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_picking_form" model="ir.ui.view">
|
||||
<field name="name">stock.picking.form.inherit.delivery.planner</field>
|
||||
<field name="model">stock.picking</field>
|
||||
@@ -10,4 +11,16 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_delivery_carriers" model="ir.ui.view">
|
||||
<field name="name">stock.warehouse.delivery.carriers</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="delivery_planner_carrier_ids" options="{'no_create_edit': True, 'no_create': True}" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -26,7 +26,8 @@ class StockDeliveryPlanner(models.TransientModel):
|
||||
def create(self, values):
|
||||
planner = super(StockDeliveryPlanner, self).create(values)
|
||||
|
||||
base_carriers = self.env['delivery.carrier']
|
||||
base_carriers = planner.picking_id.picking_type_id.warehouse_id.delivery_planner_carrier_ids
|
||||
if not base_carriers:
|
||||
carrier_ids = self.env['ir.config_parameter'].sudo().get_param('stock.delivery.planner.carrier_ids.%s' % (self.env.user.company_id.id, ))
|
||||
if carrier_ids:
|
||||
try:
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<field name="plan_option_ids" nolabel="1">
|
||||
<tree decoration-info="selection == 'selected'"
|
||||
decoration-muted="selection == 'deselected'"
|
||||
decoration-bf="days_different == 0.0"
|
||||
default_order="package_id, price"
|
||||
create="false" edit="false" delete="false">
|
||||
<field name="package_id" />
|
||||
|
||||
Reference in New Issue
Block a user