Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5822 มุมมอง

I have made a new field here in stock.pack.operation model:


Now how can I give the value to the field of model stock.quant? =



Here I have the field test. like this in my code:

How can I give the value to this field in quants??

no ideas?

# -*- coding: utf-8 -*-
from openerp import models, fields, api

class gio_stock_pack_picking(models.Model):
    _inherit = ["stock.pack.operation"]
    field1 = fields.Float('Stückpreis')

class gio_stock_quant(models.Model):
    _inherit = ["stock.quant"]
    field2 = fields.Float(string='Stückpreis')

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

class StockPackOperation(models.Model):

    _inherit = 'stock.pack.operation'

field1 = fields.Float('Stückpreis')	


@api.multi

@api.constrains("field1")

    def _update_quant(self):

        line = None

        Lines = None   

        for move in self:

            line = ({

                'field1': move. field1,

            })

            lines = self.env['stock.quant'].search([('order_id.name','=', move.picking_id.origin),('product_id.id','=', move.product_id.id)]).update(line)

        return True



You can use the example below, I'm using order_id as an example plus you can use other fields so that stock.quant receives the value typed in stock.pack.operation



Do not forget to give a little tip there! went

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Time field in odoo แก้ไขแล้ว
3
มี.ค. 20
43085
0
พ.ย. 19
2794
field does not exist PROBLEM แก้ไขแล้ว
1
ธ.ค. 16
6036
2
พ.ค. 24
4030
1
ก.พ. 24
1903