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

The following Code is :---


class prakrutiTemplate(models.Model):

 _inherit = 'product.template'

pm_name = fields.One2many('packing.material.line','name',string= 'PName', store=True)

ps_name = fields.One2many('product.specification.line','name',string= 'PSName', store=True)

def _get_product_template_type(self, cr, uid, context=None):

res = super(prakrutiTemplate, self)._get_product_template_type(cr, uid, context=context)

if 'packing' not in [item[0] for item in res]:

res.append(('packing', _('Packing Materials')))

return res

class packingMaterialline(models.Model):

_name= 'packing.material.line'

name = fields.Many2one('packing.material.line', string= 'Package name')

pname = fields.Many2one('packing.material',string='Name')

desc = fields.Char(related='pname.desc',string='Package Description')

class productSpecificationline(models.Model):

_name = 'product.specification.line'

name = fields.Many2one('product.specification.line',string= 'Name')

pname = fields.Many2one('product.specification', string= 'Name')

parameter = fields.Char(related='pname.desc',string='Product Specification')

class packingMaterial(models.Model):

_name= 'packing.material'

name = fields.Char(string= 'Package name')

desc = fields.Char('Package Description')

class productSpecification(models.Model):

_name= 'product.specification'

name = fields.Char(string= 'Product name')

desc = fields.Char('Specification')

아바타
취소

Please use short and concise titles and place your message in the message body. This is very annoying.

베스트 답변

class productSpecificationline(models.Model):

_name = 'product.specification.line'

name = fields.Many2one('product.specification.line',string= 'Name')

Wrong relation in your many2one field that is error. ( product.specification.line)

class openerp.fields.Many2one(comodel_name=Nonestring=None**kwargs)

Bases: openerp.fields._Relational

The value of such a field is a recordset of size 0 (no record) or 1 (a single record).

Parameters

  • comodel_name -- name of the target model (string)

  • domain -- an optional domain to set on candidate values on the client side (domain or string)

  • context -- an optional context to use on the client side when handling that field (dictionary)

  • ondelete -- what to do when the referred record is deleted; possible values are: 'set null','restrict''cascade'

  • auto_join -- whether JOINs are generated upon search through that field (boolean, by defaultFalse)

  • delegate -- set it to True to make fields of the target model accessible from the current model (corresponds to _inherits)

 The attribute comodel_name is mandatory except in the case of related fields or field extensions.

아바타
취소
관련 게시물 답글 화면 활동
2
6월 24
4718
2
2월 18
7116
Product Defaults 해결 완료
2
1월 17
3511
0
8월 16
48
1
8월 25
292