Exemplo n.º 1
0
class pos_stock_inventory_categ_detail_line(osv.osv):
    _name = 'pos.stock.inventory.categ.detail.line'
    _description = 'Detalle del Inventario por Categoria'
    _rec_name = 'product_id'
    _columns = {
        'ref_id':
        fields.many2one('pos.stock.inventory.categ.detail', 'ID Ref'),
        'location_id':
        fields.many2one(
            'stock.location',
            'Ubicacion',
        ),
        'product_id':
        fields.many2one('product.product', 'Producto'),
        'product_uom_id':
        fields.many2one(
            'product.uom',
            'Unidad Base',
        ),
        'product_qty':
        fields.float('Cantidad', digits=(14, 2)),
        'default_code':
        fields.related('product_id',
                       'default_code',
                       type='char',
                       string='Codigo Interno',
                       readonly=True),
    }
    _defaults = {}
    _order = 'id'
Exemplo n.º 2
0
class report_kas_besar(orm.TransientModel):
    _name = 'dym.kas.besar'
    _description = 'Report Kas Besar'

    _columns = {
        'start_date':
        fields.date('Start Date'),
        'end_date':
        fields.date('End Date'),
        'branch_id':
        fields.many2one('dym.branch', 'Branch'),
        'journal_id':
        fields.many2one(
            'account.journal',
            'Journal',
            domain=
            "[('type','in',['cash']),('branch_id','in',[False,branch_id])]"),
    }

    def branch_id_onchange(self, cr, uid, ids, branch_id, context=None):
        dom = {}
        val = {}
        return {'domain': dom, 'value': val}

    def print_report(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        data = self.read(cr, uid, ids)[0]
        journal_id = data['journal_id']
        start_date = data['start_date']
        end_date = data['end_date']
        #start_value_date = data['start_value_date']
        #end_value_date = data['end_value_date']
        branch_id = data['branch_id']

        data.update({
            'branch_id': branch_id,
            'journal_id': journal_id,
            'start_date': start_date,
            'end_date': end_date,
            #'start_value_date': start_value_date,
            #'end_value_date': end_value_date,
        })
        if context.get('xls_export'):
            return {
                'type': 'ir.actions.report.xml',
                'report_name': 'dym_report_kas_besar_xls',
                'datas': data
            }
        else:
            context['landscape'] = True
            return self.pool['report'].get_action(
                cr,
                uid, [],
                'dym_kas_besar.report_kas_besar',
                data=data,
                context=context)

    def xls_export(self, cr, uid, ids, context=None):
        return self.print_report(cr, uid, ids, context)
Exemplo n.º 3
0
class report(osv.osv):
    _name = "graph.report"
    _auto = False

    _columns = {
        'tanggal' : fields.date('Tanggal', readonly=True),
        'ashar' : fields. many2one('mutabaah.ashar', 'Ashar', readonly=True),
        'maghrib' : fields.many2one('mutabaah.maghrib', 'Maghrib', readonly=True),
        'isya' : fields.many2one('mutabaah.isya', 'Isya', readonly=True),
        'tilawah' : fields.many2one('mutabaah.tilawah', 'Tilawah', readonly=True),
    }

    def init(self, cr):
        tools.drop_view_if_exists(cr, 'graph.report')
        cr.execute("""
            CREATE OR REPLACE VIEW graph.report AS (
            SELECT
                m.tanggal,
                m.ashar,
                m.maghrib,
                m.isya,
                m.tilawah
                FROM
                "mutabaah" m

            ) """
        )
Exemplo n.º 4
0
    def _get_conversion_rate(self, cr, uid, ids, field_name, field_value, args, context=None):
        _logger.info('Start Get Conversion Rate')
        result = {}
        if not ids:
            return result

        trans_id = ids[0]
        trans = self.get_trans(cr, uid, ids, context)
        if trans:
            today = datetime.today()
            rate_ids = trans.lease_trans_id.rate_ids
            if rate_ids:
                for rate_id in rate_ids:
                    if datetime.strptime(rate_id.start_date, '%Y-%m-%d') <= today and datetime.strptime(
                            rate_id.end_date, '%Y-%m-%d') >= today:
                        result[trans_id] = rate_id.rate * rate_id.rupiah * trans.rental_charge
                        break
            return result[trans_id]
        else:
            return result

        'lease_trans_id': fields.many2one('bm.lease.transaction', 'Trans ID'),
        'lot_id': fields.many2one('bm.lot', 'Lot #', required=True),
        # 'rental_conversion': fields.function(_get_conversion_rate, type='float',  digits=(16,2), string="Conversion"),
        'lettable_area': fields.float('Lettable Area (sqm)', required=True),
        'rental_charge': fields.float('Rental (/sqm/month)', required=True),
        'service_charge': fields.float('Service Charge (/sqm/month)', required=True),
        'promotion_levy': fields.float('Promotion Levy (/sqm/month)', required=True),
class WizardDailyReport(osv.TransientModel):
    _name='wiz.daily.report'
    _description='daily reporting of customer entries'
    _columns={
        'date': fields.date('Date',required=True),
        'company_id_invoice': fields.many2one('res.company', 'Company ID', required=True),
        'journal_id_daily' : fields.many2one('account.journal','Journal ID',required=True)

    }

    _defaults = {
        'date': lambda *a: datetime.now().strftime('%Y-%m-%d')
    }

    def fetch_record(self):
        state='posted'
        self.env.cr.execute('select jour_en.name journal_entry,jour_it.ref,part.name partner_name,part.cs_number cs_number,acc_jou.name journal,acc_acc.name account_name,jour_en.date,jour_it.credit,jour_it.debit from public.account_move_line jour_it'
                             +' left join public.account_move jour_en on jour_it.move_id=jour_en.id '
                             +'left join public.res_partner part on jour_it.partner_id=part.id '
                             +'left join public.account_journal acc_jou on jour_it.journal_id=acc_jou.id '
                             +'left join public.account_account acc_acc on jour_it.account_id=acc_acc.id'
                             +' where jour_it.date = '+"'"+self.date +"'"+' and jour_it.company_id='+"'"+str(self.company_id_invoice.id )+"'"
                             +'and jour_it.journal_id='+"'"+str(self.journal_id_daily.id )+"'"+' and jour_en.state='+"'"+state+"'"+' order by jour_en.name asc,jour_it.debit desc')
        daily_list=self.env.cr.dictfetchall()
        return daily_list

    def print_report(self, cr, uid, ids, data, context=None):
        return {
            'type': 'ir.actions.report.xml',
            'name': 'invoice_csnumber.report_daily_report',
            'report_name': 'invoice_csnumber.report_daily_report'
        }
class nomor_faktur_pajak(osv.osv):
    _name = "nomor.faktur.pajak"
    _description = 'Nomor faktur Pajak'

    def _nomor_faktur(self, cr, uid, ids, nomorfaktur, arg, context=None):
        res = {}
        for nomor in self.browse(cr, uid, ids, context):    
            res[nomor.id] = "%s.%s.%s" % (nomor.nomor_perusahaan, nomor.tahun_penerbit, nomor.nomor_urut)
        return res
    
    _columns = {
        'nomor_perusahaan' : fields.char('Nomor Perusahaan', size=3),
        'tahun_penerbit': fields.char('Tahun Penerbit', size=2),
        'nomor_urut': fields.char('Nomor Urut', size=8),
        'name': fields.function(_nomor_faktur, type='char', string="Nomor Faktur", store=True),
        'invoice_id': fields.many2one('account.invoice','Invoice No'),
        'partner_id'    : fields.many2one('res.partner', "Customer"),
        'dpp'   : fields.float('Untaxed Amount'),
        'tax_amount': fields.float("Tax Amount"),
        'date_used' : fields.date("Used Date"),
        'company_id': fields.many2one('res.company', 'Company'),
        'currency_id': fields.many2one('res.currency', 'Currency'),
        'type'      : fields.selection([('in','Faktur Pajak Masukan'),('out','Faktur Pajak Keluaran')],'Type'),
        'status': fields.selection([('1','Used'),('0','Not Used')],'Status'),
    }
    
    _defaults = {
        'status': '0',
    }
    
    _sql_constraints = [
        ('faktur_unique', 'unique(nomor_perusahaan,tahun_penerbit,nomor_urut)', 'Number Faktur Must Be Unique.'),
    ]
Exemplo n.º 7
0
class website_wishlist(osv.osv):
    _name = "website.wishlist"

    def create(self, cr, uid, vals, context=None):
        if vals.has_key('template_id') and vals.has_key('partner_id'):
            check = self.search(cr, SUPERUSER_ID,
                                [('template_id', '=', vals['template_id']),
                                 ('partner_id', '=', vals['partner_id'])])
            if check:
                return check[0]
        return super(website_wishlist, self).create(cr, uid, vals, context)

    def get_wishlist_products(self, cr, uid, context=None):
        obj = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid)
        if obj.partner_id:
            if obj.partner_id.website_wishlist:
                return obj.partner_id.website_wishlist
        return False

    def _get_uid(self, cr, uid, ids, names, args, context=None):
        res = {}
        res = dict.fromkeys(ids, uid)
        return res

    _columns = {
        'template_id': fields.many2one('product.product', 'Product'),
        'partner_id': fields.many2one('res.partner', 'Partner'),
        'user_id': fields.function(_get_uid, type="integer", string='User ID'),
    }
