콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1409 화면
export function getRelativeDateDomain(now, offset, rangeType, fieldName, fieldType) {
const startOfNextDay = now.plus({ days: 1 }).startOf("day");
let endDate = now.endOf("day");
let startDate = endDate;
switch (rangeType) {
case "year_to_date": {
const offsetParam = { years: offset };
startDate = now.startOf("year").plus(offsetParam);
endDate = now.endOf("day").plus(offsetParam);
break;
}
case "last_week": {
const offsetParam = { days: 7 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 7 }).plus(offsetParam);
break;
}
case "last_month": {
const offsetParam = { days: 30 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 30 }).plus(offsetParam);
break;
}
case "last_three_months": {
const offsetParam = { days: 90 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 90 }).plus(offsetParam);
break;
}
case "last_six_months": {
const offsetParam = { days: 180 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 180 }).plus(offsetParam);
break;
}
case "last_year": {
const offsetParam = { days: 365 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 365 }).plus(offsetParam);
break;
}
case "last_three_years": {
const offsetParam = { days: 3 * 365 * offset };
endDate = endDate.plus(offsetParam);
startDate = startOfNextDay.minus({ days: 3 * 365 }).plus(offsetParam);
break;
}
default:
return undefined;
}

let leftBound, rightBound;
if (fieldType === "date") {
leftBound = serializeDate(startDate);
rightBound = serializeDate(endDate);
} else {
leftBound = serializeDateTime(startDate);
rightBound = serializeDateTime(endDate);
}

return new Domain(["&", [fieldName, ">=", leftBound], [fieldName, "}


I want to inherit this function and modify it to use it. I don't know how to proceed, I tried several methods: patching etc... but nothing

아바타
취소
베스트 답변

Hello soro kader, 


I hope you are doing well.


After research and analysis, I found that the method “getRelativeDateDomain” cannot be inherited. As a solution, you need to replace this function with your custom function at the point where it is called. 

I’ve attached a screenshot for your reference, showing where the “getRelativeDateDomain” method is called from within the Base Odoo Addons.

I Hope this information proves helpful to you.

Thanks & Regards,

Email:   odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari 

아바타
취소
관련 게시물 답글 화면 활동
3
7월 25
2215
1
6월 25
2866
2
5월 25
2182
1
5월 25
1353
1
2월 25
38