diff --git a/dev/scripts/interfaces/sst03_pg_create_quotation.py b/dev/scripts/interfaces/sst03_pg_create_quotation.py index fd20644f..b04dfb91 100755 --- a/dev/scripts/interfaces/sst03_pg_create_quotation.py +++ b/dev/scripts/interfaces/sst03_pg_create_quotation.py @@ -30,6 +30,7 @@ values = { "assembled": True, "line_id": "0000", "confirm_order": True, + "order_type": "D", 'confirmation_nr': 'FR000001', "portal_id": "59-0001", "portal_delivery_id": "111112", diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index be5b113c..078435ce 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -39,6 +39,11 @@ class SaleOrder(models.Model): ('done', 'Produktion fertig'), ('packed', 'Verpackt'), ('delivered', 'Geliefert')] + ORDER_TYPES = [ + ('M', 'Manuell'), + ('D', 'DesignBox'), + ('I', 'Industrie') + ] assembled = fields.Boolean(string='Zusammengebaut') line_id = fields.Many2one(comodel_name='res.line', string='Produktionslinie') @@ -51,6 +56,7 @@ class SaleOrder(models.Model): num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items') weight_total = fields.Float(string='Gesamtgewicht', compute='_compute_weight_total') confirmation_nr = fields.Char('Freigabenummer') + order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M') @api.multi @api.onchange('partner_invoice_id') @@ -267,13 +273,18 @@ class SaleOrder(models.Model): else: raise ValidationError( _("Produktionslinie \'%s\' kann nicht zugeordnet werden") % vals['line_id']) + + if vals.get('order_type', False): + selections = [selection[0] for selection in self._fields['order_type'].selection] + if vals.get('order_type') not in selections: + raise ValidationError(_("Diese Auftragsart ist nicht bekannt!")) return vals @api.model def _get_specified_fields(self): return ['origin', 'client_order_ref', 'note', 'date_order', 'assembled', 'line_id', 'partner_id', 'fiscal_position_id', 'user_id', 'payment_term_id', 'partner_delivery_id', 'partner_invoice_id', - 'assembly_state', 'confirmation_nr', 'confirm_order'] + 'assembly_state', 'confirmation_nr', 'confirm_order', 'order_type'] @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 c4e3901a..1813a065 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -12,6 +12,7 @@ + @@ -93,6 +94,7 @@ + @@ -107,6 +109,7 @@ + @@ -123,9 +126,11 @@ + +