콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

Hello everyone,

I try to call the "Create Backorder?" Wizard pop up using a Server Action. I created a button in the form view for the Server Action. But an error occured stating: Answers appreciated thank you!

AttributeError: 'stock.picking' object has no attribute 'open_wizard'

Below is my code:

def open_wizard(self):
    return {
        'name': 'Create Backorder?',
        'type': 'ir.actions.act_window',
        'view_mode': 'form', 'res_model':
            'stock.backorder.confirmation',
            'views': [[1530, 'form']],
            'view_id': 1530, 'target':
                'new', 'context': {
                    'button_validate_picking_ids': [27],
                    'default_show_transfers': False,
                    'default_pick_ids': [[4, 27]]
                   
                }
    }

actions = records.open_wizard()
아바타
취소
베스트 답변

Hi,

Try the following code,

class StockPicking(models.Model):

    _inherit = 'stock.picking'


    def open_wizard(self):

        return {

            'name': 'Create Backorder?',

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

            'view_mode': 'form',

            'res_model': 'stock.backorder.confirmation',

            'views': [[self.env.ref('stock.view_stock_backorder_confirmation').id, 'form']],

            'target': 'new',

            'context': {

                'button_validate_picking_ids': self.ids,

                'default_show_transfers': False,

                'default_pick_ids': [(6, 0, self.ids)]

            }

        }Make sure to replace the self.env.ref('stock.view_stock_backorder_confirmation').id with the correct ID of your form view.

actions = records.open_wizard()


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
0
4월 17
4450
0
6월 15
5796
0
1월 23
1958
0
1월 22
2986
1
10월 21
5253