diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index a7bc97002..3162af494 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -623,8 +623,8 @@ class SoongWorkflowRecord(models.Model): local_time = current_utc_time + timedelta(hours=8) h = local_time.hour m = local_time.minute - if not (h == 17 and 25 <= m <= 35): - return + # if not (h == 17 and 25 <= m <= 35): + # return menu_id = self.env['ir.ui.menu'].search([('name', '=', '待办流程')]) target_url = f'https://oa.thtzjt.com/web#aciton=4299&model=soong.workflow.record&view_type=list&cids=1-2-3-4&menu_id={menu_id.id}' rec_ids = self.env["soong.workflow.record"].search([ diff --git a/yuthon_property/models/property_accounts_receivable.py b/yuthon_property/models/property_accounts_receivable.py index 1a2c273af..5b2dafdcd 100644 --- a/yuthon_property/models/property_accounts_receivable.py +++ b/yuthon_property/models/property_accounts_receivable.py @@ -14,6 +14,7 @@ class PropertyAccountsReceivable(models.Model): _description = '应收账单' payout_date = fields.Date(string='收款日期') + is_liquidated_damages = fields.Boolean(string='生成违约金', default=True) rent_month = fields.Float(string='当月租金') tax = fields.Float(string='税率') title_certificate = fields.Char(sting="产权证号") @@ -54,6 +55,12 @@ class PropertyAccountsReceivable(models.Model): bank_id = fields.Many2one('property.bank.statements', string='流水记录') receivable_log = fields.Text(string='应收日志') + def update_is_liquidated_damages(self): + rent_ids = self.env["property.accounts.receivable"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for rent in rent_ids: + rent.is_liquidated_damages = False + @api.onchange('contract_id') def _onchange_contract_id(self): """选择合同时自动填充税率""" @@ -201,13 +208,13 @@ class PropertyAccountsReceivable(models.Model): 'sticky': False, } } - + receivable_records = self.env['property.accounts.receivable'].browse(receivable_ids) - + # 加载新模板文件 template_path = get_module_resource('yuthon_property', 'static', 'tmpl', 'piliangkaipiao (2).xlsx') workbook = load_workbook(template_path) - + # 指定写入"原始数据"sheet sheet = workbook['原始数据'] @@ -228,7 +235,7 @@ class PropertyAccountsReceivable(models.Model): } else: template_styles = {} - + for index, record in enumerate(receivable_records, start=1): # 先解除当前行的合并单元格(如果有) merged_cells_to_unmerge = [] @@ -247,7 +254,7 @@ class PropertyAccountsReceivable(models.Model): cell.border = copy(template_styles[col]['border']) # 统一设置居中对齐 cell.alignment = Alignment(horizontal='center', vertical='center') - + # A列:序号(从1开始) sheet.cell(row=row, column=1, value=index) @@ -305,20 +312,20 @@ class PropertyAccountsReceivable(models.Model): if record.contract_id: contract_code = record.contract_id.contract_code or '' sheet.cell(row=row, column=10, value=contract_code) - + # 设置最小行高 if not sheet.row_dimensions[row].height or sheet.row_dimensions[row].height < 30: sheet.row_dimensions[row].height = 30 row += 1 - + # 保存到内存 output = io.BytesIO() workbook.save(output) output.seek(0) excel_data = base64.b64encode(output.read()) output.close() - + # 创建附件 filename = f'批量开票_{datetime.now().strftime("%Y%m%d")}.xlsx' attachment = self.env['ir.attachment'].create({ @@ -327,7 +334,7 @@ class PropertyAccountsReceivable(models.Model): 'datas': excel_data, 'mimetype': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', }) - + # 返回下载链接 return { 'type': 'ir.actions.act_url', diff --git a/yuthon_property/models/property_rent_list.py b/yuthon_property/models/property_rent_list.py index 3f7b86ea5..384552704 100644 --- a/yuthon_property/models/property_rent_list.py +++ b/yuthon_property/models/property_rent_list.py @@ -1,3 +1,5 @@ +from email.policy import default + from odoo import models, fields, api @@ -6,6 +8,7 @@ class PropertyRentList(models.Model): _description = '租金列表' property_id = fields.Many2one('yuthon.property', string='物业') + is_liquidated_damages = fields.Boolean(string='生成违约金', default=True) lessee_id = fields.Many2one('property.tenant.information', string='承租方', store=True) admin_id = fields.Many2one(related='property_id.admin_id', string="片区管理员", store=True) rent_month = fields.Float(string='当月租金') @@ -37,6 +40,12 @@ class PropertyRentList(models.Model): management_type_id = fields.Many2one('yuthon.management.type', string='应收类型') last_update_time = fields.Datetime(string='最后修改时间') + def update_is_liquidated_damages(self): + rent_ids = self.env["property.rent.list"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for rent in rent_ids: + rent.is_liquidated_damages = False + def get_no_read_count(self): return self.env['property.rent.list'].search_count([('is_push', '=', False)]) diff --git a/yuthon_property/views/property_accounts_receivable_views.xml b/yuthon_property/views/property_accounts_receivable_views.xml index 2c05e23b6..73a93a0dd 100644 --- a/yuthon_property/views/property_accounts_receivable_views.xml +++ b/yuthon_property/views/property_accounts_receivable_views.xml @@ -34,6 +34,7 @@ +