|
@@ 877-907 (lines=31) @@
|
| 874 |
|
notify(ObjectInitializedEvent(obj)) |
| 875 |
|
|
| 876 |
|
|
| 877 |
|
class Instrument_Calibrations(WorksheetImporter): |
| 878 |
|
|
| 879 |
|
def Import(self): |
| 880 |
|
bsc = getToolByName(self.context, 'bika_setup_catalog') |
| 881 |
|
for row in self.get_rows(3): |
| 882 |
|
if not row.get('instrument', None) or not row.get('title', None): |
| 883 |
|
continue |
| 884 |
|
|
| 885 |
|
folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
| 886 |
|
if folder: |
| 887 |
|
obj = _createObjectByType("InstrumentCalibration", folder, tmpID()) |
| 888 |
|
obj.edit( |
| 889 |
|
title=row['title'], |
| 890 |
|
DownFrom=row.get('downfrom', ''), |
| 891 |
|
DownTo=row.get('downto', ''), |
| 892 |
|
Calibrator=row.get('calibrator', ''), |
| 893 |
|
Considerations=row.get('considerations', ''), |
| 894 |
|
WorkPerformed=row.get('workperformed', ''), |
| 895 |
|
Remarks=row.get('remarks', ''), |
| 896 |
|
DateIssued=row.get('DateIssued', ''), |
| 897 |
|
ReportID=row.get('ReportID', '') |
| 898 |
|
) |
| 899 |
|
# Gettinginstrument lab contacts |
| 900 |
|
bsc = getToolByName(self.context, 'bika_setup_catalog') |
| 901 |
|
lab_contacts = [o.getObject() for o in bsc(portal_type="LabContact", nactive_state='active')] |
| 902 |
|
for contact in lab_contacts: |
| 903 |
|
if contact.getFullname() == row.get('Worker', ''): |
| 904 |
|
obj.setWorker(contact.UID()) |
| 905 |
|
obj.unmarkCreationFlag() |
| 906 |
|
renameAfterCreation(obj) |
| 907 |
|
notify(ObjectInitializedEvent(obj)) |
| 908 |
|
|
| 909 |
|
|
| 910 |
|
class Instrument_Certifications(WorksheetImporter): |
|
@@ 844-874 (lines=31) @@
|
| 841 |
|
notify(ObjectInitializedEvent(obj)) |
| 842 |
|
|
| 843 |
|
|
| 844 |
|
class Instrument_Validations(WorksheetImporter): |
| 845 |
|
|
| 846 |
|
def Import(self): |
| 847 |
|
bsc = getToolByName(self.context, 'bika_setup_catalog') |
| 848 |
|
for row in self.get_rows(3): |
| 849 |
|
if not row.get('instrument', None) or not row.get('title', None): |
| 850 |
|
continue |
| 851 |
|
|
| 852 |
|
folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
| 853 |
|
if folder: |
| 854 |
|
obj = _createObjectByType("InstrumentValidation", folder, tmpID()) |
| 855 |
|
obj.edit( |
| 856 |
|
title=row['title'], |
| 857 |
|
DownFrom=row.get('downfrom', ''), |
| 858 |
|
DownTo=row.get('downto', ''), |
| 859 |
|
Validator=row.get('validator', ''), |
| 860 |
|
Considerations=row.get('considerations', ''), |
| 861 |
|
WorkPerformed=row.get('workperformed', ''), |
| 862 |
|
Remarks=row.get('remarks', ''), |
| 863 |
|
DateIssued=row.get('DateIssued', ''), |
| 864 |
|
ReportID=row.get('ReportID', '') |
| 865 |
|
) |
| 866 |
|
# Getting lab contacts |
| 867 |
|
bsc = getToolByName(self.context, 'bika_setup_catalog') |
| 868 |
|
lab_contacts = [o.getObject() for o in bsc(portal_type="LabContact", is_active=True)] |
| 869 |
|
for contact in lab_contacts: |
| 870 |
|
if contact.getFullname() == row.get('Worker', ''): |
| 871 |
|
obj.setWorker(contact.UID()) |
| 872 |
|
obj.unmarkCreationFlag() |
| 873 |
|
renameAfterCreation(obj) |
| 874 |
|
notify(ObjectInitializedEvent(obj)) |
| 875 |
|
|
| 876 |
|
|
| 877 |
|
class Instrument_Calibrations(WorksheetImporter): |