마법사의 Many2many 유형 필드 ('pack_ids')와 sale.order.line의 Many2many ('pack_id') 유형 필드가 있습니다. 그리고 나는 Many2many 유형의 마법사 필드 ('pack_ids')의 값이 sales.order.line 필드 ('pack_id')로 반환되기를 바랍니다. 이 내 코드에 대한 Odoov10의 마법사에서 sales.order.line의 반환 값
은 여기에 있습니다 :
class SalePackWizard(models.TransientModel):
_name = "sale.pack.wizard"
_description = "Sale Pack Wizard"
@api.onchange('product_id')
def _onchange_product_pack_name(self):
print"A:", self.product_id.product_pack
res = self.product_id.product_pack
a = {}
print "res:", res
if res:
domain = {'pack_ids': [('id', 'in', [v.id for v in res])]}
a= res
print "a:", a
return {'domain': domain}
product_id = fields.Many2one('product.product', string="Product Pack", required=True, domain="[('is_pack','=',True)]")
qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0)
pack_ids = fields.Many2many('product.pack', string='Pack Products', change_default=True,
default=_onchange_product_pack_name)
@api.multi
def action_salepack_add(self):
rec = self._context.get('active_ids', [])
print "REC", rec, self.product_id.categ_id #product_uom
if rec:
line_values = {'product_id': self.product_id.id,
#'design_id':self.design_id.id,
'pack_id': self.product_id.product_pack,
'category_id':self.product_id.categ_id.id,
'order_id':rec[0],
'product_uom_qty':self.qty,
}
sale_order_line = self.env['sale.order.line'].create(line_values)
안녕하세요, ** ** 미리 product.product 필드 ** product_pack **의 유형은 무엇입니까? –
It 's Many2one type 필드 –