What is wrong with the following code? I set default value preset_quantity as 1.0, but in the view it appears 0.0 instead.
I'm using Odoo 10
python code
class stock_picking_barcode(models.Model):
_name = 'stock.picking'
_inherit = ['stock.picking', 'barcodes.barcode_events_mixin']
preset_quantity = fields.Float(store=False,
default=1.0,
help="The quantity will be applied to the pending product.")
def on_barcode_scanned(self, barcode):
...
xml
<record model="ir.ui.view" id="view_picking_barcode_form">
<field name="name">stock.picking.barcode.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<notebook position="before">
<group attrs="{'invisible': [('state', 'not in', ('assigned'))]}" class="oe_edit_only">
<field name="_barcode_scanned" widget="barcode_handler"/>
<field name="preset_quantity" readonly="1"/>
</group>
</notebook>
</field>
</record>