odoo-8

How to make odoo custom stock move (odoo v8 and v9)

走远了吗. 提交于 2019-12-08 04:32:36
问题 I am creating a custom module. There is an one2many field. It has - quantity unit of measure source location destination location I need to transfer the product from source location to destination location. In odoo v8 I saw two functions - def do_detailed_transfer(self) and do_transfer() But do_detailed_transfer is not available in odoo v9. How can I create a custom stock move which will transfer products from source location to destination location for both versions? Thanks. 回答1: I am able

Changing the Filename of a Uploaded Binary File Field

妖精的绣舞 提交于 2019-12-07 07:16:24
问题 I'm using Odoo8 I have a question I used the fields.binary to upload a file/s in Odoo. But when I try to download it the filename of the uploaded file is the model name. Is it possible to change the filename of the file? And second the filters attribute in fields does not work. 回答1: My Solution to this matter/problem, create first a compute field and its function .py filename = fields.Char('file name', readonly = True,store = False,compute ='legacy_doc1_getFilename') @api.one def legacy_doc1

How to use if in Odoo template language

不打扰是莪最后的温柔 提交于 2019-12-07 07:05:29
问题 I'm trying to use the same functionality as in Django: <div class="item {% if condition == True %}active{% endif %}"> In Odoo I have: <t t-foreach="list" t-as="l"> <a t-attf-href="/downloads/{{l.id}}" class="list-group-item"><t t-esc="l.name"/></a> </t> And I need to append class "active" if "c.id = cat_id" how it's done in Odoo? I'm using: <t t-foreach="categories" t-as="c"> <t t-if="c.id == category_id"> <a t-attf-href="/downloads/{{c.id}}" class="list-group-item active"><t t-esc="c.name"/>

How to get JSON data in an Odoo controller using type='json'?

喜夏-厌秋 提交于 2019-12-07 03:41:40
问题 A few days ago I did a similar question here: How to get JSON data in an Odoo controller? But now, I need to create a controller which receives only JSON data. So, I am doing the request from a Python console, this way: import requests import json url = 'http://localhost:8069/odoo/test' headers = {'Content-Type': 'application/json'} data = { 'name': 'Jane', 'email': 'jane.doe@gmail.com', } data_json = json.dumps(data) r = requests.post(url=url, data=data_json, headers=headers) I have created

Why are some items not translated in Odoo?

你。 提交于 2019-12-06 22:16:14
问题 I have a problem with translations in Project module. Some menu items are not translated. What could be the problem? Here project_view.xml <!-- Top menu item --> <menuitem name="Project" id="base.menu_main_pm" groups="group_project_manager,group_project_user" icon="fa-calendar" web_icon="project,static/description/icon.png" sequence="50"/> Here ru.po #. module: project #: model:ir.model,name:project.model_project_project #: model:ir.model.fields,field_description:project.field_project_task

Expected singleton: hr.employee(1, 2)

那年仲夏 提交于 2019-12-06 16:40:44
Good Day! Everybody I have an error while loading the kanban view. I inherit the hr.employee Kanban xml and just add a condition if a certain documents expired, it will add a Expired Documents notification in kanban view, here is the xml code: <record model="ir.ui.view" id="hr_kanban_view_employees_recruitment_kanban"> <field name="name">HR - Employees Kanban Document Status</field> <field name="model">hr.employee</field> <field name="inherit_id" ref="hr.hr_kanban_view_employees"/> <field name="arch" type="xml"> <xpath expr="//templates" position="before"> <field name="employee_id"/> <field

Get images from db by fields.function on QWeb report - Odoo 8

余生长醉 提交于 2019-12-06 14:37:33
I want to print an image getting it by a fields.function for any image in my database. I am trying the following: def _get_image(self, cr, uid, ids, name, args, context=None): res = dict.fromkeys(ids) for record_browse in self.browse(cr, uid, ids): partner = self.pool.get('res.partner').browse(cr,uid,6,context=None).image res[record_browse.id] = base64.encodestring(partner) return res _columns = { 'image': fields.function(_get_image, string="Image", type="binary"), } but in qweb report I got: File "/opt/*/openerp/addons/base/ir/ir_qweb.py", line 791, in value_to_html raise ValueError("Non

How can I delete the “sheet” node keeping its content intact?

不羁的心 提交于 2019-12-06 14:17:33
I would like to remove the node <sheet></sheet> from a form view. For instance, I have this view: <record id="view_account_period_form" model="ir.ui.view"> <field name="name">account.period.form</field> <field name="model">account.period</field> <field name="arch" type="xml"> <form string="Account Period"> <header> [...] </header> <sheet> <group> <group> <field name="name"/> <field name="fiscalyear_id" widget="selection"/> <label for="date_start" string="Duration"/> <div> <field name="date_start" class="oe_inline" nolabel="1"/> - <field name="date_stop" nolabel="1" class="oe_inline"/> </div> <

Odoo validate invoice from code

筅森魡賤 提交于 2019-12-06 14:08:09
问题 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'

Odoo loading javascript files in version 8?

你。 提交于 2019-12-06 09:57:24
问题 How do you load javascript files in version 8? In version 7, you could simply show the location of js in manifesto file ( __openerp__.py ) like this: 'js': ['static/src/js/file.js'], Now it does not work. For example I created js file in my module with this code: openerp.calendar_service = function(instance) { var _t = instance.web._t, _lt = instance.web._lt, QWeb = instance.web.qweb; instance.calendar_service = {}; console.log('TEST') }; But using debugger, I don't see that TEST is printed.