*.py
###Part One
from datetime import date, datetime, timedelta, time
from time import time
import time
import calendar
###Part Two
#Count Date
hire_date = fields.Date(string="Hire Date", default=fields.Date.today)
count_start = fields.Date(string="Count Start", default=fields.Date.today, store=True, compute='_get_count_start', inverse='_write_count_start')
count_end = fields.Date(string="Count End", default=fields.Date.today, store=True, compute='_get_count_end', inverse='_write_count_end')
resign_date = fields.Date(string="Resign Date", default="3000-12-31")
#Count Date
###Part Three
#Count Date
@api.onchange('hire_date')
def _get_count_start(self):
for hr_employee_id in self:
if hr_employee_id.hire_date > hr_employee_id.count_start:
hr_employee_id.count_start = hr_employee_id.hire_date
def _write_count_start(self):
for hr_employee_id in self:
if hr_employee_id.hire_date > hr_employee_id.count_start:
hr_employee_id.count_start = hr_employee_id.hire_date
@api.onchange('resign_date')
def _get_count_end(self):
for hr_employee_id in self:
if hr_employee_id.resign_date < hr_employee_id.count_end:
hr_employee_id.count_end = hr_employee_id.resign_date+timedelta(-1)
def _write_count_end(self):
for hr_employee_id in self:
if hr_employee_id.resign_date < hr_employee_id.count_end:
hr_employee_id.count_end = hr_employee_id.resign_date+timedelta(-1)
#Count Date
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 会計
- 在庫
- PoS
- Project
- MRP
この質問にフラグが付けられました
1
返信
3889
ビュー
HI,
Try this,
start_date = fields.Date.from_string(start_date)
last_date = fields.Date.from_string(last_date)
number_of_days = (last_date - start_date).days
If you search inside the odoo code for .days you can see a lot of such examples/use cases.
Thanks
Thank you very much
for time count???
関連投稿 | 返信 | ビュー | 活動 | |
---|---|---|---|---|
|
3
6月 25
|
1036 | ||
|
1
1月 25
|
17941 | ||
|
1
12月 19
|
6343 | ||
|
1
12月 19
|
17253 | ||
|
3
4月 18
|
5149 |