Exemplo n.º 8
0
class init_wage(models.Model):

    _name = 'hr.contract.init.wage'
    _description = 'Starting Wages'

    _columns = {
        'job_id':
        fields.many2one(
            'hr.job',
            'Job',
        ),
        'starting_wage':
        fields.float('Starting Wage',
                     digits_compute=dp.get_precision('Payroll'),
                     required=True),
        'is_default':
        fields.boolean(
            'Use as Default',
            help="Use as default wage",
        ),
        'contract_init_id':
        fields.many2one(
            'hr.contract.init',
            'Contract Settings',
        ),
        'category_ids':
        fields.many2many(
            'hr.employee.category',
            'contract_init_category_rel',
            'contract_init_id',
            'category_id',
            'Tags',
        ),
    }

    def _rec_message(self, cr, uid, ids, context=None):
        return _('A Job Position cannot be referenced more than once in a '
                 'Contract Settings record.')

    _sql_constraints = [
        ('unique_job_cinit', 'UNIQUE(job_id,contract_init_id)', _rec_message),
    ]

    def unlink(self, cr, uid, ids, context=None):

        if isinstance(ids, (int, long)):
            ids = [ids]
        data = self.read(cr, uid, ids, ['contract_init_id'], context=context)
        for d in data:
            if not d.get('contract_init_id', False):
                continue
            d2 = self.pool.get('hr.contract.init').read(
                cr, uid, d['contract_init_id'][0], ['state'], context=context)
            if d2['state'] in ['approve', 'decline']:
                raise models.except_orm(
                    _('Error'),
                    _('You may not a delete a record that is not in a '
                      '"Draft" state'))
        return super(init_wage, self).unlink(cr, uid, ids, context=context)
