stock_inventory_conflict.py 896 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. from odoo import fields, models
  4. class StockInventoryConflict(models.TransientModel):
  5. _name = 'stock.inventory.conflict'
  6. _description = 'Conflict in Inventory'
  7. quant_ids = fields.Many2many(
  8. 'stock.quant', 'stock_conflict_quant_rel', string='Quants')
  9. quant_to_fix_ids = fields.Many2many(
  10. 'stock.quant', string='Conflicts')
  11. def action_keep_counted_quantity(self):
  12. for quant in self.quant_ids:
  13. quant.inventory_diff_quantity = quant.inventory_quantity - quant.quantity
  14. return self.quant_ids.action_apply_inventory()
  15. def action_keep_difference(self):
  16. for quant in self.quant_ids:
  17. quant.inventory_quantity = quant.quantity + quant.inventory_diff_quantity
  18. return self.quant_ids.action_apply_inventory()