[IMP] stock: default action on count request
When requesting an inventory count, the manager can decide to, in the same time, precounting the quant to their actual values. Task : 2555118 Part-of: odoo/odoo#74715
This commit is contained in:
@@ -14,11 +14,14 @@ class StockRequestCount(models.TransientModel):
|
||||
default=fields.Datetime.now)
|
||||
user_id = fields.Many2one('res.users', string="User")
|
||||
quant_ids = fields.Many2many('stock.quant')
|
||||
set_count = fields.Selection([('empty', 'Leave Empty'), ('set', 'Set Current Value')], default='empty', string='Count')
|
||||
|
||||
def action_request_count(self):
|
||||
for count_request in self:
|
||||
count_request.quant_ids.with_context(inventory_mode=True).write(
|
||||
count_request._get_values_to_write())
|
||||
if count_request.set_count == 'set':
|
||||
count_request.quant_ids.filtered(lambda q: not q.inventory_quantity_set).action_set_inventory_quantity()
|
||||
|
||||
def _get_values_to_write(self):
|
||||
values = {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="quant_ids" invisible="1"/>
|
||||
<field name="inventory_date"/>
|
||||
<field name="user_id"/>
|
||||
<field name="set_count" widget='radio'/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_request_count" string="Confirm" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
|
||||
Reference in New Issue
Block a user