Exemplo n.º 9
0
class pos_order_report_jasper_line(osv.osv):
    _name = 'pos.order.report.jasper.line'
    _description = 'Pedidos de Venta Origen'
    _rec_name = 'order_id'
    _columns = {
        'report_id': fields.many2one('pos.order.report.jasper', 'ID Ref'),
        'order_id': fields.many2one('pos.order', 'Pedido de Venta (POS)'),
    }
    _defaults = {}
Exemplo n.º 10
0
class custom_calendar_event(osv.osv):
    _name = "calendar.event"
    _inherit = 'calendar.event'


    @api.depends('x_categ_id','x_partner_id')
    def _compute_categ_id_char(self):
        self.x_categ_id_char = self.x_categ_id.name
        if self.x_categ_id_char and self.x_partner_id.display_name and self.x_partner_id.phone:
            self.name = self.x_categ_id_char+' : '+self.x_partner_id.display_name+', '+self.x_partner_id.phone
        elif self.x_categ_id_char and self.x_partner_id.display_name:
            self.name = self.x_categ_id_char+' : '+self.x_partner_id.display_name
        elif self.x_partner_id.display_name:
            self.name = self.x_partner_id.display_name
        elif self.x_categ_id_char:
            self.name = self.x_categ_id_char
        else:
  
            
    _columns = {
        'x_domicile': fields.boolean('A domicile'),
        'x_partner_id': fields.many2one('res.partner', 'Attendee', default=''),
        'x_categ_id': fields.many2one('calendar.event.type', 'Tags'),
        'x_categ_id_char': fields.char(compute='_compute_categ_id_char', default=''),
        'x_event_is_billed': fields.boolean('is_billed'),
        'x_event_is_printed': fields.boolean('is_printed'),

        # related field res.partner 
        # -------------------------
        'x_event_display_name' : fields.related('x_partner_id', 'display_name', type="char"),
        'x_event_name' : fields.related('x_partner_id', 'name', type="char"),
        'x_event_phone' : fields.related('x_partner_id', 'phone', type="char", default=''),
        'x_event_patient_prenom': fields.related('x_partner_id', 'x_patient_prenom', type="char"),
        'x_event_patient_sexe': fields.related('x_partner_id', 'x_patient_sexe', type="selection", selection=SEXE_SELECTION),
        'x_event_patient_cafat': fields.related('x_partner_id', 'x_patient_cafat', type="char"),
        'x_event_dob': fields.date(related='x_partner_id.dob'),
        'x_event_age' : fields.integer(related='x_partner_id.age'),
        'x_event_src_avatar' : fields.binary(related='x_partner_id.x_src_avatar'),
        'x_event_medecin_traitant': fields.char(related='x_partner_id.x_medecin_traitant'),
        ########## MEDICAL INFO ???
        # 'x_event_groupe_sang': fields.related('x_partner_id', 'x_groupe_sang', type="selection", selection=GRP_SANG_SELECTION),
        # 'x_event_taille': fields.float(related='x_partner_id.x_taille'),
        # 'x_event_poids': fields.float(related='x_partner_id.x_poids'),
        # 'x_event_IMC': fields.float(related='x_partner_id.x_IMC'),
        ##########
        
        
        # related field calendar_event_type 
        # -------------------------
        'x_event_codeActe': fields.char(related='x_categ_id.x_code_acte', size=8),
        'x_event_priceActe': fields.float(related='x_categ_id.x_price_acte', digits=(4,0)),
        # -------------------------
    }
    _default = {
        'x_domicile': False,
    }
