Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I'm trying to implement a boat company module.
I have various boats, and each boat has model options, like engine names, etc.
In my sale.order module, I have extended the module to be able to enter boat name
In the Order Lines page of that form, I have an option to select the model options relevant to that boat name. And I'm trying to implement a search function that refines the results of that drop down to only the models of that particular boat's id we just selected above.
I wrote the function but it's not working for some reason. Can you please help me out?
Here are the relevant files:
<record id="sale_view_order_form" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<xpath expr="//field[@name='product_id']" position="attributes">
'boatlength':fields.char("Boat Length", size=18),
'fuelcapacity':fields.char("Fuel Capacity", size=18),
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
print("Hii Search has started")
if context is None:
print("Heloo context was none")
#code to limit by category assigned to the boat model
productobj=self.pool.get('product.template').read(cr, uid, context['boatmodel_id'],['modeloptions_id'])
args=[('categ_id','=',productobj['modeloptions_id'])] + args
return super(product_template, self).search(cr, uid, args, offset, limit, order, context=context, count=count)
'boatmodel_id':fields.many2one("product.template","Boat Model", domain=[('categ_id.name','=','Boat Models')]),
Note:As you may have noticed, I have written print statements to test the outputs of the search function on the console. But nothing ever gets printed. I guess the search function never gets called. I'm using Odoo 8
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/12/15, 6:43 AM|
|Seen: 737 times|
|Last updated: 3/16/15, 8:10 AM|