Created
August 13, 2018 05:41
-
-
Save tienhieuD/d55c0e5ddd1bbed47599e7a830c7979f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import calendar | |
from datetime import datetime as date | |
def get_date_range(self, month, year): | |
last_day_of_month = calendar.monthrange(year, month)[1] | |
begin_date = date(year, month, 1).strftime('%Y-%m-%d') | |
end_date = date(year, month, last_day_of_month).strftime('%Y-%m-%d') | |
return begin_date, end_date | |
# ----------------------------------------- | |
# Code | |
# ----------------------------------------- | |
begin_date, end_date = self.get_date_range(month, year) | |
figure = self.env['working.rate'].search([ | |
('employee_code', '=', self.employee_code), | |
('date', '>=', begin_date), | |
('date', '<=', end_date), | |
]).x_value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment