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

I have a model contribution_period

class contribution_period(models.Model):
    _name='contribution.period'

    PERIOD_STATE = [
        ('create''Create'),
        ('ask_payment_done''Payment requests made'),
    ]
    
    #Fields
    state = fields.Selection(PERIOD_STATE, 'State')
    name = fields.Char('Name of the period'required=True)
    period_start = fields.Date('Start of the period'required=True)
    period_end = fields.Date('End of the period'required=True)

    _defaults = {
        'state''create',
    }

    @api.multi
    def create_payment_requests(self):
        
        self.state = 'ask_payment_done'


In the method create_payment_requests, I want to create a line in the model member_payment per record in member_active. Is it possible?

아바타
취소
베스트 답변

Hi Louis:

Yes you can call methods of other models. Here's an example of the "_get_mto_route" method of model "stock.warehouse" being called from the "_check_routing" method of model "sale_order_line".

https://github.com/odoo/odoo/blob/8.0/addons/sale_stock/sale_stock.py#L291

You may also find the following documentation useful to understand the concepts involved.

https://www.odoo.com/documentation/8.0/reference/orm.html

아바타
취소
관련 게시물 답글 화면 활동
1
8월 25
624
1
8월 25
777
2
7월 25
3365
3
7월 25
956
1
6월 25
2497