odoo-8

Addition in General Settings of Odoo

不羁的心 提交于 2019-12-04 19:25:21
I am writing as custom Odoo module, with some configuration that can be set by the user. I want to add some setting in Settings -> Configuration -> General Settings Therefore, I created a .py containing: from openerp.osv import fields, osv class mymodule_configuration(osv.osv_memory): _inherit = 'res.config.settings' 'test_field': fields.char( string='Test Field', required=True, ) .XML <record id="custom_id" model="ir.ui.view"> <field name="name">General Settings</field> <field name="model">res.config.settings</field> <field name="arch" type="xml"> <form string="General"> <field name="test

Odoo validate invoice from code

自闭症网瘾萝莉.ら 提交于 2019-12-04 18:52:36
I creating an invoice from another model, and want to get validated not draft But internal number and total are not generated with my code. invoice_id = self.pool.get('account.invoice').create(cr, uid,{ 'partner_id':self.supplier.id, 'name' : 'Faltante mercaderia', 'journal_id': journal_id, 'account_id':account_id, 'type': 'in_refund', }) self.pool.get('account.invoice.line').create(cr, uid,{ 'invoice_id' : invoice_id, 'name' : 'Faltante mercaderia %s: %s' %(self.type,self.number), 'quantity' : self.dif_final, 'price_unit':self.tarifa_dif / 1000, }) a = self.env['account.invoice'].browse(

Set and get store data Odoo with TransientModel

ε祈祈猫儿з 提交于 2019-12-04 14:32:26
问题 I'm trying to store config data in odoo, I need to store 3 reference to 'account.journal'. The model is created in database, the view is shown in configuration base menu, the data is store in database when I push the APPLY button BUT when I reload the menu the data is not shown The code use: from openerp import fields, models, osv, api, _ class Configuration(models.TransientModel): _inherit = 'res.config.settings' _name = 'transporte_carta_de_porte.config.settings' ft_mercaderia = fields

What is difference between @api.one, @api.multi and @api.model?

别说谁变了你拦得住时间么 提交于 2019-12-04 11:45:20
问题 I am confused regarding @api.one , @api.multi , and @api.model in Odoo. What are the differences between the three and what are their use cases? 回答1: api.one is meant to be used when method is called only on one record. It makes sure, that there are no multiple records when calling method with api.one decorator. Let say you got record partner = res.partner(1,) . It is only one record and there is method for example (in res.partner ): @api.one def get_name(self): return self.name #self here

How do I update other fields or another models from inside compute function?

邮差的信 提交于 2019-12-04 10:52:29
问题 There are 3 classes, sync.test.subject.a which has many2many relation with sync.test.subject.b which is inherited by sync.test.subject.c . sync.test.subject.b 's separated_chars field is populated through a compute function called _compute_separated_chars which is triggered by the change of sync.test.subject.b 's chars field. The role of sync.test.subject.c is basically to set chars by its own name so that _compute_separated_chars is triggered. The problem is I can't delete leftover records

Could not display Selected Image in Odoo 9

两盒软妹~` 提交于 2019-12-04 05:54:49
问题 I have problem with image loading in product.template form view. When i upload a new image it is uploading and displaying correctly in product kanban view , but in product form view it is giving me error Could not display Selected Image as displaying in attached image Someone please tell me about why it is happening. I'll be very thankful .. 来源: https://stackoverflow.com/questions/37987347/could-not-display-selected-image-in-odoo-9

How to update default header in PDF report (qWeb)?

本小妞迷上赌 提交于 2019-12-04 02:07:38
问题 I have a PDF report, using qWeb in Odoo (v8). My report has this line of code: <t t-call="report.external_layout"> This line I suppose is for inserting the predefined header in the PDF report. In Settings -> Companies, tab Report Configuration in respective company, there is something like this: <header> <pageTemplate> <frame id="first" x1="1.3cm" y1="3.0cm" height="21.7cm" width="19.0cm"/> <stylesheet> <!-- Set here the default font to use for all <para> tags --> <paraStyle name='Normal'

One2many field on_change function can't change its own value?

会有一股神秘感。 提交于 2019-12-03 22:28:05
I have these two fields. 'name' : fields.char('Name'), 'addresses' : fields.one2many('res.partner.address', 'partner','Addresses'), This function: def addresses_change(self, cr, uid, ids, name, addresses, context=None): value = {} new_addresses = [] address_pool = self.pool.get('res.partner.address') for address in address_pool.browse(cr, uid, addresses[0][2], context=context): new_addresses.append((1,address.id,{'street':'wall street','zip':'7777','partner': ids[0],'active':True})) value.update(name='whatever') value.update(addresses=new_addresses) return {'value':value} And these view fields

Odoo 8: Many2many domain filter

拈花ヽ惹草 提交于 2019-12-03 19:25:10
问题 I have several organization types with a many2many relation describing which types that may be parent to other types (e.g. department can be parent to sub-department and working group). It's NOT a strict hierarchy (working group can be parent to other working groups), hence the many2many relation. I have two fields on my organization_type object: allowed_parent_type_ids and the inverse allowed_children_type_ids . Now I want to restrict the organization type field on my organization object

Can we able to inherit and change the noupdate=“1” in odoo?

邮差的信 提交于 2019-12-03 16:14:04
Is it possible to inherit from one xml and to change its updatable. I tried to inherit "Check Action Rules" to change the "interval_number" from 4 to 1 hours. To make it run every single hour. I don't think it may work because of noupdate="1". Anyone have any idea about this? Yes you can change the noupdate file by the help of hook. In the manifest file next to data add 'post_init_hook': 'post_init_hook', create hooks.py file def post_init_hook(cr, registry): env = api.Environment(cr, SUPERUSER_ID, {}) orginalxml=env.ref('module.external id') orginalxml.write({'field_name_to_inherit':value, })