Exemplo n.º 11
0
class hr_infraction_action(models.Model):

    _name = 'hr.infraction.action'
    _description = 'Action Based on Infraction'
    _columns = {
        'infraction_id': fields.many2one(
            'hr.infraction',
            'Infraction',
            ondelete='cascade',
            required=True,
            readonly=True,
        ),
        'type': fields.selection(
            ACTION_TYPE_SELECTION,
            'Type',
            required=True,
        ),
        'memo': fields.text(
            'Notes',
        ),
        'employee_id': fields.related(
            'infraction_id',
            'employee_id',
            type='many2one',
            store=True,
            obj='hr.employee',
            string='Employee',
            readonly=True,
        ),
        'warning_id': fields.many2one(
            'hr.infraction.warning',
            'Warning',
            readonly=True,
        ),
        'transfer_id': fields.many2one(
            'hr.department.transfer',
            'Transfer',
            readonly=True,
        ),
    }
    _rec_name = 'type'

    def unlink(self, cr, uid, ids, context=None):

        for action in self.browse(cr, uid, ids, context=context):
            if action.infraction_id.state not in ['draft']:
                raise models.except_orm(
                    _('Error'),
                    _('Actions belonging to Infractions not in "Draft" state '
                      'may not be removed.')
                )

        return super(hr_infraction_action, self).unlink(
            cr, uid, ids, context=context
        )
Exemplo n.º 12
0
class pos_stock_inventory_categ_line(osv.osv):
    _name = 'pos.stock.inventory.categ.line'
    _description = ' Reporte Inventario Lineas de Categoria'
    _rec_name = 'detail_id'
    _columns = {
        'report_id':
        fields.many2one('pos.stock.inventory.categ', 'ID Ref'),
        'detail_id':
        fields.many2one('pos.stock.inventory.categ.detail',
                        'Inventario por Categoria'),
    }
    _defaults = {}
