Jeff P.
Jeff P.

Reputation: 91

openERP: Changing "Create" button behavior for Search: Products

I'm trying to inherit and add/remove some fields from the default New Product page in openERP. I'd like to change the behavior of the default "Create" button in the Search Products view to send users to the new modified Products page, but I can't seem to change it. I've tried XPath, position="replace", and a few other things, but nothing seems to work. How do I grab it? Just use XPath and replace it with another button?

How do I change the results of clicking on that button?

Thanks,

Upvotes: 1

Views: 2054

Answers (4)

aaltinisik
aaltinisik

Reputation: 73

As I understand you want to modify product form view and remove some of the unnecessary fields for your application.

you just need to create inherited views for the fields you need to remove from the form view. for 6.1 to remove the weight field in product form view

  1. activate the developer mode by clicking information button next to the exit button on top right and click to the activate developer mode text.
  2. open the product form you would like to modify
  3. select manage views from developer drop down menu
  4. click edit
  5. select the field you would like to remove
  6. click on inherited view button to create an inherited view and confirm the dialogue go to views from settings > Customization > User interface > views
  7. find the inherited view you just created by writing name or object and checking the few results.
  8. the inherited view is like

<?xml version='1.0'?>
<field name='weight' position='after'> </field>

- to remove the weight field just change the position property with replace

<?xml version='1.0'?>
<field name='weight' position='replace'> </field>

save the inherited view, its done. you can also achieve this by just adding invisible to the filed property like

<?xml version='1.0'?>
<field name='weight' position='replace'><field name='weight' invisible='1'?></field>

if there are more than one inherited views referring to the same field you may need to increase or decrease the sequence value of the inherited view to change the order of inherited view to get the necessary behavior.

Upvotes: 0

Daniel Reis
Daniel Reis

Reputation: 13342

You don't describe what you want to achieve, but a possible solution coudl be:

  • Grant your users read-only access to the Product model, let them
  • Create new products through a wizard, opened through a Client Action.

Upvotes: 0

ifixthat
ifixthat

Reputation: 6295

Jeff,

You can not remove the create button by uisng XPath, position="replace". The Create Button is part of the From view Template which you can find in the web addons part formview js file. and qweb xml template, and You can modify it web with some hard code but that will affect all view as that create button is the Generic/ Common Template to all Views. So Even if you try CSS and JS stuff I do not suggest.

Thank You,

Upvotes: 0

OmaL
OmaL

Reputation: 5044

I think you are trying the remove the create button shown in the tree view. To remove it there is an openerp module called web-remove-quick-create. Its in the openerp apps. Please use this. Otherwise try to modify the jc and css files. Thank you

Upvotes: 1

Related Questions