From 61e77cf92b50aef1c9325162d957ac923c9a81e1 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Fri, 12 Oct 2018 11:55:27 +0200 Subject: [PATCH] sales_order_line: mark items with notes in lot (!=important for production) --- ext/custom-addons/dp_custom/models/sale.py | 8 ++++++ .../dp_custom/views/sale_views.xml | 28 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 918e7ebb..bbe0677f 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -519,6 +519,14 @@ class SaleOrderLine(models.Model): weight = fields.Float(string='Gewicht', compute='_compute_weight') intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code') sequence = fields.Integer(string='Sequence', default=9999) + item_notes = fields.Text(string='Notes', related='lot_id.notes', store=False) + item_warn = fields.Boolean(string='Notes!!!', compute='_compute_item_warn', store=False) + + @api.multi + def _compute_item_warn(self): + for record in self: + iNote = str(record.lot_id.notes) + record.item_warn = True if iNote.startswith('!') else False @api.multi @api.onchange('product_id') diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index 1d3433ab..695cda71 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -6,6 +6,10 @@ sale.order + + + item_warn +