Exemplo n.º 13
0
class pos_stock_inventory_categ_detail(osv.osv):
    _name = 'pos.stock.inventory.categ.detail'
    _description = 'Inventario por Categoria'
    _rec_name = 'product_category'
    _columns = {
        'ref_id':
        fields.many2one('pos.stock.inventory.categ.line', 'ID Ref'),
        'product_category':
        fields.many2one('product.category', 'Categoria'),
        'detail_line':
        fields.one2many('pos.stock.inventory.categ.detail.line', 'ref_id',
                        'Productos'),
    }
    _defaults = {}
    _order = 'id'
Exemplo n.º 14
0
class InvoiceDosage(models.Model):
    _name = 'l10n_bo.invoice.dosage'

    code = fields.Char('Code', required=True)
    name = fields.Char('Name', required=True)
    active = fields.Boolean(default=True)
    company = fields.many2one('res.company', 'Company', required=True),
    branch_office = fields.many2one('res.partner', required=False),

    nit = fields.Char()
    authorization_code = fields.Char()
    authorization_secret = fields.Char()

    valid_until_date = fields.DateField()
    valid_until_total = fields.IntegerField()
Exemplo n.º 15
0
class policy_line_absence(models.Model):

    _name = 'hr.policy.line.absence'

    _columns = {
        'name':
        fields.char('Name', size=64, required=True),
        'code':
        fields.char('Code',
                    required=True,
                    help="Use this code in the salary rules."),
        'holiday_status_id':
        fields.many2one('hr.holidays.status', 'Leave', required=True),
        'policy_id':
        fields.many2one('hr.policy.absence', 'Policy'),
        'type':
        fields.selection(
            [('paid', 'Paid'), ('unpaid', 'Unpaid'), ('dock', 'Dock')],
            'Type',
            required=True,
            help="Determines how the absence will be treated in payroll. "
            "The 'Dock Salary' type will deduct money (useful for "
            "salaried employees).",
        ),
        'rate':
        fields.float('Rate',
                     required=True,
                     help='Multiplier of employee wage.'),
        'use_awol':
        fields.boolean(
            'Absent Without Leave',
            help='Use this policy to record employee time absence not covered '
            'by other leaves.')
    }

    def onchange_holiday(self, cr, uid, ids, holiday_status_id, context=None):

        res = {'value': {'name': False, 'code': False}}
        if not holiday_status_id:
            return res
        data = self.pool.get('hr.holidays.status').read(cr,
                                                        uid,
                                                        holiday_status_id,
                                                        ['name', 'code'],
                                                        context=context)
        res['value']['name'] = data['name']
        res['value']['code'] = data['code']
        return res
Exemplo n.º 16
0
class prestamos( osv.osv):
    
    _name="prestamo.libro"
    _description = 'prestamos de libros'
    
   
    _columns = {
                
                
            'name':fields.char('prestamo',required=False),
            
                             #  ID del modelo cliente es decir una relacion many2one al nombre del cliente 
          
            'cliente_id': fields.many2one('cliente.libro',string="nombre del cliente", required=True, select=True,
                                help='Tipo de libro', store=True),
    
            
             
             
             
            'fecha_prestamo': fields.date('Fecha de entrega', required=True),
            'devolucion': fields.date('Fecha de devolucion' ,required=True),
           
            
            
                    }
Exemplo n.º 17
0
class hr_accrual_job(models.Model):

    _name = 'hr.policy.line.accrual.job'
    _description = 'Accrual Policy Line Job Run'

    _columns = {
        'name':
        fields.date('Date', required=True, readonly=True),
        'exec':
        fields.datetime('Execution Date/Time', required=True, readonly=True),
        'policy_line_id':
        fields.many2one('hr.policy.line.accrual',
                        'Accrual Policy Line',
                        required=True,
                        readonly=True),
        'accrual_line_ids':
        fields.many2many('hr.accrual.line',
                         'hr_policy_job_accrual_line_rel',
                         'job_id',
                         'accrual_line_id',
                         'Accrual Lines',
                         readonly=True),
        'holiday_ids':
        fields.many2many('hr.holidays',
                         'hr_policy_job_holiday_rel',
                         'job_id',
                         'holiday_id',
                         'Leave Allocation Requests',
                         readonly=True),
    }
