feat: hide authorizer for rental orders, auto-set sale type

Rental orders no longer show the "Authorizer Required?" question or
the Authorizer field. The sale type is automatically set to 'Rentals'
when creating or confirming a rental order. Validation logic also
skips authorizer checks for rental sale type.

Made-with: Cursor
This commit is contained in:
gsinghpal
2026-02-25 23:33:23 -05:00
parent 3c8f83b8e6
commit 14fe9ab716
51 changed files with 4192 additions and 822 deletions

View File

@@ -0,0 +1,43 @@
/** @odoo-module **/
import { registry } from "@web/core/registry";
import { Many2ManyBinaryField, many2ManyBinaryField } from "@web/views/fields/many2many_binary/many2many_binary_field";
import { useFileViewer } from "@web/core/file_viewer/file_viewer_hook";
export class InspectionPhotoField extends Many2ManyBinaryField {
setup() {
super.setup();
this.fileViewer = useFileViewer();
}
get viewableFiles() {
return this.files
.filter((f) => this.isImage(f))
.map((f) => ({
name: f.name,
isImage: true,
isViewable: true,
downloadUrl: `/web/content/${f.id}?download=true`,
defaultSource: `/web/image/${f.id}`,
}));
}
onClickImage(fileId) {
const viewable = this.viewableFiles;
const clicked = viewable.find(
(vf) => vf.defaultSource === `/web/image/${fileId}`
);
if (clicked) {
this.fileViewer.open(clicked, viewable);
}
}
}
InspectionPhotoField.template = "fusion_rental.InspectionPhotoField";
export const inspectionPhotoField = {
...many2ManyBinaryField,
component: InspectionPhotoField,
};
registry.category("fields").add("inspection_photos", inspectionPhotoField);