def action_breeding_list(self): ctx = { 'default_work_order_id': self.id, } model_name = 'berdikari.breeding.input' model = self.env[model_name] if len(self.line_breed_ids) == 1: rec = model.search([('work_order_id', '=', self.id)], limit=1) res_id = False if rec: res_id = rec.id action = Util.jek_open_form( self, model_name=model_name, id=res_id, ctx=ctx ) else: domain = [('work_order_id','=',self.id)] action = Util.jek_redirect_to_model( title='Breeding', model_name=model_name, ctx=ctx, domain=domain ) action = self.env.ref('berdikari.breeding_input_list_action').read()[0] action['domain'] = domain return action
def action_hatcher_input(self): ctx = { 'default_work_order_id': self.id, } model_name = 'berdikari.fms.grading.hatcher' res_id = False action = Util.jek_open_form( self, model_name=model_name, id=res_id, ctx=ctx ) return action
def action_write_off_input(self): ctx = { 'default_asset_id': self.id, } model_name = 'berdikari.asset.write.off' res_id = False action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) return action
def action_create_rfq(self): ctx = { 'default_purchase_request_id': self.id, } model_name = 'purchase.order' res_id = False action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) return action
def action_write_off_input(self): ctx = { 'default_asset_id': self.asset_id.id, 'default_asset_qty': self.qty, 'default_aquire_value': self.asset_id.value, 'default_write_off_value': self.asset_id.value, 'default_asset_used_id': self.id, } model_name = 'berdikari.asset.write.off' res_id = False action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) return action
def action_breeding_input(self): ctx = { 'default_work_order_id': self.id, } model_name = 'berdikari.breeding.input' # model = self.env[model_name] # rec = model.search([('work_order_id', '=', self.id)], limit=1) # res_id = False # if rec: # res_id = rec.id res_id = False action = Util.jek_open_form( self, model_name=model_name, id=res_id, ctx=ctx ) return action
def action_hachery(self): ctx = { 'default_flock_id': self.id, } model_name = 'berdikari.fms.hatchery' model = self.env[model_name] rec = model.search([('flock_id', '=', self.id)], limit=1) res_id = False if rec: res_id = rec.id action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) print(action) return action
def action_hatcher_list(self): ctx = { 'default_work_order_id': self.id, } model_name = 'berdikari.fms.grading.hatcher' model = self.env[model_name] if len(self.line_breed_ids) == 1: rec = model.search([('work_order_id', '=', self.id)], limit=1) res_id = False if rec: res_id = rec.id action = Util.jek_open_form( self, model_name=model_name, id=res_id, ctx=ctx ) else: action = Util.jek_redirect_to_model( title='Hatcher', model_name=model_name, ctx=ctx, domain=[('work_order_id','=',self.id)] ) return action
def action_biological_used(self): model_name = 'berdikari.asset.biologis.used' model = self.env[model_name] for rec in self: ctx = {} domain = [] res_id = False if rec.biologis_used_id: res_id = rec.biologis_used_id.id else: if rec.work_order_id and rec.asset_id: ctx['default_work_order_id'] = rec.work_order_id.id ctx['default_work_order_line_breed_id'] = rec.id ctx['default_asset_id'] = rec.asset_id.id domain.append(('work_order_line_breed_id', '=', rec.id)) rec = model.search(domain, limit=1) if rec: res_id = rec.id action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) return action
def action_work_order_input(self): if not (self.start_date and self.end_date and self.duration): raise ValidationError( _('Start Date, End Date, and Duration may not be empty!')) ctx = { 'default_flock_id': self.id, } model_name = 'berdikari.work.order' # model = self.env[model_name] # rec = model.search([('flock_id', '=', self.id)], limit=1) # res_id = False # if rec: # res_id = rec.id res_id = False action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) return action
def action_work_order_list(self): ctx = { 'default_flock_id': self.id, } model_name = 'berdikari.work.order' model = self.env[model_name] if len(self.work_order_ids) == 1: rec = model.search([('flock_id', '=', self.id)], limit=1) res_id = False if rec: res_id = rec.id action = Util.jek_open_form(self, model_name=model_name, id=res_id, ctx=ctx) else: action = Util.jek_redirect_to_model(title='Work Order', model_name=model_name, ctx=ctx, domain=[('flock_id', '=', self.id)]) return action