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

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
Time field in odoo تم الحل
3
مارس 20
42956
0
نوفمبر 19
2715
1
ديسمبر 16
5989
2
مايو 24
3947
1
فبراير 24
1862