Remove 2to3

This commit is contained in:
Sebastián Marró 2019-03-04 11:41:58 -03:00
parent 3d3d1b563d
commit fe8d687c82
42 changed files with 251 additions and 323 deletions

View File

@ -435,9 +435,9 @@ class Typification(ModelSQL, ModelView):
typification.detection_limit),
'quantification_limit': str(
typification.quantification_limit),
'initial_concentration': unicode(
'initial_concentration': str(
typification.initial_concentration or ''),
'final_concentration': unicode(
'final_concentration': str(
typification.final_concentration or ''),
'initial_unit': typification.start_uom,
'final_unit': typification.end_uom,
@ -456,7 +456,7 @@ class Typification(ModelSQL, ModelView):
])
if notebook_lines:
NotebookLine.write(notebook_lines, {
'initial_concentration': unicode(
'initial_concentration': str(
typification.initial_concentration or ''),
})
@ -1352,7 +1352,7 @@ class Analysis(Workflow, ModelSQL, ModelView):
new_context['date_from'] = date_from
new_context['date_to'] = date_to
with Transaction().set_context(new_context):
pending_fractions = cls.analysis_pending_fractions().iteritems()
pending_fractions = iter(cls.analysis_pending_fractions().items())
processed_lines = []
for analysis, pending in pending_fractions:

View File

@ -120,9 +120,8 @@ class Printer(ModelSQL, ModelView):
name = fields.Char('Name', required=True)
class User:
class User(metaclass=PoolMeta):
__name__ = 'res.user'
__metaclass__ = PoolMeta
notebook_view = fields.Many2One('lims.notebook.view', 'Notebook view')
role = fields.Many2One('lims.user.role', 'Role')
@ -580,8 +579,7 @@ class ModelDoc(ModelSQL, ModelView):
return self.model.name
class Model:
class Model(metaclass=PoolMeta):
__name__ = 'ir.model'
__metaclass__ = PoolMeta
docs = fields.One2Many('ir.model.doc', 'model', 'Docs')

View File

@ -727,8 +727,8 @@ class MeansDeviationsCalc(Wizard):
}
if records:
to_create = []
for record in records.itervalues():
details = [d for d in record['details'].itervalues()]
for record in records.values():
details = [d for d in record['details'].values()]
to_create.append({
'session_id': self._session_id,
'product_type': record['product_type'],
@ -1310,7 +1310,7 @@ class ControlChartReport(Report):
index = columns
cols = []
ds = {}
for r in sorted(records.values(), key=lambda x: x['order']):
for r in sorted(list(records.values()), key=lambda x: x['order']):
cols.append(r['name'])
ds[r['name']] = [r['recs'][col] for col in index]
df = pd.DataFrame(ds, index=index)

View File

@ -276,14 +276,14 @@ class Entry(Workflow, ModelSQL, ModelView):
if (c.report_contact_default and c not
in a_report_contacts):
value = ReportContacts(**ReportContacts.default_get(
ReportContacts._fields.keys()))
list(ReportContacts._fields.keys())))
value.contact = c
report_contacts.append(value)
if (c.acknowledgment_contact_default and c not
in a_acknowledgment_contacts):
value = AcknowledgmentContacts(
**AcknowledgmentContacts.default_get(
AcknowledgmentContacts._fields.keys()))
list(AcknowledgmentContacts._fields.keys())))
value.contact = c
acknowledgment_contacts.append(value)
@ -336,7 +336,7 @@ class Entry(Workflow, ModelSQL, ModelView):
if (c.invoice_contact_default and c not
in a_invoice_contacts):
value = InvoiceContacts(**InvoiceContacts.default_get(
InvoiceContacts._fields.keys()))
list(InvoiceContacts._fields.keys())))
value.contact = c
invoice_contacts.append(value)
@ -539,9 +539,9 @@ class Entry(Workflow, ModelSQL, ModelView):
], limit=1)
with Transaction().set_context(language=lang.code):
subject = unicode('%s %s' % (config.mail_ack_subject,
subject = str('%s %s' % (config.mail_ack_subject,
self.number)).strip()
body = unicode(config.mail_ack_body)
body = str(config.mail_ack_body)
return subject, body
@ -553,9 +553,9 @@ class Entry(Workflow, ModelSQL, ModelView):
self.ack_report_format == 'pdf' and 'pdf' or
'vnd.oasis.opendocument.text',
'filename':
(unicode(self.number) + '.' +
(str(self.number) + '.' +
str(self.ack_report_format)),
'name': unicode(self.number),
'name': str(self.number),
}
return data
@ -858,8 +858,8 @@ class EntryDetailAnalysis(ModelSQL, ModelView):
else None)
if typification:
repetitions = typification[0]
initial_concentration = unicode(typification[1] or '')
final_concentration = unicode(typification[2] or '')
initial_concentration = str(typification[1] or '')
final_concentration = str(typification[2] or '')
initial_unit = typification[3]
final_unit = typification[4]
detection_limit = str(typification[5])
@ -1443,7 +1443,7 @@ class AcknowledgmentOfReceipt(Report):
ia['acredited']):
s_methods[ia['method_id']]['enac'] = True
for v in s_methods.itervalues():
for v in s_methods.values():
if v['enac']:
v['enac_label'] = (Entry.raise_user_error(
'enac_acredited', raise_exception=False))

View File

@ -36,7 +36,7 @@ class FormulaParser(Model):
'pi': 3.141592653589793,
'e': 2.718281828459045,
}
for var in vars.keys():
for var in list(vars.keys()):
if self.vars.get(var) is not None:
self.raise_user_error('variable_redefine', (var,))
self.vars[var] = vars[var]

View File

