XML ID missing on rule edition - Odoo 14 - odoo-14

I've tried in a xml file this code:
<record id="stock.stock_production_lot_rule" model="ir.rule">
<field name="active" eval="False"/>
</record>
I don't have an error on the website, but since it didn't work, I checked the input log and found the error 'XML ID is missing'
WARNING test odoo_tools_convert : Skipping deletion for missing XML ID 'stock_production_lot_rule'"
Yet the ID matches the one in the rule metadata.
I am on Odoo 14 Version Enterprise.
Here a screenshot of the rule metadata :
https://i.stack.imgur.com/XWj1f.png
manifest.py :
# -*- coding: utf-8 -*-
{
'name': "stock_module_modifie",
"version": "14.0",
"author": "John",
"website": "",
"license": "AGPL-3",
"category": "Vertical",
"description": "Module Modèle",
"depends": [
'base',
'stock',
],
'data': [
'views/stock_modification.xml',
],
'demo': [
],
'qweb': [
],
'installable': True,
'application':True,
}
stock_modification.xml :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="stock.stock_production_lot_rule" model="ir.rule">
<field name="active" eval="False"/>
</record>
</odoo>

Related

Vuetables2 How to add dynamic style to specific data in vue-client-table

I am working on vue js and vue client table. I have created a vue-client-table and populated some dummy data as static.
Now there is a column name STATUS which will have two value i.e Active or Inactive.
I want to change the font color of 'Inactive' to red.
(Which denotes that link is down)
I need help to understand it.
Below I have attached my code:
Headings : [ 'APPLICATION NAME', 'URL','LAST ACCESSED','STATUS'],
tableData: [
{
"APPLICATION NAME": "Pannier",
"URL": "http://boston.com/urna/ut/tellus/nulla/ut/erat/id.js?magna=blandit&ac=ultrices&consequat=enim&metus=lorem",
"LAST ACCESSED": "5:07 PM",
"STATUS": 'Inactive'
},{
"APPLICATION NAME": "Kanlam",
"URL": "http://archive.org/rutrum/nulla/nunc/purus.jpg?ac=ametttis&sit=nibh&amet=ligula",
"LAST ACCESSED": "7:02 AM",
"STATUS": 'active'
}
Below I have attached my image:
One simple way is to use Scoped slots, in order to add css class and the href attribute. Take a look at the official docs.
Here is an example.
Vue.use(VueTables.ClientTable);
new Vue({
el: "#app",
data: {
columns: ['APPLICATION NAME', 'URL', 'STATUS'],
tableData: [
{
"APPLICATION NAME": "Pannier",
"URL": "http://boston.com/urna/ut/tellus/nulla/ut/erat/id.js?magna=blandit&ac=ultrices&consequat=enim&metus=lorem",
"LAST ACCESSED": "5:07 PM",
"STATUS": 'Inactive'
},{
"APPLICATION NAME": "Kanlam",
"URL": "http://archive.org/rutrum/nulla/nunc/purus.jpg?ac=ametttis&sit=nibh&amet=ligula",
"LAST ACCESSED": "7:02 AM",
"STATUS": 'active'
}],
}
});
.Inactive {
color: red
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.8/vue.min.js"></script>
<script src="https://rawgit.com/matfish2/vue-tables-2/master/dist/vue-tables-2.min.js"></script>
<h3>Vue Tables 2</h3>
<div id="app">
<v-client-table :columns="columns" :data="tableData">
<a :class="props.row.STATUS" :href="props.row.URL" slot="STATUS" slot-scope="props">{{props.row.STATUS}}</a>
</v-client-table>
</div>
You need to create a css class with name "Inactive", exactly the same with the "STATUS" value.

How to add button to POS screen in Odoo11?

I am trying to add a button to the POS screen. A lot of the information I have for this is related to Odoo 11 CE and this is probably why it is not working. I installed the custom addon without any errors but I don't see the button. I don't get any errors when running the POS either. In version 11 there is a widgets.js file which includes
module.PosWidget.include({
build_widgets: function(){
var self = this;
this._super()
There is no widgets.js in version 11 and I am guessing this is where my problem is. Its just a guess I really dont know how to add a button to the POS.
Here is my pos_custom.js
odoo.pos_custom = function(instance){
var module = instance.point_of_sale;
var round_pr = instance.web.round_precision
var QWeb = instance.web.qweb;
console.log("POS JS Loaded")
module.PosWidget.include({
build_widgets: function(){
var self = this;
this._super()
custom_btn = $(QWeb.render(`custom_btn`))
custom_btn.click(function(){
alert("hello")
})
console.log("button <<<>>> ",custom_btn,this.$(`.control-button`))
custom_btn.appendTo(this.$(`.control-button`))
this.$control_buttons`).removeClass(`oe_hidden`)
}
})
};
My /src/xml/pos_custom.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates xml="template" xml:space="preserve">
<t t-name="custom_btn">
<button>Cust Button</button>
</t>
</templates>
my /views/templates.xml
<?xml version="1.0"?>
<openerp>
<data>
<template id="assets_backend" name="pos_custom assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="/pos_custom/static/src/js/pos_custom.js"></script>
</xpath>
</template>
</data>
</openerp>
manifest.py
{
'name': 'Point Custom Module',
'version': '1.2',
'category': 'Point of Sale',
'summary': 'Custom Point of Sale ',
'description': "",
'data': [
"views/templates.xml"
],
'depends': ['point_of_sale'],
'qweb': ['static/src/xml/*.xml'],
'application': True,
}
/custom-button/manifest.py
{
'name': 'CustomButton',
'summary': '',
'version': '1.0',
'description': """
""",
# 'author': '',
# 'maintainer': '',
# 'contributors': [''],
# 'website': '',
'license': 'AGPL-3',
'category': 'Uncategorized',
'depends': [
'base', 'point_of_sale',
],
'external_dependencies': {
'python': [
],
},
'data': [
'views/templates.xml',
],
'demo': [
],
'js': [
],
'css': [
],
'qweb': [
'static/src/xml/custom_button.xml',
],
'images': [
],
'test': [
],
'installable': True
}
/custom-button/views/templates.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/custom-button/static/src/js/custom.js"></script>
</xpath>
</template>
</odoo>
/custom-button/static/src/xml/custom_button.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="CustomButton">
<span class="control-button">
<i class="fa fa-print"></i>
Custom Button
</span>
</t>
</templates>
/custom-button/static/src/js/custom.js
odoo.define('custom-button.custom_button', function (require) {
"use strict";
var core = require('web.core');
var screens = require('point_of_sale.screens');
var gui = require('point_of_sale.gui');
//Custom Code
var CustomButton = screens.ActionButtonWidget.extend({
template: 'CustomButton',
button_click: function(){
var self = this;
self.custom_function();
},
custom_function: function(){
console.log('Hi I am button click of CustomButton');
}
});
screens.define_action_button({
'name': 'custom_button',
'widget': CustomButton,
});
});
screenshot of the custom button in POS screen
https://github.com/minaeid90/Custom-Button

IDEA turn off automatically format html

in html file, there is a piece of javascript like:
{text: "EmployeeManagement", icon: "code", children: [
{text: "HR", link: [[#{/employeeManage/hr.html}]]},
{text: "Developer", link: [[#{/employeeManage/developer.html}]]},
]},
However, once I put a
if(isEmployer) {
}
around it, it formats the above code like:
if (isEmployer) {
{
text: "EmployeeManagement", children
:
[
{text: "HR", link: [[#{
/employeeManage
/hr.html
}
]]
},
{
text: "Developer", link
:
[[#{
/employeeManage
/developer.html
}
]]
}
How to turn off this automatically form?
EDIT: This is the file structure:
<!DOCTYPE html>
<html lang="en"
xmlns:th="http://www.thymeleaf.org">
<head>
....
</head>
<body data-module="app" style="overflow: hidden">
<div id="desktop"></div>
<script th:inline="javascript">
/*<![CDATA[*/
var isEmployer = ...
...
{text: "EmployeeManagement", icon: "code", children: [
{text: "HR", link: [[#{/employeeManage/hr.html}]]},
{text: "Developer", link: [[#{/employeeManage/developer.html}]]},
]},
...
If you do not want to have this behaviour (I guess it is by adding }) go to
Editor -> General -> Smart Keys and disable option Reformat block on typing }

Add Button next the create Button in odoo Tree View

how to add this button in the Tree view ??
This code in library/static/src/js/script.js
openerp.library = function(instance) {
instance.web.ListView.include({
load_list: function(data) {
this._super(data);
if (this.$buttons) {
this.$buttons.find('.oe_my_button').off().click(this.proxy('do_the_job'));
}
},
do_the_job: function() {
this.do_action({
name: _t("View name"),
type: "ir.actions.act_window",
res_model: "object",
domain: [],
views: [
[false, "list"],
[false, "tree"]
],
target: 'new',
context: {},
view_type: 'list',
view_mode: 'list'
});
}
});
}
This code in library/static/src/xml/library_view.xml
<template xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<button t-if="widget.dataset.model == 'inventory'" class="oe_button oe_my_button oe_highlight" type="button">My Button</button>
</t>
</t>
</template>
in my openerp.py
'qweb': ['static/src/xml/library_view.xml'],
What about your library/static/src/js/script.js file?
Add js file in odoo backend asset template like below:-
<template id="assets_backend" name="work_group assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/library/static/src/js/script.js">
</script>
</xpath>
</template>

How can i read xml item's attribute?

I'm newbie in Sencha touch and i need to parse a xml file.
I can display data between tag but i can't display data when i have an attribute.
some body can help me please.Thanks for advance
You can use the mapping property in your field definition.
Ext.define('temp.model.User', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'pseudo', type: 'string', mapping: '#pseudo' },
{ name: 'id', type: 'int' },
{ name: 'name', type: 'string' },
]
}
});
Will read this xml:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user pseudo="pierre">
<id>1</id>
<name>Pierre</name>
</user>
<user pseudo="zorg">
<id>99</id>
<name>Zorglub</name>
</user>
</users>
I know this is an old post, but since I found the question when searching for the answer...