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

Hi community, I am a bit new to Odoo development.


I am trying to modify the create() method of the stock.picking model, because I need to insert a new data in a field called pick-up date. 


I need this new field to be filled at the moment of confirming the sales order, because this is the moment when the picks are generated (when pressing the confirm button).


That button executes the action_confirm method in the sale.order model, which in turn executes the private _action_confirm method, I have discovered that this last method is the one that triggers the create method of stock.picking, however I can't find where and how. Because it only needs _action_confirm to exist, even though it doesn't do anything, I have tried:


def _action_confirm(self):

pass


And inside action_confirm, just call it:


self._action_confirm(),


However, I can't see at what point the create method of stock.picking is instantiated.


If the _action_confirm method is not called in action_confirm, neither is the create method of stock.picking, just call it, even if it does nothing


I hope you understand my problem, I don't know if I'm doing the right analysis or I'm just complicating my existence.




아바타
취소
베스트 답변

You can modify the create() method of the stock.picking model like this,


class CustomStockPicking(models.Model): 

_inherit = 'stock.picking' 

@api.model 

def create(self, vals): 

  ​picking = super(CustomStockPicking, self).create(vals) 

​# Add new data you needed 

​# You can also check it contain sale.order[sale_id] or not 

​return picking

아바타
취소
관련 게시물 답글 화면 활동
0
3월 21
2113
1
5월 25
1028
2
11월 24
2219
4
2월 24
12412
sale / delivery 해결 완료
1
1월 24
1695