error programming when using inherit in oodo9 - openerp-8

i am new in oodo9, i have got error when i have try to add a new field into res.partner using inherit, it tell me that the new field does not exist in res.partner, please help me
class testtt(models.Model):
_inherit ='res.partner'
_columns = {
'test_field': fields.char('test field'),
}
testtt()
<record id="testtt" model="ir.ui.view">
<field name="name"> test.form </field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="test_field" />
</field>
</field>
</record>

Related

Hide string name from field in odoo 12

When you define a field in odoo, by default, it displays the string for that value and next to it, the value.
If you don't put the field between group tags, the string value, doesn't appear.
The problem is that I am defining a tree view which doesn't contain group tags:
<record model="ir.ui.view" id="field_partida_fertilizer_tree">
<field name="name">field.diary.partida.fertilizer.tree.view</field>
<field name="model">field.diary.partida.fertilizer</field>
<field name="priority" eval="17"/>
<field name="arch" type="xml">
<tree string="Fertilizante">
<field string= 'Nombre' name="fertilizer"/>
<field string='N' name="nitrato" options='{"show_string": False}' widget="percentpie"/>
<field string='P' name="fosforo" options='{"fg_color": "white"}' widget="percentpie"/>
<field string='K' name="potasio" options='{"fg_color": "white"}' widget="percentpie"/>
<field string='Cantidad (kg)' name="quantity"/>
</tree>
</field>
</record>
By using widget percentpie, I can display this:
I want to hide the letter N next to the graph but not the column and I can't find any property of the widget to do that. The only way I could trick this is by giving the color white to the text so it disappears with the background, but the column cant be centered.
I have tried with the option show_string I found on GitHub but it doesn't work.
Any help would be awesome...
Thank you!
Odoo defines a condition in the PercentPie template to show the string attribute vaue:
<span t-if="widget.string"><t t-esc="widget.string"/></span>
You can alter the template and define a new condition base on a value (show_string ) passed through the options attribute:
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="FieldPercentPie">
<t t-jquery="span" t-operation="attributes">
<attribute name="t-if">widget.string and (widget.attrs.options.show_string === undefined or widget.attrs.options.show_string)</attribute>
</t>
</t>
</templates>
Create a new XML file with the above content and add it under the qweb section of the manifest file.
Example:
<record model="ir.ui.view" id="field_partida_fertilizer_tree">
<field name="name">field.diary.partida.fertilizer.tree.view</field>
<field name="model">field.diary.partida.fertilizer</field>
<field name="priority" eval="17"/>
<field name="arch" type="xml">
<tree string="Fertilizante">
<field string='Nombre' name="fertilizer"/>
<field name="nitrato" options='{"show_string": False}' widget="percentpie"/>
<field name="fosforo" options='{"show_string": False}' widget="percentpie"/>
<field name="potasio" options='{"show_string": False}' widget="percentpie"/>
<field string='Cantidad (kg)' name="quantity"/>
</tree>
</field>

Wordpress - add featured post with image using MySQL

I am trying to add featured post with image in Wordpress using MySQL. I want to do it only by MySQL(no php, only SQL). I tried to add post and then I added meta for the post too. Still, I cannot see featured post with image. Please advise where I am wrong? I have generated XML for records, please check and let me know where I am wrong.
Post Data:
<?xml version="1.0" encoding="utf-8"?>
<table_data name="wp_posts">
<row>
<field name="ID">62</field>
<field name="post_author">1</field>
<field name="post_date">2018-04-24 00:00:00</field>
<field name="post_date_gmt">2018-04-24 00:00:00</field>
<field name="post_content"><img class="alignnone size-medium wp-image-26" src="http://test.com/wp-content/uploads/2018/photos/testing2.jpg" alt="test" width="300" height="219"></field>
<field name="post_title">Manual post</field>
<field name="post_excerpt"></field>
<field name="post_status">publish</field>
<field name="comment_status">open</field>
<field name="ping_status">open</field>
<field name="post_password"></field>
<field name="post_name"></field>
<field name="to_ping"></field>
<field name="pinged"></field>
<field name="post_modified">0000-00-00 00:00:00</field>
<field name="post_modified_gmt">0000-00-00 00:00:00</field>
<field name="post_content_filtered"></field>
<field name="post_parent">0</field>
<field name="guid"></field>
<field name="menu_order">0</field>
<field name="post_type">post</field>
<field name="post_mime_type"></field>
<field name="comment_count">0</field>
</row>
<row>
<field name="ID">63</field>
<field name="post_author">1</field>
<field name="post_date">2018-04-24 00:00:00</field>
<field name="post_date_gmt">2018-04-24 00:00:00</field>
<field name="post_content"></field>
<field name="post_title">testing2</field>
<field name="post_excerpt"></field>
<field name="post_status">inherit</field>
<field name="comment_status">closed</field>
<field name="ping_status">open</field>
<field name="post_password"></field>
<field name="post_name">testing2</field>
<field name="to_ping"></field>
<field name="pinged"></field>
<field name="post_modified">0000-00-00 00:00:00</field>
<field name="post_modified_gmt">0000-00-00 00:00:00</field>
<field name="post_content_filtered"></field>
<field name="post_parent">62</field>
<field name="guid">http://test.com/wp-content/uploads/2018/photos/testing2.jpg</field>
<field name="menu_order">0</field>
<field name="post_type">attachment</field>
<field name="post_mime_type">image/jpeg</field>
<field name="comment_count">0</field>
</row>
</table_data>
Meta of Post
<table_data name="wp_postmeta">
<row>
<field name="meta_id">211</field>
<field name="post_id">62</field>
<field name="meta_key">_thumbnail_id</field>
<field name="meta_value">63</field>
</row>
</table_data>
What is missing and how to add using MySQL?
Thanks

