I find the solution, sale.report is not a real model, it's a view. For add field, you need to overwrite select method. so class sale_report(osv.osv): _inherit = 'sale.report' date_order_month = fields.Char(string='Date Month') date_order_day = fields.Char(string='Date Day') def _select(self): select_str = """ SELECT min(l.id) as id, l.product_id as product_id, t.uom_id as...
@api.depends This decorator is specifically used for "fields.function" in odoo. For a "field.function", you can calculate the value and store it in a field, where it may possible that the calculation depends on some other field(s) of same table or some other table, in that case you can use '@api.depends'...
Just follow this way I just try to do something like this from my end from openerp.osv import fields, osv from openerp import tools from dateutil.relativedelta import relativedelta import datetime class myclass_nextyear(osv.Model): _name='myclass.nextyear' def str_to_datetime(strdate): return datetime.datetime.strptime(strdate, tools.DEFAULT_SERVER_DATE_FORMAT) def compute_next_year_date(self, strdate): oneyear = datetime.timedelta(days=365) curdate = str_to_datetime(strdate) return datetime.datetime.strftime(curdate +...
First you need to browse that record and than assign it's value to a field1. Try with this def button1(self, cr, uid, ids, context=None): field2 = self.browse(cr, uid, ids[0], context=context).field2 return self.write(cr, uid, ids, {'field1': field2}, context=context) ...
Track the following: checkout __init__.py, __openerp__.py files weather any server track-back appear or not find the path of addons module is your module is at same place or path? give read/write/execute permission for that module restart your server Go to browser, from GUI, Setting => Modules => Update Modules List...
openerp,odoo,openerp-7,raiseerror
You can add Add Python constraints like, @api.one @api.constrains('start_trip', 'start_business', 'end_business', 'end_trip') def _check_date(self): now = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT) if self.start_trip and now < self.start_trip: raise exceptions.ValidationError("Entered Date Should be greter then Today") elif self.start_business and now < self.start_business: raise exceptions.ValidationError("Entered Date Should be greter then Today") elif self.end_business and now <...
You need to return a dictionary of dictionary for functional fields. You defined res as list and tried to assign as the dictionary. res[perfo.id] is considered as list and index value perfo.id is not found in the res list. That is what the error says. Now the code will be...
If you only want to change the string of existing filter than use attributes for example: <record id="sale_order_list_select" model="ir.ui.view"> <field name="name">sale.order.list.select</field> <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_sales_order_filter"/> <field name="arch" type="xml"> <filter string="To Invoice" position="attributes"> <attribute name = "string">WON</attribute> </filter> <!-- After "Sales" filter it will add new...
Add the readonly attribute. You can do this either in your model or in the view (one of those in enough). Example of the latter: <field name="clicshopping_products_id" readonly="1"/> This won't change the fields color to gray, but it will made it uneditable, and that's what you ultimately want, if I...
openerp,odoo,openerp-7,openerp-8,odoo-8
If you take a look at the user definition, you can find the password field: 'password': fields.char('Password', size=64, invisible=True, copy=False, help="Keep empty if you don't want the user to be able to connect on the system."), In order to implement your desired behavior, create an 'onchange' method for the password...
If you want to call the python function on your button click you must have to set the same method name in your button name attribute and button type attributes as the object. I will give the small demo with you just check it with one your hand def main_val(self,cr,uid,ids,context=None):...
And finally it's done : ) Following is my working code in python: models.execute_kw(db, uid, password, 'res.users', 'search',[[['id','=',userid],['groups_id.name','=','Manager'],['groups_id.category_id.name','=','Point of Sale']]],{}) ...
python-2.7,calendar,odoo,odoo-8
Is your field used for 'display_start' on your view has a default value on your model ? I think it's because it returns False for this field you have this error. If it returns today, I think it will be ok....
in the searching of currency_rate_id, the search function is getting an empty list and you are trying to select the first element from the empty list which causes the error
States data are defined in res.country.state.csv file as you mentioned. You can define a new file like this one or just modify it respecting that format. To visualize your changes, don't forget to update base module (restarting server not enough). If you create a new file don't forget to add...
The fields you use in attrs need to be present in the current view. You can add this field to model: class test_rule(models.Model): _name = 'test.rule' rule_id = fields.Many2one('test.list', required=True) type_test = fields.Selection(related='rule_id.type_test') ul = fields.Many2one('product.ul', string='Package Logistic Unit') And then to your form: <form string="Test Rules"> <field name="type_test" invisible="1"/>...
By using this module you can backup your database periodically https://www.odoo.com/apps/modules/7.0/crontab_config/ (v7) you can also test this module https://www.odoo.com/apps/modules/6.1/db_backup_ept/ (v6 it can be miggrated to v7) in your case you can add button to execute the function that will be executed by the schedular....
you may make related field for it and than add field on a attrs after than it will work fine. For example: 'category': fields.related('m2_id', 'category', type="char", relation='target_table_name', readonly=True, string="Category"), now use in xml like <field name="m2_id" /> <field name="category" invisible="1"/> <field name="option" attrs="{'invisible': [('category','=','val1')]}" /> ...
try with this code: class mrp_bom(osv.osv): _inherit = 'mrp.bom' _name = 'mrp.bom' _columns = { 'x_nk_default_code': fields.related('product_id', 'default_code', type='char', relation='product.product', string='Part Number', store=True, readonly=True), 'x_nk_class_desc': fields.related('product_id', categ_id', 'name', type='char', string='Class Description', store=True, readonly=True), } Here is an example of related field in Odoo. ...
The name_get method is used to display value of a record in a many2one field. For example, in a sale order line, if you select a product, the value displayed in the sale order line for the field 'product_id' must be the result of the 'name_get' on the product.product object....
python,python-2.7,openerp,odoo,openerp-8
The Odoo server can process only one request at a time. This means that other request have to wait until they are processed. The solution is to run Odoo in multiprocess mode, where several workers can handle requests is parallel (docs): Use the --workers=x option, where x is the number...
One likely culprit is the recomputation of the parent_left and parent_right fields. You could try disabling it by using a context with 'defer_parent_store_computation': True and then calling self._parent_store_compute(cr) when all the categories have been computed.
You need to run Odoo with the -u options for the changes to be applied: ./odoo.py -u changed_module_name ...
I just fixed this issue for our invoices. Odoo switched from Mako in v7 to Jinja2 in v8, with a "simulated" Mako notation where most things work as before. Inline Python code doesn't, this "n" filter doesn't. You have to switch from Mako's "|n" to Jinja2's "|safe" (this filter means...
You have a condition problem for orange test: ( ( record.eth_current_stage_deadline.raw_value gt new Date() ) and (record.eth_current_stage_deadline.raw_value - new Date() lt 3*86400000) ) Note that there are two comparisons like this: (date_val > today) and (date_val - today < 3 days) The value 86400000 = 24 * 60 * 60...
try _columns={ 'sale_price_unit': fields.related('procurement_id','sale_line_id','price_unit',string='Prix de vente',type='float', store=True, readonly=True), } ...
python,templates,inheritance,odoo
In OpenERP, Sequence is matter when we inherit other class. So first we need to match that hierarchical. For example if any new object is define in other files and we inherit that class in another file than we must to load/import parent file first. So we never get that...
In Odoo 8.0 new API the field itself use the related attribute in any fields. hear there have no any facility to add the separate field as related Just like this.. country_id = fields.many2one('res.country', 'Country') state_id=fields.many2one(related='country_id.state_id.id', store=True) I hope this should helpful for you .. :)...
openerp,imap,odoo,odoo-8,fetchmail
Finally, I've found the problem, which is very specific I guess, but who knows, may be this answer helps someone in the future. I've realized that the module fetchmail_attach_from_folder was installed in all the computers which were giving errors, on the contrary, it was not installed in those which there...
You can use 'name_get' method to achieve this. def name_get(self,cr,uid,ids,context=None): result = {} for record in self.browse(cr,uid,ids,context=context): result[record.id] = record.name + " " + record.lastname return result.items() Following is just an example: There is a model 'sale.order', in that there is a model 'res.partner' as many2one. So let's say you...
First when you create widget it will automatically render above xml file that you mention in first line so below line render the another widget template xml file $(Qweb.render("fb_shared_post", {'res':'Hello'})).prependTo('<TemplateDivID or Class>'); ...
openerp,openerp-7,odoo,openerp-8,rml
We can track from the Source Document In report.py we need to make a function and pass origin in it. def __init__(self, cr, uid, name, context): super(your_report_calss_name, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'get_cust_ref_val': self._get_cust_ref_val, }) This method will check like origin is SO or PO or OUT/###:SO### or...
You missed required module descriptor on model. try to _name or _inherit on your model class. It will resolve this kind of error....
Check the method argument while you are calling the method in Qweb View. def _hello_world(self, field): return "Hello World!" the above function uses some argument as field but you can try to called that function something like this. <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <template id="ig_account_object_printout_report_template"> <t t-call="report.html_container"> <t t-foreach="docs" t-as="o">...
raise osv.except_osv(('Error'), ('Error Cannot Edit')) ...
I solved it myself. I manually copied connector module from github to /usr/lib/python2.7/dist-packages/openerp/addons (to make sure it's in my IDE's libraries' path). Installed the connector from Settings -> Local Modules. Used the following code (can be anywhere, even in __init__.py of your module) @on_record_create(model_names=['res.users', 'res.partner']) @on_record_write(model_names=['res.users', 'res.partner']) def delay_export(session, model_name,...
my odoo installation is a little different, but this (adapated to your case) works for me : 'x_nk_class_desc': fields.related('product_id', 'categ_id', 'name', type='char', string='Class Description', store=True, readonly=True), the two changes I did are : removing relation='product.category' : from this I get (maybe wrongly) that it's only useful if the last term...
python,xml,openerp,odoo,openerp-7
I've just found a solution!! The problem arose when I clicked on the button Close, Discard or Save, the popup was closed and the function field of type="one2many" had no time to be reloaded. So I added an option to the function field: <field name="summary" options="{'reload_on_button': True}"> <tree> ... </tree>...
U want to use for loop in qweb report ? Example: <tr t-foreach="get_payslip_lines(o.line_ids)" t-as="p"> <td><span t-field="p.code"/></td> <td><span t-field="p.name"/></td> <td> <t t-if="p.amount < 0"> <span t-esc="formatLang(-p.amount, currency_obj=o.company_id.currency_id)"/></t> <t t-if="p.amount >= 0"><span t-esc="formatLang(p.amount, currency_obj=o.company_id.currency_id)"/></t> </td> <td> <t t-if="p.total <...
There is no need to inherit from product.template. Just make a one2many field referencing the template you want to change. Also, it seems like nk.product.template should be a TransientModel and not a normal model. Objects of transient models exist only temporarily and are not indefinitely stored in the database. They...
After the R&D i found the solutions for this... and its work for me... -> This error is also post in bugs.debian.org, and patch is provide to avoid this error. -> And another solution is (I prefer this one): Download this pfbfer.zip, and extract it. Now put all the files...
I actually just finished something similar. I did it using @api.onchange so for your purpose the function can look like this: @api.onchange('product') def product_changed(self) self.price = self.product.price In the view just display the fields....
In General Directory file structure for creating the Qweb Report in ODOO report directory file contain __ init __.py file which is use as the manifest file for any python module its kind of entry point of the python module. (add the entry point of the your_report_parser_class_file.py file) your_report_parser_class_file.py file...
Here ids[0] will give you id of bom line, and in bom line there is reference of product.product not product.template. so if you wanted to open a product you need to write a method like, def open_product(self, cr, uid, ids, context=None): rec = self.browse(cr, uid, ids[0], context) return { 'type':...
First go to your Odoo web module and open below file. addons => web => views => webclient_templates.xml Now find this tag <div class="oe_footer"> and put it comment like. <!--div class="oe_footer"> Powered by <a href="http://www.openerp.com" target="_blank"><span>Odoo</span></a> </div--> Hope this will solved your problem....
Yes we can use multiple condition on colors with the help of and and or for example: colors="blue:state=='approved' and doc_type=='revisi' " colors="blue:state=='approved' or doc_type=='revisi' " ...
It could happen if you run your server in "run" mode and not "debug" mode. If you are in "run" mode the breakpoints would be skipped. In Aptana, go to the "run" -> "debug" to run it in debug mode.
If we want to add new field or any new element on parent view than we need to specify it's position. Means this new field or new element will be shown in view. So in your case try with this: <record model="ir.ui.view" id="view_bill_clients_form"> <field name="name">bills.clients.form</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/>...
To install an internal dependency in bitnami Odoo stack: Go to /../odoo-8.0-6/python/bin/ Run from there the executable "python2.7" (Do not run native python shell. i.e. from command prompt or terminal.). Instead run python shell from above directory. In Python type: from subprocess import call call("pip install your_dependency_name",shell=True) e.g call("pip install...
pdf,report,wkhtmltopdf,odoo,qweb
Hear it means that the current Report not using the compatible version of Wkhtmltopdf python library you need to check from version of current Wkhtmltopdf python library and if it 0.12 to lower remove and reinstall then install the latest Wkhtmltopdf 0.12.X version or later and print your report again....
When you declared your field you gave it a set of options instead of a list of options. Sets in Python doesn't keep the information about items order, but lists do. For your declared order to be respected you just need to replace the set literal by a list literal:...
You can use in to choose from multiple values: fonts="bold:task_name in ('PLANNING AND DESIGN', 'DEVELOPMENT')" The following alternative approaches would also work, but in this particular case using in is preferable (as it is much clearer and shorter). Using or: fonts="bold:task_name == 'PLANNING AND DESIGN' or task_name == 'DEVELOPMENT'" Chaning...
Try Following and add your custom code either before to the return statement or catch the result of super somewhere and add your code after that and return the changed result, do not forget to return from the method. from openerp.osv import osv class lcd_update(osv.osv): _inherit = 'product.product' def create(self,...
Fields placed inside a <group> XML element will display labels by default. <field name="arch" type="xml"> <group> <field name="default_code" string="Item Number" readonly="1" invisible="0" /> </group> </field> ...
Generally both decoarators are used to decorate a record-style method where 'self' contains recordset(s). Let me explain in brief when to use @api.one and @api.multi: 1. @api.one: Decorate a record-style method where 'self' is expected to be a singleton instance. The decorated method automatically loops on records (i.e, for each...
First go to your Odoo web module and open below file. addons => web => views => webclient_templates.xml Now find this tag <div class="oe_footer"> and edit it like <div class="oe_footer"> Made by <a href="http://www.openerp.com" target="_blank"><span>Odoo</span></a> </div> Save it and refresh your browser. Hope you get what you want....
You need to declare which field is used for the object name, using the _rec_name attribute. In your case: class clicshopping_manufacturer(orm.Model): _name = 'clicshopping.manufacturer' _rec_name = 'clicshopping_manufacturers_name' # ... Alternatively, you could just rename clicshopping_manufacturers_name to name, since name is the default value for _rec_name. I'd choose the second option,...
AFAIK displaying icons in menu items is deprecated and does not work on the web client. Probably the to achieve you would need to create a module for the web client extending it with that capability.
You have added the field product_qty_available in the model mrp.bom and you are trying to add the field in the inside the field bom_line_ids - in the tree view of bom_line_ids which is one2many of mbrp.bom.line, so system tries to find the field product_qty_available over there in mrp.bom.line model which...
python,inheritance,openerp,odoo
Lets take an example. Suppose I have created a TestModel. class TestModel(models.Model): _name = 'test.model' name = fields.Char('Name', required=1) email = fields.Char('Field') user_id = fields.Many2one('res.users', 'Related User') Now I wanted to create a user when the record of test model is created. so I will modify the create method of...
you can achieve this by onchange method, here is a demo of onchange method using new api of odoo. class DemoModel(models.Model): _name = 'demo.model' field_x = fields.Integer('Column X') field_y = fields.Integer('Column Y') field_sum = fields.Integer('Column Sum') @api.onchange('field_x', 'field_y') def onchange_field(self): if self.field_x or self.field_y: self.field_sum = self.field_x + self.field_y you...
You are accessing the Odoo External API. The read method is to be used when you know the id for the records to fetch. To get records based on a condition you should use search_read and pass it a domain expression instead of the record ids. As an illustration, the...
First We Need to change the Order of the ir.actions.act_window and see Below Sample Demo for the customer(partner) <record id="base.action_partner_form" model="ir.actions.act_window"> <field name="name">Customers</field> <field name="type">ir.actions.act_window</field> <field name="res_model">res.partner</field> <field name="view_type">form</field> <field name="view_mode">tree,form,kanban</field> <field name="domain">[('customer','=',1)]</field>...
You need to install the additional languages on the Settings menu. Login as admin and make sure you have the Technical Features enabled (On user admin, Access Rights tab, Technical Features checkbox). On the Settings | Translations | Load a translation menu option you open a wizard to select and...
You have used wrong model in inherit it should be as follows: _inherit= 'stock.picking' _columns={ 'user_id': fields.many2one('res.users', 'user', select=True), } _inherit= 'stock.move' _columns={ 'user_id': fields.related('picking_id', 'user_id', relation="res.users", type='many2one', string="user", store=True, readonly=True) } ...
You can add to the addons_path directive in openerp-server.conf, (separate paths with a comma) or you can use --addons= if starting your server from the command line.
sql,postgresql,postgresql-9.2,odoo,pgadmin
[USING @Patrick 's cleaned up code] Most probable cause is that an 1:N relation exists between orders and order_lines, causing the orders with multiple order_lines to be included in the sum() more than once. SELECT to_char(o.date_order, 'DD-MM-YYYY') AS date_order , sum(o.amount_total) AS amount FROM public.sale_order o WHERE EXISTS ( SELECT...
change the Text of the button field value. ...
order,openerp,odoo,odoo-8,kanban
One method I use to to odd sortsis use the context to control it. In the window action for the kanban view, add a context like <field name="context">{'do_my_special_sort': True}</field> and then on the model, override the search method, check for this flag in the context and set the sort order....
You need to do this(small change in xml file)... and its work like charm. Put all code between <div> --put your code here-- </div> Here, i'm not putting your whole code structure, but you only put all your <button> and <ul> tag between <div></div>. So, your code looks like this......
python,performance,postgresql,odoo
You can create a selective index for the specific query, something like CREATE INDEX idx_order_messages on mail_message (id) where model = 'purchase.order' A smaller index results in fewer reads etc, so it must be faster....
inheritance,view,odoo,openerp-8
You need to specify which view to open for which view mode. Because when you copy another model's view, it seems it does not find correct view automatically (even if only one is defined for each mode) <record model="ir.actions.act_window.view" id="action_my_model_template_tree"> <field name="sequence" eval="1"/> <field name="view_mode">tree</field> <field name="view_id" ref="view_my_model_template_tree"/> <field name="act_window_id"...
python,orm,openerp,odoo,openerp-8
it might not be the brightiest way, but you should be able to do something like this : def get_age_comp(self, cr, uid, context=None): cr.execute('DELETE FROM stat;') cr.execute('''INSERT INTO stat(name, age) SELECT name, date_part('years',age(birth_date)) FROM fci_student WHERE gender='m' AND date_part('years',age(birth_date)) > 18;''') if you don't want to drop existing stat rows...
def onchange_client(self,cr,uid,ids, client_id,sale_orders_ids,context=None): res={} order_obj = self.pool.get('sale.order') order_ids = order_obj.search(cr,uid, [('partner_id','=',client_id)]) logging.info('LIST OF SALE ORDERS OF SELECTED PARTNER') logging.info(order_ids) return {'domain':{'sale_orders_ids':[('id','in',order_ids)]}} you can do it with set domain on many2one field....
python-2.7,openerp,odoo,openerp-8,odoo-8
I just searched for "passwords do not match" and IntelliJ took me to addons/auth_signup/controllers/main.py:116. This is where an assert is introduced to check if the passwords match. The simplest thing would be to add an assert with your custom message, following their example. Good luck!...
python,orm,openerp,odoo,openerp-8
It's very hard (verging on impossible) to answer without seeing your actual code. The problem is clearly in _inherits definition in one of your models. Most likely you mixed up _inherits and _inherit. While the later one can be a either a list or a single string, _inherits has to...
Refer pycups Documentation. As there is no available package for Windows right now, You can not run in windows machine. Try in Mac OS or any *NIX environment. You can not install linux packages into Windows!...
When This Type is Problem Occurred Then Following Command in your Terminal Most simple way is to install nodeJs with its package manager npm. Nodejs is in the repositories, but that one is a bit outdated, instead you could use this ppa: sudo apt-add-repository ppa:chris-lea/node.js sudo apt-get update sudo...
You want to filter the purchase_approval_item tree to have only the records where the approved_by_ids one2many field contains a certain a user - probably the current one. You should have a search view for your purchase_approval_item model, with: <filter domain="[('approved_by_ids', 'in', [uid])]" name="filter_my_approvals" string="My Approvals" /> ...
I solved as : def _format_date(self, cr, uid, ids, field_name, arg, context=None): res = {} for line in self.browse(cr, uid, ids, context=context): print line.id,'date ',str(line.date).replace(',','.') if line.date: res[line.id]=line.date.split()[0] return res _columns={ 'date_fin': fields.function( _format_date,method=True, string='date fin',type='date', store = { 'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['sale_price_unit','product_uom_qty'], 10), },...
ios,openerp,odoo,openerp-7,openerp-8
You do not describe how you are interfacing with Odoo, but I looks like you are using some library performing XML-RPC calls. The create() API function accepts a dictionary with the data for the new record to be created. It looks like that the dictionary after the create, argument should...
Eclipse + PyDev convenient for OpenERP/Odoo-Python. For quick computations, apply patches, Idle is great. Also Aptana Studio (http://www.aptana.com/) is good and it's alongside GIT to have local version control. It is easy to either deploy locally or push the changes to a remote GIT repo. here is good anwer given...
First of all you need to use partner's id, not user's id. Second of all you need to add all users, not only the first one. This is a code based on what I use in my project to create an array that can be used as a value for...
i don't know if anyone have the same problem as I but the solution that i found was to add a warning to the return instead of the raise osv.except.... ... for vat,nam,estado in registos: if estado == 'open' or estado == 'paid': result['name'] = nam return{'value': result, 'warning':{'title':'warning','message':'Não pode...
I did not add 'stock' in my depends __openerp__.py file. It is possible to check this by looking at the file or executing this query : select * from ir_model where model='stock.picking' select * from stock_picking ...
You can use function field. Function is called when the form loading and at the time of new record creation before and after. When you create a new record this function field will take value as a William and after saving value will change and become odedra Here is example...
That's what domain is for: To have the selectable list filtered by type 'external' add: domain=[('type', '=', 'external')] You can set the domain either in the field definition (python file) or in the view field (XML file). The actual filter is done by the view; if you set the domain...
The product_uom field has a groups="product.group_uom" attribute. This makes it visible only to the users in that Group. Either remove it from the tree definition, or make sure your user in in that group. Probably what you need is just to activate the "Allow using different units of measures" feature...
You need to write default_get in that pop-up object. try with this, def default_get(self, cr, uid, fields, context=None): product_obj = self.pool.get('product.product') record_ids = context and context.get('active_ids', []) or [] res = super(product_product, self).default_get(cr, uid, fields, context=context) for product in product_obj.browse(cr, uid, record_ids, context=context): if 'default_code' in fields: #in 'default_code' is...
You need to: Choose "Users" from the menu Click the current user, and edit it by checking "Technical features" Refresh the page Click the "Update module list" menu item. ...