summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_controller.js
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2018-03-08 13:29:35 +0100
committerDenis Ledoux <dle@odoo.com>2018-03-08 13:48:17 +0100
commitb98233aacc5ae71216400e9c3acb390eef4c6247 (patch)
tree9ab6b3f56c7c0729de35775273b9d8625be45384 /addons/web/static/src/js/views/basic/basic_controller.js
parent4fc09478505689300fe7e2557a605fe47425d0af (diff)
[FIX] stock_landed_costs: gap in landed costs sequences
On creation of a new landed cost, in the web client, the name was filled with the next sequence `self.env['ir.sequence'].next_by_code('stock.landed.cost')` but then, as the field is readonly, it is not sent in the create values to the server, and therefore the server sets again the default value and generates a new sequence name. The previous assigned sequence name is therefore never assigned, and there was an obvious gap in the landed costs sequences. Besides, using a sequence as a default is never a good idea, as the record can be discarded, and this will not discard the sequence number that has been used. There will be again a gap in the sequence. See this forum topic for reference: https://www.odoo.com/forum/help-1/question/how-to-handle-reading-and-writing-to-read-only-fields-2247#answer_2281 I therefore remove the default value, and use the exact same behavior than on the sale order, which is pretty similar: - The default value is set to `New` - Then, on creation, it is replaced to the actual sequence number. https://github.com/odoo/odoo/blob/bfe88c50e2b4975a23c624cc5b5171158bb9f855/addons/sale/models/sale.py#L273-L279 opw-1823133 Note: This can be back-ported to Odoo 9.0, but the fix will be different since the module has been converted to the new API since then. If I did it in 9.0 in the first place, mostlikely it would not have been forward ported correctly.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
0 files changed, 0 insertions, 0 deletions