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


class SaleTransportOrder(models.Model):

          _inherit = 'sale.order'

          transport_id = fields.Many2one('transport.management', string="Transport Via", required=True)
          def  action_confirm(self):

          rec = super(SaleTransportOrder, self).action_confirm()

           i = self.env['stock.picking'].create({'transport_id':self.transport_id.id, })

           returnrec

class   Stockpicking(models.Model):

            _inherit = "stock.picking"
            transport_id = fields.Many2one("transport.management",string="Transport Via",tracking=True,required=True ,           readonly=True)

아바타
취소
작성자
bro not showing any thing please type enlish

On Thu, Dec 29, 2022 at 6:12 PM Malik Imad Khan <notifications@mail.odoo.com> wrote:

Une nouvelle question how to pass value sale.order to stock.picking , below my code i am trying but not work please help me, i use odoo V14 le Aide a été publiée. Cliquez ici pour accéder à la question :

Voir la question

--
Malik Imad Khan

Envoyé par Odoo S.A. utilisant Odoo.

작성자 베스트 답변

i was value create or write sale.order to stock.picking but now done

this code.

def action_confirm(self):

    res = super(SaleTransportOrder,self).action_confirm()

    for rec in self:

   rec.picking_ids.write({'transport_id':rec.transport_id.id})

   return res

this is answer


아바타
취소

ِThis is work and my below answer also work.

베스트 답변


sale_id field already exists in stock.picking so you need to add "sale_stock" to your depends in __manifest__.py file and then you can add related field as below to get  transport_id  in stock.picking.

You don't need to override  action_confirm  in sale order. so you can remove it. 

class SaleTransportOrder(models.Model):
_inherit = 'sale.order'

transport_id = fields.Many2one('transport.management', string="Transport Via", required=True)

class Stockpicking(models.Model):
_inherit = "stock.picking"

transport_id = fields.Many2one(related="sale_id.transport_id ", string="Transport Via", store=True)
아바타
취소
관련 게시물 답글 화면 활동
1
11월 21
2457
0
8월 25
164
1
8월 25
2122
1
7월 25
2593
2
7월 25
8033