Merge branch 'dev' of https://gitee.com/jinan-pengyusen-data/gzth into dev_wang
This commit is contained in:
@@ -51,6 +51,11 @@ function forceMobileBarVisible(container) {
|
||||
container.style.setProperty('pointer-events', 'auto', 'important');
|
||||
}
|
||||
|
||||
function shouldUseMobileBar() {
|
||||
if (typeof window === 'undefined') return false;
|
||||
return window.matchMedia('(max-width: 767.98px)').matches;
|
||||
}
|
||||
|
||||
function applyWorkflowButtonPaint(button) {
|
||||
for (const [cls, bg, fg] of WORKFLOW_BUTTON_STYLES) {
|
||||
if (button.classList.contains(cls)) {
|
||||
@@ -104,10 +109,18 @@ patch(StatusBarButtons, {
|
||||
try {
|
||||
const mobileContainers = document.querySelectorAll('.o_statusbar_buttons_mobile_fixed');
|
||||
if (mobileContainers.length === 0) return;
|
||||
const useMobileBar = shouldUseMobileBar();
|
||||
|
||||
mobileContainers.forEach(container => {
|
||||
try {
|
||||
forceMobileBarVisible(container);
|
||||
if (useMobileBar) {
|
||||
forceMobileBarVisible(container);
|
||||
} else {
|
||||
container.style.setProperty('display', 'none', 'important');
|
||||
container.style.setProperty('visibility', 'hidden', 'important');
|
||||
container.style.setProperty('opacity', '0', 'important');
|
||||
return;
|
||||
}
|
||||
|
||||
// 同时修复容器内的按钮
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
@@ -178,7 +191,11 @@ patch(StatusBarButtons, {
|
||||
try {
|
||||
const desktopButtons = document.querySelectorAll('.o_form_statusbar > .o_statusbar_buttons:not(.o_statusbar_buttons_mobile_fixed .o_statusbar_buttons)');
|
||||
desktopButtons.forEach(btn => {
|
||||
btn.style.setProperty('display', 'none', 'important');
|
||||
if (useMobileBar) {
|
||||
btn.style.setProperty('display', 'none', 'important');
|
||||
} else {
|
||||
btn.style.removeProperty('display');
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('Error hiding desktop buttons in setup:', e);
|
||||
@@ -232,8 +249,14 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
|
||||
containers.forEach(container => {
|
||||
try {
|
||||
// 无条件强制底栏可见,避免主题在特定机型上把栏绘制成透明
|
||||
forceMobileBarVisible(container);
|
||||
if (shouldUseMobileBar()) {
|
||||
forceMobileBarVisible(container);
|
||||
} else {
|
||||
container.style.setProperty('display', 'none', 'important');
|
||||
container.style.setProperty('visibility', 'hidden', 'important');
|
||||
container.style.setProperty('opacity', '0', 'important');
|
||||
return;
|
||||
}
|
||||
|
||||
// 修复按钮的交互性和可见性
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
@@ -306,7 +329,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
});
|
||||
|
||||
// 在移动设备上,确保原始状态栏中的按钮被隐藏
|
||||
if (isMobileDevice()) {
|
||||
if (shouldUseMobileBar()) {
|
||||
try {
|
||||
const desktopButtons = document.querySelectorAll('.o_form_statusbar > .o_statusbar_buttons:not(.o_statusbar_buttons_mobile_fixed .o_statusbar_buttons)');
|
||||
desktopButtons.forEach(btn => {
|
||||
@@ -386,7 +409,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
}, { passive: true });
|
||||
|
||||
// 定期检查按钮是否可见(防止被其他样式覆盖)
|
||||
if (isMobileDevice()) {
|
||||
if (shouldUseMobileBar()) {
|
||||
// 延迟启动定时器,避免影响页面加载
|
||||
setTimeout(() => {
|
||||
checkInterval = setInterval(() => {
|
||||
|
||||
@@ -166,15 +166,6 @@ class HrContract(models.Model):
|
||||
end_valid = not contract.date_end or contract.date_end >= today
|
||||
contract.current_contract = start_valid and end_valid
|
||||
|
||||
@api.onchange("date_start")
|
||||
def _onchange_date_end(self):
|
||||
for record in self:
|
||||
if record.date_start:
|
||||
record.employee_id.entry_date = record.date_start
|
||||
record.date_end = (
|
||||
record.date_start + relativedelta(years=1) - relativedelta(days=1)
|
||||
)
|
||||
|
||||
@api.onchange("contract_type_id")
|
||||
def _onchange_contract_type_id(self):
|
||||
for record in self:
|
||||
@@ -192,12 +183,6 @@ class HrContract(models.Model):
|
||||
- relativedelta(days=1)
|
||||
)
|
||||
|
||||
@api.onchange("date_start")
|
||||
def _onchange_date_start(self):
|
||||
for record in self:
|
||||
if record.date_start and record.state == "open" and record.employee_id:
|
||||
record.employee_id.entry_date = record.date_start
|
||||
|
||||
def renew(self):
|
||||
contract_ids = self.env["hr.contract"].browse(
|
||||
self._context.get("active_ids", self._context.get("active_id"))
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
<field name="update_type" readonly="0"/>
|
||||
<field name="update_date" readonly="0"/>
|
||||
<field name="update_lines"/>
|
||||
<field name="valid_date"/>
|
||||
<field name="valid_date" column_invisible="1"/>
|
||||
<field name="adjust_date"/>
|
||||
<field name="allocation_type" optional="hide"/>
|
||||
<field name="is_void"/>
|
||||
@@ -285,7 +285,7 @@
|
||||
<field name="workday"/>
|
||||
<field name="legal_day"/>
|
||||
<field name="public_holidays"/>
|
||||
<field name="valid_date"/>
|
||||
<field name="valid_date" column_invisible="1"/>
|
||||
<field name="adjust_date"/>
|
||||
<field name="meal_number" column_invisible="1"/>
|
||||
<field name="overtime_methods"/>
|
||||
|
||||
Reference in New Issue
Block a user