Merge pull request !448 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2024-11-13 10:42:17 +00:00
committed by Gitee
7 changed files with 112 additions and 3 deletions
+2 -1
View File
@@ -6,11 +6,12 @@
'category': 'zhou',
'version': '0.1',
'license': 'LGPL-3',
'depends': ['base','soong_workflow','yuthon_issue','hr','documents','product','mail'],
'depends': ['base', 'soong_workflow', 'yuthon_issue', 'hr', 'documents', 'product', 'mail'],
'data': [
'security/ir.model.access.csv',
'data/sps_approval_code_data.xml',
'views/yuthon_office_supplies_views.xml',
'views/yuthon_office_borrow_views.xml',
]
}
@@ -7,4 +7,11 @@
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
<record id="yuthon_sps_code_sequence1" model="ir.sequence">
<field name="name">办公用品借用编号</field>
<field name="code">yuthon_office_borrow_code</field>
<field name="prefix">BG%(y)s%(month)s%(day)s</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
</odoo>
+1
View File
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from . import yuthon_office_supplies
from . import yuthon_office_borrow
@@ -0,0 +1,31 @@
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="金额")
@@ -3,7 +3,7 @@ from odoo import models, fields, api
class YuthonOfficeSupplies(models.Model):
_name = 'yuthon.office.supplies'
_description = '办公用品申请'
_description = '办公用品借用单'
name = fields.Char(string='标题', required=True)
code = fields.Char(string="编号",
@@ -16,6 +16,8 @@ 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="关联办公用品申请明细")
active = fields.Boolean('Active',default=True,tracking=True)
class YuthonOfficeSuppliesLine(models.Model):
_name = 'yuthon.office.supplies.line'
@@ -1,3 +1,5 @@
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_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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_yuthon_office_supplies yuthon_office_supplies model_yuthon_office_supplies base.group_user 1 1 1 1
3 access_yuthon_office_supplies_line yuthon_office_supplies_line model_yuthon_office_supplies_line base.group_user 1 1 1 1
4 access_yuthon_office_borrow yuthon_office_borrow model_yuthon_office_borrow base.group_user 1 1 1 1
5 access_yuthon_office_borrow_line yuthon_office_borrow_line model_yuthon_office_borrow_line base.group_user 1 1 1 1
@@ -0,0 +1,65 @@
<?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>