在odoo 10中使用自定义模块中的库存模块

时间:2017-12-06 12:11:55

标签: xml python-2.7 odoo-10

我是Odoo的新手。我有两个字段调用部件和位置。我需要从库存中获取相关产品。我怎么能在xml和python中做到这一点。 这是我的代码,

class SO_Parts(models.Model):
_name = 'my_so_parts'

so_p_id = fields.Many2one('my_depots_so',string='Add Service Order Part', invisible='1')
created_date = fields.Date('Date Created',default=date.today(),readonly=True)
so_part_type = [
                ('r_r','Remove/Repair'),('add','Add'),('r_s','Remove/Scrap'),('r_b','Remove/Bench')
                ]
so_part_t = fields.Selection(so_part_type,'Type',default ='add', required='1')
so_part_product = fields.Char('Product')
so_part_description = fields.Char('Description')
so_part_sno = fields.Char('Serial No:')
so_part_qty = fields.Integer('Quantity')
so_part_stype = [
           ('stockable','Stockable'),('consumable','Consumable')
        ]
so_ps_type = fields.Selection(so_part_stype,'Stock Type',default ='stockable', required='1')
so_part_source = [
    ('mystock','MS'),('shop','Shop')
]
so_psource = fields.Selection(so_part_source,'Source',default ='toweriq', required='1')
bo_sequence = fields.Char('BO Number', readonly=True)
bo_status = [
    ('new', 'New')]
bo_status = fields.Selection(bo_status, 'Status', default='new')

我需要使用库存模块执行此操作。这里我不使用库存模块

1 个答案:

答案 0 :(得分:0)

您可以在一个字段中使用product.product。 for so_part_product = fields.Char(' Product')将其替换为

so_part_product = fields.Many2one('product.product',string='Product')

谢谢