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

Hi, 

when I press smart button the function that returns orders already created does not run

anyone knows why?


class ContractContract(models.Model):

    _inherit = 'contract.contract'


    orders_count = fields.Integer(compute="_compute_orders_count")

    orders_ids = fields.One2many(string='Orders', comodel_name='sale.order',     inverse_name='contract_id', default=None)


    def action_view_sales_orders(self):

        return {

            'name': 'Orders',

            'type': 'ir.actions.act_window',

            'res_model': 'sale.order',

            'view_mode': 'tree',

            'domain': [('id', 'in', self.orders_ids.ids)], 

            'context': "{'create': False}"

        }


    <button class="oe_stat_button"

      type="object"

      name="action_view_sales_orders"

      icon="fa-list"

        <field string="Orders"

               name="orders_count"

               widget="statinfo"/>

    </button>

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

Do you mean when you click on the button, nothing happens and is not returning action?

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

Hello Jakub Patch,

Can you try this code -

def action_view_sales_orders (self):

return {

'name': _ ('Orders'),

'view_type': 'form',

'view_mode': 'tree, form',

'res_model': 'sale.order',

'type': 'ir.actions.act_window',

 'domain': [('id', 'in', self.orders_ids.ids)], 

'context': {

'create': False

}

}

Thanks ..

For more information Contact us:- https: //kanakinfosystems.com/odoo-development-services

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 21
4596
1
thg 10 19
6004
3
thg 3 15
9642
2
thg 2 23
3141
1
thg 10 21
4257