Exemplo n.º 18
0
class WizardInvoiceList(osv.TransientModel):
    _name = 'wiz.invoice.list'
    _description = 'General report for invoice listing'
    _columns = {
        'date':
        fields.date('Start Date', required=True),
        'company_id_invoice':
        fields.many2one('res.company', 'Company ID', required=True)
    }
    _defaults = {'date': lambda *a: datetime.now().strftime('%Y-%m-%d')}

    def fetch_record(self):
        self.env.cr.execute(
            'SELECT res_partner.cs_number,res_partner.name,res_partner.credit_card_no,account_invoice.date_due FROM res_partner INNER JOIN account_invoice ON res_partner.id = account_invoice.partner_id where account_invoice.date_invoice ='
            + "'" + self.date + "'" + ' and account_invoice.company_id=' +
            "'" + str(self.company_id_invoice.id) + "'" +
            ' order by res_partner.cs_number asc')
        inventory_list = self.env.cr.dictfetchall()
        return inventory_list

    def print_report(self, cr, uid, ids, data, context=None):
        return {
            'type': 'ir.actions.report.xml',
            'name': 'invoice_csnumber.report_invoice_list',
            'report_name': 'invoice_csnumber.report_invoice_list'
        }
class WizardCustomerInventory(osv.TransientModel):
    _name = 'wiz.customer.inventory'
    _description = 'Generate Report for Customer Inventory'

    _columns = {
        'partner_id': fields.many2one('res.partner', 'Customer',
                                      required=True),
    }
    _default = {
        'all_req': False,
    }

    def fetch_record(self):
        self.env.cr.execute(
            "SELECT stock_picking.origin,stock_picking.date,stock_picking.status,"
            "stock_move.product_qty,stock_move.name FROM stock_picking "
            "INNER JOIN stock_move ON stock_picking.id = stock_move.picking_id "
            "where stock_picking.state = 'done' and stock_picking.partner_id = "
            + str(self.partner_id.id) + "order by stock_picking.origin asc")
        products = self.env.cr.dictfetchall()
        return products

    def print_report(self, cr, uid, ids, data, context=None):
        return {
            'type': 'ir.actions.report.xml',
            'name': 'mutual_project.report_customer_inventory',
            'report_name': 'mutual_project.report_customer_inventory'
        }
Exemplo n.º 20
0
class policy_line_ot(models.Model):

    _name = 'hr.policy.line.ot'

    def _tz_list(self, cr, uid, context=None):

        res = tuple()
        for name in common_timezones:
            res += ((name, name),)
        return res

    _columns = {
        'name': fields.char('Name', size=64, required=True),
        'policy_id': fields.many2one('hr.policy.ot', 'Policy'),
        'type': fields.selection([('daily', 'Daily'),
                                  ('weekly', 'Weekly'),
                                  ('restday', 'Rest Day'),
                                  ('holiday', 'Public Holiday')],
                                 'Type', required=True),
        'weekly_working_days': fields.integer('Weekly Working Days'),
        'active_after': fields.integer(
            'Active After', help="Minutes after which this policy applies"),
        'active_start_time': fields.char(
            'Active Start Time', size=5, help="Time in 24 hour time format"),
        'active_end_time': fields.char(
            'Active End Time', size=5, help="Time in 24 hour time format"),
        'tz': fields.selection(_tz_list, 'Time Zone'),
        'rate': fields.float(
            'Rate', required=True, help='Multiplier of employee wage.'),
        'code': fields.char(
            'Code', required=True, help="Use this code in the salary rules.")
    }
