添加功能
This commit is contained in:
@@ -58,6 +58,15 @@ class InheritMaintenanceEquipment(models.Model):
|
||||
equipment_approval_line_ids = fields.One2many('maintenance.equipment.line', 'maintenance_equipment_id',
|
||||
string='关联流程')
|
||||
|
||||
def add_office_supplies(self):
|
||||
maintenance_ids = self.env["maintenance.equipment"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
for maintenance in maintenance_ids:
|
||||
self.env['product.template'].create({
|
||||
'name': maintenance.name,
|
||||
'uom_id': maintenance.equipment_unit.id,
|
||||
'is_fixed_assets': True,
|
||||
})
|
||||
|
||||
|
||||
class MaintenanceEquipmentLine(models.Model):
|
||||
_name = 'maintenance.equipment.line'
|
||||
|
||||
@@ -168,4 +168,11 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="all_fixed_assets" model="ir.actions.server">
|
||||
<field name="name">固定资产</field>
|
||||
<field name="model_id" ref="yuthon_maintain.model_maintenance_equipment"/>
|
||||
<field name="binding_model_id" ref="yuthon_maintain.model_maintenance_equipment"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.add_office_supplies()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -69,7 +69,7 @@ class PropertyLeaseContract(models.Model):
|
||||
rent_company = fields.Char(related='lessor_id.name', string="收租公司名称")
|
||||
rent_account = fields.Char(related='lessor_id.rent_account', string="收租公司账号")
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门", store=True)
|
||||
department_id = fields.Many2one('hr.department', string="部门", store=True, compute='_compute_department_id')
|
||||
company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司")
|
||||
# 承租方的个人信息
|
||||
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
|
||||
@@ -220,6 +220,11 @@ class PropertyLeaseContract(models.Model):
|
||||
reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count')
|
||||
process_count = fields.Integer(string="流程数量", compute='_compute_process_count')
|
||||
|
||||
@api.depends('users_id')
|
||||
def _compute_department_id(self):
|
||||
for record in self:
|
||||
record.department_id = record.users_id.employee_ids.department_id.id
|
||||
|
||||
def _compute_contract_count(self):
|
||||
for record in self:
|
||||
record.contract_count = self.env['property.accounts.receivable'].search_count([('contract_id', '=', record.id)])
|
||||
@@ -280,7 +285,7 @@ class PropertyLeaseContract(models.Model):
|
||||
if rec.lease_ids:
|
||||
rec.admin_id = rec.lease_ids[0].admin_line_id.id
|
||||
|
||||
@api.depends('lease_ids')
|
||||
@api.depends("lease_ids")
|
||||
def _compute_lease_ids(self):
|
||||
for rec in self:
|
||||
# 初始化值
|
||||
@@ -329,6 +334,8 @@ class PropertyLeaseContract(models.Model):
|
||||
rec.water_fee_ids = water_fee_values
|
||||
if electricity_fee_values:
|
||||
rec.electricity_fee_ids = electricity_fee_values
|
||||
rec.admin_id = rec.lease_ids[0].admin_line_id.id
|
||||
rec.users_id = rec.lease_ids[0].admin_line_id.id
|
||||
|
||||
|
||||
@api.depends(
|
||||
@@ -1217,9 +1224,7 @@ class PropertyLeaseContract(models.Model):
|
||||
def action_update_contract(self):
|
||||
contract_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in contract_ids:
|
||||
record.write({
|
||||
'condition':'new',
|
||||
})
|
||||
record._compute_department_id()
|
||||
|
||||
@api.constrains("contract_code")
|
||||
def _check_contract_code(self):
|
||||
|
||||
@@ -925,13 +925,13 @@
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.disposable_button()</field>
|
||||
</record>
|
||||
<!-- <record id="all_data_action_update_state" model="ir.actions.server">-->
|
||||
<!-- <field name="name">更新状态</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
<!-- <field name="state">code</field>-->
|
||||
<!-- <field name="code">action = model.action_update_contract()</field>-->
|
||||
<!-- </record>-->
|
||||
<record id="all_data_action_update_state" model="ir.actions.server">
|
||||
<field name="name">更新状态</field>
|
||||
<field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="binding_model_id" ref="yuthon_property_approval.model_property_lease_contract"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = model.action_update_contract()</field>
|
||||
</record>
|
||||
<!-- <record id="all_data_action_update_rent" model="ir.actions.server">-->
|
||||
<!-- <field name="name">更新租金明细</field>-->
|
||||
<!-- <field name="model_id" ref="yuthon_property_approval.model_property_lease_contract"/>-->
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
'data/sps_approval_code_data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/inherit_hr_employee_views.xml',
|
||||
'views/inherit_product_template.xml',
|
||||
'views/yuthon_office_supplies_views.xml',
|
||||
'views/yuthon_office_supplies_setting_views.xml',
|
||||
],
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
from odoo import api, fields, models
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
is_fixed_assets = fields.Boolean(string='是否固定资产', default=True)
|
||||
|
||||
@api.onchange('is_fixed_assets')
|
||||
def _onchange_fixed_assets(self):
|
||||
if not self.is_fixed_assets and self._origin.is_fixed_assets:
|
||||
related_equipments = self.env['maintenance.equipment'].search([
|
||||
('name', '=', self.name)
|
||||
])
|
||||
if related_equipments:
|
||||
raise UserError('该产品已关联设备,请先删除固定资产')
|
||||
|
||||
def update_company_id(self):
|
||||
template_ids = self.env["product.template"].browse(self._context.get('active_ids', self._context.get('active_id')))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_product_template_inherit_sps_form" model="ir.ui.view">
|
||||
<field name="name">product.template.inherit.sps.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='uom_po_id']" position="after">
|
||||
<field name="is_fixed_assets"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -134,11 +134,6 @@
|
||||
action="yuthon_maintain.view_yuthon_maintain_desktop_action"
|
||||
name="桌面"
|
||||
sequence="5"/>
|
||||
<menuitem id="yuthon_maintain_service_menu_brand"
|
||||
parent="yuthon_maintenance_equipment_menu_brand"
|
||||
action="yuthon_maintain.view_yuthon_maintain_service_action"
|
||||
name="服务"
|
||||
sequence="10"/>
|
||||
<!--配置-->
|
||||
<menuitem id="yuthon_software_issues_setting_brand"
|
||||
parent="maintenance.menu_maintenance_configuration"
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
parent="purchase_menus_root_board"
|
||||
sequence="5"/>
|
||||
<menuitem id="purchase_fixed_root"
|
||||
name="固定资产"
|
||||
name="办公用品"
|
||||
parent="purchase_assets_root"
|
||||
action="purchase.product_normal_action_puchased"
|
||||
sequence="1"/>
|
||||
<menuitem id="purchase_assets_equipment_root"
|
||||
name="设备"
|
||||
name="固定资产"
|
||||
parent="purchase_assets_root"
|
||||
action="maintenance.hr_equipment_action"
|
||||
sequence="5"/>
|
||||
|
||||
Reference in New Issue
Block a user