1
0
Fork 0

add resource.py file missed on last commit

This commit is contained in:
?ngel ?lvarez 2014-09-21 11:48:20 +02:00
parent 7d26949419
commit 92d745aa1b
1 changed files with 25 additions and 0 deletions

25
resource.py Normal file
View File

@ -0,0 +1,25 @@
from trytond.pool import Pool, PoolMeta
__all__ = ['ResourceBooking']
__metaclass__ = PoolMeta
class ResourceBooking:
__name__ = 'resource.booking'
@classmethod
def confirm(cls, bookings):
pool = Pool()
Work = pool.get('project.work')
super(ResourceBooking, cls).confirm(bookings)
to_write = []
for booking in bookings:
work = booking.document
if (work and isinstance(work, Work) and not work.assigned_employee
and booking.resource.employee):
to_write.extend(([work], {
'assigned_employee': booking.resource.employee.id,
}))
if to_write:
Work.write(*to_write)