Exemplo n.º 21
0
class hr_payslip_worked_days(models.Model):
    _inherit = 'hr.payslip.worked_days'

    _columns = {
        'activity_id': fields.many2one(
            'hr.activity',
            'Activity',
            required=True,
        ),
    }

    def _get_default_activity(self, cr, uid, context=None):
        """
        This function searches activities and return an activity.

        This is important because hr_worked_days_from_timesheet
        module's yml tests will fail otherwise because it can't create
        worked days records.

        It returns a leave type because leave types are the same for every
        employees whereas job positions are different from an employee to
        another.
        """
        activities = self.pool['hr.activity'].search(
            cr, uid, [('type', '=', 'leave')], context=context
        )
        return activities and activities[0] or False

    _defaults = {
        'activity_id': lambda self, cr, uid, context=None:
        self._get_default_activity(cr, uid, context=context)
    }
Exemplo n.º 22
0
class policy_line_presence(models.Model):

    _name = 'hr.policy.line.presence'

    _columns = {
        'name':
        fields.char('Name', size=64, required=True),
        'policy_id':
        fields.many2one('hr.policy.presence', 'Policy'),
        'code':
        fields.char('Code',
                    required=True,
                    help="Use this code in the salary rules."),
        'rate':
        fields.float('Rate',
                     required=True,
                     help='Multiplier of employee wage.'),
        'type':
        fields.selection([('normal', 'Normal Working Hours'),
                          ('holiday', 'Holidays'), ('restday', 'Rest Days')],
                         'Type',
                         required=True),
        'active_after':
        fields.integer(
            'Active After',
            required=True,
            help='Minutes after first punch of the day in which policy will '
            'take effect.'),
        'duration':
        fields.integer('Duration', required=True, help="In minutes.")
    }

    _defaults = {
        'rate': 1.0,
    }
Exemplo n.º 23
0
class hr_salary_rule_variable(models.Model):
    _name = 'hr.salary.rule.variable'
    _description = 'Variables used on salary rules that change over the years'
    _columns = {
        'salary_rule_id':
        fields.many2one(
            'hr.salary.rule',
            'Salary Rule',
            ondelete='cascade',
            required=True,
        ),
        'date_from':
        fields.date(
            'Date From',
            required=True,
        ),
        'date_to':
        fields.date('Date To', ),
        'type':
        fields.selection([('python', 'Python Code'),
                          ('fixed', 'Fixed Amount')],
                         string='Type'),
        'python_code':
        fields.text('Python Code'),
        'fixed_amount':
        fields.float('Fixed Amount'),
    }
Exemplo n.º 24
0
class WizardReports(osv.TransientModel):
    _name = 'wiz.report.balances'
    _description = 'PDF Reports for showing all disconnection,reconnection'

    _columns = {
        'company_id': fields.many2one('res.company', string='Company'),
        # 'fiscalyear_id': fields.many2one('account.fiscalyear', string='Fiscal Year'),
        'start_date': fields.date('Start Date'),
        'end_date': fields.date('End Date'),
    }

    _defaults = {
        'start_date': lambda *a: datetime.now().strftime('%Y-%m-%d'),
        'end_date': lambda *a: datetime.now().strftime('%Y-%m-%d'),
    }

    def cal_balances(self):
        self.env.cr.execute(
            "select cs_category,sum(account_move_line.debit)as debit,sum(account_move_line.credit) as credit from res_partner inner join account_move_line on res_partner.id = account_move_line.partner_id "
            "where customer = True and res_partner.company_id ='" +
            str(self.company_id.id) + "'" + "and account_move_line.date >='" +
            self.start_date + "'" + "and account_move_line.date<='" +
            str(self.end_date) + "'"
            "group by cs_category order by cs_category ")
        result = self.env.cr.dictfetchall()
        return result

    def print_report(self, cr, uid, ids, data, context=None):
        return {
            'type': 'ir.actions.report.xml',
            'name': 'mutual_reports.wiz_report_balances',
            'report_name': 'mutual_reports.wiz_report_balances'
        }
