This commit removes stock.inventory(.line) and moves its general functionality into stock.quant. Some features are lost during this switch as well. Feature Additions: - New single list view for inventory adjustments (no more multiple inventory adjustment records to keep track of!) - Improved cyclic counts (annual inventory day setting) + next inventory dates are immediately viewable in view (vs auto-generated inventories based only on location) - Specific quants (i.e. counts) can be assigned to users for more flexibility (vs only able to restrict by location + product combinations) - Counts can be requested (i.e. bulk assigned to user/for a specific inventory date) Feature Removals: - Can no longer look at previous inventory adjustments linked to a specific record. Each quant has a history button to show inventory related moves. [relevant account moves are also now harder to see via stock as well] Other changes: - Bulk of changes were for demo/test - Some changes were done to ensure "Update Quantity"/"Inventory Report" views still mainly function the same as before with the exception of a new column added to support updating quant quantities in these views. Task: 2440026 ENT PR: odoo/enterprise#17329 Upgrade PR: odoo/upgrade#2326 closes odoo/odoo#68409 Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
30 lines
969 B
Python
30 lines
969 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import fields, models
|
|
|
|
|
|
class StockRequestCount(models.TransientModel):
|
|
_name = 'stock.request.count'
|
|
_description = 'Stock Request an Inventory Count'
|
|
|
|
inventory_date = fields.Date(
|
|
'Inventory Date', required=True,
|
|
help="Choose a date to get the inventory at that date",
|
|
default=fields.Datetime.now)
|
|
user_id = fields.Many2one('res.users', string="User")
|
|
quant_ids = fields.Many2many('stock.quant')
|
|
|
|
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())
|
|
|
|
def _get_values_to_write(self):
|
|
values = {
|
|
'inventory_date': self.inventory_date,
|
|
}
|
|
if self.user_id:
|
|
values['user_id'] = self.user_id.id,
|
|
return values
|