Issue when converting odoo 9 code in to Odoo 10 - odoo

I have a module developed for online payments. As Odoo 10 has released with a new API I have converted this in to the new API. But when I install / update my addon I have an xml parse error in my xml file.
ParseError: "File not found: payment_gateway/static/src/img/gateway_icon.png" while parsing file:///C:/Program%20Files%20(x86)/Odoo%2010.0e/server/odoo/addons/payment_gateway/data/payment_acquirer_data.xml:5, near
<record id="payment.payment_acquirer_gateway" model="payment.acquirer">
**<field name="name">gateway</field>**
<field name="image" type="base64" file="payment_gateway/static/src/img/gateway_icon.png"/>
<field name="provider">gateway</field>
<field name="company_id" ref="base.main_company"/>
<field name="view_template_id" ref="gateway_acquirer_button"/>
<field name="environment">test</field>
<field name="pre_msg">
<p>You will be redirected to the website after clicking on the payment button.</p></field>
<field name="gateway_merchant_number">dummy</field>
</record>
Above code in a screenshot
Does anyone can point me the reason.
Thanks

Related

automated actions through xml files

I managed to make the system send a message as a notification when some expiration date is close
BUT
I created a server action and an automatic action both in the GUI
I'd like to use xml files to create such actions
Otherwise I have to remember to create them every time I create a new db
I found something but for Odoo 15, I'm on Odoo 14
The creation of server actions and automated actions from XML are same in Odoo 14.0 or 15.0 and you can check the Odoo 14.0 Documentation
Example for server action:
<record id="act_hr_employee_holiday_request" model="ir.actions.server">
<field name="name">Time off Analysis</field>
<field name="model_id" ref="hr_holidays.model_hr_leave_report"/>
<field name="binding_model_id" ref="hr.model_hr_employee"/>
<field name="state">code</field>
<field name="groups_id" eval="[(4, ref('base.group_user'))]"/>
<field name="code">
action = model.action_time_off_analysis()
</field>
</record>
Examples for automated action.

odoo.tools.convert.ParseError: "External ID not found in the system: project_manage.view_project_turn_over_action" in Odoo12

there are two xml files,the first one has a button,and another is the form view xml.
It should jump to the form view xml,when I click the button.
But I had a mistake:odoo.tools.convert.ParseError: "External ID not found in the system: project_manage.view_test_project_turn_over_action"
(project_manage is the module name and view_test_project_turn_over_action is the action id,both button xml and form view xml are in the module 'project_manage'.)
the button xml:
<button name="%(view_test_project_turn_over_action)d" string="Turn over" type="action"/>
the form view xml:
<record model="ir.actions.act_window" id="view_test_project_turn_over_action">
<field name="name">Turn Over Form</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.project.turn.over</field>
<field name="view_mode">form</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_test_project_turn_over_form"/>
<field name="target">new</field>
</record>
It's because sequence of xml files listed in manifest file.
To avoid sequence problem, you can always use external id with module name.
Like
module_name.xml_id
In your case, it would be
%(project_manage.view_test_project_turn_over_action)d
Or you can change sequence of xml file listing in manifest file.

Is it normal fields are not updated after installing modules?

I'm developping a module on OpenERP 7.
It is a very simple code : it has only 1 new field (or column) in python file, and an xpath in the xml. I know it works because one time it was succesfully installed
When I try to install/update my module with the module interface, sometimes the field is added/updated to OpenERP, but sometimes no.
I tried to start/stop and restart Openerp before and after installing my module, but I don't know if it has consequences. I don't have errors or useful thing in the logs.
So fields don't add/update but xml update everytime... Does anyone have an idea of what's going on and a solution ?
python code:
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class StockPickingIn(osv.osv):
_name = "stock.picking.in"
_inherit = "stock.picking.in"
_columns = {
'adquat_ack_recep': fields.boolean('Accusé de réception'),
}
xml code:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_picking_in_form_adquat" model="ir.ui.view">
<field name="name">stock.picking.in.form.adquat</field>
<field name="model">stock.picking.in</field>
<field name="inherit_id" ref="stock.view_picking_in_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='stock_journal_id']" position="after">
<field name="adquat_ack_recep" />
</xpath>
</field>
</record>
<record id="view_picking_in_tree_adquat" model="ir.ui.view">
<field name="name">stock.picking.in.tree.adquat</field>
<field name="model">stock.picking.in</field>
<field name="inherit_id" ref="stock.view_picking_in_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='state']" position="after">
<field name="adquat_ack_recep" />
</xpath>
</field>
</record>
</data>
</openerp>
I think it works to update fields with Command line -u !
But my other problem is not solved : I dont have empty checkboxes in form view
And in form view i can't have this checkbox checked :
I click on edit, i check it and save : the checkbox come back to empty !
I saw in the database the value is saved as true or false, but it's not displayed on the interface
You should see the following error
ValidateError
Error occurred while validating the field(s) arch: Invalid XML for View Architecture!
Because adquat_ack_recep is defined in stock.picking and you add it to stock.picking.in form.
You need to inherit from stock.picking.in.
_inherit = "stock.picking.in"
Edit:
Add adquat_ack_recep field to both models stock.picking and stock.picking.in (stock.picking.in read method was overitten to read values from stock.picking model). Take a look at fields not saving problem
Problem may arises due two instances running at same time. make sure you run single instance. you can also update module through command line this may solve your issue
refer this link for module updation through command line.

Odoo testing failed to initialize database

I was testing Odoo modules, using coverage command, I get the Failed to initialize database error, I think the error is in this line:
expr="//field[#name='unit_amount']", but i don't know how to solve it.
<record id="hr_timesheet_sheet_form_inherited_working_type" model="ir.ui.view">
<field name="name">hr.timesheet.sheet.form.inherited.working_type</field>
<field name="model">hr_timesheet_sheet.sheet</field>
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='unit_amount']" position="before">
<field name="task_id" domain="[('project_id','=',project_id)]" attrs="{'required':True}"/>
<field name="working_type_id"/>
</xpath>
</field>
</record>
Thanks for your help
Your xpath is wrong. The field you are using is in timesheet line and not in the timesheet.
Use following xpath:
<xpath expr="//field[#name='timesheet_ids']/tree/field[#name='unit_amount']" position="before"></xpath>

How to display only my costumes (created ) modules in Odoo (OpenERP)

I would like to show only my custom module in Odoo interface, without displaying other Odoo Modules.
I have tried to assign my module to the user ( in user settings interface) and hidde other modules to him. But when the user login he see only the Web module, without the other modules.
For example:
I Odoo menu you can see the names of modules like : Sales, Calender ...etc
My goal is to hidde all module to users, and display only my module ( my costum module)
Any help please ... Thank you
Inherit action for module list and add a domain
Try below code:
<record id="open_module_tree" model="ir.actions.act_window">
<field name="name">Apps</field>
<field name="res_model">ir.module.module</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('name,'=','your_module_name')]</field>
<field name="context">{'search_default_app':1}</field>
<field name="search_view_id" ref="view_module_filter"/>
<field name="help" type="html">
<p><b>No module found!</b></p>
<p>You should try other search criteria.</p>
</field>
</record>
Hope it will help you.