mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[9.0][IMP] mrp_bom_dismantling: rename method
This commit is contained in:
@@ -74,7 +74,7 @@ class MrpBom(models.Model):
|
||||
self._check_bom_validity(check_dismantling=True)
|
||||
|
||||
product = self._get_bom_product()
|
||||
components = self._get_components_needs()
|
||||
components = self._get_component_needs()
|
||||
|
||||
# If no main component, take first sorted by Id
|
||||
if not main_component:
|
||||
@@ -143,14 +143,14 @@ class MrpBom(models.Model):
|
||||
if warning:
|
||||
raise exceptions.UserError(_(warning))
|
||||
|
||||
def _get_components_needs(self):
|
||||
def _get_component_needs(self):
|
||||
""" Return this BoM components and their needed qties.
|
||||
|
||||
The result is like {component_1: 1, component_2: 5, ...}
|
||||
|
||||
:rtype: dict(product_product, float)
|
||||
"""
|
||||
components = self.product_id._get_components_needs(
|
||||
components = self.product_id._get_component_needs(
|
||||
product=self.product_id, bom=self
|
||||
)
|
||||
return dict(components)
|
||||
|
||||
@@ -20,7 +20,7 @@ class ProductProduct(models.Model):
|
||||
result['domain'] = [('dismantling', '=', False)]
|
||||
return result
|
||||
|
||||
def _get_components_needs(self, product, bom):
|
||||
def _get_component_needs(self, product, bom):
|
||||
""" Return the needed qty of each compoments in the *bom* of *product*.
|
||||
|
||||
:type product: product_product
|
||||
|
||||
@@ -28,7 +28,7 @@ class DismantlingProductChoice(models.TransientModel):
|
||||
""" Update component_id domain to include only BOM components.
|
||||
"""
|
||||
component_ids = sorted(
|
||||
[c.id for c in self.bom_id._get_components_needs()]
|
||||
[c.id for c in self.bom_id._get_component_needs()]
|
||||
)
|
||||
if not component_ids:
|
||||
raise UserError(_('This BoM does not have components.'))
|
||||
|
||||
Reference in New Issue
Block a user