Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
7587 Lượt xem

Hello!!

Please, i want to know how can we pass some values to a popup open through a button.

Is here any suggestion.

Best Regards.

Ảnh đại diện
Huỷ bỏ

What is the type of your button (object or action)?

Tác giả

my button' type is "OBJECT"

Câu trả lời hay nhất

Dear Drees Far,

Using below code you will pass the value in pop-up

write this code inside your button function if your button type is object

raise osv.except_osv(_('Warning'), _('Your message %s.') % (fetching value))

For example:

first import the library

1.from openerp.tools.translate import _

2. Define your function like below.

def reverse_stock(self, cr, uid, ids, context=None):

    product_obj = self.pool.get('product.product')

    for data in self.browse(cr, uid, ids, context=None):

        for line_data in data.invoice_line:

            if line_data.quantity < line_data.product_id.qty_available:

                pass

            else:

                raise osv.except_osv(_('Warning'), _('Your total available products are %s.') % (line_data.product_id.qty_available))

    return True

Ảnh đại diện
Huỷ bỏ
Tác giả

sorry but are you talking about POPUP????

Tác giả

@Ankit my friend, i have a button to click. And when i click on this button i call an other menu so that i want to define some values in the other menu. i am asking how can i do it ???

Câu trả lời hay nhất

Use the context attribute of the button tag. Example

<button name="method" string="clic me" type="object" context="{'key': 'value', 'field_key': field}" />
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 15
3968
0
thg 12 15
123
0
thg 12 15
76
0
thg 9 15
3962
2
thg 7 25
6579