Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
pengyuthon
2025-12-25 20:41:45 +08:00
24 changed files with 194 additions and 50 deletions
+5
View File
@@ -11,6 +11,11 @@
<field name="model_id" ref="model_room_room"/>
<field name="domain_force">[('company_id', 'in', company_ids)]</field>
</record>
<record model="ir.rule" id="room_booking_rule">
<field name="name">预定会议多公司</field>
<field name="model_id" ref="model_room_booking"/>
<field name="domain_force">[('company_id', 'in', company_ids)]</field>
</record>
<!-- <record id="room_room_comp_rule" model="ir.rule">-->
<!-- <field name="name">Room Room MC Rule</field>-->
<!-- <field name="model_id" ref="model_room_room"/>-->
@@ -43,7 +43,11 @@ class SoongWorkflowRecordRevokeWizard(models.TransientModel):
])
meal_line.unlink()
record_to_update.write({'log_ids': [(5, 0, 0)]})
record_to_update.state = '申请人'
self.record_id.approve_state = 'start'
self.record_id.write({
'approve_state': 'start',
'soong_state': 'to_do',
'employee_ids': [(6, 0, [self.record_id.create_uid.employee_ids.id])],
'users_ids': [(6, 0, [self.record_id.create_uid.id])]
})
@@ -889,15 +889,15 @@ class AppletAttendance(Controller):
last_day_str = last_day.strftime('%Y-%m-%d')
two_months_ago = datetime.now().date() - relativedelta(months=2)
# 去掉 数据为 0 的数据.
valid_archives_ids = request.env(user=SUPERUSER_ID)['property.meter.archives'].search([
valid_archives = request.env(user=SUPERUSER_ID)['property.meter.archives'].search([
('is_virtual_meter', '!=', True),
'|',
('end_time', '=', False),
('end_time', '<=', two_months_ago)
]).ids
])
electric_records = request.env(user=SUPERUSER_ID)['meter.archives.line'].search([
('archives_state', '!=', 'stop'),
('archives_id', 'in', valid_archives_ids),
('archives_id', 'in', valid_archives.ids),
('meter_date', '>=', first_day_str),
('meter_date', '<=', last_day_str),
])
@@ -1071,14 +1071,21 @@ class AppletAttendance(Controller):
# ('meter_date', '>=', first_day_str),
# ('meter_date', '<=', last_day_str)]
# 去掉 state
domain = [('epitope_values_id.name', '=', floor_name),
('meter_date', '>=', first_day_str),
('meter_date', '<=', last_day_str)]
domain = [
('epitope_values_id.name', '=', floor_name),
('meter_date', '>=', first_day_str),
('meter_date', '<=', last_day_str)
]
two_months_ago = datetime.now().date() - relativedelta(months=2)
if type == 'electric':
domain.append(('archives_state', '!=', 'stop'))
model = 'meter.archives.line'
domain.extend([
('archives_id.is_virtual_meter', '!=', True),
'|',
('archives_id.end_time', '=', False),
('archives_id.end_time', '<=', two_months_ago)
])
else:
domain.append(('water_state', '!=', 'stop'))
model = 'meter.water.line'
@@ -286,6 +286,28 @@ class YuthonHrEmployee(models.Model):
else:
record.date_end = None
def renew(self):
employee_ids = self.env["hr.employee"].browse(
self._context.get("active_ids", self._context.get("active_id"))
)
for record in employee_ids:
if len(record) > 1:
raise UserError("只能选择一个员工续签")
return {
"name": "续签",
"type": "ir.actions.act_window",
"res_model": "yuthon.renewal.approval",
"view_mode": "form",
"context": {
"default_employee_id": self.id,
"default_current_status": self.contract_id.date_end,
"default_department1_id": self.department_id.id,
"default_contract_id": self.contract_id.id,
},
}
def update_social_base(self):
current_year = fields.Date.today().year
group_company = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
@@ -6,4 +6,4 @@ class YuthonServiceType(models.Model):
_name = 'yuthon.service.type'
_description = '服务类型'
name = fields.Char(string="名称")
name = fields.Char(string="名称")
@@ -11,7 +11,7 @@ class YuthonServiceApproval(models.Model):
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_service_approval_code'))
service_type_id = fields.Many2one('yuthon.service.type', string="服务类型")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.snv.user.id)
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
documents_ids = fields.Many2many('ir.attachment', string="附件")
department_id = fields.Many2one(related='users_id.employee_ids.department_id', string="部门", store=True)
employee_id = fields.Many2one('hr.employee', string="员工姓名", default=lambda self: self.env.user.employee_id.id)
@@ -10,6 +10,7 @@
<button name="pub_leaving_employee" string="离职" type="object"/>
<button name="pub_regularization_employee" string="转正" type="object"/>
<button name="pub_retired_employee" string="退休" type="object"/>
<button name="renew" string="续签" type="object"/>
</xpath>
</field>
</record>
@@ -27,6 +27,7 @@ class IssueApprovalDecision(models.Model):
end_date = fields.Date(string="失效日期")
remarks = fields.Text(string='备注')
issue_approval_id = fields.Many2one('issue.approval', string="关联议题审批")
version = fields.Char(string="版本", default="V3.0")
def _get_default_company(self):
company = self.env['res.company'].search([('name', '=', '集团本部')], limit=1)
@@ -20,6 +20,7 @@
<field name="is_filing"/>
<field name="remarks"/>
<field name="scope"/>
<field name="version"/>
<field name="company_id" optional="hide"/>
<field name="start_date" optional="hide"/>
<field name="end_date" optional="hide"/>
@@ -47,14 +48,14 @@
</group>
<group>
<field name="specifics" required="1"/>
<field name="by_law"/>
<field name="is_filing"/>
<field name="team_meet_id"/>
</group>
<group>
<field name="board_meet_id"/>
<field name="start_date"/>
<field name="department_id" widget="ztree_select"/>
<field name="department_id"/>
<field name="by_law"/>
<field name="is_filing"/>
</group>
<group>
<field name="district_state_id"/>
@@ -62,6 +63,7 @@
<field name="district_party_id"/>
<field name="scope"/>
<field name="company_id"/>
<field name="version"/>
<field name="end_date"/>
</group>
</group>
@@ -100,6 +100,28 @@ class ProcessingOrderApproval(models.Model):
else:
record.contract_id = False
def open_record(self):
if self.device_id:
return {
'type': 'ir.actions.act_window',
'name': self.device_id.display_name,
'res_model': 'property.device.repair',
'res_id': self.device_id.id,
'view_mode': 'form',
'view_type': 'form',
'target': 'new'
}
elif self.repair_id:
return {
'type': 'ir.actions.act_window',
'name': self.repair_id.display_name,
'res_model': 'property.report.repair',
'res_id': self.repair_id.id,
'view_mode': 'form',
'view_type': 'form',
'target': 'new'
}
@api.onchange('repair_id')
def onchange_repair_id(self):
if self.repair_id:
@@ -8,7 +8,6 @@ from odoo.exceptions import UserError, ValidationError
class PropertyDeviceRelief(models.Model):
_name = 'property.device.repair'
_description = '报事报修'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='标题', compute='_compute_name', store=True)
code = fields.Char(string="报修编号",
@@ -18,8 +17,7 @@ class PropertyDeviceRelief(models.Model):
company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司")
software_processing_id = fields.Many2one('software.issues.processing', string="设备类型")
problem_description = fields.Text(string="问题描述")
remake = fields.Text(string="问题描述")
report_state = fields.Selection([('to', '待处理'), ('done', '已处理')], string='状态', default='to')
report_state = fields.Selection([('to_submitted', '待提交'), ('to', '待处理'), ('done', '已处理')], string='状态', default='to_submitted')
create_time = fields.Date(string="填报日期", default=fields.Datetime.now)
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
@@ -38,14 +36,26 @@ class PropertyDeviceRelief(models.Model):
def _compute_name(self):
for rec in self:
if rec.users_id and rec.software_processing_id:
rec.name = f" {rec.software_processing_id.name}-{rec.users_id.name}-{rec.remake}"
rec.name = f"{rec.users_id.name}-{rec.software_processing_id.name}-{rec.problem_description}"
def device_delete(self):
self.unlink()
def open_record(self):
return {
"type": "ir.actions.act_window",
"res_model": 'processing.order.approval',
"res_id": self.processing_order_id.id,
"name": '详情',
"view_mode": "form",
}
def get_no_read_count(self):
return self.search_count([('report_state', '=', 'to')])
return self.search_count([('report_state', '=', 'to'), ('users_id', '=', self.env.user.id)])
def pull_order(self):
soong_workflow_line_list = []
self.report_state = 'to'
if self.env['processing.order.approval'].search([('device_id', '=', self.id)]):
raise UserError('该设备已生成处理单')
order_id = self.env['processing.order.approval'].create({
@@ -8,7 +8,6 @@ from odoo.exceptions import UserError
class PropertyRentRelief(models.Model):
_name = 'property.report.repair'
_description = '报事报修(物业)'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='标题', compute='_compute_name', store=True)
code = fields.Char(string="报修编号",
@@ -29,8 +28,6 @@ class PropertyRentRelief(models.Model):
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
self_users_ids = fields.Many2many('res.users', string="当前经办人",
default=lambda self: [(6, 0, [self.env.user.id])])
create_time = fields.Date(string="填报日期", default=fields.Datetime.now)
processing_order_id = fields.Many2one('processing.order.approval', string="处理单")
def _get_default_name_title(self):
@@ -43,7 +43,7 @@
<field name="name_title" readonly="1"/>
</h1>
</div>
<group string="审批详情">
<group string="报障详情">
<field name="name"/>
<field name="applicant_id"/>
<field name="repair_date"/>
@@ -53,7 +53,9 @@
<field name="self_users_ids" invisible="1"/>
<field name="repair_id" invisible="1"/>
<field name="device_id" invisible="1"/>
<field name="documents_ids" widget="preview_many2many"/>
</group>
<group>
<button name="open_record" string="报修详情" type="object" class="btn btn-primary button_width"/>
</group>
<group string="处理详情" col="2" invisible="not repair_id">
<group>
@@ -70,12 +72,11 @@
<group string="处理详情" invisible="not device_id">
<group>
<field name="fault_reason"/>
<field name="device_name"/>
<field name="device_code"/>
</group>
</group>
<group>
<field name="repair_details"/>
<field name="documents_ids" widget="preview_many2many"/>
<field name="processing_results"/>
<field name="is_fee"/>
</group>
@@ -4,13 +4,15 @@
<field name="name">property.device.repair.tree</field>
<field name="model">property.device.repair</field>
<field name="arch" type="xml">
<tree string="报事报修(办公设备)">
<tree string="报事报修">
<field name="name"/>
<field name="code"/>
<field name="software_processing_id"/>
<field name="report_state"/>
<field name="create_time"/>
<button name="pull_order" string="提交" type="object" class="btn-primary"/>
<button name="pull_order" string="提交" type="object" class="btn-primary" invisible="report_state != 'to_submitted'"/>
<button name="device_delete" string="删除" type="object" class="btn-primary" invisible="report_state != 'to_submitted'"/>
<button name="open_record" string="详情" type="object" class="btn-primary" invisible="report_state == 'to_submitted'"/>
</tree>
</field>
</record>
@@ -18,7 +20,7 @@
<field name="name">property.device.repair.form</field>
<field name="model">property.device.repair</field>
<field name="arch" type="xml">
<form string="报事报修(办公设备)" create="1">
<form string="报事报修" create="1">
<sheet>
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
invisible="urgency_level != 'normal'"/>
@@ -51,6 +53,7 @@
<field name="processing_order_id" invisible="not processing_order_id"/>
<field name="problem_description"/>
<field name="documents_ids" widget="preview_many2many"/>
<field name="report_state"/>
<field name="create_time"/>
</group>
</sheet>
@@ -60,6 +63,12 @@
<record id="property_device_repair_action" model="ir.actions.act_window">
<field name="name">报事报修</field>
<field name="res_model">property.device.repair</field>
<field name="domain">[('users_id', '=', uid)]</field>
<field name="view_mode">tree,form</field>
</record>
<record id="property_device_repair_all_action" model="ir.actions.act_window">
<field name="name">报事报修(管理员)</field>
<field name="res_model">property.device.repair</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -49,7 +49,6 @@
<field name="types_repairs"/>
<field name="company_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="self_users_ids" invisible="1"/>
<field name="processing_order_id" invisible="not processing_order_id"/>
<field name="remake"/>
<field name="documents_ids" widget="preview_many2many"/>
@@ -129,10 +129,13 @@ class PenaltyLineWizard(models.Model):
# 计算剩余本金
remaining_principal = max(0, pay_line.not_collected - pay_amount)
penalty_start_date = pay_date
if is_penalty:
remake = f'支付违约金¥{pay_line.amount}'
else:
remake = f'支付金额¥{pay_line.amount}'
new_penalty_lines.append((0, 0, {
'date': pay_date,
'remake': f'支付金额¥{pay_line.amount}',
'remake':remake,
'days_overdue': days_overdue,
'remaining_principal': remaining_principal,
'penalty': round(current_penalty, 2),
@@ -196,7 +199,7 @@ class PenaltyLineWizard(models.Model):
'date': self.calculation_date,
'days_overdue': days_overdue,
'remaining_principal': prev_line.remaining_principal,
'remake': f'{base_date}至{self.calculation_date}',
'remake': f'违约金:{base_date}至{self.calculation_date}',
'penalty': round(current_penalty, 2),
'is_realtime': True,
}))
@@ -586,9 +586,13 @@ class PropertyReconciliationWizard(models.Model):
'is_write': True if line.amount != 0 else False,
'is_penalty': True,
'reconciliation_date': rec.actual_date if line.amount != 0 else None,
'receivable_id': receivable_id.id,
'receivable_id': receivable_id[0].id,
'amount': line.amount,
})
# 删除多余的违约金数据
if len(receivable_id) > 1:
receivable_id = existing_record[1:]
receivable_id.unlink()
rec.amount_been_reconciled += line.amount
yes_amount += line.amount
@@ -607,7 +611,6 @@ class PropertyReconciliationWizard(models.Model):
if unreconciled_receivables:
remaining_contract_ids.append(contract.id)
class PropertyReconciliationLine(models.Model):
_name = 'property.reconciliation.line'
_description = '对账明细'
+23 -11
View File
@@ -24,13 +24,14 @@ class PurchaseWorkflow(models.Model):
default='normal', required=True)
pay_way = fields.Selection([('onetime', '一次性'), ('installment', '分期')], string="付款方式", default='onetime',
required=True)
pay_amount = fields.Float(string="付款金额")
total = fields.Float(string="合计金额", readonly=True)
document_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('启用', default=True, tracking=True)
work_end = fields.Boolean(string="审批结束", default=False, tracking=True)
purchase_order_id = fields.Many2one('purchase.order', string="采购订单", readonly=True)
purchase_type = fields.Selection([('fixed', '固定资产'), ('low', '低值易耗'), ('service', '服务')],
purchase_type = fields.Selection([('fixed', '固定资产'), ('low', '低值易耗'), ('service', '服务'), ('day', '日常消耗品')],
string="采购类型", required=True, default='fixed')
service_content = fields.Text(string="服务内容")
@@ -127,12 +128,12 @@ class PurchaseFixedLine(models.Model):
product_id = fields.Many2one('product.product', string="物品名称")
brand = fields.Char(string="品牌")
specs = fields.Char(string="规格")
number = fields.Integer(string="数量",)
number = fields.Integer(string="数量")
name = fields.Text(string="描述")
product_packaging_id = fields.Many2one('product.packaging', string="包装")
taxes_id = fields.Many2one('account.tax', string='税项')
unit_id = fields.Many2one(related='product_id.uom_id', string="单位")
price_unit = fields.Float(related='product_id.standard_price', string="单价", store=True)
unit_id = fields.Many2one('uom.uom', string="单位")
price_unit = fields.Float(string="单价", store=True)
total = fields.Float(string="合计", compute='_compute_total', store=True)
@api.depends('price_unit', 'number')
@@ -144,20 +145,23 @@ class PurchaseFixedLine(models.Model):
def _onchange_product_id(self):
if self.product_id:
self.name = self.product_id.display_name
self.unit_id = self.product_id.uom_id
self.price_unit = self.product_id.standard_price
class PurchaseLowLine(models.Model):
_name = 'purchase.low.line'
_description = '低值易耗采购明细'
purchase_id = fields.Many2one('purchase.workflow', string="关联采购工作流")
product_id = fields.Many2one('product.product', string="物品名称")
brand = fields.Char(related="product_id.brand", string="品牌")
specs = fields.Char(related="product_id.specs", string="规格")
brand = fields.Char(string="品牌")
specs = fields.Char(string="规格")
name = fields.Text(string="描述")
product_packaging_id = fields.Many2one('product.packaging', string="包装")
taxes_id = fields.Many2one('account.tax', string='税项')
number = fields.Integer(string="数量")
unit_id = fields.Many2one(related='product_id.uom_id', string="单位")
price = fields.Float(related='product_id.standard_price', string="单价", store=True)
unit_id = fields.Many2one('uom.uom', string="单位")
price = fields.Float(string="单价", store=True)
total = fields.Float(string="合计", compute='_compute_total', store=True)
@api.depends('price', 'number')
@@ -169,7 +173,12 @@ class PurchaseLowLine(models.Model):
def _onchange_product_id(self):
if self.product_id:
self.name = self.product_id.display_name
self.brand = self.product_id.brand
self.specs = self.product_id.specs
self.unit_id = self.product_id.uom_id
self.price = self.product_id.standard_price
# 服务采购明细
class PurchaseServiceLine(models.Model):
_name = 'purchase.service.line'
_description = '服务采购明细'
@@ -178,11 +187,11 @@ class PurchaseServiceLine(models.Model):
product_id = fields.Many2one('product.product', string="服务项目")
frequency = fields.Integer(string='频次')
fee = fields.Float(string="费用")
name = fields.Text(string="描述", default=lambda self: self.product_id.display_name if self.product_id else False )
name = fields.Text(string="描述")
product_packaging_id = fields.Many2one('product.packaging', string="包装")
taxes_id = fields.Many2one('account.tax', string='税项')
unit_id = fields.Many2one(related='product_id.uom_id', string="单位")
price = fields.Float(related='product_id.standard_price', string="单价", store=True)
unit_id = fields.Many2one('uom.uom', string="单位")
price = fields.Float(string="单价", store=True)
total = fields.Float(string="合计", compute='_compute_total', store=True)
@api.depends('price', 'frequency')
@@ -194,6 +203,9 @@ class PurchaseServiceLine(models.Model):
def _onchange_product_id(self):
if self.product_id:
self.name = self.product_id.display_name
self.unit_id = self.product_id.uom_id
self.price = self.product_id.standard_price
class PurchaseFixedAssets(models.Model):
_name = 'purchase.fixed.assets'
@@ -50,6 +50,7 @@
<field name="purchase_type" required="1"/>
<field name="partner_id" domain="[('user_ids', '=', False)]" required="1"/>
<field name="pay_way" required="1"/>
<field name="pay_amount" invisible="pay_way != 'onetime'"/>
</group>
<group>
<field name="date_order" string="订单日期" required="1"/>
@@ -92,6 +93,23 @@
</tree>
</field>
</page>
<page string="日常消耗品明细" invisible="purchase_type != 'day'">
<field name="fixed_line_ids">
<tree editable="bottom">
<field name="purchase_id" column_invisible="1"/>
<field name="product_id" required="1"/>
<field name="brand"/>
<field name="specs"/>
<field name="product_packaging_id"/>
<field name="number"/>
<field name="unit_id"/>
<field name="price_unit"/>
<field name="taxes_id"/>
<field name="total" sum="Total"/>
<field name="name" string="描述" required="1"/>
</tree>
</field>
</page>
<page string="低值易耗明细" invisible="purchase_type != 'low'">
<field name="low_line_ids">
<tree editable="bottom">
@@ -5,6 +5,20 @@ from datetime import datetime, timedelta, date
class InheritRoomBooking(models.Model):
_inherit = 'room.booking'
def get_no_read_count(self):
today = date.today()+ timedelta(hours=8)
today_start = datetime.combine(today, datetime.min.time())
today_end = datetime.combine(today, datetime.max.time())
current_datetime = datetime.now() + timedelta(hours=8)
domain = [
('start_datetime', '>=', today_start),
('start_datetime', '<=', today_end),
'|',
('end_datetime', '=', False),
('end_datetime', '>', current_datetime)
]
return self.search_count(domain)
@api.model
def create(self, vals):
task_time_ids = self.env['yuthon.task.time'].search([('name', '=', '30分钟')])
@@ -13,5 +13,13 @@
<field name="category_id" ref="module_yuthon_will_task"/>
<field name="implied_ids" eval="[(4, ref('group_yuthon_will_task_user'))]"/>
</record>
<record id="group_module_room_booking" model="ir.module.category">
<field name="name">会议组</field>
</record>
<record id="group_room_booking_manager" model="res.groups">
<field name="name">会议管理员</field>
<field name="category_id" ref="group_module_room_booking"/>
<field name="users" eval="[(4, ref('base.user_admin'))]"/>
</record>
</data>
</odoo>
@@ -23,6 +23,7 @@
name="预定会议"
action="room.room_booking_action"
parent="menu_yuthon_will_task"
groups="yuthon_will_task.group_room_booking_manager"
sequence="10"/>
<menuitem id="room_booking_menu_will"
name="会议室"
@@ -8,7 +8,7 @@
decoration-muted = "task_state == 'cancel'"
decoration-danger="priority == 'very_urgent'"
decoration-info="priority == 'urgent'"
decoration-success="priority == 'important'">
decoration-success="priority == 'important'" limit="15">
<field name='start_date' column_invisible="1"/>
<field name='task_time' />
<field name='name' required="1"/>
@@ -115,7 +115,7 @@
decoration-muted = "task_state == 'cancel'"
decoration-danger="priority == 'very_urgent'"
decoration-info="priority == 'urgent'"
decoration-success="priority == 'important'" create="false" edit="false" js_class="custom_task_tree_button">
decoration-success="priority == 'important'" create="false" edit="false" js_class="custom_task_tree_button" limit="15">
<field name='start_date' column_invisible="1"/>
<field name='task_time' />
<field name='name' required="1"/>
+6 -1
View File
@@ -707,7 +707,12 @@
name="报事报修"
action="yuthon_maintain.property_device_repair_action"
sequence="5"/>
<menuitem id="property_device_repair_action_brand_all"
parent="holiday_manage_menu_root_board"
name="报事报修(管理员)"
action="yuthon_maintain.property_device_repair_all_action"
groups="base.group_system"
sequence="5"/>
<menuitem id="yuthon_notice_menu1_board"
parent="holiday_manage_menu_root_board"
name="通知公告"