diff --git a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml index 1893d1f1824..d144de3b0e7 100644 --- a/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml +++ b/addons/l10n_fr_hr_payroll/l10n_fr_hr_payroll_data.xml @@ -21,7 +21,7 @@ - 2946 + 3218 diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 684c5630e41..ad4e59c72f9 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1222,6 +1222,7 @@ class mrp_production(osv.osv): move_id = stock_move.create(cr, uid, { 'name': production.name, 'date': production.date_planned, + 'date_expected': production.date_planned, 'product_id': product.id, 'product_uom_qty': qty, 'product_uom': uom_id, diff --git a/addons/resource/resource.py b/addons/resource/resource.py index c9429ac07c2..a41d43e1cf0 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -20,6 +20,7 @@ ############################################################################## import datetime +from datetime import timedelta from dateutil import rrule from dateutil.relativedelta import relativedelta from openerp.tools import DEFAULT_SERVER_DATE_FORMAT @@ -348,14 +349,8 @@ class resource_calendar(osv.osv): working_intervals = [] tz_info = fields.datetime.context_timestamp(cr, uid, work_dt, context=context).tzinfo for calendar_working_day in self.get_attendances_for_weekday(cr, uid, id, start_dt, context=context): - if context and context.get('no_round_hours'): - min_from = int((calendar_working_day.hour_from - int(calendar_working_day.hour_from)) * 60) - min_to = int((calendar_working_day.hour_to - int(calendar_working_day.hour_to)) * 60) - dt_f = work_dt.replace(hour=int(calendar_working_day.hour_from), minute=min_from) - dt_t = work_dt.replace(hour=int(calendar_working_day.hour_to), minute=min_to) - else: - dt_f = work_dt.replace(hour=int(calendar_working_day.hour_from)) - dt_t = work_dt.replace(hour=int(calendar_working_day.hour_to)) + dt_f = work_dt.replace(hour=0, minute=0, second=0) + timedelta(seconds=(calendar_working_day.hour_from * 3600)) + dt_t = work_dt.replace(hour=0, minute=0, second=0) + timedelta(seconds=(calendar_working_day.hour_to * 3600)) # adapt tz working_interval = ( diff --git a/addons/resource/tests/test_resource.py b/addons/resource/tests/test_resource.py index 064a54868f2..f8f45d7b362 100644 --- a/addons/resource/tests/test_resource.py +++ b/addons/resource/tests/test_resource.py @@ -423,6 +423,35 @@ class TestResource(TestResourceCommon): default_interval=(8, 16), context=context) self.assertEqual(res, 32.0, 'resource_calendar: wrong get_working_hours computation') + self.att0_0_id = self.resource_attendance.create( + cr, uid, { + 'name': 'Att0', + 'dayofweek': '0', + 'hour_from': 7.5, + 'hour_to': 12.5, + 'calendar_id': self.calendar_id, + }, context=context + ) + self.att0_1_id = self.resource_attendance.create( + cr, uid, { + 'name': 'Att0', + 'dayofweek': '0', + 'hour_from': 13, + 'hour_to': 14, + 'calendar_id': self.calendar_id, + }, context=context + ) + date1 = datetime.strptime('2013-02-11 07:30:00', '%Y-%m-%d %H:%M:%S') + date2 = datetime.strptime('2013-02-11 14:00:00', '%Y-%m-%d %H:%M:%S') + res = self.resource_calendar.get_working_hours( + cr, uid, self.calendar_id, + date1, + date2, + compute_leaves=False, resource_id=self.resource1_id, context=context) + # 7h30 -> 12h30 = 5 / 13h -> 14h = 1 / -> 6h + self.assertEqual(res, 6, 'resource_calendar: wrong get_working_hours computation') + + def test_50_calendar_schedule_days(self): """ Testing calendar days scheduling """ cr, uid = self.cr, self.uid diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 65473793893..db0e37d7031 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -125,7 +125,7 @@ class stock_history(osv.osv): product_categ_id, SUM(quantity) as quantity, date, - price_unit_on_quant, + SUM(price_unit_on_quant * quantity) / SUM(quantity) as price_unit_on_quant, source FROM ((SELECT @@ -193,5 +193,5 @@ class stock_history(osv.osv): dest_location.usage not in ('internal', 'transit')) )) AS foo - GROUP BY move_id, location_id, company_id, product_id, product_categ_id, date, price_unit_on_quant, source + GROUP BY move_id, location_id, company_id, product_id, product_categ_id, date, source )""") diff --git a/doc/cla/corporate/roomsfor.md b/doc/cla/corporate/roomsfor.md index f2aa1d0c2ce..522ffffe78a 100644 --- a/doc/cla/corporate/roomsfor.md +++ b/doc/cla/corporate/roomsfor.md @@ -11,3 +11,4 @@ Yoshi Tashiro tashiro@roomsfor.hk https://github.com/yostashiro List of contributors: Yoshi Tashiro tashiro@roomsfor.hk https://github.com/yostashiro +Manami Hashi manami@roomsfor.hk https://github.com/manamirfhk diff --git a/doc/cla/individual/fabienmorin.md b/doc/cla/individual/fabienmorin.md new file mode 100644 index 00000000000..3478578d9fc --- /dev/null +++ b/doc/cla/individual/fabienmorin.md @@ -0,0 +1,11 @@ +France, 2016-02-11 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +MORIN Fabien fabien.morin@gmail.com https://github.com/fabienmorin