這是我的班級模特。和現場
class Selection(models.Model):
"""Seed Selection"""
_name = 'estate.nursery.selection'
picking_id= fields.Many2one('stock.picking', "Picking", readonly=True)
lot_id = fields.Many2one('stock.production.lot', "Lot",required=True, ondelete="restrict", domain=[('product_id.seed','=',True)])
selectionline_ids = fields.One2many('estate.nursery.selectionline', 'selection_id', "Selection Lines")
batch_id = fields.Many2one('estate.nursery.batch', "Batch")
stage_id = fields.Many2one('estate.nursery.stage',"Stage")
selectionstage_id = fields.Many2one('estate.nursery.selectionstage',"Selection Stage",
required=True)
qty_normal = fields.Integer("Normal Seed Quantity",)
qty_abnormal = fields.Integer("Abnormal Seed Quantity",)
date_plant = fields.Date("Planted Date",required=False,readonly=True,related='batch_id.date_planted',store=True)
qty_batch = fields.Integer("DO Quantity",required=False,readonly=True,related='batch_id.qty_received',store=True)
presentage_normal = fields.Float("Persentage Normal",digits=(2,2),required=False)
presentage_abnormal = fields.Float("Persentage Abnormal",digits=(2,2), required=False)
selection_date = fields.Date("Selection Date",required=True)
selection_type = fields.Selection([('0', 'Broken'),('1', 'Normal'),('2', 'Politonne')], "Selection Type")
selec = fields.Integer(related='selectionstage_id.age_selection')
maxa = fields.Integer(related='selectionstage_id.age_limit_max')
mina = fields.Integer(related='selectionstage_id.age_limit_min')
comment = fields.Text("Additional Information")
product_id = fields.Many2one('product.product', "Product", related="lot_id.product_id")
nursery_information = fields.Selection([('draft','Draft'),
('0','untimely'),
('1','late'),('2','passed'),
('3','very late'),('4','very untimely')],
compute='dateinformation', default='draft', string="Information Time" ,
readonly=True,required=False)
nursery_lapseday = fields.Integer(string="Information Lapse of Day",
required=False,readonly=True,compute='calculatedays',multi='sums',store=True)
nursery_lapsemonth = fields.Integer(string="Information Lapse of Month",
required=False,readonly=True,compute='calculatemonth',multi='sums',store=True)
nursery_plandate = fields.Char('Planning Date',readonly=True,compute="calculateplandate",visible=True)
nursery_plandatemax = fields.Char('Planning Date max',readonly=True,compute="calculateplandatemax",visible=True)
nursery_plandatemin = fields.Char('Planning Date min',readonly=True,compute="calculateplandatemin",visible=True)
nursery_persentagen = fields.Float(digit=(2.2),compute='computepersentage')
nursery_persentagea = fields.Float(digit=(2.2),compute='computepersentage')
state = fields.Selection([
('draft', 'Draft'),
('confirmed', 'Confirmed'),
('done', 'Done')], string="State")
culling_location_id = fields.Many2one('stock.location',("Culling Location"),
domain=[('estate_location', '=', True),
('estate_location_level', '=', '3'),
('estate_location_type', '=', 'nursery'),('scrap_location', '=', True)])
與顯示領域的工作模型的類定義。 –
我顯示我的工作模型類。在回答 –
在哪個事件你寫這個代碼(股票移動創建)?它在創建方法? –