@@ -10,8 +10,9 @@
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/sps_approval_code_data.xml',
|
||||
'views/inherit_hr_employee_views.xml',
|
||||
'views/yuthon_office_supplies_views.xml',
|
||||
'views/yuthon_office_borrow_views.xml',
|
||||
'views/yuthon_office_supplies_setting_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import yuthon_office_supplies
|
||||
from . import yuthon_office_borrow
|
||||
from . import yuthon_office_supplies_setting
|
||||
from . import inherit_hr_employee
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class YuthonHrEmployee(models.Model):
|
||||
_inherit = "hr.employee"
|
||||
|
||||
office_supplies_ids = fields.One2many('yuthon.office.supplies.line', 'employee_id', string="办公用品明细行")
|
||||
|
||||
|
||||
class YuthonOfficeSuppliesLine(models.Model):
|
||||
_name = 'yuthon.office.supplies.line'
|
||||
_description = "办公用品明细行"
|
||||
|
||||
employee_id = fields.Many2one('hr.employee', string="关联员工")
|
||||
product_id = fields.Many2one('product.product', string="办公用品")
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
amount = fields.Float(string="金额")
|
||||
@@ -1,31 +0,0 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class YuthonOfficeBorrow(models.Model):
|
||||
_name = 'yuthon.office.borrow'
|
||||
_description = '办公用品借用单'
|
||||
|
||||
name = fields.Char(string='标题', required=True)
|
||||
code = fields.Char(string="编号",
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_office_borrow_code'))
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
department_id = fields.Many2one('hr.department', string="部门", related='users_id.employee_id.department_id')
|
||||
reason_application = fields.Html(string="事由")
|
||||
date = fields.Date(string="申请日期", default=fields.Date.today())
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
|
||||
yuthon_office_borrow_line_ids = fields.One2many('yuthon.office.borrow.line', 'borrow_id', string="关联办公用品申请明细")
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
|
||||
|
||||
class YuthonOfficeBorrowLine(models.Model):
|
||||
_name = 'yuthon.office.borrow.line'
|
||||
_description = '办公用品申请明细'
|
||||
|
||||
borrow_id = fields.Many2one('yuthon.office.borrow', string="关联办公用品申请")
|
||||
name = fields.Many2one('product.product', string="办公用品")
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
amount = fields.Float(string="金额")
|
||||
|
||||
@@ -16,16 +16,55 @@ class YuthonOfficeSupplies(models.Model):
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
yuthon_company = fields.Selection(related='users_id.employee_id.yuthon_company', string="公司")
|
||||
yuthon_office_supplies_line_ids = fields.One2many('yuthon.office.supplies.line', 'supplies_id', string="关联办公用品申请明细")
|
||||
yuthon_office_borrow_line_ids = fields.One2many('yuthon.office.borrow.line', 'supplies_id', string="关联办公用品借用明细")
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
office_supplies_id = fields.Many2one('yuthon.office.supplies.setting',string="办公用品")
|
||||
|
||||
@api.onchange('office_supplies_id')
|
||||
def _onchange_office_supplies(self):
|
||||
supplies_setting_line_ids = self.office_supplies_id.supplies_setting_line_ids
|
||||
supplies_borrow_line_ids = self.office_supplies_id.supplies_borrow_line_ids
|
||||
|
||||
new_supplies_lines = []
|
||||
for supplies_setting in supplies_setting_line_ids:
|
||||
new_supplies_lines.append((0, 0, {
|
||||
'product_id': supplies_setting.product_id.id,
|
||||
'number': supplies_setting.number,
|
||||
'price': supplies_setting.price,
|
||||
'total': supplies_setting.total,
|
||||
}))
|
||||
self.yuthon_office_supplies_line_ids = new_supplies_lines
|
||||
|
||||
new_borrow_lines = []
|
||||
for supplies_borrow in supplies_borrow_line_ids:
|
||||
new_borrow_lines.append((0, 0, {
|
||||
'product_id': supplies_borrow.product_id.id,
|
||||
'number': supplies_borrow.number,
|
||||
'price': supplies_borrow.price,
|
||||
'total': supplies_borrow.total,
|
||||
'start_time': supplies_borrow.start_time,
|
||||
'end_time': supplies_borrow.end_time,
|
||||
}))
|
||||
self.yuthon_office_borrow_line_ids = new_borrow_lines
|
||||
|
||||
class YuthonOfficeSuppliesLine(models.Model):
|
||||
_name = 'yuthon.office.supplies.line'
|
||||
_description = '办公用品申请明细'
|
||||
|
||||
supplies_id = fields.Many2one('yuthon.office.supplies', string="关联办公用品申请")
|
||||
name = fields.Many2one('product.product', string="办公用品")
|
||||
product_id = fields.Many2one('product.product', string="办公用品")
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
amount = fields.Float(string="金额")
|
||||
|
||||
class YuthonOfficeBorrowLine(models.Model):
|
||||
_name = 'yuthon.office.borrow.line'
|
||||
_description = '办公用品借用明细'
|
||||
|
||||
supplies_id = fields.Many2one('yuthon.office.supplies', string="关联办公用品申请")
|
||||
product_id = fields.Many2one('product.product', string="办公用品")
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
start_time = fields.Date(string="借用时间")
|
||||
end_time = fields.Date(string="归还时间")
|
||||
amount = fields.Float(string="金额")
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class YuthonOfficeSuppliesSetting(models.Model):
|
||||
_name = 'yuthon.office.supplies.setting'
|
||||
_description = '办公用品套餐配置'
|
||||
|
||||
name = fields.Char(string='名称')
|
||||
supplies_setting_line_ids = fields.One2many('office.supplies.setting.line', 'supplies_setting_id', string='关联明细')
|
||||
supplies_borrow_line_ids = fields.One2many('office.supplies.borrow.line', 'supplies_setting_id', string='关联明细')
|
||||
|
||||
class OfficeSuppliesSettingLine(models.Model):
|
||||
_name = 'office.supplies.setting.line'
|
||||
_description = '办公用品申用套餐配置明细'
|
||||
|
||||
supplies_setting_id = fields.Many2one('yuthon.office.supplies.setting', string='关联办公用品套餐配置')
|
||||
product_id = fields.Many2one('product.product', string='办公用品')
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
amount = fields.Float(string="金额")
|
||||
|
||||
class OfficeSuppliesBorrowLine(models.Model):
|
||||
_name = 'office.supplies.borrow.line'
|
||||
_description = '办公用品申用明细'
|
||||
|
||||
supplies_setting_id = fields.Many2one('yuthon.office.supplies.setting', string='关联办公用品套餐配置')
|
||||
product_id = fields.Many2one('product.product', string='办公用品')
|
||||
number = fields.Integer(string="数量")
|
||||
price = fields.Float(string="单价")
|
||||
amount = fields.Float(string="金额")
|
||||
start_time = fields.Date(string="借用时间")
|
||||
end_time = fields.Date(string="归还时间")
|
||||
@@ -1,5 +1,7 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_yuthon_office_supplies,yuthon_office_supplies,model_yuthon_office_supplies,base.group_user,1,1,1,1
|
||||
access_yuthon_office_supplies_line,yuthon_office_supplies_line,model_yuthon_office_supplies_line,base.group_user,1,1,1,1
|
||||
access_yuthon_office_borrow,yuthon_office_borrow,model_yuthon_office_borrow,base.group_user,1,1,1,1
|
||||
access_yuthon_office_borrow_line,yuthon_office_borrow_line,model_yuthon_office_borrow_line,base.group_user,1,1,1,1
|
||||
access_yuthon_office_borrow_line,yuthon_office_borrow_line,model_yuthon_office_borrow_line,base.group_user,1,1,1,1
|
||||
access_yuthon_office_supplies_setting,yuthon_office_supplies_setting,model_yuthon_office_supplies_setting,base.group_user,1,1,1,1
|
||||
access_office_supplies_setting_line,office_supplies_setting_line,model_office_supplies_setting_line,base.group_user,1,1,1,1
|
||||
access_office_supplies_borrow_line,office_supplies_borrow_line,model_office_supplies_borrow_line,base.group_user,1,1,1,1
|
||||
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_employee_inherit_sps_form" model="ir.ui.view">
|
||||
<field name="name">hr.employee.inherit.sps.form</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||
<xpath expr="//page[@name='education']" position="after">
|
||||
<page string="办公用品">
|
||||
<field name="office_supplies_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="employee_id" column_invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_office_borrow_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.office.borrow.tree</field>
|
||||
<field name="model">yuthon.office.borrow</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="办公用品借用">
|
||||
<field name="name"/>
|
||||
<field name="users_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="yuthon_company"/>
|
||||
<field name="date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_office_borrow_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.office.borrow.form</field>
|
||||
<field name="model">yuthon.office.borrow</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="办公用品借用">
|
||||
<sheet>
|
||||
<group string="申请人信息" col="3">
|
||||
<group>
|
||||
<field name="users_id"/>
|
||||
<field name="code"/>
|
||||
<field name="is_issues" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="yuthon_company"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="审批事项">
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="reason_application"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="办公用品借用明细">
|
||||
<field name="yuthon_office_borrow_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="borrow_id" column_invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="关联议题" invisible="not is_issues">
|
||||
<field name="related_issues_id"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_office_borrow_action" model="ir.actions.act_window">
|
||||
<field name="name">办公用品借用</field>
|
||||
<field name="res_model">yuthon.office.borrow</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_office_supplies_setting_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.office.supplies.setting.tree</field>
|
||||
<field name="model">yuthon.office.supplies.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="办公用品套餐配置">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_office_supplies_setting_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.office.supplies.setting.form</field>
|
||||
<field name="model">yuthon.office.supplies.setting</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="办公用品套餐配置">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name"/>
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
</div>
|
||||
<notebook>
|
||||
<page string="办公用品申请套餐">
|
||||
<field name="supplies_setting_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="supplies_setting_id" column_invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="办公用品借用套餐">
|
||||
<field name="supplies_borrow_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="supplies_setting_id" column_invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_yuthon_office_supplies_setting_action" model="ir.actions.act_window">
|
||||
<field name="name">办公用品设置</field>
|
||||
<field name="res_model">yuthon.office.supplies.setting</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -27,6 +27,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="department_id"/>
|
||||
<field name="office_supplies_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="yuthon_company"/>
|
||||
@@ -42,13 +43,26 @@
|
||||
<field name="yuthon_office_supplies_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="supplies_id" column_invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="办公用品借用明细">
|
||||
<field name="yuthon_office_borrow_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="supplies_id" column_invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="number"/>
|
||||
<field name="price"/>
|
||||
<field name="amount"/>
|
||||
<field name="start_time"/>
|
||||
<field name="end_time"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="关联议题" invisible="not is_issues">
|
||||
<field name="related_issues_id"/>
|
||||
</page>
|
||||
|
||||
@@ -159,11 +159,6 @@
|
||||
parent="hr_menu_recruitment_process"
|
||||
action="yuthon_sps_approval.view_yuthon_office_supplies_action"
|
||||
sequence="12"/>
|
||||
<menuitem id="yuthon_office_borrow_root_board"
|
||||
name="办公用品借用"
|
||||
parent="hr_menu_recruitment_process"
|
||||
action="yuthon_sps_approval.view_yuthon_office_borrow_action"
|
||||
sequence="15"/>
|
||||
<menuitem id="hr_recruitment_setting_menu_board"
|
||||
name="配置"
|
||||
parent="hr_recruitment_menu_root_board"
|
||||
@@ -208,7 +203,11 @@
|
||||
parent="hr_recruitment_setting_menu_board"
|
||||
action="hr_recruitment.hr_applicant_refuse_reason_action"
|
||||
sequence="13"/>
|
||||
|
||||
<menuitem id="hr_office_supplies_setting_board"
|
||||
name="办公用品设置"
|
||||
parent="hr_recruitment_setting_menu_board"
|
||||
action="yuthon_sps_approval.view_yuthon_office_supplies_setting_action"
|
||||
sequence="17"/>
|
||||
<!-- 人事 -->
|
||||
<menuitem id="hr_menu_root_board"
|
||||
name="人事管理"
|
||||
@@ -578,7 +577,7 @@
|
||||
action="hr_payroll.action_view_hr_payroll_structure_list_form"
|
||||
sequence="3"/>
|
||||
<menuitem id="human_pay_setting_type_rules_root_board"
|
||||
name="规则"
|
||||
name="工资项"
|
||||
parent="human_pay_setting_type_root_board"
|
||||
action="hr_payroll.action_salary_rule_form"
|
||||
sequence="5"/>
|
||||
|
||||
Reference in New Issue
Block a user