添加功能

This commit is contained in:
zhou
2025-01-02 17:43:02 +08:00
parent f1a682e8aa
commit 9cb3a1a156
17 changed files with 161 additions and 23 deletions
@@ -31,7 +31,7 @@ class SoongWorkflowRecord(models.Model):
node_id = fields.Many2one(comodel_name="soong.workflow.node", string="当前节点")
approve_state = fields.Selection([("start", "开始"), ("pending", "审批中"), ("end", "结束")], default="start", string="审批状态", compute="_compute_node_id")
reclaim_state = fields.Boolean(string="回收")
done_by = fields.Many2one(comodel_name="res.users", string="经办人")
done_by = fields.Many2one(comodel_name="res.users", string="发起人")
is_department_record = fields.Boolean(string="是否是本部门的数据", store=False, search="_search_is_department_record")
def get_department_employees(self, department_id):
@@ -24,7 +24,7 @@
<field name="workflow_id" string="审批类型"/>
<field name="node_id" string="当前节点"/>
<field name="approve_state" string="审批状态"/>
<field name="users_ids" string="审批人" widget="many2many_tags"/>
<field name="users_ids" string="当前经办人" widget="many2many_tags"/>
<field name="done_by" />
<field name="write_date"/>
<field name="reclaim_state" column_invisible="1"/>
@@ -9,8 +9,13 @@ class YuthonFixesWizard(models.TransientModel):
remediate_days = fields.Char(string='修正天数')
users_id = fields.Many2one('res.users')
duration_display = fields.Char(string='假期余额')
remarks = fields.Text(string='备注')
def confirm(self):
for record in self:
partner_ids = record.users_id.partner_id.ids
record.with_context(lang=record.env.lang)._message_auto_subscribe_notify(partner_ids,
f'{record.remarks},{record.remediate_days}天')
form_id = self.env.ref('yuthon_holiday.view_yuthon_fixes_approval_form').id
return {
"type": "ir.actions.act_window",
@@ -26,3 +31,5 @@ class YuthonFixesWizard(models.TransientModel):
@@ -10,6 +10,7 @@
<field name="users_id" invisible="1"/>
<field name="duration_display" invisible="1"/>
<field name="remediate_days"/>
<field name="remarks" required="1"/>
</group>
</sheet>
<footer>
@@ -7,13 +7,17 @@ from dateutil.relativedelta import relativedelta
class AttendanceBannerRoute(Controller):
@route('/attendance/banner/route', type='json', auth='user')
def employee_banner_route(self):
current_date = datetime.today()
month_start = current_date.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
month_end = (current_date.replace(day=1, hour=0, minute=0, second=0, microsecond=0) + relativedelta(months=1)) - timedelta(seconds=1)
now = datetime.now()
first_day_of_month = datetime(now.year, now.month, 1)
if now.month == 12:
next_month_first_day = datetime(now.year + 1, 1, 1)
else:
next_month_first_day = datetime(now.year, now.month + 1, 1)
last_day_of_month = next_month_first_day - timedelta(days=1)
domain = [
('employee_id.user_id', '=', request.env.user.id),
('check_in', '>=', month_start),
('check_in', '<=', month_end),
('check_in', '>=', first_day_of_month),
('check_in', '<=', last_day_of_month),
('week', 'not in', ['seven', 'six'])
]
attendance = request.env['hr.attendance'].sudo().search(domain)
+4 -1
View File
@@ -66,7 +66,10 @@ class CardApprovals(models.Model):
rec.attendance_id.check_in = rec.attendance_id.check_in.replace(hour=min_hour, minute=min_minute) - timedelta(hours=8)
rec.attendance_id.check_out = rec.attendance_id.check_in.replace(hour=max_hour, minute=max_minute) - timedelta(hours=8)
rec.attendance_id.is_approval = True
rec.attendance_id.is_abnormal = False
rec.attendance_id.is_no_card = False
rec.attendance_id.is_early_card = False
rec.attendance_id.is_late_card = False
@api.onchange('is_issues')
def _onchange_is_issues(self):
if self.is_issues:
@@ -28,7 +28,7 @@ class YuthonDutyPlan(models.Model):
# 计算结束日期(下个月的第一天)
next_month = (selected_month % 12) + 1
next_year = year + (1 if next_month == 1 else 0) # 如果是12月,年份加1
last_day_of_month = datetime(next_year, next_month, 1)- timedelta(days=1)
last_day_of_month = datetime(next_year, next_month, 1)
existing_slots = self.env['planning.slot'].search([
('role_id.name', '=', '联安粮库'),
('start_datetime', '>=', first_day_of_month),
@@ -42,7 +42,7 @@ class YuthonDutyPlan(models.Model):
first_day_of_month = datetime(next_year, next_month, 1)
next_next_month = (next_month % 12) + 1
next_next_year = next_year + (1 if next_next_month == 1 else 0)
last_day_of_month = datetime(next_next_year, next_next_month, 1)- timedelta(days=1)
last_day_of_month = datetime(next_next_year, next_next_month, 1)
existing_slots = self.env['planning.slot'].search([
('role_id.name', '=', '联安粮库'),
('start_datetime', '>=', first_day_of_month),
+1
View File
@@ -0,0 +1 @@
from . import models
+21
View File
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
{
'name': "yuthon maintain",
'summary': "维修",
'description': """
""",
'author': 'pengyuthon',
'website': 'https://www.pengyuthon.com',
'category': 'Human Resources/Attendances',
'version': '0.1',
'license': 'LGPL-3',
'depends': ['documents'],
'data': [
'security/ir.model.access.csv',
'views/maintenance_equipment_views.xml',
],
'installable': True,
'application': True,
}
+5
View File
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from . import inherit_maintenance_equipment
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
import datetime
class InheritMaintenanceEquipment(models.Model):
_inherit = 'maintenance.equipment'
image_1920 = fields.Image(string="图片")
documents_ids = fields.Many2many('ir.attachment', string="附件")
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="maintain_equipment_view_form_inherit_hr" model="ir.ui.view">
<field name="name">maintenance.equipment.view.form.inherit.hr</field>
<field name="model">maintenance.equipment</field>
<field name="inherit_id" ref="maintenance.hr_equipment_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='department_id']" position="after">
<field name="documents_ids" widget="preview_many2many"/>
</xpath>
<xpath expr="//div[@class='oe_title']" position="replace">
<div class="container">
<div class="row justify-content-between position-relative w-100 m-0 mb-2" style="display: flex; align-items: center;">
<div class="col-6 oe_title mw-75 ps-0 pe-2">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<div class="col-6 o_employee_avatar m-0 p-0" style="text-align: right;">
<field name="image_1920" widget="image" class="oe_avatar"
optional="{'preview_image': 'image_128'}" />
</div>
</div>
</div>
</xpath>
</field>
</record>
<record id="maintain_equipment_kanban_inherit_hr" model="ir.ui.view">
<field name="name">maintain.equipment.kanban.inherit.hr</field>
<field name="model">maintenance.equipment</field>
<field name="inherit_id" ref="maintenance.hr_equipment_view_kanban"/>
<field name="arch" type="xml">
<xpath expr="//templates" position="replace">
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_card oe_kanban_global_click">
<div class="o_kanban_image me-1">
<img t-att-src="kanban_image('maintenance.equipment', 'image_1920', record.id.raw_value)"
alt="Product" class="o_image_64_contain"/>
</div>
<div class="oe_kanban_details">
<div class="o_kanban_record_top mb-0">
<div class="o_kanban_record_headings">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
<div>
<span>设备类别:</span>
<field name="category_id"/>
</div>
<div>
<span>技术员:</span>
<field name="technician_user_id"/>
</div>
<div>
<span>部门:</span>
<field name="department_id"/>
</div>
</div>
</div>
</div>
</div>
</t>
</templates>
</xpath>
</field>
</record>
</odoo>
@@ -39,3 +39,18 @@ class PropertyMeterArchives(models.Model):
associated_standards = fields.Char(string='关联标准') #选择字段或者many2one 后续优化
late_fee_standard = fields.Char(string='滞纳金标准')#选择字段或者many2one 后续优化
@api.onchange('yuthon_property_id')
def _onchange_property(self):
if self.yuthon_property_id:
meter_list = []
property_id = self.env['yuthon.property'].search([('id', '=', self.yuthon_property_id.id)])
property_id.is_message_fee = True
meter_list.append((0, 0, {
'yuthon_property_id':property_id.id,
'property_meter_archives_id':self.id,
'rate': self.gauge_magnification,
'installation_date': self.start_time,
'demolition_date':self.end_time,
'location':self.installation_location
}))
property_id.energy_meter_ids = meter_list
+1 -1
View File
@@ -71,7 +71,7 @@ class YuthonProperty(models.Model):
ame = fields.Char(string='标题')
management_area = fields.Float(string="管理面积", group_operator="sum", digits=(16, 4))
rent_area = fields.Float(string="可租面积", group_operator="sum", digits=(16, 4))
equity_area = fields.Float(string="产权面积", group_operator="sum", digits=(16, 4))
equity_area = fields.Float(string="产权面积", digits=(16, 4))
decoration_type = fields.Selection([('blank', '毛坯'), ('hardcover', '精装'), ('brands', '简装'), ('rsz', '豪装')],
string="装修类型")
water_meter_ids = fields.One2many('yuthon.property.water', 'yuthon_property_id', string='水表列表')
@@ -86,7 +86,7 @@ class PropertyLeaseContract(models.Model):
performance_bonds_write = fields.Char(string="履约保证金大写")
first_year_rent = fields.Float(string="首年租金")
rent = fields.Float(string="租金", help='第一笔合同的应收')
total_contract_receivables = fields.Float(string="合同应收")
total_contract_receivables = fields.Float(string="合同总应收")
tax_rate = fields.Many2one('yuthon.tariff.setting', string="税率")
not_tax_amount = fields.Float(string="不含税价")
tax = fields.Float(string="税金")
@@ -89,18 +89,18 @@
</field>
</page>
<page string="附件">
<group col="3">
<group col="2">
<group>
<field name="license_id"/>
<field name="card_id"/>
<field name="legal_entity_id"/>
<field name="confirmation_transaction_id"/>
<field name="handover_time"/>
<field name="license_id" widget="preview_many2one"/>
<field name="card_id" widget="preview_many2one"/>
<field name="legal_entity_id" widget="preview_many2one"/>
<field name="confirmation_transaction_id" widget="preview_many2one"/>
<field name="handover_time" widget="preview_many2one"/>
</group>
<group>
<field name="power_attorney_id"/>
<field name="handle_cards_id"/>
<field name="confirmation_transaction_id"/>
<field name="power_attorney_id" widget="preview_many2one"/>
<field name="handle_cards_id" widget="preview_many2one"/>
<field name="confirmation_transaction_id" widget="preview_many2one"/>
</group>
</group>
</page>
@@ -180,10 +180,10 @@
<field name="deposit" invisible="deposit_type != 'deposit'" string=" "/>
<field name="performance_bonds" invisible="deposit_type != 'performance' " string=" "/>
<field name="first_year_rent"/>
<field name="rent"/>
<field name="total_contract_receivables"/>
</group>
<group>
<field name="total_contract_receivables"/>
<field name="rent"/>
<field name="tax_rate"/>
<field name="unit_price"/>
<field name="tax"/>