import time import xlrd from datetime import datetime from netforce.model import Model, fields, get_model from netforce.access import get_active_company from netforce.access import get_active_user, set_active_user from netforce.utils import get_file_path from netforce.utils import get_data_path PAMENT_TYPE={ "mg":"Medical Government", "sc":"Social Security", "nhso":"NHSO (30฿)", "personal": "Personal", "others": "Others", } class ImportPayment(Model): _name="clinic.import.payment" _string="Import Payment" _fields={ 'name': fields.Char("Name"), 'date_import': fields.DateTime("Date"), 'mg_file': fields.File("File"), 'sc_file': fields.File("File"), 'nhso_file': fields.File("File"), 'mg_payment_id': fields.Many2One("account.payment","Payment"), 'sc_payment_id': fields.Many2One("account.payment","Payment"), 'nhso_payment_id': fields.Many2One("account.payment","Payment"), "state": fields.Selection([("draft","Draft"),("success","Succes"),("fail","Fail")],"Status"), 'note': fields.Text("Note"), } _order="date_import desc" def _get_name(self,context={}): timenow=time.strftime("%Y-%m-%d") return 'Import Payment - %s'%timenow _defaults={ 'date_import': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"), 'name': _get_name, 'state': 'draft', } ImportPayment.register()