@@ -39,8 +39,8 @@ class HrContract(models.Model):
|
||||
documents_ids = fields.Many2many('ir.attachment', string="合同附件")
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company', search='_search_part_of_company')
|
||||
|
||||
@api.onchange('date_end')
|
||||
def _onchange_date_end(self):
|
||||
@api.constrains("state")
|
||||
def _constrains_state(self):
|
||||
today = date.today()
|
||||
if self.date_end:
|
||||
if self.date_end < today:
|
||||
|
||||
@@ -239,15 +239,18 @@ class YuthonHrEmployee(models.Model):
|
||||
}
|
||||
insurance_records = self.env['yuthon.payroll.insurances'].search([('name', 'in', list(insurance_names.keys()))])
|
||||
for record in self:
|
||||
# 初始化所有保险基数为 0
|
||||
# 初始化所有保险基数为0
|
||||
for field_name in insurance_names.values():
|
||||
setattr(record, field_name, 0)
|
||||
if 1 <= current_month <= 6:
|
||||
base = record.social_base_on
|
||||
else:
|
||||
base = record.social_base_off
|
||||
base = record.social_base_on if 1 <= current_month <= 6 else record.social_base_off
|
||||
for insurance in insurance_records:
|
||||
field_name = insurance_names[insurance.name]
|
||||
# 特殊处理:只有这两个人的住房公积金设为4000
|
||||
if field_name == 'housing_fund_base' and record.name in ['郭爱娣', '黄炎方']:
|
||||
record.housing_fund_base = 4000
|
||||
continue # 跳过住房公积金的正常计算
|
||||
|
||||
# 正常计算其他保险和普通人的住房公积金
|
||||
if base > insurance.employee_base_ceiling:
|
||||
setattr(record, field_name, insurance.employee_base_ceiling)
|
||||
elif base < insurance.employee_base_floor:
|
||||
|
||||
@@ -422,10 +422,13 @@ class InheritHrPayslip(models.Model):
|
||||
def open_record(self):
|
||||
return {
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": 'hr.payslip',
|
||||
"res_id": self.id,
|
||||
"name": "薪资详情",
|
||||
"view_mode": "form",
|
||||
"res_model": "hr.payslip.line",
|
||||
"name": "薪资明细",
|
||||
"view_mode": "tree",
|
||||
"views": [(False, "tree")],
|
||||
"domain": [("slip_id", "=", self.id), ("amount", "!=", 0)],
|
||||
"target": "new",
|
||||
"view_id": self.env.ref("yuthon_salary.view_hr_payslip_line_tree_custom").id,
|
||||
}
|
||||
|
||||
def update_record(self):
|
||||
|
||||
@@ -21,7 +21,7 @@ class YuthonPayrollCommon(models.Model):
|
||||
end_date = fields.Date(string="失效日期")
|
||||
before_tax = fields.Boolean(string="税前")
|
||||
is_enable = fields.Boolean(string="启用", default=True)
|
||||
create_time = fields.Date(string="生效日期", default=fields.Datetime.now)
|
||||
create_time = fields.Date(string="创建日期", default=fields.Datetime.now)
|
||||
attributes = fields.Selection([('increment', '增'), ('deduction', '减')], string="工资项属性", default='increment')
|
||||
|
||||
@api.onchange('payroll_type_ids')
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="document_ids" widget="preview_many2many"/>
|
||||
<field name="run_stage" readonly="1"/>
|
||||
<button type="object" name="Fileline" string="归档明细" class="oe_highlight" invisible="run_stage == 'issued'"/>
|
||||
<button type="object" name="payslip_wizard" string="发放工资条" class="oe_highlight" invisible="run_stage == 'to_be_issued'" groups="yuthon_salary.salary_rule_confirm_group"/>
|
||||
<button type="object" name="Fileline" string="归档明细" class="oe_highlight" invisible="run_stage != 'issued'"/>
|
||||
<button type="object" name="payslip_wizard" string="发放工资条" class="oe_highlight" invisible="run_stage != 'to_be_issued'" groups="yuthon_salary.salary_rule_confirm_group"/>
|
||||
<button type="object" name="open_payslip" string="详情" class="oe_highlight"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -492,4 +492,15 @@
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="cs_hr_payslip_line_tree"/>
|
||||
</record>
|
||||
<record id="view_hr_payslip_line_tree_custom" model="ir.ui.view">
|
||||
<field name="name">薪资明细树形视图</field>
|
||||
<field name="model">hr.payslip.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="薪资明细">
|
||||
<field name="name"/>
|
||||
<field name="category_id"/>
|
||||
<field name="amount" widget="monetary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user