changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -2178,6 +2178,7 @@
|
||||
help="Device approved by ADP"/>
|
||||
<field name="name" string="Description" class="text-wrap"/>
|
||||
<field name="x_fc_adp_device_type" string="Device Type" optional="show" width="150px"/>
|
||||
<field name="x_fc_adp_build_type" string="Build" optional="show" width="100px"/>
|
||||
<field name="x_fc_serial_number" string="S/N" optional="show" width="90px"/>
|
||||
<field name="product_uom_qty" string="Qty" width="60px"/>
|
||||
<field name="price_unit" string="Unit $" width="100px"/>
|
||||
@@ -2410,9 +2411,11 @@
|
||||
<attribute name="optional">hide</attribute>
|
||||
</xpath>
|
||||
|
||||
<!-- Serial Number: after description, always visible -->
|
||||
<!-- Serial Number and Build Type: after description -->
|
||||
<xpath expr="//field[@name='order_line']/list/field[@name='name']" position="after">
|
||||
<field name="x_fc_serial_number" string="S/N" optional="show"/>
|
||||
<field name="x_fc_adp_build_type" string="Build" optional="hide"
|
||||
column_invisible="not parent.x_fc_is_adp_sale"/>
|
||||
</xpath>
|
||||
|
||||
<!-- Shorten Qty label -->
|
||||
|
||||
Reference in New Issue
Block a user