31 lines
1.8 KiB
Python
31 lines
1.8 KiB
Python
from odoo import models, fields, api, exceptions, _
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class PropertyProjectWorks(models.Model):
|
|
_name = 'property.project.works'
|
|
_description = '项目工程'
|
|
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
|
|
|
|
name = fields.Char(string="工程名称", required=True)
|
|
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_project_works_code'))
|
|
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="部门")
|
|
process_links = fields.Selection([('entrusted', '委托'), ('design', '设计'), ('cost', '造价'), ('design_cost', '设计造价'),
|
|
('construction', '施工'), ('supervision', '监理'), ('acceptance', '验收')], string='流程环节')
|
|
signing_date = fields.Date(string="签订日期")
|
|
acceptance_date = fields.Date(string="验收日期")
|
|
total = fields.Float(string="总金额")
|
|
coping = fields.Float(string="应付")
|
|
paid = fields.Float(string="已付")
|
|
not_paid = fields.Float(string="未付")
|
|
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
|
|
default='normal')
|
|
active = fields.Boolean('Active', default=True, tracking=True)
|
|
work_end = fields.Boolean(string="结束")
|
|
|
|
def _get_default_name_title(self):
|
|
return self._description if self._description else self._name
|
|
|
|
name_title = fields.Char(default=_get_default_name_title)
|
|
self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) |