Exemplo n.º 25
0
class appointment (osv.osv):
	_name = "medical.appointment"
	_inherit = "medical.appointment"

	def copy(self, cr, uid, id, default=None, context={}):
		default.update({'validity_status':'tobe'})
		return super(appointment,self).copy(cr, uid, id, default, context)
            
	def onchange_appointment_date(self, cr, uid, ids, apt_date):
		if apt_date:
			validity_date = datetime.datetime.fromtimestamp(time.mktime(time.strptime(apt_date,"%Y-%m-%d %H:%M:%S")))
			validity_date = validity_date+datetime.timedelta(days=7)
			v = {'appointment_validity_date':str(validity_date)}
			return {'value': v}
		return {}

	_columns = {
		'no_invoice' : fields.boolean ('Invoice exempt'),
		'appointment_validity_date' : fields.datetime ('Validity Date'),
		'validity_status' : fields.selection([('invoiced','Invoiced'),('tobe','To be Invoiced')],'Status'),
		'consultations' : fields.many2one ('product.product', 'Consultation Service', domain=[('type', '=', "service")], help="Consultation Services", required=True),
	}
	_defaults = {
		'validity_status': lambda *a: 'tobe',
		'no_invoice': lambda *a: True
	}
Exemplo n.º 26
0
class hr_warning(models.Model):

    _name = 'hr.infraction.warning'
    _description = 'Employee Warning'
    _columns = {
        'name': fields.char(
            'Subject',
            size=256,
        ),
        'date': fields.date(
            'Date Issued',
        ),
        'type': fields.selection(
            [
                ('verbal', 'Verbal'),
                ('written', 'Written'),
            ],
            'Type',
            required=True,
        ),
        'action_id': fields.many2one(
            'hr.infraction.action',
            'Action',
            ondelete='cascade',
            readonly=True,
        ),
        'infraction_id': fields.related(
            'action_id',
            'infraction_id',
            type='many2one',
            obj='hr.infraction',
            string='Infraction',
            readonly=True,
        ),
        'employee_id': fields.related(
            'infraction_id',
            'employee_id',
            type='many2one',
            obj='hr.employee',
            string='Employee',
            readonly=True,
        ),
    }

    _defaults = {
        'type': 'written',
        'date': time.strftime(DEFAULT_SERVER_DATE_FORMAT),
    }

    def unlink(self, cr, uid, ids, context=None):
        for warning in self.browse(cr, uid, ids, context=context):
            if (warning.action_id
                    and warning.action_id.infraction_id.state != 'draft'):
                raise models.except_orm(
                    _('Error'),
                    _('Warnings attached to Infractions not in "Draft" state '
                      'may not be removed.')
                )
        return super(hr_warning, self).unlink(cr, uid, ids, context=context)
Exemplo n.º 27
0
class hr_payroll_run(models.Model):

    _name = 'hr.payslip.run'
    _inherit = 'hr.payslip.run'

    _columns = {
        'register_id': fields.many2one('hr.payroll.register', 'Register'),
    }
class account_liquidation_line(osv.osv):
    _name = 'account.liquidation.line'
    _description = 'Purchase liquidation lines'
    
    _columns = {
    
        'liquidation_id': fields.many2one('account.liquidation', 'Purchase liquidation'),
        'acc_partner_id': fields.many2one('account.account', 'Partner account'),
        'partner_id': fields.many2one('res.partner', 'Partner'),
        'acc_product_id': fields.many2one('account.account', 'Product account'),
        'product_id': fields.many2one('product.product', 'Product'),
        
        'price_unit': fields.float('Price unit'),
        'quantity': fields.float('Quantity'),
        'name': fields.text('Description'),

    }
Exemplo n.º 29
0
class pos_order_report_tax_line(osv.osv):
    _name = 'pos.order.report.tax.line'
    _description = 'Impuestos del Reporte'
    _columns = {
        'report_id': fields.many2one('pos.order.report.jasper', 'ID Ref'),
        'name': fields.char('Descripcion', size=128),
        'amount': fields.float('Total', digits=(14, 2)),
    }
    _defaults = {}
Exemplo n.º 30
0
class pos_order_report_journal_line(osv.osv):
    _name = 'pos.order.report.journal.line'
    _description = 'Pagos del Reporte'
    _columns = {
        'report_id': fields.many2one('pos.order.report.jasper', 'ID Ref'),
        'name': fields.char('Descripcion', size=128),
        'sum': fields.float('Total', digits=(14, 2)),
    }
    _defaults = {}