@ -213,7 +213,7 @@ class Notebook(ModelSQL, ModelView):
domain = ('current_location', 'in', [l.id for l in locations])
all_notebooks = cls.search([])
current_locations = cls.get_current_location(all_notebooks).iteritems()
current_locations = iter(cls.get_current_location(all_notebooks).items())
processed_lines = [{
'fraction': fraction,
@ -1261,7 +1261,7 @@ class NotebookInitialConcentrationCalc(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var[0] == 'A':
analysis_code = var[1:]
result = self._get_analysis_result(analysis_code, notebook,
@ -1300,7 +1300,7 @@ class NotebookInitialConcentrationCalc(Wizard):
result = VolumeConversion.brixToDensity(result)
if result is not None:
variables[var] = result
for var in variables.itervalues():
for var in variables.values():
if var is None:
return None
return variables
@ -1450,7 +1450,7 @@ class NotebookResultsConversion(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var == 'DI':
if initial_uom_volume:
c = float(notebook_line.initial_concentration)
@ -1700,7 +1700,7 @@ class NotebookInternalRelationsCalc1(Wizard):
}
if relations:
NotebookInternalRelationsCalc1Relation.create(
[ir for ir in relations.itervalues()])
[ir for ir in relations.values()])
return True
return False
@ -1719,7 +1719,7 @@ class NotebookInternalRelationsCalc1(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var[0] in ('A', 'D', 'T'):
analysis_code = var[1:]
with Transaction().set_user(0):
@ -1750,7 +1750,7 @@ class NotebookInternalRelationsCalc1(Wizard):
more_formulas = more_formulas.replace(i, '')
self._get_variables_list(more_formulas, notebook, analysis)
return [v for v in analysis.itervalues()]
return [v for v in analysis.values()]
def transition_confirm(self):
pool = Pool()
@ -1884,7 +1884,7 @@ class NotebookInternalRelationsCalc1(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var[0] == 'A':
analysis_code = var[1:]
result = self._get_analysis_result(analysis_code, notebook,
@ -1923,7 +1923,7 @@ class NotebookInternalRelationsCalc1(Wizard):
result = VolumeConversion.brixToDensity(result)
if result is not None:
variables[var] = result
for var in variables.itervalues():
for var in variables.values():
if var is None:
return None
return variables
@ -2133,7 +2133,7 @@ class NotebookInternalRelationsCalc2(Wizard):
if relations:
res_lines = NotebookInternalRelationsCalc2Relation.create(
[ir for ir in relations.itervalues()])
[ir for ir in relations.values()])
self.result.relations = res_lines
self.result.total = len(self.result.relations)
self.result.index = 0
@ -2188,7 +2188,7 @@ class NotebookInternalRelationsCalc2(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var[0] in ('A', 'D', 'T'):
analysis_code = var[1:]
with Transaction().set_user(0):
@ -2219,7 +2219,7 @@ class NotebookInternalRelationsCalc2(Wizard):
more_formulas = more_formulas.replace(i, '')
self._get_variables_list(more_formulas, notebook, analysis)
return [v for v in analysis.itervalues()]
return [v for v in analysis.values()]
def transition_check_variables(self):
variables = {}
@ -2234,7 +2234,7 @@ class NotebookInternalRelationsCalc2(Wizard):
variables[analysis_code] = True
var.save()
for var in variables.itervalues():
for var in variables.values():
if not var:
return 'process'
return 'next_'
@ -2372,7 +2372,7 @@ class NotebookInternalRelationsCalc2(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var[0] == 'A':
analysis_code = var[1:]
result = self._get_analysis_result(analysis_code, notebook,
@ -2411,7 +2411,7 @@ class NotebookInternalRelationsCalc2(Wizard):
result = VolumeConversion.brixToDensity(result)
if result is not None:
variables[var] = result
for var in variables.itervalues():
for var in variables.values():
if var is None:
return None
return variables
@ -2572,7 +2572,7 @@ class NotebookLoadResultsFormulaProcess(ModelView):
variables = {}
for variable in self.variables:
variables[variable.number] = variable.description
for k, v in variables.iteritems():
for k, v in variables.items():
formula = formula.replace(k, v)
return formula
return ''
@ -2914,7 +2914,7 @@ class NotebookLoadResultsFormula(Wizard):
variables_desc[var.number] = var.description
default['variables'] = variables
formula_formula = formula.formula
for k, v in variables_desc.iteritems():
for k, v in variables_desc.items():
formula_formula = formula_formula.replace(k, v)
default['formula_formula'] = formula_formula
@ -2943,7 +2943,7 @@ class NotebookLoadResultsFormula(Wizard):
variables_desc[var.number] = var.description
default['variables'] = variables
formula_formula = formula.formula
for k, v in variables_desc.iteritems():
for k, v in variables_desc.items():
formula_formula = formula_formula.replace(k, v)
default['formula_formula'] = formula_formula
default['result_modifier'] = 'eq'
@ -2996,7 +2996,7 @@ class NotebookLoadResultsFormula(Wizard):
prof_lines[key].append(data.line.id)
situation_1 = []
for key in situations.iterkeys():
for key in situations.keys():
qualifications = LabProfessionalMethod.search([
('professional', '=', key[0]),
('method', '=', key[1]),
@ -3019,7 +3019,7 @@ class NotebookLoadResultsFormula(Wizard):
return 'sit1'
situation_2 = []
for key, sit in situations.iteritems():
for key, sit in situations.items():
if sit == 2:
situation_2.append({
'session_id': self._session_id,
@ -3102,7 +3102,7 @@ class NotebookLoadResultsFormula(Wizard):
supervisor_lines[detail.supervisor.id] = []
supervisor_lines[detail.supervisor.id].extend([
l.id for l in detail.lines])
for prof_id, lines in supervisor_lines.iteritems():
for prof_id, lines in supervisor_lines.items():
notebook_lines = NotebookLine.search([
('id', 'in', lines),
])
@ -3129,7 +3129,7 @@ class NotebookLoadResultsFormula(Wizard):
all_prof[key].append(detail.supervisor.id)
today = Date.today()
for key, sup in all_prof.iteritems():
for key, sup in all_prof.items():
professional_method, = LabProfessionalMethod.search([
('professional', '=', key[0]),
('method', '=', key[1]),
@ -3484,7 +3484,7 @@ class NotebookLoadResultsManual(Wizard):
if hasattr(self.sit2, 'supervisor'):
supervisor_lines[self.sit2.supervisor.id] = [
l.id for l in self.sit2.lines]
for prof_id, lines in supervisor_lines.iteritems():
for prof_id, lines in supervisor_lines.items():
notebook_lines = NotebookLine.search([
('id', 'in', lines),
])
@ -3509,7 +3509,7 @@ class NotebookLoadResultsManual(Wizard):
all_prof[key].append(self.sit2.supervisor.id)
today = Date.today()
for key, sup in all_prof.iteritems():
for key, sup in all_prof.items():
professional_method, = LabProfessionalMethod.search([
('professional', '=', key[0]),
('method', '=', key[1]),
@ -4204,7 +4204,7 @@ class NotebookResultsVerification(Wizard):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var == 'DI':
ic = float(notebook_line.final_concentration)
result = VolumeConversion.brixToDensity(ic)
@ -4777,7 +4777,7 @@ class AnalysisPendingInform(Report):
excluded_notebooks = cls._get_excluded_notebooks(date_from, date_to,
laboratory, party)
if excluded_notebooks:
for n_id, a_ids in excluded_notebooks.iteritems():
for n_id, a_ids in excluded_notebooks.items():
clause = [
('notebook.id', '=', n_id),
('analysis', 'in', a_ids),

View File

@ -12,9 +12,8 @@ from trytond.pyson import Bool, Eval, Or
__all__ = ['Party', 'Address', 'Company']
class Party:
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
__metaclass__ = PoolMeta
email_report = fields.Boolean('Email report')
single_sending_report = fields.Boolean('Single sending of report')
@ -54,9 +53,8 @@ class Party:
return False
class Address:
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
__metaclass__ = PoolMeta
email = fields.Char('Email',
states={
@ -104,9 +102,8 @@ class Address:
self.invoice_contact_default = False
class Company:
class Company(metaclass=PoolMeta):
__name__ = 'company.company'
__metaclass__ = PoolMeta
logo = fields.Binary('Logo')

View File

@ -322,7 +322,7 @@ class Planification(Workflow, ModelSQL, ModelView):
fractions[key] = '%s (%s)' % (detail.fraction.rec_name,
service_detail.notebook_line.method.code)
if fractions:
sorted_fractions = sorted(fractions.values(), key=lambda x: x)
sorted_fractions = sorted(list(fractions.values()), key=lambda x: x)
self.raise_user_error('no_technician',
('\n' + '\n'.join(sorted_fractions) + '\n',))
@ -1218,7 +1218,7 @@ class RelateTechnicians(Wizard):
}
to_create = []
for d in details1.itervalues():
for d in details1.values():
to_create.append({
'session_id': self._session_id,
'fraction': d['fraction'],
@ -1273,7 +1273,7 @@ class RelateTechnicians(Wizard):
}
to_create = []
for d in details2.itervalues():
for d in details2.values():
to_create.append({
'session_id': self._session_id,
'fraction': d['fraction'],
@ -1327,7 +1327,7 @@ class RelateTechnicians(Wizard):
}
to_create = []
for d in details3.itervalues():
for d in details3.values():
to_create.append({
'session_id': self._session_id,
'fraction': d['fraction'],
@ -1605,7 +1605,7 @@ class UnlinkTechnicians(Wizard):
}
to_create = []
for d in details1.itervalues():
for d in details1.values():
to_create.append({
'session_id': self._session_id,
'fraction': d['fraction'],
@ -1937,7 +1937,7 @@ class AddFractionControl(Wizard):
notebook = Notebook(notebook_lines[0].notebook.id)
to_create = []
for analysis_id, nline in analysis_to_repeat.iteritems():
for analysis_id, nline in analysis_to_repeat.items():
to_create.append({
'analysis_detail': nline.analysis_detail.id,
'service': nline.service.id,
@ -2010,7 +2010,7 @@ class AddFractionControl(Wizard):
'is_control': True,
})
if details_to_create:
for k, v in details_to_create.iteritems():
for k, v in details_to_create.items():
details = PlanificationDetail.search([
('planification', '=', self.start.planification.id),
('fraction', '=', k[0]),
@ -2591,7 +2591,7 @@ class AddFractionRMBMZ(Wizard):
notebook = Notebook(notebook_lines[0].notebook.id)
to_create = []
for nline in analysis_to_repeat.itervalues():
for nline in analysis_to_repeat.values():
for i in range(1, repetitions + 1):
to_create.append({
'analysis_detail': nline.analysis_detail.id,
@ -2665,7 +2665,7 @@ class AddFractionRMBMZ(Wizard):
'is_control': True,
})
if details_to_create:
for k, v in details_to_create.iteritems():
for k, v in details_to_create.items():
details = PlanificationDetail.search([
('planification', '=', self.start.planification.id),
('fraction', '=', k[0]),
@ -3024,7 +3024,7 @@ class AddFractionBRE(Wizard):
'is_control': True,
})
if details_to_create:
for k, v in details_to_create.iteritems():
for k, v in details_to_create.items():
details = PlanificationDetail.search([
('planification', '=', self.start.planification.id),
('fraction', '=', k[0]),
@ -3364,7 +3364,7 @@ class AddFractionMRT(Wizard):
notebook = Notebook(notebook_lines[0].notebook.id)
to_create = []
for nline in analysis_to_repeat.itervalues():
for nline in analysis_to_repeat.values():
for i in range(1, repetitions + 1):
to_create.append({
'analysis_detail': nline.analysis_detail.id,
@ -3438,7 +3438,7 @@ class AddFractionMRT(Wizard):
'is_control': True,
})
if details_to_create:
for k, v in details_to_create.iteritems():
for k, v in details_to_create.items():
details = PlanificationDetail.search([
('planification', '=', self.start.planification.id),
('fraction', '=', k[0]),
@ -3730,7 +3730,7 @@ class SearchFractions(Wizard):
data = self._get_service_details(planification)
to_create = []
for k, v in data.iteritems():
for k, v in data.items():
to_create.append({
'session_id': self._session_id,
'fraction': k[0],
@ -3768,7 +3768,7 @@ class SearchFractions(Wizard):
data = self._get_service_details(planification, extra_where)
to_create = []
for k, v in data.iteritems():
for k, v in data.items():
details = PlanificationDetail.search([
('planification', '=', planification.id),
('fraction', '=', k[0]),
@ -4039,7 +4039,7 @@ class SearchPlannedFractions(Wizard):
data = self._get_service_details()
to_create = []
for k, v in data.iteritems():
for k, v in data.items():
to_create.append({
'session_id': self._session_id,
'fraction': k[0],
@ -4077,7 +4077,7 @@ class SearchPlannedFractions(Wizard):
data = self._get_service_details(extra_where)
to_create = []
for k, v in data.iteritems():
for k, v in data.items():
details = PlanificationDetail.search([
('planification', '=', planification.id),
('fraction', '=', k[0]),
@ -4904,7 +4904,7 @@ class TechniciansQualification(Wizard):
'professional': k[0],
'method': k[1],
'situation': v,
} for k, v in situations.iteritems()])
} for k, v in situations.items()])
self.situations.total = len(self.situations.situations)
self.situations.index = 0
return 'next_'
@ -5589,9 +5589,9 @@ class PlanificationSequenceReport(Report):
sample_client_description),
}
for k1 in objects.iterkeys():
for k2, lines in objects[k1]['methods'].iteritems():
sorted_lines = sorted(lines['lines'].values(),
for k1 in objects.keys():
for k2, lines in objects[k1]['methods'].items():
sorted_lines = sorted(list(lines['lines'].values()),
key=lambda x: x['order'])
objects[k1]['methods'][k2]['lines'] = sorted_lines
@ -5692,13 +5692,13 @@ class PlanificationWorksheetAnalysisReport(Report):
key]['lines'][number] = record
objects[date]['professionals'][p_key]['total'] += 1
for k1 in objects.iterkeys():
for k2 in objects[k1]['professionals'].iterkeys():
sorted_analysis = sorted(objects[k1]['professionals'][k2][
'analysis'].items(), key=lambda x: x[1]['order'])
for k1 in objects.keys():
for k2 in objects[k1]['professionals'].keys():
sorted_analysis = sorted(list(objects[k1]['professionals'][k2][
'analysis'].items()), key=lambda x: x[1]['order'])
objects[k1]['professionals'][k2]['analysis'] = []
for item in sorted_analysis:
sorted_lines = sorted(item[1]['lines'].items(),
sorted_lines = sorted(list(item[1]['lines'].items()),
key=lambda x: x[1]['order'])
item[1]['lines'] = [l[1] for l in sorted_lines]
objects[k1]['professionals'][k2]['analysis'].append(
@ -5815,14 +5815,14 @@ class PlanificationWorksheetMethodReport(Report):
number]['methods'][notebook_line.method.id] = (
notebook_line.method.rec_name)
for k1 in objects.iterkeys():
for k2 in objects[k1]['professionals'].iterkeys():
for k1 in objects.keys():
for k2 in objects[k1]['professionals'].keys():
objects[k1]['professionals'][k2]['methods'] = {}
fractions = objects[k1]['professionals'][k2]['lines'].values()
fractions = list(objects[k1]['professionals'][k2]['lines'].values())
for fraction in fractions:
m_key = ()
m_names = []
for m_id, m_name in fraction['methods'].iteritems():
for m_id, m_name in fraction['methods'].items():
m_key += (m_id,)
m_names.append(m_name)
m_key = tuple(sorted(m_key))
@ -5837,7 +5837,7 @@ class PlanificationWorksheetMethodReport(Report):
del objects[k1]['professionals'][k2]['lines']
for m_key in objects[k1]['professionals'][k2][
'methods'].iterkeys():
'methods'].keys():
sorted_lines = sorted(objects[k1]['professionals'][k2][
'methods'][m_key]['lines'], key=lambda x: x['order'])
objects[k1]['professionals'][k2]['methods'][m_key][
@ -5993,18 +5993,18 @@ class PlanificationWorksheetReport(Report):
notebook_line.method.id] = (
notebook_line.method.rec_name)
for k1 in objects.iterkeys():
for k2 in objects[k1]['professionals'].iterkeys():
for k1 in objects.keys():
for k2 in objects[k1]['professionals'].keys():
for k3 in objects[k1]['professionals'][k2][
'analysis'].iterkeys():
'analysis'].keys():
objects[k1]['professionals'][k2]['analysis'][k3][
'methods'] = {}
fractions = objects[k1]['professionals'][k2]['analysis'][
k3]['lines'].values()
fractions = list(objects[k1]['professionals'][k2]['analysis'][
k3]['lines'].values())
for fraction in fractions:
m_key = ()
m_names = []
for m_id, m_name in fraction['methods'].iteritems():
for m_id, m_name in fraction['methods'].items():
m_key += (m_id,)
m_names.append(m_name)
m_key = tuple(sorted(m_key))
@ -6021,7 +6021,7 @@ class PlanificationWorksheetReport(Report):
del objects[k1]['professionals'][k2]['analysis'][k3][
'lines']
for m_key in objects[k1]['professionals'][k2][
'analysis'][k3]['methods'].iterkeys():
'analysis'][k3]['methods'].keys():
sorted_lines = sorted(objects[k1]['professionals'][k2][
'analysis'][k3]['methods'][m_key]['lines'],
key=lambda x: x['order'])
@ -6181,7 +6181,7 @@ class PendingServicesUnplannedReport(Report):
}
number = service.fraction.get_formated_number('pt-m-sn-sy-fn')
number = (number + '-' + unicode(service.sample.label))
number = (number + '-' + str(service.sample.label))
number_parts = number.split('-')
order = (number_parts[3] + '-' + number_parts[2] + '-' +
number_parts[4])
@ -6257,10 +6257,10 @@ class PendingServicesUnplannedReport(Report):
objects[laboratory.id]['services'][analysis.id]['total'] += 1
objects[laboratory.id]['services'][analysis.id]['parties'][
party.id]['total'] += 1
for k1 in objects.iterkeys():
for k2 in objects[k1]['services'].iterkeys():
for k1 in objects.keys():
for k2 in objects[k1]['services'].keys():
for k3, lines in objects[k1]['services'][k2][
'parties'].iteritems():
'parties'].items():
sorted_lines = sorted(lines['lines'],
key=lambda x: x['order'])
objects[k1]['services'][k2]['parties'][k3]['lines'] = (
@ -6399,7 +6399,7 @@ class PendingServicesUnplannedSpreadsheet(Report):
continue
number = service.fraction.get_formated_number('pt-m-sn-sy-fn')
number = (number + '-' + unicode(service.sample.label))
number = (number + '-' + str(service.sample.label))
number_parts = number.split('-')
order = (number_parts[3] + '-' + number_parts[2] + '-' +
number_parts[4])
@ -6763,7 +6763,7 @@ class BlindSampleReport(Report):
formula = formula.replace(var, '_')
else:
break
for var in variables.iterkeys():
for var in variables.keys():
if var == 'DI':
ic = float(notebook_line.final_concentration)
result = VolumeConversion.brixToDensity(ic)
@ -6839,9 +6839,9 @@ class PlanificationSequenceAnalysisReport(Report):
sample_client_description),
}
for k1 in objects.iterkeys():
for k2, lines in objects[k1]['methods'].iteritems():
sorted_lines = sorted(lines['lines'].values(),
for k1 in objects.keys():
for k2, lines in objects[k1]['methods'].items():
sorted_lines = sorted(list(lines['lines'].values()),
key=lambda x: x['order'])
objects[k1]['methods'][k2]['lines'] = sorted_lines

View File

@ -375,11 +375,11 @@ class ResultsReportVersionDetail(ModelSQL, ModelView):
'multiple_reports': 'Please, select only one report to print',
'annulled_report': 'This report is annulled',
'empty_report': 'The report has not lines to print',
'replace_number': u'Supplants the Results Report N° %s',
'replace_number': 'Supplants the Results Report N° %s',
'quantification_limit': '< LoQ = %s',
'detection_limit': '(LoD = %s %s)',
'detection_limit_2': '(LoD = %s)',
'uncertainty': u'(U± %s %s)',
'uncertainty': '(U± %s %s)',
'obs_uncert': 'U = Uncertainty.',
'neg': 'Negative',
'pos': 'Positive',
@ -393,7 +393,7 @@ class ResultsReportVersionDetail(ModelSQL, ModelView):
'analysis covered by the Accreditation is available.'),
'concentration_label_1': ('(Expressed at the concentration of '
'the received sample)'),
'concentration_label_2': u'(Expressed at %s° Brix)',
'concentration_label_2': '(Expressed at %s° Brix)',
'concentration_label_3': '(Expressed at %s)',
'final_unit_label_1': 'Expressed at %s %% Alcohol',
'final_unit_label_2': 'Expressed at %s',
@ -1442,7 +1442,7 @@ class GenerateResultsReport(Wizard):
excluded_notebooks = self._get_excluded_notebooks()
if excluded_notebooks:
notebooks = {}
for (n_id, grouper), a_ids in excluded_notebooks.iteritems():
for (n_id, grouper), a_ids in excluded_notebooks.items():
clause = [
('notebook.id', '=', n_id),
('analysis_detail.report_grouper', '=', grouper),
@ -1459,13 +1459,13 @@ class GenerateResultsReport(Wizard):
'session_id': self._session_id,
'notebook': k,
'lines': [('add', v)],
} for k, v in notebooks.iteritems()]
} for k, v in notebooks.items()]
self.result_aut.excluded_notebooks = (
GenerateResultsReportResultAutExcludedNotebook.create(
to_create))
notebook_lines = self._get_notebook_lines('aut',
excluded_notebooks.keys())
list(excluded_notebooks.keys()))
if notebook_lines:
notebooks = {}
for line in notebook_lines:
@ -1474,7 +1474,7 @@ class GenerateResultsReport(Wizard):
notebooks[line.notebook.id].append(line.id)
to_create = []
for k, v in notebooks.iteritems():
for k, v in notebooks.items():
to_create.append({
'session_id': self._session_id,
'notebook': k,
@ -1571,7 +1571,7 @@ class GenerateResultsReport(Wizard):
})
reports_details = []
for notebook in notebooks.itervalues():
for notebook in notebooks.values():
if not notebook['divided_report']:
details = {
'notebook_lines': [('create', notebook['notebook_lines'])],
@ -1602,7 +1602,7 @@ class GenerateResultsReport(Wizard):
grouped_reports[report_grouper] = []
grouped_reports[report_grouper].append(line)
for grouper, notebook_lines in grouped_reports.iteritems():
for grouper, notebook_lines in grouped_reports.items():
details = {
'notebook_lines': [('create', notebook_lines)],
'signer': self.start.laboratory.default_signer.id,
@ -1680,7 +1680,7 @@ class GenerateResultsReport(Wizard):
if valid_detail[0].resultrange_origin:
details['resultrange_origin'] = (
valid_detail[0].resultrange_origin.id)
details['comments'] = unicode(
details['comments'] = str(
valid_detail[0].comments or '')
detail, = ResultsReportVersionDetail.create([
details])
@ -1733,7 +1733,7 @@ class GenerateResultsReport(Wizard):
if valid_detail[0].resultrange_origin:
details['resultrange_origin'] = (
valid_detail[0].resultrange_origin.id)
details['comments'] = unicode(
details['comments'] = str(
valid_detail[0].comments or '')
detail, = ResultsReportVersionDetail.create([
details])
@ -1766,7 +1766,7 @@ class GenerateResultsReport(Wizard):
})
reports_details = []
for party in parties.itervalues():
for party in parties.values():
grouped_reports = {}
for line in party['notebook_lines']:
nline = NotebookLine(line['notebook_line'])
@ -1775,7 +1775,7 @@ class GenerateResultsReport(Wizard):
grouped_reports[report_grouper] = []
grouped_reports[report_grouper].append(line)
for grouper, notebook_lines in grouped_reports.iteritems():
for grouper, notebook_lines in grouped_reports.items():
details = {
'notebook_lines': [('create', notebook_lines)],
'report_type_forced': report_type_forced,
@ -1816,7 +1816,7 @@ class GenerateResultsReport(Wizard):
})
reports_details = []
for notebook in notebooks.itervalues():
for notebook in notebooks.values():
if not notebook['divided_report']:
details = {
'notebook_lines': [('create',
@ -1851,7 +1851,7 @@ class GenerateResultsReport(Wizard):
grouped_reports[report_grouper].append(line)
for grouper, notebook_lines in \
grouped_reports.iteritems():
grouped_reports.items():
details = {
'notebook_lines': [('create', notebook_lines)],
'report_type_forced': report_type_forced,
@ -1935,7 +1935,7 @@ class GenerateResultsReport(Wizard):
if valid_detail[0].resultrange_origin:
details['resultrange_origin'] = (
valid_detail[0].resultrange_origin.id)
details['comments'] = unicode(
details['comments'] = str(
valid_detail[0].comments or '')
detail, = ResultsReportVersionDetail.create([details])
reports_details = [detail.id]
@ -2443,7 +2443,7 @@ class ResultReport(Report):
language=lang_code)
record['reference'] = ''
if obs_result_range:
record['reference'] = unicode(cls.get_reference(range_type,
record['reference'] = str(cls.get_reference(range_type,
t_line, lang_code, report_context['report_section']))
if (t_line.rm_correction_formula and (record['result'] or
(record['converted_result'] and
@ -2571,11 +2571,11 @@ class ResultReport(Report):
reference_sample.matrix.code in ('SUELO', 'LODO')):
dry_matter = True
sorted_fractions = sorted(fractions.values(),
sorted_fractions = sorted(list(fractions.values()),
key=lambda x: x['fraction'])
with Transaction().set_context(language=lang_code):
for fraction in sorted_fractions:
for conc, lines in fraction['concentrations'].iteritems():
for conc, lines in fraction['concentrations'].items():
if report_context['report_section'] == 'rp':
sorted_lines = sorted(lines, key=lambda x: (
x['rp_order'], x['analysis']))
@ -2650,12 +2650,12 @@ class ResultReport(Report):
report_context['fractions'] = sorted_fractions
report_context['methods'] = []
for method in methods.itervalues():
for method in methods.values():
concat_lines = ', '.join(list(set(method['analysis'])))
method['analysis'] = concat_lines
report_context['methods'].append(method)
report_context['pnt_methods'] = [m for m in pnt_methods.itervalues()]
report_context['pnt_methods'] = [m for m in pnt_methods.values()]
report_context['enac'] = 'True' if enac else 'False'
if enac:
@ -2674,12 +2674,12 @@ class ResultReport(Report):
report_context['initial_unit'] = initial_unit
report_context['comments'] = ''
for entry_comment in comments.itervalues():
for entry_comment in comments.values():
if entry_comment['report_comments']:
if report_context['comments']:
report_context['comments'] += '\n'
report_context['comments'] += entry_comment['report_comments']
for sample_comment in entry_comment['samples'].itervalues():
for sample_comment in entry_comment['samples'].values():
if sample_comment:
if report_context['comments']:
report_context['comments'] += '\n'

View File

@ -677,8 +677,8 @@ class Service(ModelSQL, ModelView):
if aditional_services:
services_default = []
for fraction_id, analysis in aditional_services.iteritems():
for analysis_id, service_data in analysis.iteritems():
for fraction_id, analysis in aditional_services.items():
for analysis_id, service_data in analysis.items():
if not Service.search([
('fraction', '=', fraction_id),
('analysis', '=', analysis_id),
@ -779,7 +779,7 @@ class Service(ModelSQL, ModelView):
comments[fraction_id] += service.analysis.comments
if comments:
fractions_to_save = []
for fraction_id, comment in comments.iteritems():
for fraction_id, comment in comments.items():
fraction = Fraction(fraction_id)
if fraction.comments:
fraction.comments += '\n' + comment
@ -4873,7 +4873,7 @@ class CountersampleStorageReport(Report):
if fraction.comments else ''),
})
ordered_objects = sorted(objects.values(),
ordered_objects = sorted(list(objects.values()),
key=lambda x: x['location'])
report_context['objects'] = ordered_objects
@ -5031,7 +5031,7 @@ class CountersampleDischargeReport(Report):
if fraction.comments else ''),
})
ordered_objects = sorted(objects.values(),
ordered_objects = sorted(list(objects.values()),
key=lambda x: x['location'])
report_context['objects'] = ordered_objects

View File

@ -11,9 +11,8 @@ from trytond.transaction import Transaction
__all__ = ['Location', 'Move', 'ShipmentInternal']
class Location:
class Location(metaclass=PoolMeta):
__name__ = 'stock.location'
__metaclass__ = PoolMeta
storage_time = fields.Integer('Storage time (in months)')
@ -29,9 +28,8 @@ class Location:
return [(cls._rec_name,) + tuple(clause[1:])]
class Move:
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
__metaclass__ = PoolMeta
fraction = fields.Many2One('lims.fraction', 'Fraction', select=True,
ondelete='CASCADE', states={
@ -78,9 +76,8 @@ class Move:
return super(Move, cls).copy(moves, default=default)
class ShipmentInternal:
class ShipmentInternal(metaclass=PoolMeta):
__name__ = 'stock.shipment.internal'
__metaclass__ = PoolMeta
@classmethod
def copy(cls, shipments, default=None):

View File

@ -89,7 +89,7 @@ Create Samples::
>>> create_sample.form.zone = zone
>>> create_sample.form.fraction_type = fraction_type
>>> create_sample.form.storage_location = storage_location
>>> create_sample.form.labels = u'LBL-001\nLBL-002\nLBL-003'
>>> create_sample.form.labels = 'LBL-001\nLBL-002\nLBL-003'
>>> service = create_sample.form.services.new()
>>> service.analysis = analysis
@ -140,3 +140,4 @@ Plan the analysis::
>>> technicians_qualification = Wizard(
... 'lims.planification.technicians_qualification', [planification])
>>> _ = planification.click('confirm')

View File

@ -10,9 +10,8 @@ __all__ = ['Uom', 'UomCategory', 'UomConversion', 'Template',
'ConcentrationLevel', 'VolumeConversion']
class Uom:
class Uom(metaclass=PoolMeta):
__name__ = 'product.uom'
__metaclass__ = PoolMeta
maximum_concentration = fields.Char('Maximum concentration')
rsd_horwitz = fields.Char('% RSD Horwitz')
@ -31,9 +30,8 @@ class Uom:
return self.symbol
class UomCategory:
class UomCategory(metaclass=PoolMeta):
__name__ = 'product.uom.category'
__metaclass__ = PoolMeta
lims_only_available = fields.Boolean('Only available in Lims')
@ -67,9 +65,8 @@ class UomConversion(ModelSQL, ModelView):
return None
class Template:
class Template(metaclass=PoolMeta):
__name__ = "product.template"
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -9,9 +9,8 @@ from trytond.pool import PoolMeta
__all__ = ['Configuration']
class Configuration:
class Configuration(metaclass=PoolMeta):
__name__ = 'lims.configuration'
__metaclass__ = PoolMeta
mail_send_invoice_subject = fields.Char('Email subject of Invoice report',
help="In the text will be added suffix with the invoice report number")

View File

@ -24,9 +24,8 @@ __all__ = ['Invoice', 'InvoiceContact', 'InvoiceLine', 'CreditInvoice',
logger = logging.getLogger('lims_account_invoice')
class Invoice:
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
__metaclass__ = PoolMeta
no_send_invoice = fields.Boolean('No send invoice',
states={'invisible': Eval('type') == 'in'},
@ -155,9 +154,9 @@ class Invoice:
], limit=1)
with Transaction().set_context(language=lang.code):
subject = unicode('%s %s' % (config.mail_send_invoice_subject,
subject = str('%s %s' % (config.mail_send_invoice_subject,
self.number)).strip()
body = unicode(config.mail_send_invoice_body)
body = str(config.mail_send_invoice_body)
return subject, body
@ -170,9 +169,9 @@ class Invoice:
self.invoice_report_format == 'pdf' and 'pdf' or
'vnd.oasis.opendocument.text',
'filename':
unicode(self.number) + '.' +
str(self.number) + '.' +
str(self.invoice_report_format),
'name': unicode(self.number),
'name': str(self.number),
})
if self.invoice_service_report_cache:
data.append({
@ -182,9 +181,9 @@ class Invoice:
self.invoice_service_report_format == 'pdf' and 'pdf' or
'vnd.oasis.opendocument.text',
'filename':
unicode(self.number) + ' (II).' +
str(self.number) + ' (II).' +
str(self.invoice_report_format),
'name': unicode(self.number) + ' (II)',
'name': str(self.number) + ' (II)',
})
return data
@ -242,9 +241,8 @@ class InvoiceContact(ModelSQL, ModelView):
return credit
class InvoiceLine:
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
__metaclass__ = PoolMeta
lims_service_party = fields.Function(fields.Many2One('party.party',
'Party', depends=['invoice_type'],
@ -361,9 +359,8 @@ class InvoiceLine:
return models
class CreditInvoice:
class CreditInvoice(metaclass=PoolMeta):
__name__ = 'account.invoice.credit'
__metaclass__ = PoolMeta
def do_credit(self, action):
pool = Pool()

View File

@ -11,9 +11,8 @@ from trytond.transaction import Transaction
__all__ = ['FractionType', 'Entry', 'Fraction', 'Service', 'ManageServices']
class FractionType:
class FractionType(metaclass=PoolMeta):
__name__ = 'lims.fraction.type'
__metaclass__ = PoolMeta
invoiceable = fields.Boolean('Invoiceable')
@ -22,9 +21,8 @@ class FractionType:
return True
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
@classmethod
def on_hold(cls, entries):
@ -43,9 +41,8 @@ class Entry:
service.create_invoice_line('out')
class Fraction:
class Fraction(metaclass=PoolMeta):
__name__ = 'lims.fraction'
__metaclass__ = PoolMeta
@classmethod
def confirm(cls, fractions):
@ -67,9 +64,8 @@ class Fraction:
service.create_invoice_line('out')
class Service:
class Service(metaclass=PoolMeta):
__name__ = 'lims.service'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):
@ -177,9 +173,8 @@ class Service:
InvoiceLine.delete(lines_to_delete)
class ManageServices:
class ManageServices(metaclass=PoolMeta):
__name__ = 'lims.manage_services'
__metaclass__ = PoolMeta
def create_service(self, service, fraction):
new_service = super(ManageServices, self).create_service(service,

View File

@ -9,9 +9,8 @@ from trytond.pool import PoolMeta
__all__ = ['Party', 'Address']
class Party:
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
__metaclass__ = PoolMeta
no_send_invoice = fields.Boolean('No send invoice',
help='If checked, customer invoices will not be set by default '
@ -24,9 +23,8 @@ class Party:
return False
class Address:
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
__metaclass__ = PoolMeta
@classmethod
def validate(cls, addresses):

View File

@ -9,9 +9,8 @@ from trytond.pool import Pool, PoolMeta
__all__ = ['InventoryLine']
class InventoryLine:
class InventoryLine(metaclass=PoolMeta):
__name__ = 'stock.inventory.line'
__metaclass__ = PoolMeta
account_move = fields.Function(fields.Many2One('account.move',
'Account Move'), 'get_account_move')

View File

@ -10,9 +10,8 @@ from trytond.pool import PoolMeta
__all__ = ['Location']
class Location:
class Location(metaclass=PoolMeta):
__name__ = 'stock.location'
__metaclass__ = PoolMeta
cost_center = fields.Many2One('analytic_account.account', 'Cost center',
domain=[('type', '=', 'normal')],

View File

@ -10,9 +10,8 @@ from trytond.transaction import Transaction
__all__ = ['Move']
class Move:
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
__metaclass__ = PoolMeta
def _get_account_stock_move_lines(self, type_):
move_line, = super(Move, self)._get_account_stock_move_lines(type_)

View File

@ -9,9 +9,8 @@ from trytond.pool import PoolMeta
__all__ = ['Configuration']
class Configuration:
class Configuration(metaclass=PoolMeta):
__name__ = 'lims.configuration'
__metaclass__ = PoolMeta
mail_ack_report_subject = fields.Char('Email subject of Acknowledgment of'
' results report',

View File

@ -22,9 +22,8 @@ __all__ = ['ResultsReportVersionDetail', 'ResultsReport',
'ResultsReportAnnulation']
class ResultsReportVersionDetail:
class ResultsReportVersionDetail(metaclass=PoolMeta):
__name__ = 'lims.results_report.version.detail'
__metaclass__ = PoolMeta
def unsign(self):
'''
@ -54,9 +53,8 @@ class ResultsReportVersionDetail:
detail.unsign()
class ResultsReport:
class ResultsReport(metaclass=PoolMeta):
__name__ = 'lims.results_report'
__metaclass__ = PoolMeta
signed = fields.Boolean('Signed', readonly=True)
signed_date = fields.DateTime('Signed date', readonly=True)
@ -193,7 +191,7 @@ class ResultsReport:
try:
token = GetToken(listen, origin, target)
token.signDoc()
except Exception, msg:
except Exception as msg:
logging.getLogger('lims_digital_sign').error(
'Unable to digitally sign for results report %s'
% (self.number))
@ -267,10 +265,10 @@ class ResultsReport:
else:
label = self.raise_user_error('polisample',
raise_exception=False)
subject = unicode('%s %s (%s)' % (
subject = str('%s %s (%s)' % (
config.mail_ack_report_subject,
self.number, label)).strip()
body = unicode(config.mail_ack_report_body)
body = str(config.mail_ack_report_body)
body = body.replace('<SAMPLES>', '\n'.join(sample_list))
return subject, body
@ -303,8 +301,8 @@ class ResultsReport:
self.report_format_eng or
self.report_format),
'mimetype': 'pdf',
'filename': unicode(self.number) + '-' + suffix + '.pdf',
'name': unicode(self.number),
'filename': str(self.number) + '-' + suffix + '.pdf',
'name': str(self.number),
}
return data
@ -392,9 +390,8 @@ class ResultsReport:
return True
class ResultsReportAnnulation:
class ResultsReportAnnulation(metaclass=PoolMeta):
__name__ = 'lims.results_report_annulation'
__metaclass__ = PoolMeta
def transition_annul(self):
logging.getLogger('lims_digital_sign').info(

View File

@ -3,7 +3,7 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
import json
import xmlrpclib
import xmlrpc.client
class EchoClient():
@ -16,7 +16,7 @@ class EchoClient():
def _get_server(self, listen):
host, port = listen.split(':')
return xmlrpclib.Server('http://%s:%s/' % (host, port))
return xmlrpc.client.Server('http://%s:%s/' % (host, port))
def signDoc(self):
data = json.dumps({

View File

@ -3,9 +3,9 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
try:
import cStringIO as StringIO
import io as StringIO
except ImportError:
import StringIO
import io
import traceback
import xlrd
from xlutils.copy import copy
@ -23,9 +23,8 @@ __all__ = ['NotebookLine', 'ResultsImport', 'NotebookLoadResultsFileStart',
'NotebookLoadResultsFileExport', 'NotebookLoadResultsFile']
class NotebookLine:
class NotebookLine(metaclass=PoolMeta):
__name__ = 'lims.notebook.line'
__metaclass__ = PoolMeta
imported_result = fields.Char('Result')
imported_literal_result = fields.Char('Literal result')
@ -347,7 +346,7 @@ class NotebookLoadResultsFile(Wizard):
if not notebook:
continue
for analysis in raw_results[f[1]].keys():
for analysis in list(raw_results[f[1]].keys()):
cursor.execute('SELECT id '
'FROM "' + Analysis._table + '" '
'WHERE code = %s '
@ -356,7 +355,7 @@ class NotebookLoadResultsFile(Wizard):
if not cursor.fetchone():
continue
for rep in raw_results[f[1]][analysis].keys():
for rep in list(raw_results[f[1]][analysis].keys()):
clause = [
('notebook', '=', notebook[0]),
('analysis', '=', analysis),
@ -389,7 +388,7 @@ class NotebookLoadResultsFile(Wizard):
res = {}
if 'result' in data or 'literal_result' in data:
if 'result' in data:
res['imported_result'] = unicode(float(data['result']))
res['imported_result'] = str(float(data['result']))
if 'literal_result' in data:
res['imported_literal_result'] = data['literal_result']
res['imported_end_date'] = (data['end_date'] if 'end_date' in data
@ -545,7 +544,7 @@ class NotebookLoadResultsFile(Wizard):
else:
prevent_line = True
outcome = self.raise_user_error('professionals',
(unicode(line.imported_professionals),),
(str(line.imported_professionals),),
raise_exception=False)
if prevent_line:
@ -623,7 +622,7 @@ class NotebookLoadResultsFile(Wizard):
def default_export(self, fields):
rawresults = self.start.results_importer.rawresults
filedata = StringIO.StringIO(self.start.infile) # TODO: refactoring
filedata = io.StringIO(self.start.infile) # TODO: refactoring
workbook = xlrd.open_workbook(file_contents=filedata.getvalue(),
formatting_info=True)
wb_copy = copy(workbook)
@ -635,6 +634,6 @@ class NotebookLoadResultsFile(Wizard):
sheet, row, col = repetition['status_cell']
wb_sheet = wb_copy.get_sheet(sheet)
wb_sheet.write(row, col, repetition['outcome'])
output = StringIO.StringIO()
output = io.StringIO()
wb_copy.save(output)
return {'file': bytearray(output.getvalue())}

View File

@ -2,7 +2,7 @@
# This file is part of lims_instrument_custom_set module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
import StringIO
import io
import csv
from trytond.transaction import Transaction
@ -10,13 +10,13 @@ from trytond.transaction import Transaction
def getControllerName():
if Transaction().language in ('es', 'es_419'):
return u'Planilla personalizada - CSV'
return 'Planilla personalizada - CSV'
else:
return u'Custom Set - CSV'
return 'Custom Set - CSV'
def parse(self, infile):
filedata = StringIO.StringIO(infile)
filedata = io.StringIO(infile)
reader = csv.reader(filedata)
for line in reader:
print(unicode(', '.join(line), 'utf-8'))
print((str(', '.join(line), 'utf-8')))

View File

@ -2,7 +2,7 @@
# This file is part of lims_instrument_custom_set module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
import StringIO
import io
import xlrd
from trytond.pool import Pool
@ -17,15 +17,15 @@ FORMULA = 'Formula'
def getControllerName():
if Transaction().language in ('es', 'es_419'):
return u'Planilla personalizada - XLS'
return 'Planilla personalizada - XLS'
else:
return u'Custom Set - XLS'
return 'Custom Set - XLS'
def parse(self, infile):
LabWorkYear = Pool().get('lims.lab.workyear')
filedata = StringIO.StringIO(infile)
filedata = io.StringIO(infile)
workbook = xlrd.open_workbook(file_contents=filedata.getvalue())
worksheets = workbook.sheet_names()
for worksheet_name in worksheets:

View File

@ -4,15 +4,14 @@
# the full copyright notices and license terms.
from trytond.pool import PoolMeta
import custom_set_csv
import custom_set_xls
from . import custom_set_csv
from . import custom_set_xls
__all__ = ['ResultsImport']
class ResultsImport:
class ResultsImport(metaclass=PoolMeta):
__name__ = 'lims.resultsimport'
__metaclass__ = PoolMeta
analysis_code = None
formula = None

View File

@ -4,14 +4,13 @@
# the full copyright notices and license terms.
from trytond.pool import PoolMeta
import generic_form_xls
from . import generic_form_xls
__all__ = ['ResultsImport']
class ResultsImport:
class ResultsImport(metaclass=PoolMeta):
__name__ = 'lims.resultsimport'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -4,14 +4,13 @@
# the full copyright notices and license terms.
from trytond.pool import PoolMeta
import generic_service_xls
from . import generic_service_xls
__all__ = ['ResultsImport']
class ResultsImport:
class ResultsImport(metaclass=PoolMeta):
__name__ = 'lims.resultsimport'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -12,9 +12,8 @@ __all__ = ['ProductionConfiguration', 'ProductionConfigurationLotSequence',
'Configuration', 'ConfigurationSolvents']
class ProductionConfiguration:
class ProductionConfiguration(metaclass=PoolMeta):
__name__ = 'production.configuration'
__metaclass__ = PoolMeta
lot_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence', 'Lot Sequence', required=True,
@ -57,9 +56,8 @@ class ProductionConfigurationLotSequence(ModelSQL, CompanyValueMixin):
return None
class Configuration:
class Configuration(metaclass=PoolMeta):
__name__ = 'lims.configuration'
__metaclass__ = PoolMeta
solvents = fields.Many2Many('lims.configuration.solvents',
'configuration', 'category', 'Solvents')

View File

@ -13,16 +13,14 @@ from trytond.report import Report
__all__ = ['BOM', 'Production', 'FamilyEquivalentReport']
class BOM:
class BOM(metaclass=PoolMeta):
__name__ = 'production.bom'
__metaclass__ = PoolMeta
divide_lots = fields.Boolean('Divide lots')
class Production:
class Production(metaclass=PoolMeta):
__name__ = 'production'
__metaclass__ = PoolMeta
concentration = fields.Char('Concentration',
depends=['salable_product', 'state'], states={

View File

@ -78,9 +78,8 @@ class FamilyEquivalent(ModelSQL, ModelView):
default=current_default)
class Template:
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
__metaclass__ = PoolMeta
common_name = fields.Char('Common name')
chemical_name = fields.Char('Chemical name')
@ -106,14 +105,13 @@ class Template:
[('barcode',) + tuple(clause[1:])],
], order=[])
if products:
return [('id', 'in', map(int, [product.template.id
for product in products]))]
return [('id', 'in', list(map(int, [product.template.id
for product in products])))]
return super(Template, cls).search_rec_name(name, clause)
class Product:
class Product(metaclass=PoolMeta):
__name__ = 'product.product'
__metaclass__ = PoolMeta
catalog = fields.Char('Catalog', depends=['active'],
states={'readonly': ~Eval('active', True)})
@ -175,7 +173,7 @@ class Product:
return
to_write = []
for cost, records in costs.iteritems():
for cost, records in costs.items():
to_write.append(records)
to_write.append({'cost_price': cost})
@ -267,9 +265,8 @@ class LotCategory(ModelSQL, ModelView):
cls._order.insert(0, ('name', 'ASC'))
class Lot:
class Lot(metaclass=PoolMeta):
__name__ = 'stock.lot'
__metaclass__ = PoolMeta
category = fields.Many2One('stock.lot.category', 'Category')
special_category = fields.Function(fields.Char('Category'),
@ -444,9 +441,8 @@ class Lot:
return [('product.' + name,) + tuple(clause[1:])]
class Move:
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
__metaclass__ = PoolMeta
label_quantity = fields.Float("Label Quantity",
digits=(16, Eval('unit_digits', 2)), depends=['unit_digits'])
@ -518,9 +514,8 @@ class Move:
write({'cost_price': new_cost_price})
class ShipmentIn:
class ShipmentIn(metaclass=PoolMeta):
__name__ = 'stock.shipment.in'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -61,9 +61,8 @@ class Project(ModelSQL, ModelView):
return [(cls._rec_name,) + tuple(clause[1:])]
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
project = fields.Many2One('lims.project', 'Project',
domain=[('client', '=', Eval('party'))], depends=['party'])
@ -88,9 +87,8 @@ class Entry:
return res
class Sample:
class Sample(metaclass=PoolMeta):
__name__ = 'lims.sample'
__metaclass__ = PoolMeta
project_type = fields.Function(fields.Selection([], 'Type'),
'on_change_with_project_type')
@ -110,16 +108,14 @@ class Sample:
return res
class CreateSampleStart:
class CreateSampleStart(metaclass=PoolMeta):
__name__ = 'lims.create_sample.start'
__metaclass__ = PoolMeta
project_type = fields.Char('Type')
class CreateSample:
class CreateSample(metaclass=PoolMeta):
__name__ = 'lims.create_sample'
__metaclass__ = PoolMeta
def default_start(self, fields):
Entry = Pool().get('lims.entry')

View File

@ -16,9 +16,8 @@ DEPENDS = ['type']
PROJECT_TYPE = ('itl', 'Interlaboratory')
class Project:
class Project(metaclass=PoolMeta):
__name__ = 'lims.project'
__metaclass__ = PoolMeta
int_itl_party = fields.Many2One('party.party', 'ITL Party',
states=STATES, depends=DEPENDS)
@ -45,9 +44,8 @@ class Project:
})]
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -11,9 +11,8 @@ __all__ = ['Configuration', 'ConfigurationSequence', 'LabWorkYear',
'LabWorkYearSequence']
class Configuration:
class Configuration(metaclass=PoolMeta):
__name__ = 'lims.configuration'
__metaclass__ = PoolMeta
sample_in_custody_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence', 'Sample in Custody Sequence', required=True,
@ -36,9 +35,8 @@ class Configuration:
'sample_in_custody_sequence').default_sample_in_custody_sequence()
class ConfigurationSequence:
class ConfigurationSequence(metaclass=PoolMeta):
__name__ = 'lims.configuration.sequence'
__metaclass__ = PoolMeta
sample_in_custody_sequence = fields.Many2One('ir.sequence',
'Sample in Custody Sequence', depends=['company'], domain=[
@ -57,9 +55,8 @@ class ConfigurationSequence:
return None
class LabWorkYear:
class LabWorkYear(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear'
__metaclass__ = PoolMeta
project_study_plan_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence.strict', 'Study plan Projects Sequence', required=True,
@ -77,9 +74,8 @@ class LabWorkYear:
return super(LabWorkYear, cls).multivalue_model(field)
class LabWorkYearSequence:
class LabWorkYearSequence(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear.sequence'
__metaclass__ = PoolMeta
project_study_plan_sequence = fields.Many2One('ir.sequence.strict',
'Study plan Projects Sequence', depends=['company'], domain=[

View File

@ -36,9 +36,8 @@ DEPENDS = ['stp_state']
PROJECT_TYPE = ('study_plan', 'Study plan')
class Project:
class Project(metaclass=PoolMeta):
__name__ = 'lims.project'
__metaclass__ = PoolMeta
stp_number = fields.Char('SP Id', readonly=True)
stp_title = fields.Function(fields.Char('Title'),
@ -298,7 +297,7 @@ class Project:
if line.device.id not in devices:
devices[line.device.id] = line.device.rec_name
if devices:
stp_test_system = '\n'.join([d for d in devices.values()])
stp_test_system = '\n'.join([d for d in list(devices.values())])
self.stp_test_system = stp_test_system
@ModelView.button_change('stp_test_method')
@ -316,7 +315,7 @@ class Project:
if line.method.id not in methods:
methods[line.method.id] = line.method.rec_name
if methods:
stp_test_method = '\n'.join([m for m in methods.values()])
stp_test_method = '\n'.join([m for m in list(methods.values())])
self.stp_test_method = stp_test_method
@classmethod
@ -387,9 +386,8 @@ class Project:
return []
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):
@ -797,9 +795,8 @@ class ProjectChangeLog(ModelSQL):
return [('id', 'in', [x[0] for x in cursor.fetchall()])]
class Sample:
class Sample(metaclass=PoolMeta):
__name__ = 'lims.sample'
__metaclass__ = PoolMeta
application_date = fields.Date('Application date', states={
'invisible': Not(Bool(Equal(Eval('project_type'), 'study_plan'))),
@ -837,9 +834,8 @@ class Sample:
})]
class CreateSampleStart:
class CreateSampleStart(metaclass=PoolMeta):
__name__ = 'lims.create_sample.start'
__metaclass__ = PoolMeta
application_date = fields.Date('Application date', states={
'invisible': Not(Bool(Equal(Eval('project_type'), 'study_plan'))),
@ -877,9 +873,8 @@ class CreateSampleStart:
})]
class CreateSample:
class CreateSample(metaclass=PoolMeta):
__name__ = 'lims.create_sample'
__metaclass__ = PoolMeta
def _get_samples_defaults(self, entry_id):
samples_defaults = super(CreateSample,
@ -924,9 +919,8 @@ class CreateSample:
return samples_defaults
class Lot:
class Lot(metaclass=PoolMeta):
__name__ = 'stock.lot'
__metaclass__ = PoolMeta
formula = fields.Char('Formula', depends=['special_category'],
states={
@ -1019,7 +1013,7 @@ class ProjectGLPReport01(Report):
'packages': '%s %s' % (sample.packages_quantity or '',
sample.package_type.description if sample.package_type
else ''),
'comments': unicode(sample.comments or ''),
'comments': str(sample.comments or ''),
'entry_responsible': (sample.entry_responsible.rec_name
if sample.entry_responsible else ''),
'file_operator_responsible': (
@ -1090,7 +1084,7 @@ class ProjectGLPReport02(Report):
'entry_date': fraction.sample.date2,
'label': fraction.sample.label,
'sample_weight': fraction.sample.sample_weight,
'comments': unicode(fraction.comments or '')
'comments': str(fraction.comments or '')
})
report_context['objects'] = objects
@ -1183,7 +1177,7 @@ class ProjectGLPReport03(Report):
'countersample_location': (fraction.countersample_location.code
if fraction.countersample_location else ''),
'countersample_date': fraction.countersample_date or '',
'comments': unicode(fraction.comments or ''),
'comments': str(fraction.comments or ''),
})
report_context['objects'] = objects
@ -1345,7 +1339,7 @@ class ProjectGLPReport05(Report):
if fraction.countersample_location else ''),
'countersample_date': fraction.countersample_date or '',
'discharge_date': fraction.discharge_date or '',
'comments': unicode(fraction.comments or ''),
'comments': str(fraction.comments or ''),
})
report_context['objects'] = objects
@ -1397,8 +1391,8 @@ class ProjectGLPReport06(Report):
'type_number': '%s %s' % (dev_amnd.type_string,
dev_amnd.number),
'document_type': dev_amnd.document_type_string,
'reason': unicode(dev_amnd.reason or ''),
'description': unicode(dev_amnd.description or ''),
'reason': str(dev_amnd.reason or ''),
'description': str(dev_amnd.description or ''),
'professionals': [{
'name': p.professional.rec_name,
'date': p.date or '',
@ -1744,7 +1738,7 @@ class ProjectGLPReport10(Report):
'packages': '%s %s' % (s.packages_quantity or '',
s.package_type.description if s.package_type
else ''),
'comments': unicode(s.comments or ''),
'comments': str(s.comments or ''),
} for s in project.stp_samples_in_custody],
})
report_context['objects'] = objects
@ -1882,16 +1876,16 @@ class ProjectGLPReport12(Report):
'stp_state': project.stp_state_string,
'stp_proposal_start_date': project.stp_proposal_start_date,
'stp_proposal_end_date': project.stp_proposal_end_date,
'stp_rector_scheme_comments': unicode(
'stp_rector_scheme_comments': str(
project.stp_rector_scheme_comments or ''),
'stp_implementation_validation': (True if
project.stp_implementation_validation ==
'implementation_validation' else False),
'stp_pattern_availability': (
project.stp_pattern_availability),
'stp_target': unicode(project.stp_target or ''),
'stp_target': str(project.stp_target or ''),
'stp_description': project.stp_description,
'stp_test_method': unicode(project.stp_test_method or ''),
'stp_test_method': str(project.stp_test_method or ''),
'stp_study_director': (project.stp_study_director.rec_name
if project.stp_study_director else ''),
'stp_facility_director': (
@ -1941,7 +1935,7 @@ class ProjectGLPReportStudyPlan(Report):
report_context['stp_number'] = project.stp_number
report_context['code'] = project.code
report_context['stp_title'] = project.stp_title
report_context['stp_target'] = unicode(project.stp_target or '')
report_context['stp_target'] = str(project.stp_target or '')
report_context['stp_description'] = project.stp_description
report_context['stp_sponsor'] = project.stp_sponsor
report_context['stp_date'] = project.stp_date
@ -1951,9 +1945,9 @@ class ProjectGLPReportStudyPlan(Report):
report_context['stp_proposal_start_date'] = (
project.stp_proposal_start_date)
report_context['stp_proposal_end_date'] = project.stp_proposal_end_date
report_context['stp_test_method'] = unicode(project.stp_test_method
report_context['stp_test_method'] = str(project.stp_test_method
or '')
report_context['stp_test_system'] = unicode(project.stp_test_system
report_context['stp_test_system'] = str(project.stp_test_system
or '')
report_context['stp_study_director'] = None
report_context['stp_study_director_date'] = None
@ -2050,7 +2044,7 @@ class ProjectGLPReportFinalRP(Report):
report_context['stp_study_director'] = (
project.stp_study_director.party if project.stp_study_director
else None)
report_context['stp_target'] = unicode(project.stp_target or '')
report_context['stp_target'] = str(project.stp_target or '')
report_context['stp_description'] = project.stp_description
report_context['stp_test_elements'] = [e for e in
project.stp_reference_elements if e.type == 'test']
@ -2065,7 +2059,7 @@ class ProjectGLPReportFinalRP(Report):
cls.get_experimental_end_date(project.id))
report_context['stp_lims_sample_input'] = (
cls.get_lims_sample_input(project.id))
report_context['stp_test_method'] = unicode(project.stp_test_method
report_context['stp_test_method'] = str(project.stp_test_method
or '')
report_context['stp_solvents_and_reagents'] = (
project.stp_solvents_and_reagents)
@ -2291,7 +2285,7 @@ class ProjectGLPReportFinalFOR(Report):
product_type_matrix[key] = '%s-%s' % (
s.product_type.code, s.matrix.code)
report_context['product_type_matrix_list'] = ', '.join(
product_type_matrix.values())
list(product_type_matrix.values()))
report_context['stp_test_elements'] = [e for e in
project.stp_reference_elements if e.type == 'test']
report_context['stp_test_elements_list'] = ', '.join([
@ -2301,7 +2295,7 @@ class ProjectGLPReportFinalFOR(Report):
report_context['stp_study_director'] = (
project.stp_study_director.party if project.stp_study_director
else None)
report_context['stp_target'] = unicode(project.stp_target or '')
report_context['stp_target'] = str(project.stp_target or '')
report_context['stp_description'] = project.stp_description
report_context['stp_professionals'] = [pp.professional.party
for pp in project.stp_laboratory_professionals]
@ -2314,7 +2308,7 @@ class ProjectGLPReportFinalFOR(Report):
cls.get_lims_sample_input(project.id))
report_context['stp_all_professionals'] = (
cls.get_laboratory_professionals(project.id))
report_context['stp_test_method'] = unicode(project.stp_test_method
report_context['stp_test_method'] = str(project.stp_test_method
or '')
report_context['stp_reference_elements'] = [e for e in
project.stp_reference_elements if e.type == 'reference']
@ -2340,7 +2334,7 @@ class ProjectGLPReportFinalFOR(Report):
for detail in details:
if detail.analysis.id not in analysis:
analysis[detail.analysis.id] = detail.analysis.description
return ', '.join(analysis.values())
return ', '.join(list(analysis.values()))
@staticmethod
def get_experimental_start_date(project_id):
@ -2538,7 +2532,7 @@ class ProjectGLPReportAnalyticalPhase(Report):
report_context['stp_study_director'] = (
project.stp_study_director.party if project.stp_study_director
else None)
report_context['stp_target'] = unicode(project.stp_target or '')
report_context['stp_target'] = str(project.stp_target or '')
report_context['stp_description'] = project.stp_description
report_context['stp_test_elements'] = [e for e in
project.stp_reference_elements if e.type == 'test']
@ -2553,7 +2547,7 @@ class ProjectGLPReportAnalyticalPhase(Report):
cls.get_lims_sample_input(project.id))
report_context['stp_all_professionals'] = (
cls.get_laboratory_professionals(project.id))
report_context['stp_test_method'] = unicode(project.stp_test_method
report_context['stp_test_method'] = str(project.stp_test_method
or '')
report_context['stp_solvents_and_reagents'] = (
project.stp_solvents_and_reagents)

View File

@ -10,9 +10,8 @@ from trytond.pyson import Eval
__all__ = ['LabWorkYear', 'LabWorkYearSequence']
class LabWorkYear:
class LabWorkYear(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear'
__metaclass__ = PoolMeta
project_tas_sequence = fields.MultiValue(fields.Many2One(
'ir.sequence.strict', 'TAS Projects Sequence', required=True,
@ -30,9 +29,8 @@ class LabWorkYear:
return super(LabWorkYear, cls).multivalue_model(field)
class LabWorkYearSequence:
class LabWorkYearSequence(metaclass=PoolMeta):
__name__ = 'lims.lab.workyear.sequence'
__metaclass__ = PoolMeta
project_tas_sequence = fields.Many2One('ir.sequence.strict',
'TAS Projects Sequence', depends=['company'], domain=[

View File

@ -10,9 +10,8 @@ from trytond.pyson import Eval
__all__ = ['Invoice']
class Invoice:
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
__metaclass__ = PoolMeta
lims_project = fields.Many2One('lims.project', 'TAS Project',
domain=[('type', '=', 'tas')],

View File

@ -16,9 +16,8 @@ DEPENDS = ['type']
PROJECT_TYPE = ('tas', 'TAS')
class Project:
class Project(metaclass=PoolMeta):
__name__ = 'lims.project'
__metaclass__ = PoolMeta
tas_invoice_party = fields.Many2One('party.party', 'Invoice party',
domain=[('id', 'in', Eval('tas_invoice_party_domain'))],
@ -126,9 +125,8 @@ class Project:
return super(Project, cls).create(vlist)
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):

View File

@ -18,9 +18,8 @@ DEPENDS = ['type']
PROJECT_TYPE = ('water', 'Water sampling')
class Project:
class Project(metaclass=PoolMeta):
__name__ = 'lims.project'
__metaclass__ = PoolMeta
wtr_comments = fields.Text('Climatic conditions of the sampling')
@ -43,9 +42,8 @@ class Project:
})]
class Entry:
class Entry(metaclass=PoolMeta):
__name__ = 'lims.entry'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):
@ -55,9 +53,8 @@ class Entry:
cls.project_type.selection.append(project_type)
class Sample:
class Sample(metaclass=PoolMeta):
__name__ = 'lims.sample'
__metaclass__ = PoolMeta
sampling_point = fields.Char('Sampling point', states={
'invisible': Not(Bool(Equal(Eval('project_type'), 'water'))),
@ -82,9 +79,8 @@ class Sample:
})]
class CreateSampleStart:
class CreateSampleStart(metaclass=PoolMeta):
__name__ = 'lims.create_sample.start'
__metaclass__ = PoolMeta
sampling_point = fields.Char('Sampling point', states={
'invisible': Not(Bool(Equal(Eval('project_type'), 'water'))),
@ -109,9 +105,8 @@ class CreateSampleStart:
})]
class CreateSample:
class CreateSample(metaclass=PoolMeta):
__name__ = 'lims.create_sample'
__metaclass__ = PoolMeta
def _get_samples_defaults(self, entry_id):
samples_defaults = super(CreateSample,
@ -207,7 +202,7 @@ class ProjectWaterSampling(Report):
if fraction.countersample_location else ''),
'countersample_date': fraction.countersample_date or '',
'discharge_date': fraction.discharge_date or '',
'sample_comments': unicode(fraction.sample.comments or ''),
'sample_comments': str(fraction.sample.comments or ''),
'label': fraction.sample.label,
'results': (cls.get_results_insitu(fraction.id)),
})

View File

@ -12,9 +12,8 @@ from trytond.transaction import Transaction
__all__ = ['Sale', 'SaleLoadServicesStart', 'SaleLoadServices']
class Sale:
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):
@ -85,7 +84,7 @@ class SaleLoadServices(Wizard):
sale_services[service.analysis.id]['quantity'] += 1
sale_lines = []
for service in sale_services.itervalues():
for service in sale_services.values():
sale_line = SaleLine(
quantity=service['quantity'],
unit=service['unit'],

View File

@ -125,8 +125,4 @@ setup(name='kalenis_lims',
test_suite='setup.kalenis_test_suite',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
convert_2to3_doctests=[
'lims/tests/scenario_lims.rst',
],
)