添加功能

This commit is contained in:
zhou
2025-06-15 21:51:23 +08:00
parent f4e4423b55
commit a92fb0f4da
9 changed files with 31 additions and 74 deletions
@@ -280,6 +280,7 @@ class SoongWorkflowMixin(models.AbstractModel):
return btn_rec.with_context(cx).run()
def _add_comment(self, logs, btn_rec):
trans_link_ids = []
wizard = self.env.ref("soong_workflow.view_soong_workflow_comment_wizard")
# 状态列表
state_list = [i.node_name for i in btn_rec.workflow_id.node_ids.sorted('sequence')]
@@ -288,7 +289,6 @@ class SoongWorkflowMixin(models.AbstractModel):
self.env['trans.link'].search([]).unlink()
# 退回节点根据日志进行判断
if btn_rec.name == '退回':
trans_link_ids = []
for ret in self.log_ids.search([('approval_state', '=', '2'), ('res_id', '=', self.id), ('node_btn_name', '=', '0')]):
if not self.env['trans.link'].search([('name', '=', ret.name)]):
self.env['trans.link'].create({
@@ -9,6 +9,7 @@ class PropertyBankStatements(models.Model):
name = fields.Char('对方账号')
company_id = fields.Many2one('yuthon.property.company', string="收款账户")
sequence_number = fields.Char('顺序号')
name_account = fields.Char('对方户名')
bank_branch = fields.Char('对方开户机构')
bank_number = fields.Char('对方行号')
@@ -50,11 +50,9 @@
<field name="extract" optional="hide"/>
<field name="account_code" optional="hide"/>
<field name="remake"/>
<field name="registered"/>
<field name="original_amount"/>
<field name="contract_account" optional="hide"/>
<field name="contract_penalty" optional="hide"/>
<field name="property_ids" widget="many2many_tags"/>
<field name="bank_number" optional="hide"/>
<field name="message" optional="hide"/>
<field name="number" optional="hide"/>
@@ -30,63 +30,29 @@ class PropertyStatementsWizard(models.Model):
elif self.selection_bank == 'gs':
self.property_bank_statements_gc_data(row)
def property_bank_statements_jh_data(self, row):
contract_ids = self.env['property.lease.contract']
if row[2].value:
formatted_date = self.convert_date_format(row[2].value)
start_time = pd.to_datetime(formatted_date)
def property_bank_statements_gc_data(self, row):
if row[0].value:
start_time = datetime.strptime(row[0].value, '%Y-%m-%d %H:%M:%S')
else:
start_time = None
if row[10].value:
formatted_date = self.convert_date_format1(row[10].value)
journal_date = pd.to_datetime(formatted_date)
else:
journal_date = None
name = row[8].value
company_id = self.env['yuthon.property.company'].search([('name', '=', row[1].value)])
name_account = row[7].value
voucher_type = row[15].value
voucher_type_dict = {'电子转账凭证': 'electronic_transfer', '电汇凭证': 'telegraphic_transfer'}
voucher_type = voucher_type_dict.get(voucher_type)
remake = row[12].value
original_amount = row[4].value
bank_branch = row[9].value
account_code = row[13].value
number = row[16].value
extract = row[11].value
property_ids = []
name = row[4].value
name_account = row[1].value
remake = row[2].value
original_amount = row[3].value
cleaned_amount = original_amount.replace(',', '') # 移除逗号
float_amount = float(cleaned_amount)
sequence_number = row[5].value
bank_data = {
'name': name,
'contract_ids':[(6, 0, contract_ids.ids)] if contract_ids else [],
'property_ids':[(6, 0, property_ids)],
'company_id': company_id.id,
'original_amount': float_amount,
'sequence_number': sequence_number,
'start_time': start_time,
'name_account': name_account,
'voucher_type': voucher_type,
'original_amount':original_amount,
'journal_date':journal_date,
'bank_branch':bank_branch,
'extract':extract,
'account_code':account_code,
'number':number,
'remake':remake,
}
if float(row[4].value) != 0:
self.env['property.bank.statements'].create(bank_data)
else:
pass
self.env['property.bank.statements'].create(bank_data)
def convert_date_format(self,date_str):
pattern = r'(\d{4})(\d{2})(\d{2}) (\d{2}:\d{2}:\d{2})'
return re.sub(pattern, r'\1/\2/\3 \4', date_str)
def convert_date_format1(self,date_str):
pattern = r'(\d{4})(\d{2})(\d{2})'
return re.sub(pattern, r'\1/\2/\3', date_str)
def property_bank_statements_gc_data(self, row):
def property_bank_statements_jh_data(self, row):
message = row[18].value
if row[2].value:
start_time = pd.to_datetime(row[2].value)
@@ -402,16 +402,6 @@
<button name="button_reconciliation" type="object" string="对账" class="btn btn-primary" invisible="is_reconciliation"/>
</xpath>
</field>
</record>
<record id="inherit_property_bank_statements_tree1" model="ir.ui.view">
<field name="name">property.bank.statements.tree1</field>
<field name="model">property.bank.statements</field>
<field name="inherit_id" ref="yuthon_property.view_property_bank_statements_tree1"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='property_ids']" position="before">
<field name="contract_ids" string="合同编号" widget="many2many_tags"/>
</xpath>
</field>
</record>
<record id="all_data_property_bank_statements" model="ir.actions.server">
<field name="name">批量对账</field>
@@ -19,6 +19,7 @@ class PropertyRentalWizard(models.Model):
first_day_of_month = start_date.replace(day=1)
last_day_of_month = first_day_of_month + relativedelta(months=1) - timedelta(days=1)
rent_id = self.env['property.rent.list'].search([
('contract_id', '=', record.id),
('property_id', '=', property_id),
('due_date', '>=', first_day_of_month),
('due_date', '<=', last_day_of_month)
@@ -63,6 +64,7 @@ class PropertyRentalWizard(models.Model):
property_id = lease_id.address_id
management_id = self.env['property.management.list'].search([
('property_id', '=', property_id.id),
('contract_id', '=', record.id),
('due_date', '>=', first_day_of_month),
('due_date', '<=', last_day_of_month)
])
@@ -141,7 +143,13 @@ class PropertyRentalWizard(models.Model):
date_field_year_month = date_field.strftime('%Y-%m')
for record in records:
days = record.date_payment_month
date_data = {
'five': 5,
'fifteen': 15,
'twentyfive': 25
}
days = date_data.get(record.date_payment_day, 0)
period_month =record.rent_free_period_month if record.rent_free_period_month else 0 # 免租期
#判断是否年
@@ -179,13 +179,8 @@ class HrPayrollStructure(models.Model):
def update_payroll_items(self):
payroll_ids = self.env["hr.payroll.structure"].browse(
self._context.get('active_ids', self._context.get('active_id')))
category_id = self.env['hr.salary.rule.category'].search([('name', '=', '常用项')], limit=1)
category_id = self.env["hr.salary.rule.category"].search([('name', '=', '常用项')])
for payroll in payroll_ids:
self.env['hr.salary.rule'].create({
'name': '质检员津贴',
'code': 'ZJYJT',
'category_id': category_id.id,
'struct_id': payroll.id,
'sequence': 1,
'amount_select': 'fix',
})
for rule in payroll.rule_ids:
if rule.name == '工会会费':
rule.write({'category_id': category_id.id})
+1 -2
View File
@@ -428,8 +428,7 @@ class InheritHrPayslip(models.Model):
"views": [(False, "tree")],
"domain": [("slip_id", "=", self.id), ("amount", "!=", 0)],
"target": "new",
"context": "{'tree_view_ref': 'yuthon_salary.view_hr_payslip_line_tree_custom'}",
'create': False,
"context": "{'tree_view_ref': 'yuthon_salary.view_hr_payslip_line_tree_custom'}, {'group_by': 'category_id'}",
}
def open_record(self):
@@ -495,7 +495,7 @@
<field name="name">薪资明细树形视图</field>
<field name="model">hr.payslip.line</field>
<field name="arch" type="xml">
<tree string="薪资明细">
<tree string="薪资明细" create="false">
<field name="name"/>
<field name="category_id"/>
<field name="amount" widget="monetary"/>