Exemple #1
0
from fields.reference_field import ReferenceField
from fields.widget.widget import StringWidget, TextAreaWidget, BooleanWidget, FileWidget, DateTimeWidget
import datetime
from openerp.exceptions import Warning

schema = (
    StringField(string='title', required=1),
    StringField(string='InvoiceNumber',
                compute='_ComputeInvoiceId',
                required=0),
    fields.Many2one(
        string='Client',
        required=0,
        comodel_name='olims.client',
    ),
    DateTimeField('Invoice Date', ),
    DateTimeField(
        'StartDate',
        required=1,
        default_method='current_date',
        widget=DateTimeWidget(label=_("Date"), ),
    ),
    DateTimeField(
        'EndDate',
        required=1,
        default_method='end_date',
        widget=DateTimeWidget(label=_("End Date"), ),
    ),
    TextField(
        'Remarks',
        searchable=True,
Exemple #2
0
            label=_("Location"),
            description=_("The room and location where the instrument is installed"),
        )
    ),

    FileField('Photo',
              help='Photo of the instrument',
        widget = FileWidget(
            label = _("Photo image file"),
        ),
    ),
          
    DateTimeField('InstallationDate',
    schemata = 'Additional info.',
    widget = DateTimeWidget(
        label=_("InstallationDate"),
        description=_("The date the instrument was installed"),
        )
    ),

    FileField('InstallationCertificate',
    schemata = 'Additional info.',
    widget = FileWidget(
        label=_("Installation Certificate"),
        description=_("Installation certificate upload"),
        ),
    ),
    DateTimeField('ExpiryDate',
                  widget = DateTimeWidget(
                            label=_("Expiry Date"),
                            description=_("Date until the certificate is valid"),
Exemple #3
0
        comodel_name='olims.instrument',
        required=False,
    ),

    # ~~~~~~~ To be implemented ~~~~~~~
    # ComputedField('InstrumentUID',
    #     expression = 'context.getInstrument() and context.getInstrument().UID() or None',
    #     widget=ComputedWidget(
    #         visible=False,
    #     ),
    # ),
    DateTimeField(
        'DateIssued',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("Report Date"),
            description=_("Calibration report date"),
        ),
    ),
    DateTimeField(
        'DownFrom',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("From"),
            description=_(
                "Date from which the instrument is under calibration"),
        ),
    ),
    DateTimeField(
Exemple #4
0
 StringField('SamplePoint',
     searchable = True,
     widget = StringWidget(
         label = _("Sample Point"),
     ),
 ),
 StringField('Temperature',
     widget = StringWidget(
         label = _("Temperature"),
     ),
 ),
 DateTimeField('DateImported',
     required = 1,
     widget = DateTimeWidget(
         label = _("Date Imported"),
         size=12,
         visible={'edit': 'visible', 'view': 'visible', 'add': 'visible',
                  'secondary': 'invisible'},
     ),
 ),
 DateTimeField('DateApplied',
     widget = DateTimeWidget(
         label = _("Date Applied"),
         size=12,
         visible={'edit': 'visible', 'view': 'visible', 'add': 'visible',
                  'secondary': 'invisible'},
     ),
 ),
 IntegerField('NumberSamples',
     widget = IntegerWidget(
         label = _("Number of samples"),
Exemple #5
0
                                IntegerWidget, DecimalWidget
from base_olims_model import BaseOLiMSModel

schema = (
    fields.Many2one(
        string='Calculation',
        comodel_name='olims.calculation',
        required=False,
    ),
    fields.Many2many(
        string='InterimFields',
        comodel_name='olims.interimfield',
    ),
    StringField('Result', ),
    DateTimeField(
        'ResultCaptureDate',
        widget=ComputedWidget(visible=False, ),
    ),
    StringField('ResultDM', ),
    BooleanField(
        'Retested',
        default=False,
    ),
    fields.Char(string='Days'),
    fields.Char(string='Hours'),
    fields.Char(string='Minutes'),
    DateTimeField(
        'DateAnalysisPublished',
        widget=DateTimeWidget(label=_("Date Published"), ),
    ),
    DateTimeField(
        'DueDate',
Exemple #6
0
 #         comodel_name='olims.invoice',
 #         required =False,
 #          help =    'contact',
 #     # vocabulary_display_path_bound=sys.maxsize,
 #     #                allowed_types=('Invoice',),
 #     #                referenceClass=HoldingReference,
 #     #                relationship='OrderInvoice',
 #     ),
 DateTimeField(
     'OrderDate',
     required=1,
     default_method='current_date',
     widget=DateTimeWidget(
         label=_("Order Date"),
         size=12,
         render_own_label=True,
         visible={
             'edit': 'visible',
             'view': 'visible',
             'add': 'visible',
             'secondary': 'invisible'
         },
     ),
 ),
 DateTimeField(
     'DateDispatched',
     readonly=True,
     widget=DateTimeWidget(label=_("Date Dispatched"), ),
 ),
 TextField(
     'Remarks',
     searchable=True,
Exemple #7
0
 TextField(
     'Remarks',
     schemata='Description',
     searchable=True,
     default_content_type='text/plain',
     allowed_content_types=('text/plain', ),
     default_output_type="text/plain",
     widget=TextAreaWidget(
         macro="bika_widgets/remarks",
         label=_("Remarks"),
         append_only=True,
     ),
 ),
 DateTimeField(
     'Date Sampled',
     schemata='Dates',
     widget=DateTimeWidget(label=_("Date Sampled"), ),
 ),
 DateTimeField(
     'Date Received',
     schemata='Dates',
     default_method='current_date',
     widget=DateTimeWidget(label=_("Date Received"), ),
 ),
 DateTimeField(
     'Date Opened',
     schemata='Dates',
     widget=DateTimeWidget(label=_("Date Opened"), ),
 ),
 DateTimeField(
     'Expiry Date',
Exemple #8
0
 #     ),
 # ),
 BooleanField('SamplingWorkflowEnabled',
              default_method='getSamplingWorkflowEnabledDefault'),
 DateTimeField(
     'DateSampled',
     # mode="rw",
     # read_permission=permissions.View,
     # write_permission=SampleSample,
     # widget = DateTimeWidget(
     #     label=_("Date Sampled"),
     #     size=20,
     #     visible={'edit': 'visible',
     #              'view': 'visible',
     #              'header_table': 'visible',
     #              'sample_registered': {'view': 'invisible', 'edit': 'invisible'},
     #              'to_be_sampled':     {'view': 'visible', 'edit': 'visible'},
     #              'sampled':           {'view': 'visible', 'edit': 'invisible'},
     #              'to_be_preserved':   {'view': 'visible', 'edit': 'invisible'},
     #              'sample_due':        {'view': 'visible', 'edit': 'invisible'},
     #              'sample_received':   {'view': 'visible', 'edit': 'invisible'},
     #              'expired':           {'view': 'visible', 'edit': 'invisible'},
     #              'disposed':          {'view': 'visible', 'edit': 'invisible'},
     #              },
     #     render_own_label=True,
     # ),
 ),
 StringField(
     'Sampler',
     # mode="rw",
     # read_permission=permissions.View,
Exemple #9
0
# from dependencies.dependency import ContainerModifiedEvent
# from dependencies.dependency import implements

from openerp import fields, models
from models.base_olims_model import BaseOLiMSModel
from fields.date_time_field import DateTimeField
from fields.widget.widget import DateTimeWidget
from lims import bikaMessageFactory as _


#schema = BikaSchema.copy() + Schema((
schema = (
    DateTimeField('BatchStartDate',
        required=1,
        default_method='current_date',
        widget=DateTimeWidget(
            label=_("Start Date"),
        ),
    ),
    DateTimeField('BatchEndDate',
        required=1,
        default_method='current_date',
        widget=DateTimeWidget(
            label=_("End Date"),
        ),
    ),
)

#schema['title'].default = DateTime().strftime('%b %Y')

     comodel_name='olims.instrument',
 ),
 StringField(
     'Type',
     vocabulary="getMaintenanceTypes",
     widget=ReferenceWidget(
         checkbox_bound=0,
         label=("Maintenance type", "Type"),
     ),
 ),
 DateTimeField(
     'DownFrom',
     with_time=1,
     with_date=1,
     required=1,
     widget=DateTimeWidget(
         label=_("From"),
         description=_(
             "Date from which the instrument is under maintenance"),
         show_hm=True,
     ),
 ),
 DateTimeField(
     'DownTo',
     with_time=1,
     with_date=1,
     widget=DateTimeWidget(
         label=_("To"),
         description=_("Date until the instrument will not be available"),
         show_hm=True,
     ),
 ),
Exemple #11
0
 fields.Many2one(
     string='SampleType',
     comodel_name='olims.sample_type',
     readonly=True,
 ),
 fields.Many2one(
     string='SamplePoint',
     comodel_name='olims.sample_point',
 ),
 fields.Many2one(
     string='StorageLocation',
     comodel_name='olims.storage_location',
 ),
 BooleanField('SamplingWorkflowEnabled',
              default_method='getSamplingWorkflowEnabledDefault'),
 DateTimeField('DateSampled', ),
 StringField('Sampler', ),
 DateTimeField(
     'SamplingDate',
     readonly=True,
 ),
 fields.Many2one(
     string='SamplingDeviation',
     comodel_name='olims.sampling_deviation',
 ),
 fields.Many2one(
     string='SampleCondition',
     comodel_name='olims.sample_condition',
 ),
 DateTimeField(
     'DateReceived',
Exemple #12
0
        widget=BooleanWidget(
            label=_("Internal Certificate"),
            description=_("Select if is an in-house calibration certificate")
        )
    ),

    StringField('Agency',
        widget = StringWidget(
            label=_("Agency"),
            description=_("Organization responsible of granting the calibration certificate")
        ),
    ),

    DateTimeField('Date',
        widget = DateTimeWidget(
            label=_("Date"),
            description=_("Date when the calibration certificate was granted"),
        ),
    ),

    DateTimeField('ValidFrom',
        with_time = 1,
        with_date = 1,
        required = 1,
        widget = DateTimeWidget(
            label=_("From"),
            description=_("Date from which the calibration certificate is valid"),
        ),
    ),

    DateTimeField('DownTo',
        with_time = 1,
Exemple #13
0
     #        visible=True,
     #        base_query={'inactive_state': 'active'},
     #        showOn=True,
     #        colModel=[{'columnName': 'UID', 'hidden': True},
     #                  {'columnName': 'ClientID', 'width': '20', 'label': _('Client ID')},
     #                  {'columnName': 'Title', 'width': '80', 'label': _('Title')}
     #                 ],
     #  ),
 ),
 StringField('ClientBatchID',
             searchable=True,
             required=0,
             widget=StringWidget(label=_("Client Batch ID"))),
 DateTimeField(
     'BatchDate',
     required=False,
     widget=DateTimeWidget(label=_('Date'), ),
 ),
 # ~~~~~~~ To be implemented ~~~~~~~
 # LinesField(
 #     'BatchLabels',
 #     vocabulary="BatchLabelVocabulary",
 #     accessor="getLabelNames",
 #     widget=MultiSelectionWidget(
 #         label=_("Batch Labels"),
 #         format="checkbox",
 #     )
 # ),
 TextField('Remarks',
           searchable=True,
           default_content_type='text/x-web-intelligent',
Exemple #14
0
        #       allowed_types=('Preservation',),
        #         relationship='SamplePartitionPreservation',
        #         required=0,
        #         multiValued=0,
    ),
    BooleanField('Separate', default=False),
    fields.Many2one(
        string='Analyses',
        required=False,
        comodel_name='olims.analyses',
        #       allowed_types=('Analyses',),
        #         relationship='SamplePartitionAnalysis',
        #         required=0,
        #         multiValued=0,
    ),
    DateTimeField('DatePreserved', ),
    StringField('Preserver', searchable=True),
    fields.Char(string='Days'),
    fields.Char(string='Hours'),
    fields.Char(string='Minutes'),
    # ~~~~~~~ To be implemented ~~~~~~~
    # DurationField('RetentionPeriod',
    # ),

    # ComputedField('DisposalDate',
    #     expression = 'context.disposal_date()',
    #     widget = ComputedWidget(
    #         visible=False,
    #     ),
    # ),
)
Exemple #15
0
     string='Partition',
     comodel_name='olims.ar_partition',
     inverse_name='analysis_request_id',
 ),
 fields.One2many(
     string='Sample Partition',
     comodel_name='olims.ar_sample_partition',
     inverse_name='analysis_request_id',
 ),
 fields.One2many(
     string='Analyses',
     comodel_name='olims.ar_analysis',
     inverse_name='analysis_request_id',
 ),
 # Sample field
 DateTimeField('DateSampled', ),
 # Sample field
 fields.Many2one(
     string='Sampler',
     comodel_name="res.users",
     domain="[('groups_id', 'in', (14,18))]",
 ),
 DateTimeField(
     'SamplingDate',
     required=1,
 ),
 fields.Many2one(string='SampleType',
                 comodel_name='olims.sample_type',
                 required=True),
 fields.Many2one(
     string='Specification',
Exemple #16
0
 StringField(string='InvoiceNumber',
             compute='_ComputeInvoiceId',
             required=0),
 # ~~~~~~~ To be implemented ~~~~~~~
 fields.Char(
     string='Client',
     required=0,
     #         comodel_name='olims.client',
     #         vocabulary_display_path_bound=sys.maxsize,
     #         allowed_types=('Client',),
     #         relationship='ClientInvoice',
 ),
 DateTimeField(
     'Invoice Date',
     #         required=1,
     #         vocabulary_display_path_bound=sys.maxsize,
     #         allowed_types=('AnalysisRequest',),
     #         relationship='AnalysisRequestInvoice',
 ),
 DateTimeField(
     'StartDate',
     required=1,
     default_method='current_date',
     widget=DateTimeWidget(label=_("Date"), ),
 ),
 DateTimeField(
     'EndDate',
     required=1,
     default_method='end_date',
     widget=DateTimeWidget(label=_("End Date"), ),
 ),
Exemple #17
0
    FileField(
        'AttachmentFile',
        widget=FileWidget(label=_("Attachment"), ),
    ),
    fields.Many2one(string='AttachmentType',
                    comodel_name='olims.attachment_type',
                    required=False,
                    help='Attachment Type'),
    StringField(
        'AttachmentKeys',
        searchable=True,
        widget=StringWidget(label=_("Attachment Keys"), ),
    ),
    DateTimeField(
        'DateLoaded',
        required=1,
        default_method='current_date',
        widget=DateTimeWidget(label=_("Date Loaded"), ),
    ),
    # ~~~~~~~ To be implemented ~~~~~~~
    # ComputedField('ClientUID',
    #     expression = 'here.aq_parent.UID()',
    #     widget = ComputedWidget(
    #         visible = False,
    #     ),
    # ),
)


class Attachment(models.Model, BaseOLiMSModel):
    _name = 'olims.attachment'
Exemple #18
0
        selection=BULK_DISCOUNT_OPTION
    ),
    FixedPointField('BulkPrice',
        widget=DecimalWidget(
            label=_("Discount %"),
            description=_("Enter discount percentage value"),
        ),
    ),
    BooleanField('Descriptions',
        default=False,
        widget=BooleanWidget(
            label=_("Include descriptions"),
            description=_("Select if the descriptions should be included"),
        ),
    ),
    DateTimeField('ExpirationDate'),
    DateTimeField('EffectiveDate'),
)

def apply_discount(price=None, discount=None):
    return float(price) - (float(price) * float(discount)) / 100


def get_vat_amount(price, vat_perc):
    return float(price) * float(vat_perc) / 100


class Pricelist(models.Model, BaseOLiMSModel):
    _name= 'olims.price_list'
    _rec_name = 'Title'
Exemple #19
0
            label=_("Location"),
            description=_("The room and location where the instrument is installed"),
        )
    ),

    FileField('Photo',
              help='Photo of the instrument',
        widget = FileWidget(
            label = _("Photo image file"),
        ),
    ),
          
    DateTimeField('InstallationDate',
    schemata = 'Additional info.',
    widget = DateTimeWidget(
        label=_("InstallationDate"),
        description=_("The date the instrument was installed"),
        )
    ),

    FileField('InstallationCertificate',
    schemata = 'Additional info.',
    widget = FileWidget(
        label=_("Installation Certificate"),
        description=_("Installation certificate upload"),
        )
    ),

) #)
# ~~~~~~~~~~ Irrelevant code for Odoo ~~~~~~~~~~~
# schema.moveField('AssetNumber', before='description')