This commit is contained in:
gsinghpal
2026-03-09 23:45:00 -04:00
parent acd3fc455e
commit f81e0cd918
85 changed files with 6085 additions and 126 deletions

View File

@@ -29,10 +29,11 @@ class SaleOrderLine(models.Model):
@api.depends('product_id', 'product_id.default_code')
def _compute_adp_device_type(self):
"""Compute ADP device type from the product's device code."""
"""Compute ADP device type and build type from the product's device code."""
ADPDevice = self.env['fusion.adp.device.code'].sudo()
for line in self:
device_type = ''
build_type = False
if line.product_id:
# Get the device code from product (default_code or custom field)
device_code = line._get_adp_device_code()
@@ -44,7 +45,9 @@ class SaleOrderLine(models.Model):
], limit=1)
if adp_device:
device_type = adp_device.device_type or ''
build_type = adp_device.build_type or False
line.x_fc_adp_device_type = device_type
line.x_fc_adp_build_type = build_type
# ==========================================================================
# SERIAL NUMBER AND DEVICE PLACEMENT
@@ -110,6 +113,16 @@ class SaleOrderLine(models.Model):
store=True,
help='Device type from ADP mobility manual (for approval matching)',
)
x_fc_adp_build_type = fields.Selection(
selection=[
('modular', 'Modular'),
('custom_fabricated', 'Custom Fabricated'),
],
string='Build Type',
compute='_compute_adp_device_type',
store=True,
help='Build type from ADP mobility manual (Modular or Custom Fabricated)',
)
# ==========================================================================
# COMPUTED ADP PORTIONS