mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update misc
This commit is contained in:
@@ -78,7 +78,6 @@
|
||||
'app_odoo_customize/static/src/js/user_menu.js',
|
||||
'app_odoo_customize/static/src/js/ribbon.js',
|
||||
'app_odoo_customize/static/src/js/dialog.js',
|
||||
'app_odoo_customize/static/src/js/web_dialog_size.js',
|
||||
'app_odoo_customize/static/src/webclient/*.js',
|
||||
'app_odoo_customize/static/src/webclient/*.xml',
|
||||
'app_odoo_customize/static/src/xml/res_config_edition.xml',
|
||||
|
||||
@@ -1,92 +1,18 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Dialog } from "@web/core/dialog/dialog";
|
||||
import {ActionDialog} from "@web/webclient/actions/action_dialog";
|
||||
import {Component, onMounted} from "@odoo/owl";
|
||||
import {SelectCreateDialog} from "@web/views/view_dialogs/select_create_dialog";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { session } from "@web/session";
|
||||
|
||||
export class ExpandButton extends Component {
|
||||
setup() {
|
||||
this.last_size = this.props.getsize();
|
||||
}
|
||||
|
||||
dialog_button_extend() {
|
||||
this.props.setsize("dialog_full_screen");
|
||||
this.render();
|
||||
}
|
||||
|
||||
dialog_button_restore() {
|
||||
this.props.setsize(this.last_size);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
ExpandButton.template = "app_odoo_customize.ExpandButton";
|
||||
|
||||
Object.assign(ActionDialog.components, {ExpandButton});
|
||||
SelectCreateDialog.components = Object.assign(SelectCreateDialog.components || {}, {
|
||||
ExpandButton,
|
||||
});
|
||||
Dialog.components = Object.assign(Dialog.components || {}, {ExpandButton});
|
||||
// Patch annoying validation method
|
||||
Dialog.props.size.validate = (s) => ["sm", "md", "lg", "xl", "dialog_full_screen"].includes(s);
|
||||
|
||||
//处理 owl patch
|
||||
patch(Dialog.prototype, "app_odoo_customize.Dialog", {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
const app_system_name = session.app_system_name || "odooApp";
|
||||
this.title = app_system_name;
|
||||
this.setSize = this.setSize.bind(this);
|
||||
this.getSize = this.getSize.bind(this);
|
||||
|
||||
owl.onMounted(() => {
|
||||
this.setDrag();
|
||||
});
|
||||
},
|
||||
|
||||
setSize(size) {
|
||||
this.props.size = size;
|
||||
this.render();
|
||||
},
|
||||
|
||||
getSize() {
|
||||
return this.props.size;
|
||||
},
|
||||
|
||||
setDrag() {
|
||||
var $dl = $('#' + this.id + ' .modal-dialog .modal-content');
|
||||
if ($dl)
|
||||
$dl.draggable({
|
||||
handle: ".modal-header"
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
patch(SelectCreateDialog.prototype, "app_odoo_customize.SelectCreateDialog", {
|
||||
setup() {
|
||||
this._super.apply(this, arguments);
|
||||
const app_system_name = session.app_system_name || "odooApp";
|
||||
this.title = app_system_name;
|
||||
this.setSize = this.setSize.bind(this);
|
||||
this.getSize = this.getSize.bind(this);
|
||||
|
||||
owl.onMounted(() => {
|
||||
this.setDrag();
|
||||
});
|
||||
},
|
||||
|
||||
setSize(size) {
|
||||
this.props.size = size;
|
||||
this.render();
|
||||
},
|
||||
|
||||
getSize() {
|
||||
return this.props.size;
|
||||
},
|
||||
|
||||
setDrag() {
|
||||
var $dl = $('#' + this.id + ' .modal-dialog .modal-content');
|
||||
if ($dl)
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
odoo.define("app_odoo_customize.web_dialog_size", function (require) {
|
||||
"use strict";
|
||||
|
||||
var Dialog = require("web.Dialog");
|
||||
|
||||
Dialog.include({
|
||||
willStart: function () {
|
||||
var self = this;
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
self.$modal
|
||||
.find(".dialog_button_extend")
|
||||
.on("click", self.proxy("_extending"));
|
||||
self.$modal
|
||||
.find(".dialog_button_restore")
|
||||
.on("click", self.proxy("_restore"));
|
||||
});
|
||||
},
|
||||
|
||||
opened: function () {
|
||||
return this._super.apply(this, arguments).then(
|
||||
function () {
|
||||
if (this.$modal) {
|
||||
this.$modal.find(">:first-child").draggable({
|
||||
handle: ".modal-header",
|
||||
helper: false,
|
||||
});
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
close: function () {
|
||||
if (this.$modal) {
|
||||
var draggable = this.$modal.find(">:first-child").draggable("instance");
|
||||
if (draggable) {
|
||||
this.$modal.find(">:first-child").draggable("destroy");
|
||||
}
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_extending: function () {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.addClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_extend").hide();
|
||||
dialog.find(".dialog_button_restore").show();
|
||||
},
|
||||
|
||||
_restore: function () {
|
||||
var dialog = this.$modal.find(".modal-dialog");
|
||||
dialog.removeClass("dialog_full_screen");
|
||||
dialog.find(".dialog_button_restore").hide();
|
||||
dialog.find(".dialog_button_extend").show();
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -1,16 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<!--begin 旧widget模式-->
|
||||
<!-- remove d-none if want to show, 当前没必要-->
|
||||
<t t-extend="web.DialogWidget">
|
||||
<t t-jquery="button.btn-close" t-operation="inner">
|
||||
<i class="fa fa-close" />
|
||||
</t>
|
||||
<t t-jquery="button.btn-close" t-operation="before">
|
||||
<button type="button" class="dialog_button_extend btn btn-secondary d-none">
|
||||
<button type="button" class="dialog_button_extend btn btn-secondary">
|
||||
<i class="fa fa-expand" />
|
||||
</button>
|
||||
<button type="button" class="dialog_button_restore btn btn-secondary d-none">
|
||||
<button type="button" class="dialog_button_restore btn btn-secondary">
|
||||
<i class="fa fa-compress" />
|
||||
</button>
|
||||
</t>
|
||||
@@ -43,7 +42,7 @@
|
||||
<button
|
||||
t-if="props.getsize() == 'dialog_full_screen'"
|
||||
type="button"
|
||||
class="btn btn-secondary dialog_button_extend d-none"
|
||||
class="btn btn-secondary dialog_button_extend"
|
||||
t-on-click="dialog_button_restore"
|
||||
>
|
||||
<i class="fa fa-compress" />
|
||||
@@ -51,7 +50,7 @@
|
||||
<button
|
||||
t-if="props.getsize() != 'dialog_full_screen'"
|
||||
type="button"
|
||||
class="btn btn-secondary dialog_button_restore d-none"
|
||||
class="btn btn-secondary dialog_button_restore"
|
||||
t-on-click="dialog_button_extend"
|
||||
>
|
||||
<i class="fa fa-expand" />
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="inherit_id" ref="base.edit_menu"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree" position="attributes">
|
||||
<multi_edit eval="True"/>
|
||||
<attribute name="multi_edit">1</attribute>
|
||||
</xpath>
|
||||
<field name="complete_name" position="after">
|
||||
<field name="name"/>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<xpath expr="//field[@name='write_date']" position="after">
|
||||
<field name="published_date" optional="hide"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<xpath expr="//field[@name='is_seo_optimized']" position="before">
|
||||
<button name="action_post_debug_view" type="object" title="Settings" icon="fa-bug fa-lg" groups="base.group_no_one"/>
|
||||
<button name="action_post_code_view" type="object" title="Source Code" icon="fa-code fa-lg" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<field name="website_meta_title" optional="hide"/>
|
||||
<field name="website_meta_description" optional="hide"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<xpath expr="//field[@name='is_seo_optimized']" position="before">
|
||||
<button name="action_page_debug_view" position="move"/>
|
||||
<button name="action_page_code_view" type="object" title="Source Code" icon="fa-code fa-lg" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
|
||||
@@ -7,13 +7,19 @@
|
||||
<field name="inherit_id" ref="website_sale.product_pages_tree_view"/>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<xpath expr="//field[@name='is_seo_optimized']" position="before">
|
||||
<button name="action_product_debug_view" type="object" title="Content Set" icon="fa-bug fa-lg" groups="base.group_no_one"/>
|
||||
<button name="action_product_code_view" type="object" title="Source Code" icon="fa-code fa-lg" groups="base.group_no_one"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='website_url']" position="attributes">
|
||||
<attribute name="optional">hide</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='is_published']" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='is_seo_optimized']" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='is_published']" position="after">
|
||||
<field name="seo_name" optional="hide"/>
|
||||
<field name="website_meta_keywords" optional="hide"/>
|
||||
@@ -74,13 +80,21 @@
|
||||
<field name="sale_ok" invisible="1"/>
|
||||
<field name="is_published" widget="website_redirect_button" attrs="{'invisible': [('sale_ok','=',False)]}"></field>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="shop_desc" string="Website Description">
|
||||
<field name="website_description" nolabel="1" widget="ace" attrs="{'invisible': [('sale_ok','=',False)]}"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="shop_desc" string="Website Description">
|
||||
<field name="website_description" nolabel="1" widget="ace" attrs="{'invisible': [('sale_ok','=',False)]}"/>
|
||||
</page>
|
||||
<page name="seo" string="SEO">
|
||||
<group>
|
||||
<field name="seo_name"/>
|
||||
<field name="website_meta_title" string="Meta Title"/>
|
||||
<field name="website_meta_description" string="Meta Description"/>
|
||||
<field name="website_meta_keywords" string="Meta Keywords" help="Separate every keyword with a comma"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -94,7 +108,21 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='website_description']" position="attributes">
|
||||
<attribute name="widget">html</attribute>
|
||||
<attribute name="widget">html</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="app_product_template_search_view" model="ir.ui.view">
|
||||
<field name="name">app.product.template.website.search</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='categ_id']" position="after">
|
||||
<field name="seo_name"/>
|
||||
<field name="website_meta_keywords"/>
|
||||
<field name="website_meta_title"/>
|
||||
<field name="website_meta_description"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user