diff --git a/date_range/models/date_range.py b/date_range/models/date_range.py index 9fbd47545..29da5b600 100644 --- a/date_range/models/date_range.py +++ b/date_range/models/date_range.py @@ -9,6 +9,7 @@ from odoo.exceptions import ValidationError class DateRange(models.Model): _name = "date.range" + _description = "Date Range" _order = "type_name,date_start" @api.model @@ -35,7 +36,7 @@ class DateRange(models.Model): ('date_range_uniq', 'unique (name,type_id, company_id)', 'A date range must be unique per company !')] - @api.onchange('company_id') + @api.onchange('company_id', 'type_id') def _onchange_company_id(self): if self.company_id and self.type_id.company_id and \ self.type_id.company_id != self.company_id: diff --git a/date_range/models/date_range_type.py b/date_range/models/date_range_type.py index 3450c6452..3d14ff467 100644 --- a/date_range/models/date_range_type.py +++ b/date_range/models/date_range_type.py @@ -9,6 +9,7 @@ from odoo.exceptions import ValidationError class DateRangeType(models.Model): _name = "date.range.type" + _description = "Date Range Type" @api.model def _default_company(self): @@ -36,10 +37,10 @@ class DateRangeType(models.Model): for rec in self.sudo(): if not rec.company_id: continue - if bool(self.date_range_ids.filtered( + if bool(rec.date_range_ids.filtered( lambda r: r.company_id and r.company_id != rec.company_id)): raise ValidationError( _('You cannot change the company, as this ' 'Date Range Type is assigned to Date Range ' - '(%s).') % (self.date_range_ids.name_get()[0][1])) + '(%s).') % (rec.date_range_ids.name_get()[0][1])) diff --git a/date_range/readme/CONTRIBUTORS.rst b/date_range/readme/CONTRIBUTORS.rst index 4d3702578..38b10b316 100644 --- a/date_range/readme/CONTRIBUTORS.rst +++ b/date_range/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Laurent Mignon * Alexis de Lattre * Miquel Raïch +* Andrea Stirpe diff --git a/date_range/readme/INSTALL.rst b/date_range/readme/INSTALL.rst index 695d21faf..f4bf76d5e 100644 --- a/date_range/readme/INSTALL.rst +++ b/date_range/readme/INSTALL.rst @@ -1,3 +1 @@ The addon use the daterange method from postgres. This method is supported as of postgresql 9.2 - - diff --git a/date_range/wizard/date_range_generator.py b/date_range/wizard/date_range_generator.py index 2e9d8658d..534263e0c 100644 --- a/date_range/wizard/date_range_generator.py +++ b/date_range/wizard/date_range_generator.py @@ -15,6 +15,7 @@ from dateutil.relativedelta import relativedelta class DateRangeGenerator(models.TransientModel): _name = 'date.range.generator' + _description = 'Date Range Generator' @api.model def _default_company(self):