!4798 添加功能

Merge pull request !4798 from dev_zhou
This commit is contained in:
李鹏宇
2025-08-28 09:42:23 +00:00
committed by Gitee
4 changed files with 58 additions and 78 deletions
@@ -57,6 +57,21 @@ class HrContract(models.Model):
if record.date_start:
record.date_end = record.date_start + relativedelta(years=1) - relativedelta(days=1)
@api.onchange('contract_type_id')
def _onchange_contract_type_id(self):
for record in self:
if record.contract_type_id:
if record.contract_type_id.name == '正式合同(一签)':
record.date_end = record.date_start + relativedelta(years=1) - relativedelta(days=1)
elif record.contract_type_id.name == '正式合同(二签)':
record.date_end = record.date_start + relativedelta(years=3) - relativedelta(days=1)
@api.onchange('date_start')
def _onchange_date_start(self):
for record in self:
if record.date_start and record.state == 'open' and record.employee_id:
record.employee_id.entry_date = record.date_start
def renew(self):
contract_ids = self.env["hr.contract"].browse(
self._context.get('active_ids', self._context.get('active_id')))
@@ -17,8 +17,10 @@
<xpath expr="//field[@name='date_end']" position="before">
<field name="termination_date"/>
</xpath>
<xpath expr="//field[@name='employee_id']" position="after">
<xpath expr="//field[@name='code']" position="after">
<field name="contract_type_id" string="用工形式"/>
</xpath>
<xpath expr="//field[@name='employee_id']" position="after">
<field name="is_company" string="是否本公司" optional="hide"/>
</xpath>
<xpath expr="//field[@name='date_end']" position="attributes">
@@ -366,76 +366,39 @@
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="banner_route">/employee/banner/route</attribute>
<attribute name="limit">20</attribute>
</xpath>
<xpath expr="//field[@name='activity_ids']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='activity_date_deadline']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='work_email']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='parent_id']" position="attributes">
<attribute name="string">上级单位</attribute>
</xpath>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="class">list_employee_width</attribute>
</xpath>
<!-- <xpath expr="//field[@name='contract_id']" position="attributes">-->
<!-- <attribute name="column_invisible">1</attribute>-->
<!-- </xpath>-->
<xpath expr="//field[@name='department_id']" position="before">
<field name="mobile_phone"/>
<field name="work_phone"/>
</xpath>
<xpath expr="//field[@name='job_id']" position="after">
<field name="political_aspects"/>
<field name="user_role_id" column_invisible="1"/>
<field name="contract_type_id"/>
<field name="use_user_type" column_invisible="1"/>
<field name="is_company" optional="hide"/>
<field name="salary_group_id" column_invisible="1"/>
<field name="user_number" optional="hide"/>
<field name="mobile_phone" optional="hide"/>
<field name="confirmation_date" optional="hide"/>
<field name="user_number_start_time" optional="hide"/>
<field name="nation" optional="hide"/>
<field name="user_sex" optional="hide"/>
<field name="old" optional="hide"/>
<field name="retire_date" optional="hide"/>
<field name="birthday_month" optional="hide"/>
<field name="user_type" optional="hide"/>
<!-- <field name="retire_years" optional="hide"/>-->
<field name="dang_data" optional="hide"/>
<!-- <field name="new_start_contract_data" optional="hide"/>-->
<field name="open_start_time" optional="hide"/>
<field name="interrupt_work_month" optional="hide"/>
<field name="cumulative_work_month" optional="hide"/>
<field name="cumulative_work_years" optional="hide"/>
<field name="high_degree" optional="hide"/>
<field name="high_degree2" optional="hide"/>
<field name="profession" optional="hide"/>
<field name="graduate_date" optional="hide"/>
<field name="graduate_school" optional="hide"/>
</xpath>
<xpath expr="//field[@name='first_contract_date']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='attendance_manager_id']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='parent_id']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='work_phone']" position="attributes">
<attribute name="column_invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='company_id']" position="attributes">
<attribute name="optional">hide</attribute>
<xpath expr="//tree" position="replace">
<tree string="员工列表" banner_route="/employee/banner/route">
<header>
</header>
<field name="name"/>
<field name="department_id"/>
<field name="job_id"/>
<field name="work_phone"/>
<field name="mobile_phone"/>
<field name="work_email"/>
<field name="political_aspects"/>
<field name="dang_data"/>
<field name="contract_type_id"/>
<field name="identification_id"/>
<field name="user_sex"/>
<field name="nation"/>
<field name="birthday_month"/>
<field name="old"/>
<field name="entry_date"/>
<field name="confirmation_date"/>
<field name="interrupt_work_month"/>
<field name="cumulative_work_month"/>
<field name="cumulative_work_years"/>
<field name="graduate_school"/>
<field name="profession"/>
<field name="high_degree"/>
<field name="high_degree2"/>
<field name="graduate_date"/>
<field name="user_type"/>
<field name="user_number"/>
<field name="company_id"/>
<field name="work_location_id" column_invisible="1"/>
</tree>
</xpath>
</field>
</record>
@@ -367,10 +367,10 @@ class PropertyReconciliationWizard(models.Model):
rec.bank_id.write({
'create_receivable_ids': [(4, receivable_id.id)]
})
if receivable_id:
rec.bank_id.write({
'create_receivable_ids': [(4, receivable_id.id)]
})
# if receivable_id:
# rec.bank_id.write({
# 'create_receivable_ids': [(4, receivable_id.id)]
# })
else:
existing_record.write({
'delivered1': existing_record.delivered1 + line.amount,
@@ -382,9 +382,9 @@ class PropertyReconciliationWizard(models.Model):
'is_write': True if line.amount != 0 else None,
'reconciliation_time': fields.Datetime.now(),
})
rec.bank_id.write({
'write_receivable_ids': [(4, existing_record.id)]
})
# rec.bank_id.write({
# 'write_receivable_ids': [(4, existing_record.id)]
# })
# 计算已对账和未对账金额
rec.amount_been_reconciled += line.amount