This commit is contained in:
pengyuthon
2026-02-22 10:18:52 +08:00
parent 55ac43a56c
commit c3778f47cb
8 changed files with 92 additions and 11 deletions
@@ -91,10 +91,12 @@ class DiagramPlusView(http.Controller):
'name': n.name,
'x': json.loads(n[d_position_field])['x'],
'y': json.loads(n[d_position_field])['y'],
'sequence': n.sequence
}
else:
isolate_nodes[n.id] = {
'name': n.name,
'sequence': n.sequence
}
if not nodes:
init_view = True
@@ -75,7 +75,7 @@ export class DiagramPlusRenderer extends Component {
// FIXME the +50 should be in the layout algorithm
node.x + self.diagram_offset,
node.y + self.diagram_offset,
CuteGraphPlus_wordwrap(node.name, 14),
CuteGraphPlus_wordwrap(`${node.sequence}-${node.name}`, 14),
node.shape === 'rectangle' ? 'rect' : 'circle',
node.color === 'white' || node.color === 'gray'
? style[node.color] : node.color,
@@ -12,6 +12,10 @@ import { usePosition } from "@web/core/position_hook";
patch(ListController.prototype, {
setup() {
super.setup();
const { defaultOrder } = this.archInfo;
if (defaultOrder.length) {
this.props.orderBy = defaultOrder;
}
this.isChange = false;
this.orm = useService('orm');
this.ooColumnsRef = useRef('ooColumnsRef');
@@ -96,6 +100,16 @@ patch(ListController.prototype, {
})
useExternalListener(window, "click", this.onGlobalClick.bind(this));
},
get modelParams() {
const params = super.modelParams;
const { defaultOrder } = this.archInfo;
if (defaultOrder.length) {
params.config.orderBy = defaultOrder;
}
return params
},
onGlobalClick(ev) {
if (this.ooListRef.el && !this.ooListRef.el.contains(ev.target)) {
this.ooManager.state = false;
@@ -206,11 +206,11 @@
}
}
}
.sh_backmate_theme_appmenu_div.o_navbar_apps_menu {
.logo {
display: none !important;
}
}
//.sh_backmate_theme_appmenu_div.o_navbar_apps_menu {
// .logo {
// display: none !important;
// }
//}
.sh_backmate_theme_appmenu_div.o_navbar_apps_menu {
.o-dropdown--menu.dropdown-menu.d-block {
width: 0 !important;
@@ -214,7 +214,7 @@
<div class="o_menu_systray d-flex flex-shrink-0 ms-auto" role="menu">
<t t-foreach="systrayItems" t-as="item" t-key="item.key">
<div t-att-data-index="item.index"/>
<ErrorHandler onError="error => this.handleItemError(error, item)" t-if="!this.env.isSmall">
<ErrorHandler onError="error => this.handleItemError(error, item)">
<t t-component="item.Component" t-props="item.props"/>
</ErrorHandler>
</t>
@@ -392,6 +392,10 @@
<span>紧急度:</span>
<field name="urgency_level"/>
</div>
<div>
<span>流程状态:</span>
<field name="approve_state"/>
</div>
</div>
<div class="o_kanban_record_bottom">
<button class="btn btn-primary" type="object" name="open_record">
+62 -1
View File
@@ -1,5 +1,9 @@
from odoo import fields, models, api
import logging
from odoo import api, fields, models
from odoo.addons.web.models.models import Base
from odoo.osv.expression import AND
_logger = logging.getLogger(__name__)
class IrModelFields(models.Model):
_inherit = 'ir.model.fields'
@@ -20,3 +24,60 @@ class UsersHomeBatchWizard(models.TransientModel):
def confirm(self):
for user in self.user_ids:
user.write({'action_id': self.action_id.id})
class InheritBase(models.AbstractModel):
_inherit = 'base'
@api.model
def web_search_read(self, domain, specification, offset=0, limit=None, order=None, count_limit=None):
if default_order := self._context.get('default_order'):
new_order = default_order
try:
res = super().web_search_read(domain, specification, offset, limit, new_order, count_limit)
return res
except Exception as e:
_logger.warning(e)
return super().web_search_read(domain, specification, offset, limit, order, count_limit)
return super().web_search_read(domain, specification, offset, limit, order, count_limit)
@api.model
def _new_search_panel_domain_image(self, field_name, domain, set_count=False, limit=False):
""" 重写增加根据selection的定义顺序返回search_panel筛选结果
"""
field = self._fields[field_name]
if field.type == 'many2one':
def group_id_name(value):
return value
else:
# field type is selection: see doc above
desc = self.fields_get([field_name])[field_name]
field_name_selection = dict(desc['selection'])
def group_id_name(value):
return value, field_name_selection[value]
domain = AND([
domain,
[(field_name, '!=', False)],
])
groups = self.read_group(domain, [field_name], [field_name], limit=limit)
domain_image = {}
for group in groups:
id, display_name = group_id_name(group[field_name])
values = {
'id': id,
'display_name': display_name,
}
if set_count:
values['__count'] = group[field_name + '_count']
domain_image[id] = values
if field.type == 'selection':
sorted_domain_image = dict(sorted(domain_image.items(), key=lambda x: list(field_name_selection.keys()).index(x[0])))
return sorted_domain_image
return domain_image
Base._search_panel_domain_image = _new_search_panel_domain_image
@@ -149,7 +149,7 @@ class PropertyLeaseContract(models.Model):
term_end_time = fields.Date(string="合约结束时间")
actual_start_time = fields.Date(string="实际开始时间")
actual_end_time = fields.Date(string="实际结束时间")
end_comparison = fields.Selection([('red', '红'),('yellow', '黄'),('blue', '蓝')], string="结束时间对比(颜色)", compute='_compute_end_comparison', store=True)
end_comparison = fields.Selection([('red', '红'), ('yellow', '黄'), ('blue', '蓝')], string="结束时间对比(颜色)", compute='_compute_end_comparison', store=True)
expiration_coming = fields.Selection([('coming', '即将到期'), ('due', '已到期')], string="结束时间对比(状态)", compute='_compute_expiration_coming', store=True)
is_equal = fields.Boolean(string="是否相等", compute='_compute_end_comparison', store=True)
is_has = fields.Boolean(string='已退押金', compute="compute_is_has")
@@ -1030,11 +1030,11 @@ class PropertyLeaseContract(models.Model):
record.end_comparison = None
@api.depends('actual_end_time')
def compute_expiration_coming(self):
def _compute_expiration_coming(self):
for record in self:
if record.actual_end_time:
delta = record.actual_end_time - date.today()
if 0< delta.days < 90:
if 0 < delta.days < 90:
record.expiration_coming = 'coming'
elif delta.days <=0:
record.expiration_coming = 'due'