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

I have overridden a method to append some new items to the dictionary of the original method. the dictionary is the third item of a tuple. I want to add new items to the dictionary. when I execute my code I have this error:

'bool' object has no attribute 'dict_one'
 

here is my code:


def action_transaction_done(self):
        res = super(ProjectTransaction, self).action_transaction_done()

        res.dict_one['branch_id'] = self.branch_id.id
        return res

and this the orginal method code:


def action_transaction_done(self):

        for action in self:
        
            for line in action.details_by_category:
            
                if self.account_id:
                    dict_one= (0, 0, {
                       'name': line.name,
                       'partner_id': line._get_partner_id(credit_account=False),
                       'account_id': self.account_id,
                       'journal_id': action.journal_id.id,
                       'date': date,
                       #to be added here
                    
                       })
                       return dict_one

how can access the dictionary from the oveeriden method and add some new items to it?


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 23
3101
1
thg 1 23
2882
1
thg 8 22
3574
0
thg 8 22
2712
1
thg 3 22
2235