fix id supplier in export devices

This commit is contained in:
Cayo Puigdefabregas 2023-04-21 12:47:53 +02:00
parent 119b4938c0
commit 750d3e7db6
2 changed files with 13 additions and 5 deletions

View File

@ -468,8 +468,6 @@ class NewDeviceForm(FlaskForm):
if self._obj.placeholder.is_abstract:
self.type.render_kw = disabled
self.amount.render_kw = disabled
# self.id_device_supplier.render_kw = disabled
self.pallet.render_kw = disabled
self.info.render_kw = disabled
self.components.render_kw = disabled
self.serial_number.render_kw = disabled
@ -683,6 +681,14 @@ class NewDeviceForm(FlaskForm):
):
self._obj.set_functionality(self.functionality.data)
else:
self._obj.placeholder.id_device_supplier = (
self.id_device_supplier.data or None
)
self._obj.placeholder.id_device_internal = (
self.id_device_internal.data or None
)
self._obj.placeholder.pallet = self.pallet.data or None
placeholder_log = PlaceholdersLog(
type="Update", source='Web form', placeholder=self._obj.placeholder
)

View File

@ -40,8 +40,9 @@ class BaseDeviceRow(OrderedDict):
self['Temporary Lots'] = ''
self['Incoming Lots'] = ''
self['Outgoing Lots'] = ''
self['Placeholder Palet'] = ''
self['Placeholder Pallet'] = ''
self['Placeholder Id Supplier'] = ''
self['Placeholder Id Internal'] = ''
self['Placeholder Info'] = ''
self['Placeholder Components'] = ''
self['Placeholder Type'] = ''
@ -266,7 +267,7 @@ class BaseDeviceRow(OrderedDict):
class DeviceRow(BaseDeviceRow):
def __init__(self, device: d.Device, document_ids: dict) -> None:
def __init__(self, device: d.Device, document_ids: dict) -> None: # noqa: C901
super().__init__()
self.placeholder = device.binding or device.placeholder
self.device = self.placeholder.binding or self.placeholder.device
@ -510,8 +511,9 @@ class DeviceRow(BaseDeviceRow):
self['Temporary Lots'] = none2str(self.device.get_lots_from_type('temporary'))
self['Incoming Lots'] = none2str(self.device.get_lots_from_type('incoming'))
self['Outgoing Lots'] = none2str(self.device.get_lots_from_type('outgoing'))
self['Placeholder Palet'] = none2str(self.placeholder.pallet)
self['Placeholder Pallet'] = none2str(self.placeholder.pallet)
self['Placeholder Id Supplier'] = none2str(self.placeholder.id_device_supplier)
self['Placeholder Id Internal'] = none2str(self.placeholder.id_device_internal)
self['Placeholder Info'] = none2str(self.placeholder.info)
self['Placeholder Components'] = none2str(self.placeholder.components)
self['Placeholder Type'] = none2str(self.placeholder.device.type)