[MERGE] forward port of branch 8.0 up to 0f46e6a
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<!-- Rule Category -->
|
||||
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="plafond_secu">2946</field>
|
||||
<field name="plafond_secu">3218</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)""")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user