Use Report Object Inside OpenERP Webkit Report Header - webkit

I'm creating an invoice report for OpenERP 7 using webkit engine
I need to display the invoice number and the partner in the header.
I've tried using the variable directly:
${inv.partner_id.name}
but it's giving me this error:
AttributeError: 'Undefined' object has no attribute 'partner_id'
is there any workaround for this problem ?
it's possible to use the inv variable directly in RML
but I can't use RML for this report for some reason.
thanks before

Solved it,
I can just use:
%for inv in objects :

Related

Odoo 12: KeyError: 'ir.values'

I m trying to create a new contact in odoo application but it shows me this error :
KeyError: 'ir.values'
The issue is related with this funtion.
class ResPartner(models.Model):
_inherit = 'res.partner'
def _default_credit_limit(self):
return self.env['ir.values'].get_default('account.config.settings', 'credit_limit')
I don't understand the problem
Can you please help me
KeyError: 'ir.values'
If you run self.env['ir.values'] on Odoo 12, you will get the above error because the ir.values Model does not exist in Odoo 12.
The ir.values Model was removed and replaced with ir.default. For example:
self.env['ir.default'].get('sale.order', 'sale_order_template_id')
You can see the relevant file in the Odoo core code or the commit where most of that Model was added.
Are you sure that this setting even exists anymore? I don't know for sure, but couldn't find it, i'm aware in Odoo 8 it existed. Beside the fact, that i don't think it exists anymore: account.config.settings don't exist for 100% sure, because the settings model was refactored into res.config.settings.
Actually the partner field credit_limit is gone, too. So if you want to use it and have a default outside the code, use ir.default for your desired behaviour.

How can i create a Dynamic Multi-Select List in hippo cms?

I am trying to create a Dynamic Multi-Select List. I tried to add a DynamicDropdown and added Multiple in Fields properties but throws an error:
An error has occurred, sorry for that.
java.lang.IllegalStateException:
org.onehippo.forge.selection.frontend.plugin.DynamicDropdownPlugin
does not support fields that are multiple: please use
org.onehippo.forge.selection.frontend.plugin.DynamicMultiSelectPlugin
for that. Field name is *. Failed to instantiate plugin class
'org.onehippo.forge.selection.frontend.plugin.DynamicDropdownPlugin'
for wicket id
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown-preview.cluster..plugin.home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown.cluster.default.service.wicket.id'
in plugin
'home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown-preview.cluster..plugin.home.cluster.cms-static.plugin.servicesLoader.cluster.cms-services.plugin.defaultEditorFactory.cluster.cms-editor0.plugin.editorPlugin.cluster.default.plugin.preview.cluster.default.plugin.dynamicdropdown.cluster.default.plugin.root'
(JcrPluginConfig:/hippo:namespaces/system/DynamicDropdown/editor:templates/default/root)
Indeed the DynamicDropdownPlugin is not meant for multi-selects, you should use the DynamicMultiSelectPlugin. Easiest to install using Essentials set=up tool, see 'Add a Selection Field to a Document Type
Using the Setup Application' at https://documentation.bloomreach.com/library/concepts/plugins/selections/configuration.html
HTH
Jeroen

What is use of sanitize attribute in html type field in odoo?

In html type of field one attribute is available, In which we can pass True/False.
body_html = fields.Html('Body', translate=True, sanitize=False, help="Rich-text/HTML version of the message (placeholders may be used here)")
body_html = fields.Html('Body', translate=True, sanitize=True, help="Rich-text/HTML version of the message (placeholders may be used here)")
If we set True/False then we are getting same result.
What is difference if we set True/False in this field ?
It's just telling Odoo if to clean html code, like deleting scripts, tags/nodes, etc. For more information look into the code.

Getting reference from model One2many relationship comodel inside an ir.actions.act_window

Would like to ask on how you can get the id of the comodel inside the ir.actions.act_window.
See my source code: https://gist.github.com/renesansz/2642b02875475383605e
Currently, I cannot get the sprint_id.project_id.current_sprint reference since it's giving me an error of Uncaught Error: NameError: name 'sprint_id' is not defined. So what I wanted to happen is that upon opening the project it should add a default filter for the current sprint of the project.
Do I have any alternative for this kind of approach?
Tried doing domain, but still no luck solving the issue.
Try this: make related field and then use this field in xml view.

Adding new field on Odoo Product Variant

I am trying to add new field to product.product model.
What I've done so far is:
Add new field on the following model (From Settings > Database Structure > Models):
product.product
with the following details:
Name: x_product_cost
Field Label: Product Cost
Field Type: Float
and leave the rest to default.
The problem is i am unable to show it on the form. This is the only code that is generated when I tried to edit Form:
View Name: product.product.form
Object: product.product
Inherited View: product.template.common.form
Product Variant
lst_price
I can't use product.template model, since that inherits to product.product
Am i missing something here?
PS: I am trying to temporarily fixed assign-different-cost-on-product-variant bug as specified here
https://github.com/odoo/odoo/issues/1198
Can anyone help me with this?
Actually instead of modifying the model from the Odoo configuration, you should create a custom module, in which you will add the new fields and the new behaviors that you need.
To do so you will have to inherit from the models in the python files to extend them, and you will surely have to modify the views as well, so that your custom fields get displayed.
For reference on how to extend models, create a custom module and create the views, you should refer to the Odoo documentation that you can find here.
As an additional note in case you didn't know, but their is a new API that appeared in the version 8 of Odoo, if you can use it, it is much easier and much nicer.