From b734908ea40815363a2e5d70404f3121d34a54b2 Mon Sep 17 00:00:00 2001 From: Invitu Date: Sat, 4 Nov 2017 08:09:19 -1000 Subject: [PATCH] [FIX] in v10, we can add value to selection fieldw --- pos_price_to_weight/data/barcode_rule.xml | 2 +- pos_price_to_weight/models/barcode_rule.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pos_price_to_weight/data/barcode_rule.xml b/pos_price_to_weight/data/barcode_rule.xml index 21fbc514..72cab823 100644 --- a/pos_price_to_weight/data/barcode_rule.xml +++ b/pos_price_to_weight/data/barcode_rule.xml @@ -9,7 +9,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). Price Barcodes (Computed Weight) 2 Decimals - + price_to_weight 02.....{NNNDD} 15 diff --git a/pos_price_to_weight/models/barcode_rule.py b/pos_price_to_weight/models/barcode_rule.py index d268390b..be66165b 100644 --- a/pos_price_to_weight/models/barcode_rule.py +++ b/pos_price_to_weight/models/barcode_rule.py @@ -3,15 +3,12 @@ # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import _, api, models +from odoo import _, fields, models class BarcodeRule(models.Model): _inherit = 'barcode.rule' - @api.model - def _get_type_selection(self): - res = super(BarcodeRule, self)._get_type_selection() - res.append( - ('price_to_weight', _('Priced Product (Computed Weight)'))) - return res + type = fields.Selection(selection_add=[ + ('price_to_weight', _('Priced Product (Computed Weight)')) + ])