# -*- coding: utf-8 -*-

from odoo import models, fields, api

class test2(models.Model):
	""" MAin FOrm class  """
	_name = 'saif.stock'
	_rec_name = 'date'


	date = fields.Date("Date",read=['portal.group_portal'], default=lambda self: fields.date.today())
	state = fields.Selection([('draft','Draft'),('validate',' Validate')],default='draft')
	saif_tree_link= fields.One2many('saif.stock.tree','part_id',read=['portal.group_portal'])

	@api.multi
	def validate(self):
		if self.state == 'draft':
			self.state = 'validate'

	@api.multi
	def reset(self):
		if self.state == 'validate':
			self.state = 'draft'



class saif_extension_tree(models.Model):
	""" tree class """
	_name = 'saif.stock.tree'

	# product = fields.Char(string='Product')
	product = fields.Many2one('product.product',string='Product')
	issued = fields.Float(string='Issued')
	received = fields.Float(string='Received')
	issued_to = fields.Char(string='Issued to')
	remarks = fields.Char(string='Remarks')
	part_id = fields.Many2one('saif.stock')

a9456060cee14a0d77c6ba958e37cfbb7ede6e64
<mask token>


class saif_extension_tree(models.Model):
    """ tree class """
    _name = 'saif.stock.tree'
    product = fields.Many2one('product.product', string='Product')
    issued = fields.Float(string='Issued')
    received = fields.Float(string='Received')
    issued_to = fields.Char(string='Issued to')
    remarks = fields.Char(string='Remarks')
    part_id = fields.Many2one('saif.stock')

<mask token>


class test2(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    @api.multi
    def validate(self):
        if self.state == 'draft':
            self.state = 'validate'

    @api.multi
    def reset(self):
        if self.state == 'validate':
            self.state = 'draft'


class saif_extension_tree(models.Model):
    """ tree class """
    _name = 'saif.stock.tree'
    product = fields.Many2one('product.product', string='Product')
    issued = fields.Float(string='Issued')
    received = fields.Float(string='Received')
    issued_to = fields.Char(string='Issued to')
    remarks = fields.Char(string='Remarks')
    part_id = fields.Many2one('saif.stock')

<mask token>


class test2(models.Model):
    """ MAin FOrm class  """
    _name = 'saif.stock'
    _rec_name = 'date'
    date = fields.Date('Date', read=['portal.group_portal'], default=lambda
        self: fields.date.today())
    state = fields.Selection([('draft', 'Draft'), ('validate', ' Validate')
        ], default='draft')
    saif_tree_link = fields.One2many('saif.stock.tree', 'part_id', read=[
        'portal.group_portal'])

    @api.multi
    def validate(self):
        if self.state == 'draft':
            self.state = 'validate'

    @api.multi
    def reset(self):
        if self.state == 'validate':
            self.state = 'draft'


class saif_extension_tree(models.Model):
    """ tree class """
    _name = 'saif.stock.tree'
    product = fields.Many2one('product.product', string='Product')
    issued = fields.Float(string='Issued')
    received = fields.Float(string='Received')
    issued_to = fields.Char(string='Issued to')
    remarks = fields.Char(string='Remarks')
    part_id = fields.Many2one('saif.stock')

from odoo import models, fields, api


class test2(models.Model):
    """ MAin FOrm class  """
    _name = 'saif.stock'
    _rec_name = 'date'
    date = fields.Date('Date', read=['portal.group_portal'], default=lambda
        self: fields.date.today())
    state = fields.Selection([('draft', 'Draft'), ('validate', ' Validate')
        ], default='draft')
    saif_tree_link = fields.One2many('saif.stock.tree', 'part_id', read=[
        'portal.group_portal'])

    @api.multi
    def validate(self):
        if self.state == 'draft':
            self.state = 'validate'

    @api.multi
    def reset(self):
        if self.state == 'validate':
            self.state = 'draft'


class saif_extension_tree(models.Model):
    """ tree class """
    _name = 'saif.stock.tree'
    product = fields.Many2one('product.product', string='Product')
    issued = fields.Float(string='Issued')
    received = fields.Float(string='Received')
    issued_to = fields.Char(string='Issued to')
    remarks = fields.Char(string='Remarks')
    part_id = fields.Many2one('saif.stock')

# -*- coding: utf-8 -*-

from odoo import models, fields, api

class test2(models.Model):
	""" MAin FOrm class  """
	_name = 'saif.stock'
	_rec_name = 'date'


	date = fields.Date("Date",read=['portal.group_portal'], default=lambda self: fields.date.today())
	state = fields.Selection([('draft','Draft'),('validate',' Validate')],default='draft')
	saif_tree_link= fields.One2many('saif.stock.tree','part_id',read=['portal.group_portal'])

	@api.multi
	def validate(self):
		if self.state == 'draft':
			self.state = 'validate'

	@api.multi
	def reset(self):
		if self.state == 'validate':
			self.state = 'draft'



class saif_extension_tree(models.Model):
	""" tree class """
	_name = 'saif.stock.tree'

	# product = fields.Char(string='Product')
	product = fields.Many2one('product.product',string='Product')
	issued = fields.Float(string='Issued')
	received = fields.Float(string='Received')
	issued_to = fields.Char(string='Issued to')
	remarks = fields.Char(string='Remarks')
	part_id = fields.Many2one('saif.stock')
