lims: trend chart: allow to use sample number as X-axis

This commit is contained in:
Adrián Bernardi 2022-05-26 10:30:24 -03:00
parent d7808e7c43
commit 6234f020e8
2 changed files with 10 additions and 0 deletions

View File

@ -1437,6 +1437,7 @@ class TrendChart(ModelSQL, ModelView):
], 'Precedents Filter', sort=False, required=True)
x_axis = fields.Selection([
('date', 'Date'),
('number', 'Sample'),
], 'X Axis', sort=False, required=True)
x_axis_string = x_axis.translated('x_axis')
active = fields.Boolean('Active', help='Check to include in future use')
@ -1868,12 +1869,17 @@ class OpenTrendChart(Wizard):
if chart.x_axis == 'date':
clause.append(('date', '<=', notebook.date))
elif chart.x_axis == 'number':
clause.append(('fraction.sample.number', '<=',
notebook.fraction.sample.number))
return clause
def _get_order(self):
chart = self.start.chart
if chart.x_axis == 'date':
return [('date', 'DESC')]
elif chart.x_axis == 'number':
return [('fraction.sample.number', 'DESC')]
return []
def _get_reportable_analysis(self):

View File

@ -13341,6 +13341,10 @@ msgctxt "selection:lims.trend.chart,x_axis:"
msgid "Date"
msgstr "Fecha"
msgctxt "selection:lims.trend.chart,x_axis:"
msgid "Sample"
msgstr "Muestra"
msgctxt "selection:lims.typification,report_result_type:"
msgid "Both"
msgstr "Ambos"