Browse Source

[IMP] emcc: default date to import wizard

pull/115/head
robin.keunen 4 years ago
parent
commit
100a6eed91
  1. 2
      .isort.cfg
  2. 18
      easy_my_coop_connector/wizards/emc_history_import_sr.py

2
.isort.cfg

@ -9,4 +9,4 @@ line_length=79
known_odoo=odoo known_odoo=odoo
known_odoo_addons=odoo.addons known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=addons,cStringIO,lxml,openerp,psycopg2,requests,setuptools,werkzeug,xlsxwriter
known_third_party=addons,cStringIO,dateutil,lxml,openerp,psycopg2,requests,setuptools,werkzeug,xlsxwriter

18
easy_my_coop_connector/wizards/emc_history_import_sr.py

@ -2,6 +2,10 @@
# Robin Keunen <robin@coopiteasy.be> # Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import date
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models from odoo import api, fields, models
@ -9,9 +13,19 @@ class EMCHistoryImportSR(models.TransientModel):
_name = "emc.history.import.sr" _name = "emc.history.import.sr"
_description = "emc.history.import.sr" _description = "emc.history.import.sr"
def first_day_of_month(self):
return date.today() - relativedelta(day=1)
def last_day_of_month(self):
return date.today() + relativedelta(day=31)
name = fields.Char("Name", default="Import History") name = fields.Char("Name", default="Import History")
date_from = fields.Date(string="Date From", required=True)
date_to = fields.Date(string="Date To", required=True)
date_from = fields.Date(
string="Date From", required=True, default=first_day_of_month
)
date_to = fields.Date(
string="Date To", required=True, default=last_day_of_month
)
@api.multi @api.multi
def import_subscription_button(self): def import_subscription_button(self):

Loading…
Cancel
Save