1
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding:utf-8 -*-
|
||||
# @FileName :__init__.py.py
|
||||
# @Time :2025/1/12 下午2:30
|
||||
# @Author :zzw
|
||||
from . import planning_slot
|
||||
from . import resource_resource
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding:utf-8 -*-
|
||||
# @FileName :planning_slot.py
|
||||
# @Time :2025/1/12 下午3:18
|
||||
# @Author :zzw
|
||||
from odoo import models, fields, api, _
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
class TxPlanningSlot(models.Model):
|
||||
_inherit = "planning.slot"
|
||||
_order = 'resource_id'
|
||||
|
||||
@api.model
|
||||
@api.returns('self')
|
||||
def search_fetch(self, domain, field_names, offset=0, limit=None, order=None):
|
||||
if self._context.get('show_job_title', False):
|
||||
if not order:
|
||||
order = 'resource_id'
|
||||
return super().search_fetch(domain, field_names, offset, limit, order)
|
||||
|
||||
def web_read(self, specification: Dict[str, Dict]) -> List[Dict]:
|
||||
res = super().web_read(specification)
|
||||
if self._context.get('show_job_title', False):
|
||||
if res and res[0].get('resource_id', {}).get('id'):
|
||||
data_list = [r.get('resource_id', {}).get('id') for r in res if r.get('resource_id', {})]
|
||||
self.env['resource.resource'].search([('id', 'in', data_list)], order="sequence,name")
|
||||
return res
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding:utf-8 -*-
|
||||
# @FileName :resource_resource.py
|
||||
# @Time :2025/1/12 下午2:43
|
||||
# @Author :zzw
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class TxResourceResource(models.Model):
|
||||
_inherit = "resource.resource"
|
||||
_order = "sequence,name"
|
||||
|
||||
sequence = fields.Integer(string='Sequence', default=10)
|
||||
Reference in New Issue
Block a user