diff --git a/ext/custom-addons/dp_custom/models/stock.py b/ext/custom-addons/dp_custom/models/stock.py index dbbf7fb7..4e7dfe5f 100644 --- a/ext/custom-addons/dp_custom/models/stock.py +++ b/ext/custom-addons/dp_custom/models/stock.py @@ -56,6 +56,26 @@ class StockPicking(models.Model): dlv_partner_ref = fields.Text(compute='_get_partner_ref', store=False, string='Interne Referenz') picking_signature = fields.Binary(string='Customer Signature', default=None) shopping_cart_ref = fields.Text(compute='_get_shopping_cart_ref', store=True, string='Warenkorb') + free_over = fields.Boolean(help="If the order total amount (shipping excluded) is above or equal to this value, the customer benefits from a free shipping \nIf this value = 0, no freight item is added to the order") + show_to_sign = fields.Text( + compute='_compute_show_to_sign', + help='Technical field used to compute whether the to_sign should be shown.') + + @api.multi + @api.depends('state', 'picking_signature') + def _compute_show_to_sign(self): + for picking in self: + picking.show_to_sign = '' + if picking.picking_signature == '' or picking.picking_signature == None or len(self['picking_signature']) == 3012: + picking.show_to_sign = 'btn-primary' + + @api.multi + def _add_delivery_cost_to_so(self): + self.ensure_one() + sale_order = self.sale_id + if sale_order.invoice_shipping_on_delivery and not (self.carrier_id.free_over and self.carrier_id.amount < 0.001): + sale_order._create_delivery_line(self.carrier_id, self.carrier_price) + @api.multi def write(self, vals): diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index 5b9b2a65..ed53a575 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -43,7 +43,9 @@ - diff --git a/ext/custom-addons/dp_custom/views/stock_views.xml b/ext/custom-addons/dp_custom/views/stock_views.xml index d8a194b6..79949ff7 100644 --- a/ext/custom-addons/dp_custom/views/stock_views.xml +++ b/ext/custom-addons/dp_custom/views/stock_views.xml @@ -38,10 +38,14 @@ -