New FIELDS are not showing in search

I did a basic solr setup, Configured dataImportHandler and create very simple data config file with two fields and indexed it. It all worked fine.. But now I am adding new fields there and doing full import after that but for some reason new fields are just not showing in search result ( using solr interface for search). I have tried restarting solr, running config-reload to no effect.
this is my data config file. Not sure what's wrong here.
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/msl4" user="root" password=""/>
<document>
<entity name="hub_contents" query="select * from hub_contents" deltaQuery="select * from hub_contents where last_modified > '${dataimporter.last_index_time}'">
<field column="id_original" name="id" />
<field column="title" name="title" />
<field column="parent_id" name="parent_id" />
<field column="item_type" name="item_type" />
<field column="status" name="status" />
<field column="updated_at" name="updated_at" />
</entity>
</document>
</dataConfig>
You can add the below fields in your schema.xml
<field name="id" type="long" indexed="true" stored="true"/>
<field name="title" type="text_general" indexed="true" stored="true"/>
<field name="parent_id" type="long" indexed="true" stored="true"/>
<field name="item_type" type="text_general" indexed="true" stored="true"/>
<field name="status" type="text_general" indexed="true" stored="true" />
<field name="updated_at" type="date" indexed="true" stored="true"/>
It is left to you what type(fieldType) you want to add depending on your requirement.
indexed: true if this field should be indexed (searchable or
sortable)
stored: true if this field should be retrievable
Add the below tag:
<uniqueKey>id</uniqueKey>
This is to use to determine and enforce document uniqueness.

Whys is my MySQL query returning rows, but no values?

I'm using this query:
LOAD XML LOCAL INFILE '\\MC_Library_Video.xml' INTO TABLE video ROWS IDENTIFIED BY '<Item>';
On this XML file (abbreviated)
<Item>
<field name="Filename">V:\13 Assassins\13 Assassins.mkv</field>
<field name="Name">13 Assassins</field>
<field name="File Type">mkv</field>
<field name="Genre">Adventure; Drama; Foreign; Martial Arts</field>
<field name="Date">40662</field>
<field name="Bitrate">7501</field>
<field name="Image File">13 Assassins.jpg</field>
<field name="Media Type">Video</field>
<field name="File Size">7041096346</field>
<field name="Duration">7509</field>
<field name="Date Created">1322620528</field>
<field name="Date Modified">1322620528</field>
<field name="Date Imported">1348075046</field>
<field name="Keywords">...</field>
<field name="Description">...</field>
<field name="Media Sub Type">Movie</field>
<field name="Sample Rate">48000</field>
<field name="Channels">6</field>
<field name="Bit Depth">16</field>
<field name="Compression">mkv video (video: AVC1, audio: DTS Audio)</field>
<field name="Width">1280</field>
<field name="Height">528</field>
<field name="MPAA Rating">R</field>
<field name="Director">Takashi Miike</field>
<field name="Actors">...</field>
<field name="Gross Revenue">$17,054,213</field>
<field name="Budget">$6,000,000</field>
<field name="FPS">23.9760400000000012</field>
<field name="Genres">Adventure; Drama; Foreign; Martial Arts</field>
</Item>
And I'm getting this result:
285 row(s) affected Records: 285 Deleted: 0 Skipped: 0 Warnings: 0
But when I look at the data for the table (SELECT * FROM media.video;) I get nothing. There's no data there. Am I missing something? The result makes it appear as if the data was read in, but the table is still blank.

Solr: Indexed and stored field returning cannot be queried

Solr:4.8.1,I have a field called age which stores a single character like A or C and is stored is the field
<field name="age" type="text_general" indexed="true" stored="true"/>
When I get results back from other searches I can see the field age and its value but when I search for example age:* it returns 0 results. This just happened recently as I have been working with this field for a month and it worked fine but now nothing returns. I altered the schema a few times but nothing regarding this field. The only thing I can think of is that I accidentally put an invalid value into the age field of the mysql database that I import from, but fixed that and re-imported it.
I have searched this problem and found that <defaultSearchField> needs to be set but those results were older and that field is now depreciated.
EDIT:
My data config is:
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/gtw"
user="root"
password=""/>
<document>
<entity name="id" query="select id,price,title,description,main_image,retailer,link,age,gender,type,category,creation_date from solr_listings">
<field column="category" name="category" splitBy=","></field>
</entity>
</document>
</dataConfig>
The only thing that is different from the default example schema are the fields I added below:
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="title" type="text_general" indexed="true" stored="true" />
<field name="description" type="text_general" indexed="true" stored="true"/>
<field name="retailer" type="text_general" indexed="true" stored="true"/>
<field name="category" type="text_general" indexed="true" stored="true" />
<field name="main_image" type="text_general" indexed="true" stored="true"/>
<field name="last_modified" type="date" indexed="true" stored="true"/>
<field name="link" type="string" indexed="true" stored="true" />
<field name="gender" type="text_general" indexed="true" stored="true"/>
<field name="age" type="text_general" indexed="true" stored="true"/>
<field name="type" type="text_general" indexed="true" stored="true" />
<field name="creation_date" type="date" indexed="true" stored="true" />
<field name="price" type="float" indexed="true" stored="true"/>