def action_cash_advance(self): ctx = { 'default_partner_id': self.id, } model_name = 'account.invoice' domain = [('partner_id', '=', self.id)] return Util.jek_redirect_to_model(model_name, 'Employee Cash Advance', ctx, domain=domain)
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_rfq_list(self): ctx = { 'search_default_purchase_request_id': self.name, } domain = [('purchase_request_id', '=', self.id)] return Util.jek_redirect_to_model('purchase.order', 'RFQ by PR Number', ctx, domain=domain)
def action_leave_carry_over(self): model_leave_carry_over = self.env['berdikari.leave.carry.over'] today = datetime.now() leave_period_year = today.year + 1 check_date = date(today.year, today.month, today.day) leave_period_date = date(leave_period_year, 1, 1) ctx = { 'default_employee_id': self.id, 'default_leave_to_carry_over_period': str(leave_period_year) if check_date == leave_period_date else str((today.year - 1)), } model_name = 'berdikari.leave.carry.over' domain = [('employee_id', '=', self.id)] return Util.jek_redirect_to_model(model_name, 'Leave Carry Over', ctx, domain=domain)
def action_report_receive_money(self): if self.journal_type == False: self.journal_type = 'all' ctx = { 'date_range': "{} - {}".format( self.date_from.strftime('%d %m %Y'), self.date_to.strftime('%d %m %Y'), ), 'date_from': self.date_from, 'date_to': self.date_to, 'search_default_groupby_journal_type': self.journal_type, } domain = [] if self.date_from: domain.append(('payment_date', '>=', self.date_from)) else: domain = domain if self.date_to: domain.append(('payment_date', '<=', self.date_to)) else: domain = domain if self.journal_type != 'all' and self.journal_type != False: domain.append(('journal_type', '=', self.journal_type)) else: domain = domain if self.payment_type != 'all' and self.payment_type != False: domain.append(('payment_type', '=', self.payment_type)) else: domain = domain model_name = 'account.payment' action = Util.jek_redirect_to_model(title='Receive Money', model_name=model_name, ctx=ctx, domain=domain) 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_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