Use integer without grouping for year reporting
issue10731 review355501002
This commit is contained in:
1 parent
8db518f263
commit
c762768ebe
3 files changed
+6
-10
No files matched your search
+4
-8
@@ -692,7 +692,7 @@ class SaleOpportunityEmployeeContext(ModelView):
|
||||
class SaleOpportunityMonthly(SaleOpportunityReportMixin, ModelSQL, ModelView):
|
||||
'Sale Opportunity per Month'
|
||||
__name__ = 'sale.opportunity_monthly'
|
||||
year = fields.Char('Year')
|
||||
year = fields.Integer("Year")
|
||||
month = fields.Many2One('ir.calendar.month', "Month")
|
||||
year_month = fields.Function(fields.Char('Year-Month'),
|
||||
'get_year_month')
|
||||
@@ -714,9 +714,7 @@ class SaleOpportunityMonthly(SaleOpportunityReportMixin, ModelSQL, ModelView):
|
||||
query = super(SaleOpportunityMonthly, cls).table_query()
|
||||
opportunity, = query.from_
|
||||
type_id = cls.id.sql_type().base
|
||||
type_year = cls.year.sql_type().base
|
||||
year_column = Extract('YEAR', opportunity.start_date
|
||||
).cast(type_year).as_('year')
|
||||
year_column = Extract('YEAR', opportunity.start_date).as_('year')
|
||||
month_index = Extract('MONTH', opportunity.start_date)
|
||||
query.from_ = opportunity.join(
|
||||
month, condition=month_index == month.index)
|
||||
@@ -734,7 +732,7 @@ class SaleOpportunityEmployeeMonthly(
|
||||
SaleOpportunityReportMixin, ModelSQL, ModelView):
|
||||
'Sale Opportunity per Employee per Month'
|
||||
__name__ = 'sale.opportunity_employee_monthly'
|
||||
year = fields.Char('Year')
|
||||
year = fields.Integer("Year")
|
||||
month = fields.Many2One('ir.calendar.month', "Month")
|
||||
employee = fields.Many2One('company.employee', 'Employee')
|
||||
|
||||
@@ -753,9 +751,7 @@ class SaleOpportunityEmployeeMonthly(
|
||||
query = super(SaleOpportunityEmployeeMonthly, cls).table_query()
|
||||
opportunity, = query.from_
|
||||
type_id = cls.id.sql_type().base
|
||||
type_year = cls.year.sql_type().base
|
||||
year_column = Extract('YEAR', opportunity.start_date
|
||||
).cast(type_year).as_('year')
|
||||
year_column = Extract('YEAR', opportunity.start_date).as_('year')
|
||||
month_index = Extract('MONTH', opportunity.start_date)
|
||||
query.from_ = opportunity.join(
|
||||
month, condition=month_index == month.index)
|
||||
|
||||
Reference in new issue
Block a user