Skip to Content
Menu
This question has been flagged
3 Replies
3111 Views

I'm finishing a migration of a module that allows you to put 4 different sale prices in variants. The problem is that in the creation of a pricelist the fields are not shown. I'll show you


Product.product:

View

Pricelist:

View

I want to show price2, price3 and price4 in that selection. Anyone knows how to do it?

Avatar
Discard
Best Answer

Hi,

if you want to add some more selections to the existing selection field you can use selection_add parameter.
  first inherit the product.pricelist.item and then use base = fields.Selection(selection_add=[('price1', 'price1'),('price2', 'price2'),('price3', 'price3')])
when you do this these additional selections will come to the base selection field.you can do other modification based on that

 please refer this Extend existing selection with

Avatar
Discard
Author

Like this?

from odoo import fields, models, api

class PriceListItems(models.Models):

_inherit = 'product.pricelist.item'

base = fields.Selection(selection_add=[('price1', 'price1'),('price2', 'price2'),('price3', 'price3')])

Author

It doesn't work, doesn't add the options

Hi,

the above code will add additional selection values to the already existing selection field.So based on the values that you added you can use the prices that you defined in the product.

please check this https://ibb.co/ZVHbsFG

Author

Yea I know it should do that, but the problem is that i added the code, added to the init, reinstalled completly the module and it stills doesn't show up. Can you send me the code that you used?

i did exactly that you have done above.

_inherit = 'product.pricelist.item'

base = fields.Selection(selection_add=[('price1', 'price1'), ('price2', 'price2'), ('price3', 'price3')])

Author

It doesn't work. I don't knwo why it does not work. Can you help me if I show you all the source code or something?

Best Answer

Hello,

I think you have to enable Pricelist On Product in User form.

Just enable the debug menu and go to settings --> Users --> 

Check Here User Form

Avatar
Discard
Author

Doesn't change nothing, the new fields do not appear in the selection.

did you enabled it? try to reload and check in Products or Product Variant menu

Author

Yes, it still doesn't work