Browse Source

[FIX] in v10, we can add value to selection fieldw

pull/465/head
Invitu 7 years ago
committed by Iván Todorovich
parent
commit
b734908ea4
  1. 2
      pos_price_to_weight/data/barcode_rule.xml
  2. 11
      pos_price_to_weight/models/barcode_rule.py

2
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).
<record id="rule_price_to_weight" model="barcode.rule"> <record id="rule_price_to_weight" model="barcode.rule">
<field name="name">Price Barcodes (Computed Weight) 2 Decimals</field> <field name="name">Price Barcodes (Computed Weight) 2 Decimals</field>
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/>
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/>
<field name="type">price_to_weight</field> <field name="type">price_to_weight</field>
<field name="pattern">02.....{NNNDD}</field> <field name="pattern">02.....{NNNDD}</field>
<field name="sequence">15</field> <field name="sequence">15</field>

11
pos_price_to_weight/models/barcode_rule.py

@ -3,15 +3,12 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # 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): class BarcodeRule(models.Model):
_inherit = 'barcode.rule' _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)'))
])
Loading…
Cancel
Save