Skip to content
Snippets Groups Projects
Commit 14322fc4 authored by Yoshi Tashiro's avatar Yoshi Tashiro
Browse files

[FIX] stock: allow creating a scrap with more than 2 decimals in qty


scrap_qty field was missing the digits attribute, and therefore the user
could not create a scrap with a quantity with more than two decimal places.
With this commit, scrap_qty will follow the 'Product Unit of Measure'
precision setting, just like any other quantity fields.

closes odoo/odoo#77652

Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
parent 21f68584
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
from odoo import api, fields, models, _ from odoo import api, fields, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.tools import float_compare from odoo.tools import float_compare
from odoo.addons import decimal_precision as dp
class StockScrap(models.Model): class StockScrap(models.Model):
...@@ -48,7 +49,7 @@ class StockScrap(models.Model): ...@@ -48,7 +49,7 @@ class StockScrap(models.Model):
scrap_location_id = fields.Many2one( scrap_location_id = fields.Many2one(
'stock.location', 'Scrap Location', default=_get_default_scrap_location_id, 'stock.location', 'Scrap Location', default=_get_default_scrap_location_id,
domain="[('scrap_location', '=', True)]", required=True, states={'done': [('readonly', True)]}) domain="[('scrap_location', '=', True)]", required=True, states={'done': [('readonly', True)]})
scrap_qty = fields.Float('Quantity', default=1.0, required=True, states={'done': [('readonly', True)]}) scrap_qty = fields.Float('Quantity', default=1.0, required=True, states={'done': [('readonly', True)]}, digits=dp.get_precision('Product Unit of Measure'))
state = fields.Selection([ state = fields.Selection([
('draft', 'Draft'), ('draft', 'Draft'),
('done', 'Done')], string='Status', default="draft") ('done', 'Done')], string='Status', default="draft")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment