تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3899 أدوات العرض

I have to create sale order line in on change of route_id, but i am trying to using self.copy()method, but there is issue of order_id. I didn't get order_id, because I need current record id of Sale Order instead of NewId.

@api.multi
@api.onchange('route_id')
def _onchange_route_id(self):
    # Ht stock route dosen't have enough quantity, add new sale order line
    remain_qty = 0
    route_ht_stock = self.env.ref('custom_stock.route_warehouse0_ht_stock', raise_if_not_found=False)
    if self.route_id.id == route_ht_stock.id:
        if not self.product_id.qty_available >= self.product_uom_qty:
            remain_qty = self.product_uom_qty - self.product_id.qty_available
            new_line = self.copy(default = {'order_id': self.order_id}))
الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يناير 20
3100
0
يناير 20
3358
1
ديسمبر 19
4268
1
مايو 24
3153
3
يونيو 23
16142