I am using Odoo 13. I would like to change the background colour from purple to blue from a slide. website_slides is located in /src/odoo/addons/website_slides. I can't directly change /src/odoo/addons/website_slides/static/src/scss/website_slides.scss
I would like to override the following
.o_wslides_gradient {
background-image: linear-gradient(120deg, #875A7B, darken(#875A7B, 10%));
}
This is my first time using Odoo. I would like to change the colour so that it is always blue instead of changing it per slide I use. How would I write a custom module and add it to /src/user?
You need to inherit the website.assets_frontend template to include the new scss file.
First, create a module (you can check the Building a Module documentation), then:
Add website_slides module to the manifest depends list.
Inherit the website.assets_frontend template like following:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Slides Frontend Assets">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/MODULE_NAME/static/src/scss/website_slides.scss" t-ignore="true"/>
</xpath>
</template>
</odoo>
Create an assets.xml XML file and add to it the above code then add it to the data list in the manifest file.
Create a scss file under static/src/scss/website_slides.scss and add the following scss code:
.o_wslides_gradient {
background-image: linear-gradient(120deg, #7C7BAD, darken(#7C7BAD, 10%));
}
Related
I'm trying to add a QR image to the POS's receipt. The code I used in a normal invoice that worked was the following one:
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s'%('QR', o.qr_code_string, 150, 150)"/>
For the receipt, I exported for printing my string as receipt.qr_string and added the following line to the receipt's inheriting XML file:
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s'%('QR', receipt.qr_string, 150, 150)"/>
But the image appear like a broken link. How do I achieve this?
I don't know why it is not working for POS receipts but let me tell you that POS is the system that can be run without connection to the server. Everything it executes should always using js i mean always to client side. So, my solution is to use QRrcode.js library as it is easy avaialable here.
Add this library file to the module on path /<your_module/static/src/lib/ folder and also to your pos backend like below and that file needs to added in the manifest as well under the "data" file list.
<odoo>
<data>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/<module_name>/static/src/lib/qrcode.js"></script>
</xpath>
</template>
</data>
</odoo>
Take care of path properly.
Then you can use that library in any POS Receipt Qweb like below to print QRcode.
<div t-attf-id="#{receipt.qr_string}"></div>
<script type="text/javascript">
var lot_name = "<t t-esc="receipt.qr_string"/>";
var qrcode = new QRCode(receipt.qr_string , {
text: "http://jindo.dev.naver.com/collie",
width: 100,
height: 100,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
qrcode.makeCode(receipt.qr_string);
</script>
Just adding a className to a tag doesn't help
<p className="ms-font-m">
sometext
</p>
doesn't change the font
https://developer.microsoft.com/en-us/fabric#/styles/typography
If you want to use the Fabric Core CSS classes directly, rather than with CSS-in-JS, you'll need to include the CSS on your page following the instructions for getting started with Fabric Core:
Add a reference to the stylesheet in the <head> of your page. Simplest way is to use the copy on Microsoft's CDN (grab the URL directly from the docs linked above to get the latest version):
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/10.0.0/css/fabric.min.css">
Add the ms-Fabric class to a containing element, such as <body>, to set the font-family. Then you can use the other classes to set sizes and colors:
<body class="ms-Fabric">
<span class="ms-font-su ms-fontColor-themePrimary">Big blue text</span>
</body>
Not exactly what' I was looking for but here is one way to do it:
https://github.com/OfficeDev/office-ui-fabric-react/blob/86337324a5fd8b522855eb8bdcbf012a868a26ba/packages/styling/README.md#using-fabric-core-classes
import {
ColorClassNames,
FontClassNames
} from '#uifabric/styling';
function renderHtml() {
return (
`<div class="${ [
ColorClassNames.themePrimary,
FontClassNamed.medium
].join(' ') }">Hello world!</div>`
);
}
my understanding per https://github.com/OfficeDev/office-ui-fabric-react/wiki/Component-Styling#styling-best-practices is that I need to use getTheme() and styles (not style) prop function for the new way of doing styling. So I'm still looking for a getTheme() solution
==============
here is the list of available fonts
https://github.com/OfficeDev/office-ui-fabric-react/blob/1b9405b3b64839975e16ee1fad04d7868d9e3b99/packages/styling/src/styles/fonts.ts
fonts visualized: https://developer.microsoft.com/en-us/fabric#/styles/typography
colors: https://developer.microsoft.com/en-us/fabric#/styles/colors
You can do it by adding the following code when loading theme:
loadTheme({
defaultFontStyle: { fontFamily: 'Comic Sans MS', fontWeight: 'bold' },
.......
This is available since version 7.21.0 of office-ui-fabric-react
These are the urls where you can find the release and report of bug:
https://github.com/microsoft/fluentui/issues/7416
https://github.com/microsoft/fluentui/releases/tag/office-ui-fabric-react_v7.21.0
https://github.com/microsoft/fluentui/pull/9981
I want to hide delete button from Export Data form view in odoo. Button that i want to hide also highlighted in attached image.
I'll be very thankful...
You will need to override Odoo's QWeb templates for such customizations.
Create a xml under mymodule/static/src/xml (e.g. your_customization.xml) with following content:
<template>
<t t-extend="Exists.ExportList">
<t t-jquery="button[id|='delete_export_list']" t-operation="replace" />
</t>
</template>
And then don't forget to call that file in your manifest (__openerp__.py) like
{
# other things like author, name, data
'qweb': ['static/src/xml/your_customization.xml'],
}
As a newbie,I study Yii two weeks.At the time,I have a question:
we all know,Yii provide a CHtml class,so we can create the view rapidly and convinently.
but how can I customize the style if I do not want to use the defalut style?
Depends what you mean by default style.
If you want to add extra html options you can use the optional $htmlOptions param in CHtml functions.
Eg to add a custom style to a text field you do something like:
echo Chtml::textField('mytextfield', 'defaultvalue', array('style' => 'color: green;'))
Modify the layout file, and insert an external CSS stylesheet.
protected/views/layouts/main.php
<head>
<link rel="stylesheet" type="text/css"
href="<?= Yii::app()->getBaseUrl(true) ?>/css/stylesheet.css" />
I am trying do display a form in read only mode;
I am trying to hide/disable the whole form header if posible; if not individual elements: bread crumbs, buttons (edit, create, more, delete, duplicate, next, previous) from the Form.
as shown in red selections
I tried modifying the invisible attribute using xpath as shown in
hide buttons Create, Delete and Edit
<xpath expr='/form/group/button[#string="Edit"]' position="replace">
<button type="action" attrs="{'invisible': [('uid','!=',0)]}" />
</xpath>
but all I can manage is this:
How to hide the header section or it's individual elements?
What Is the best practice in OpenErp 7 to make a form in read only mode.
Thanks
Hide it in /openerp/addons/web/static/src/xml/base.xml at line number 510
To hide the more button go to /addons/web/static/src/css/base.css and find:
.openerp .oe_sidebar {
white-space: nowrap;
}
and replace it with:
.openerp .oe_sidebar {
display: none;
white-space: nowrap;
}
This will hide the element so that the browser does not render it, it however will still be visible in the source code.