19 lines
582 B
Python
19 lines
582 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from odoo import models, fields
|
|
|
|
|
|
class VirtualBom(models.Model):
|
|
_inherit = 'mrp.bom'
|
|
|
|
is_virtual = fields.Boolean(string='Виртуальная (сгенерированная)')
|
|
|
|
def bom_available(self, qty=1):
|
|
"""Проверяет, что все компоненты BOM есть на складе в нужном количестве."""
|
|
for s in self:
|
|
for line in s.bom_line_ids:
|
|
if line.product_id.qty_available < line.product_qty * qty:
|
|
return False
|
|
return True
|
|
|