def register_all(self, cr):
        opj = os.path.join
        result=''
        cr.execute("SELECT * FROM ir_act_report_xml WHERE model=%s \
                        ORDER BY id", ('dm.offer.document',))
        result = cr.dictfetchall()
        for r in result:
            if netsvc.service_exist('report.'+r['report_name']):
                continue
            if r['report_rml'] or r['report_rml_content_data']:
                report_sxw('report.'+r['report_name'], r['model'],
                        opj('addons',r['report_rml'] or '/'), header=r['header'],
                        parser=offer_document)

        super(report_xml, self).register_all(cr)
예제 #2
0
 def register_all(self, cr):
     """Report registration handler that may be overridden by subclasses to
        add their own kinds of report services.
        Loads all reports with no manual loaders (auto==True) and
        registers the appropriate services to implement them.
     """
     opj = os.path.join
     cr.execute("SELECT * FROM ir_act_report_xml WHERE auto=%s ORDER BY id", (True,))
     result = cr.dictfetchall()
     svcs = netsvc.Service._services
     for r in result:
         if svcs.has_key('report.'+r['report_name']):
             continue
         if r['report_rml'] or r['report_rml_content_data']:
             report_sxw('report.'+r['report_name'], r['model'],
                     opj('addons',r['report_rml'] or '/'), header=r['header'])
         if r['report_xsl']:
             report_rml('report.'+r['report_name'], r['model'],
                     opj('addons',r['report_xml']),
                     r['report_xsl'] and opj('addons',r['report_xsl']))
예제 #3
0
                        delete_items.append(item2)
                        print "delete_items _____________________>>>>>", delete_items
                else:
                    print "Few Gate Pass have one line"

        return data

    def _get_filter(self, data):
        if data.get('form', False) and data['form'].get('filter', False):
            if data['form']['filter'] == 'filter_date':
                return _('Date')

        return _('No Filter')

    def _get_start_date(self, data):
        if data.get('form', False) and data['form'].get('date_from', False):
            return data['form']['date_from']
        return ''

    def _get_end_date(self, data):
        if data.get('form', False) and data['form'].get('date_to', False):
            return data['form']['date_to']
        return ''


report_sxw.report_sxw('report.gate.pass.register',
                      'kg.gate.pass',
                      'addons/kg_store_reports/report/gate_pass_register.rml',
                      parser=gate_pass_register,
                      header=False)
예제 #4
0
        if not done:
            done={}

        ctx = self.context.copy()

        ctx['fiscalyear'] = form['fiscalyear_id']
        if form['filter'] == 'filter_period':
            ctx['period_from'] = form['period_from']
            ctx['period_to'] = form['period_to']
        elif form['filter'] == 'filter_date':
            ctx['date_from'] = form['date_from']
            ctx['date_to'] =  form['date_to']
        ctx['state'] = form['target_move']
        parents = ids
        child_ids = obj_account._get_children_and_consol(self.cr, self.uid,
                ids, context=ctx)
        if child_ids:
            ids = child_ids
        accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level','child_id'], ctx)

        for parent in parents:
                if parent in done:
                    continue
                done[parent] = 1
                _process_child(accounts,form['display_account'],parent)
        return self.result_acc

report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header="internal")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #5
0
                                                    context=self.context)
        self._cache_account[account_id] = {
            'code': account['code'],
            'name': account['name']
        }
        return {'code': account['code'], 'name': account['name']}

    def __init__(self, cr, uid, name, context):
        self.filters = []
        self._cache_account = {}
        super(central_journal_report, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'time': time,
            'cr': cr,
            'uid': uid,
            'get_print_info': self._get_print_info,
            'set_print_info': self._set_print_info,
            'set_wizard_params': self._set_wizard_params,
            'get_movements': self._get_movements,
            'get_company': self._get_company,
            'get_account': self._get_account,
        })
        self.context = context


report_sxw.report_sxw(
    'report.central_journal_report',
    'account.move.line',
    'addons/account_central_journal/report/central_journal_report.mako',
    parser=central_journal_report)
            self.cr.execute('select count(crm_lead.id) from crm_lead where crm_lead.partner_name = %s',([line.name]))
            lead = self.cr.fetchall()[0][0] or 0

            self.cr.execute('select count(sale_order.id) from sale_order where sale_order.partner_id = %s',([line.id]))
            sale = self.cr.fetchall()[0][0] or 0

            self.cr.execute('select sum(amount_untaxed) from sale_order where sale_order.partner_id = %s',([line.id]))
            total_sale = self.cr.fetchall()[0][0] or 0

            res.append({
                        'name': line.name or '', 
                        'phone': line.phone or '',
                        'mobile': line.mobile,
                        'email': line.email,
                        'fax': line.fax or '',
                        'lead': lead,
                        'sale': sale,
                        'total': total_sale,

                        })
        return res

report_sxw.report_sxw(
    'report.inactive.partner.report',
    'res.partner',
    'addons/inactive_partner_report/report/order_line_expiry.rml',
    parser=inactive_partner_report,
    header='external'
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################

import base_report
from report import report_sxw

class cdr(base_report.base_report):
    def __init__(self, cr, uid, name, context):
        super(cdr, self).__init__(cr, uid, name, context)

report_sxw.report_sxw('report.l10n.fr.compute_resultant', 'account.move.line','addons/l10n_fr/report/compute_resultant_report.rml', parser=cdr, header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #8
0
###############################################################################
import time
from report import report_sxw


class report_resume(report_sxw.rml_parse):

    def __init__(self, cr, uid, name, context):
        super(report_resume, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'time': time,
            'get_experience_by_category': self.get_experience_by_category,
        })

    def get_experience_by_category(self, employee_id, category):
        self.cr.execute("SELECT exp.name, exp.start_date, exp.expire, exp.end_date, exp.location, exp.certification, \
                        exp.description, exp.diploma, exp.study_field, part.name partner_name FROM hr_experience exp \
                        LEFT JOIN res_partner part ON part.id = exp.partner_id \
                        WHERE exp.employee_id = %d AND exp.category = '%s'"%(employee_id, category))
        return self.cr.dictfetchall()

report_sxw.report_sxw(
    'report.hr.resume.report',
    'hr.employee',
    'addons/hr_resume/report/report_resume.rml',
    parser=report_resume,
    header=False
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #9
0
            li_delay.append(line.delay)
        li_delay.sort(reverse=True)
        text = ""
        a = {}
        partner_line = pooler.get_pool(self.cr.dbname).get('account.move.line').search(self.cr, self.uid, [('partner_id','=',partner.id),('reconcile_id','=',False)])
        partner_delay = []
        context={}
        context.update({'lang': partner.lang})
        for i in pooler.get_pool(self.cr.dbname).get('account.move.line').browse(self.cr, self.uid, partner_line, context):
            for delay in li_delay:
                if  i.followup_line_id and str(i.followup_line_id.delay)==str(delay):
                    text = i.followup_line_id.description
                    a[delay] = text
                    partner_delay.append(delay)
        text = partner_delay and a[max(partner_delay)] or ''
        if text:
            text = text % {
                'partner_name': partner.name,
                'date': time.strftime('%Y-%m-%d'),
                'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name,
                'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature,
            }

        return text

report_sxw.report_sxw('report.account_followup.followup.print',
        'res.partner', 'addons/account_followup/report/account_followup_print.rml',
        parser=report_rappel)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        return self.localcontext['data']['amount_generic']

    def get_amount_paid(self, context={}):
        amount = self.localcontext['data']['amount_paid']
        return amount

    def get_year(self, context={}):
        return self.pool['account.fiscalyear'].browse(
            self.cr, self.uid, self.localcontext['data']['fiscalyear_id']).name

    def get_page_year(self, context={}):
        page_year = ''
        if 'print_page_year' in self.localcontext['data']\
                and self.localcontext['data']['print_page_year']:
            page_year = self.localcontext['data']['print_page_year']
        return page_year

    def get_page_number_from(self, context={}):
        page_number_from = 0
        if 'print_page_number_from' in self.localcontext['data']\
                and self.localcontext['data']['print_page_number_from']:
            page_number_from = self.localcontext['data'][
                'print_page_number_from']
        return page_number_from


report_sxw.report_sxw('report.vat.year.end.statement',
                      'wizard.year.statement',
                      'addons/year_vat_period_and_statement/report/'
                      'year_vat_statement.mako',
                      parser=Parser)
예제 #11
0
        num = data['form']['num']

        self.cr.execute('''select emp.id from hr_employee emp 
        left join hr_loan loan on (loan.id = %s) 
        left join hr_salary_degree degree on (degree.id = emp.degree_id) 
        where emp.id not in (select loan.employee_id from hr_employee_loan loan where loan_id=%s) 
        and emp.total_service_years >= loan.year_employment and emp.state='approved' order by degree.sequence desc,emp.promotion_date,emp.otherid limit %s;'''
                        % (loan_id, loan_id, num))
        self.emp_ids = self.cr.fetchall()
        self.emp_ids = [x[0] for x in self.emp_ids]

        self.all_data = self.emp_obj.browse(self.cr, self.uid, self.emp_ids)

        return len(self.all_data)

    def _get_lines(self):
        return self.all_data

    def _get_count(self):
        self.count = self.count + 1
        return self.count


report_sxw.report_sxw(
    'report.hr.loan_candidates.report',
    'hr.employee',
    'addons/hr_custom_military/report/loan_candidates_report.mako',
    parser=loan_candidates,
    header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from report import report_sxw
import logging
_logger = logging.getLogger(__name__)
import time

class ReportProgressExams(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(ReportProgressExams, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'proj_obj':self.proj_obj,
            'format_date':self.format_date,
        })

    def proj_obj(self,pro_ids):
        rec = self.pool.get('progress.exams.line')
        rec = rec.browse(self.cr, self.uid, self.pool['progress.exams.line']
                                    .search(self.cr, self.uid, [('name','in',pro_ids)]))
        return rec

    def format_date(self,date):
        if date:
            format_date = date.split('-')
            date = format_date[2]+'/'+format_date[1]+'/'+format_date[0]
            return date
        return '-'

report_sxw.report_sxw('report.progress_exams_report', 'progress.exams.wizard',
                      'progress_project_module/report/progress_exams_report.rml'
                      , parser=ReportProgressExams,
                      header='')
예제 #13
0
                                res={'state':'Available','reason':' '}

                             else:
                                res={'state':'Rejected','reason':'Pension Reached Before Fininshig Loan Installments'}
	        
     
                       else:
                          res={'state':'Rejected','reason':'Employment years for Employee Not Fit employment Years for Thel Loan'}
                    else:
                       if employee.company_id.max_department and all_total_per_month > (emp_total_payroll*employee.company_id.max_department)/100:
                          res={'state':'Rejected','reason':'Total Loans Installments for The Department Exceed Max Percentage'}

                 else:
                    if employee.company_id.max_employee and total_per_month > (total_payroll*employee.company_id.max_employee)/100 :
                       res={'state':'Rejected','reason':'Total Loans Installments for The Employee Exceed Max Percentage'}

              else:
                 if loan_ids.loan_limit=='one' and check: 
                    res={'state':'Rejected','reason':'Loan Limit is Once and Already Taken'}
                 if loan_ids.loan_limit=='unlimit' and check and counter!= 0 and not loan_ids.allow_interference:
                    res= {'state':'Rejected','reason':'Interference Between same Loan Not Allowed'}
           else:
              res= {'state':'Rejected','reason':'Loan Not Allowed for The Degree of Employee'}
           list_res.append(res)
        return list_res
        
     

report_sxw.report_sxw('report.loan.form.report', 'hr.employee.loan', 'hr_loan/report/loan_form_report.rml' ,parser=loan_form_report ,header=True)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #14
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import time

from report import report_sxw


class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(order, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })


report_sxw.report_sxw('report.sale.order.mh',
                      'sale.order',
                      '',
                      parser=order,
                      header="internal")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #15
0
import pooler
import time
from report import report_sxw


class huissier_attestation(report_sxw.rml_parse):
    def _get_obj(self, data):
        print data
        return self.pool.get('huissier.lots').browse(
            self.cr, self.uid, data['form']['attest_ids'])

    def __init__(self, cr, uid, name, context):
        super(huissier_attestation, self).__init__(cr, uid, name, context)
        self.localcontext.update({'time': time, '_get_obj': self._get_obj})


report_sxw.report_sxw('report.huissier.lots_attestation',
                      'huissier.lots',
                      'addons/huissier/report/attestation.rml',
                      parser=huissier_attestation,
                      header=False)

report_sxw.report_sxw('report.huissier.lots_attestation2',
                      'huissier.lots',
                      'addons/huissier/report/attestation2.rml',
                      parser=huissier_attestation,
                      header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #16
0
    def get_total_deduct(self, obj):
        return self.total_deduct

    def get_net(self, obj):
        return self.net

    def get_er_contributions(self, obj):
        return self.er_contributions

    def get_no(self):
        self.no += 1
        return self.no

report_sxw.report_sxw(
    'report.hr.payroll.register.summary',
    'hr.payroll.register',
    'hr_payroll_register/report/payroll_summary.rml',
    parser=report_payroll_summary
)


class report_payslips(report_sxw.rml_parse):

    def __init__(self, cr, uid, name, context):
        super(report_payslips, self).__init__(cr, uid, name, context)

        self.localcontext.update({
            'time': time,
            'get_details_by_payslip': self.get_details_by_payslip,
        })

    def get_payslip_accruals(self, contract_ids, dToday):
예제 #17
0
#    $Id$
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import pooler
import time
from report import report_sxw

class code_barcode(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(code_barcode, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })
report_sxw.report_sxw('report.mrp.code.barcode', 'mrp_operations.operation.code', 'addons/mrp_operations/report/mrp_code_barcode.rml',parser=code_barcode,header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #18
0
                new_line.append(line['early_in'])
                new_line.append(line['short'])

                new_lines.append(new_line)

            lines = new_lines

            row = lines
            new_list = []
            header = row[0]
            flag = False
            i = 0

            for item in row:
                new_list.append(item)
                if i == 18 and not flag:
                    new_list.append(header)
                    flag = True
                    i = 0
                if i == 22 and flag:
                    new_list.append(header)
                    i = 0
                i += 1
            lines = new_list

        return lines


report_sxw.report_sxw('report.attendance_details_all.report', 'hr.attendance.percentage',
                      'addons/hr_attendance_custom/report/attendance_details.mako', parser=attendance_details_all)
예제 #19
0
            'disc': self.discount,
            'net': self.netamount,
            'formatdate': self.formatdate,
            'address': partner.address and partner.address[0] or False,
        })

    def formatdate(self, datestr):
        dateobj = ParseAny(datestr)
        return dateobj.strftime(self.localcontext['dformat'])

    def netamount(self, order_line_id):
        sql = 'select (qty*price_unit) as net_price from pos_order_line where id = %s'
        self.cr.execute(sql, (order_line_id,))
        res = self.cr.fetchone()
        return res[0]

    def discount(self, order_id):
        sql = 'select discount, price_unit, qty from pos_order_line where order_id = %s '
        self.cr.execute(sql, (order_id,))
        res = self.cr.fetchall()
        dsum = 0
        for line in res:
            if line[0] != 0:
                dsum = dsum +(line[2] * (line[0]*line[1]/100))
        return dsum

report_sxw.report_sxw('report.pos.receipt', 'pos.order', 'addons/point_of_sale/report/pos_receipt.rml', parser=order, header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #20
0
# -*- coding: utf-8 -*-
##############################################################################
#
#    NCTR, Nile Center for Technology Research
#    Copyright (C) 2011-2016 NCTR (<http://www.nctr.sd>).
#
##############################################################################
import time
from report import report_sxw
from osv import osv
import pooler
import string


class specifections_letter(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(specifections_letter, self).__init__(cr, uid, name, context=context)


report_sxw.report_sxw('report.specifections_letter', 'purchase.clearance', 'purchase_clearance_niss/report/specifections_letter.rml', parser=specifections_letter,header=False)

                return self.totales[part]['total_facturado']
        return False
        
    def _get_symbol_amount_received(self,partner):
        for part in self.totales:
            if part==partner:
                return self.totales[part]['symbol_total_pagado']
        return False
        
    def _get_payment_amount(self,partner):
        for part in self.totales:
            if part == partner:
                return self.totales[part]['total_pagado']
        return False
        
    def _get_symbol_payment_amount(self,partner):
        for part in self.totales:
            if part==partner:
                return self.totales[part]['symbol_total_facturado']
        return False
                
    def _get_dif_to_load(self,partner):
        dif = self._get_period_amount(partner) -  self._get_amount_received(partner)
        return dif
        
        
report_sxw.report_sxw('report.report.saldos.detalle', 'account.invoice',
    'addons/report_balance/report/report_saldos_detalle.rml', parser=report_saldos_detalle, header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #22
0
        qty_available = 0.0
        price = 0.0
        price_value = 0.0
        for line in fuel_list:
            prod_qty += line.get('prod_qty')
            incoming_qty += line.get('incoming_qty')
            outgoing_qty += line.get('outgoing_qty')
            qty_available += line.get('qty_available')
            price_value += line.get('price_value')

        result = {
            'prod_qty': prod_qty,
            'incoming_qty': incoming_qty,
            'outgoing_qty': outgoing_qty,
            'qty_available': qty_available,
            'price': fuel_list and fuel_list[0]['price'],
            'price_value': price_value,
            'prod_name': fuel_list and fuel_list[0]['prod_name'],
            'uom': fuel_list and fuel_list[0]['uom'],
        }
        return [result]


report_sxw.report_sxw(
    'report.fuel.location.product',
    'product.product',
    'addons/fuel_management/report/fuel_location_product.rml',
    parser=fuel_location_product_reports,
    header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        pool = pooler.get_pool(self.cr.dbname)
        sale_order_obj = pool.get('sale.order')
        oid = sale_order_obj.search(self.cr, self.uid, [('name','=',order.origin)])[0]
        saleorder = sale_order_obj.browse(self.cr, self.uid, oid)     
        return saleorder
        
        
    def caracteristiques(self, order):
        pool = pooler.get_pool(self.cr.dbname)
        sale_order_obj = pool.get('sale.order')
        oid = sale_order_obj.search(self.cr, self.uid, [('name','=',order.origin)])[0]
        saleorder = sale_order_obj.browse(self.cr, self.uid, oid)          
        
        order_lines = saleorder.order_line       
        line = order_lines[0]
        voiture = line.product_id
        cars = []     
        for car in voiture.caracteristiques_ids:
            if car.visible : 
                cars.append(car)  
        return cars
    def format_quantity(self, qty):
        return "0"+ str(int(qty))
    def amount_in_word(self, amount):
        return amount_to_text(amount, 'fr', 'DH')
            
report_sxw.report_sxw('report.invoice.ordervehicule', 'account.invoice', 'addons/account_invoice_layout/report/invoice_ordervehicule.rml', parser=invoicevehicule, header="external")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #24
0
    def _get_date_str_es(self, date_str):
        date_obj = time.strptime(date_str, '%Y-%m-%d')
        mes_int = int(time.strftime("%m", date_obj))
        month_str = months_selection[mes_int - 1][1]
        day = time.strftime('%d', date_obj)
        year = time.strftime('%Y', date_obj)
        date_str_str_es = "%s de %s del %s" % (day, month_str, year)
        return date_str_str_es

    def _get_amount_to_text(self, amount, lang, currency=""):
        if currency.upper() in ('MXP', 'MXN', 'PESOS', 'PESOS MEXICANOS'):
            sufijo = 'M. N.'
            currency = 'PESOS'
        elif currency.upper() in ('GTQ', 'QUETZAL'):
            sufijo = ''
            currency = 'QUETZALES'
        else:
            sufijo = 'M. E.'
        #return amount_to_text(amount, lang, currency)
        amount_text = amount_to_text(amount, currency, sufijo)
        amount_text = amount_text and amount_text.upper() or ''
        return amount_text


report_sxw.report_sxw(
    'report.account.payment.voucher.industrial',
    'account.voucher',
    'addons/account_invoice_receipt/report/voucher_industrial_report.rml',
    parser=voucher_industrial_report,
    header=False)
예제 #25
0
				return _('Date')			
		return _('No Filter')
		
	def _get_start_date(self, data):
		if data.get('form', False) and data['form'].get('date_from', False):
			return data['form']['date_from']
		return ''
		
	def _get_end_date(self, data):
		if data.get('form', False) and data['form'].get('date_to', False):
			return data['form']['date_to']
		return ''		   
  

report_sxw.report_sxw('report.consumption.summary', 'stock.picking', 
			'addons/kg_store_reports/report/consumption_summary.rml', 
			parser=consumption_summary, header = False)
			
			
# GRN NO and Supplier should be blank if a picking have more than one line
"""
new_data=[]
count = 0
for pos1, item1 in enumerate(data):
	delete_items = []
	match_found = False
	for pos2, item2 in enumerate(data):
		if not pos1 == pos2:
			if item1['grn_number'] == item2['grn_number'] and item1['part_name'] == item2['part_name']:
				match_found = True
				if count == 0:
# -*- coding: utf-8 -*-
##############################################################################
#
#
##############################################################################

from grap_reporting.report import grap_base_report
from report import report_sxw


class treso(grap_base_report.grap_base_report):
    def __init__(self, cr, uid, name, context):
        super(treso, self).__init__(cr, uid, name, context)


report_sxw.report_sxw('report.l10n.fr.treso',
                      'account.move.line',
                      'addons/grap_reporting/report/compute_treso.rml',
                      parser=treso,
                      header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import time
from report import report_sxw


class account_invoice(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_invoice, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({"time": time, "convert": self.convert})

    def convert(self, amount, cur):
        amt_en = amount_to_text_en.amount_to_text(amount, "en", cur)
        return amt_en


report_sxw.report_sxw(
    "report.account.bsc.invoice",
    "account.bsc.invoice",
    "addons/account/report/account_bsc_invoice.rml",
    parser=account_invoice,
)


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
                    res['currency']=''
                elif entry.state=='text':
                    res['name']=entry.name
                    res['price_subtotal']=''
                    res['currency']=''
                elif entry.state=='line':
                    res['quantity']='_______________'
                    res['price_unit']='______________'
                    res['discount']='____________'
                    res['tax_types']='____________________'
                    res['uos']='_____'
                    res['name']='_______________________________________________'
                    res['price_subtotal']='____________'
                    res['currency']='____'
                elif entry.state=='break':
                    res['type']=entry.state
                    res['name']=entry.name
                    res['price_subtotal']=''
                    res['currency']=''
                else:
                    res['name']=entry.name
                    res['price_subtotal']=''
                    res['currency']=invoice.currency_id.code

            result.append(res)
        return result

report_sxw.report_sxw('report.notify_account.invoice', 'account.invoice', 'addons/account_invoice_layout/report/special_message_invoice.rml', parser=account_invoice_with_message)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #29
0
                               'time_thr_f':time_thr_f or '',
                               'dekan':dekan or '',
                               'dekan_f':dekan_f or '',
                               'dep_mngr':dep_mngr or '',
                               'dep_mngr_f':dep_mngr_f or '',
                              })
            result.append({
                           'name1':name1,
                           'name2':name2,
                           'lines':lines
                           })
#        for val in result: 
#            print "result : ",val['name1']
        
        return result
    def last_lines(self, form):
        self.cnt += 1
        res = [{'code':'retired','name':'Тэтгэврээ тогтоолгоод ажиллаж байгаа','cnt':self.cnt},
               {'code':'badge','name':'Төрийн одонтой','cnt':self.cnt+1},
               {'code':'terguunii','name':'Боловсролын тэргүүний ажилтан','cnt':self.cnt+2},
               {'code':'dotoodod','name':'Өнгөрсөн хичээлийн жилд дотоодод мэргэжил дээшлүүлсэн','cnt':self.cnt+3},
               {'code':'gadaadad','name':'Өнгөрсөн хичээлийн жилд гадаадад мэргэжил дээшлүүлсэн','cnt':self.cnt+4},
               {'code':'dot_sanaltai','name':'Төвлөрсөн, бүсчилсэн шугамаар дотоодод мэргэжил дээшлүүлэх саналтай','cnt':self.cnt+5},
               {'code':'gad_sanaltai','name':'Төвлөрсөн, бүсчилсэн шугамаар гадаадад мэргэжил дээшлүүлэх саналтай','cnt':self.cnt+6}]
        return res
report_sxw.report_sxw(
    'report.db_5',
    'hr.employee',
    'addons/school/report/report_db_5.rml',
    parser=report_db_5, 
    header=False)
예제 #30
0
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from report import report_sxw
from spreadsheet_xml.spreadsheet_xml_write import SpreadsheetReport

class monthly_budget(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(monthly_budget, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
        })
        return

report_sxw.report_sxw('report.msf.pdf.budget.monthly', 'msf.budget', 'addons/msf_budget/report/monthly_budget.rml', parser=monthly_budget, header=False)


class monthly_budget2(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(monthly_budget2, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
        })
        return

SpreadsheetReport('report.xls.budget.monthly','msf.budget','addons/msf_budget/report/monthly_budget.mako', parser=monthly_budget2)
예제 #31
0
            total[1] += fy_line.planned_amount
            total[2] += fy_line.total_operation
            total[3] += fy_line.balance
            total[4] += fy_line.residual_balance
        res.append(total)
        return res

    def _budget_total(self, budget):
        total = {
            'planned_amount': 0.0,
            'total_operation': 0.0,
            'balance': 0.0,
            'residual_balance': 0.0
        }
        for line in budget.account_budget_line:
            total['planned_amount'] += line.planned_amount
            total['total_operation'] += line.total_operation
            total['balance'] += line.balance
            total['residual_balance'] += line.residual_balance
        return [total]


report_sxw.report_sxw(
    'report.account.account.budget.object',
    'account.budget',
    'addons/account_budget_custom/report/account_report_budget_obj.rml',
    parser=account_budget_object,
    header='internal landscape')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #32
0
import time
from report import report_sxw


class account_voucher(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_voucher, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'time': time,
        })


report_sxw.report_sxw(
    'report.account_voucher',
    'account.voucher',
    'addons/vit_account_voucher_print_report/report/account_voucher.rml',
    parser=account_voucher,
)
예제 #33
0
                val['net']=deposit
                val['tax']=0.0
                val['gross']=val['net']+val['tax']
                res['amt'].append(val)
                val={}
                val['name']='Entnahmen'
                val['no']=d
                val['net']=withdraw
                val['tax']=0.0
                val['gross']=val['net']+val['tax']
                res['amt'].append(val)
                res['should_in_pos']=sess_obj.cash_register_balance_end
                res['actual_in_pos']=sess_obj.cash_register_balance_end_real
                lst.append(res)
        return lst
report_sxw.report_sxw('report.pos_daily_report', 'daily.pos.wizard', 'addons/dantunes_pos/report/pos_daily_report.rml', parser=pos_daily_report_kt, header=False)

class pos_monthly_report_kt(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(pos_monthly_report_kt, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'get_address':self.get_address,
            'get_session_details':self.get_session_details,
            'get_totals':self.get_totals
       })
    cash_total=0.0
    card_total=0.0
    deposit_total=0.0
    withdraw_total=0.0
        
예제 #34
0
        fhasta = form['date2']
        tipo = form['type']
        sql = """
        SELECT s.name,s.date_promocion,p.name,z.name,s.state  
        FROM  sale_promocion         AS s
        INNER JOIN res_partner       AS p ON s.partner_id=p.id
        INNER JOIN res_partner_zone  AS z ON s.code_zone_id=z.id
        WHERE s.type='%s' AND s.date_promocion BETWEEN '%s' AND '%s' 
        ORDER BY s.date_promocion,s.partner_id """ % (tipo, fdesde, fhasta)
        #print sql
        self.cr.execute(sql)
        list = self.cr.fetchall()
        if list:
            data = []
            for l in list:
                data.append({
                    "nro": l[0],
                    "fecha": l[1],
                    "cliente": l[2],
                    'zona': l[3],
                    "status": l[4]
                })
        return data


report_sxw.report_sxw(
    'report.list_promocion',
    'sale.promocion',
    'addons/custom_american/promociones/report/list_promocion_ventas.rml',
    parser=list_promo,
    header=False)
예제 #35
0
                                'disable': line.disable,
                                'prod_image': line.prod_image,
                                'name': line.name or '',
                                'categ_id': line.product_id.categ_id.name,
                                'product_id': line.product_id.name,
                                'product_uom_qty':line.product_uom_qty or 0,
                                'price_unit': line.price_unit,
                                'description': line.name,
                                'note': line.note or '',
                                'totals': self.totals,
                            })
                    self.totals += (line.product_uom_qty)
                    self.subtotals += (line.product_uom_qty)
                    self.subtotal_price += (line.price_unit)
            newlist = sorted(res, key=lambda k: k['name'])
            groups = itertools.groupby(newlist, key=operator.itemgetter('categ_id'))
            result = [{'categ_id':k,'values':[x for x in v]} for k,v in groups]
            return result

    def _get_static_data(self, obj):
        product_obj = self.pool.get('product.product')
        product_id = product_obj.search(self.cr, self.uid ,[('name','=','quote template image')])
        img_browse = product_obj.browse(self.cr, self.uid, product_id[0]).image
        return img_browse


report_sxw.report_sxw('report.sale.order.image', 'sale.order', 'sales_focus_design/report/focus_design.rml', parser=focus_design, header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #36
0

class pos_sales_user(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(pos_sales_user, self).__init__(cr, uid, name, context=context)
        self.total = 0.0
        self.localcontext.update({
            'time': time,
            'get_data': self._get_data,
        })

    def _get_data(self, form):
        dt1 = form['date_start'] + ' 00:00:00'
        dt2 = form['date_end'] + ' 23:59:59'
        data = {}
        self.cr.execute("select po.name as pos,po.date_order,ru.name as user,po.state,rc.name " \
                        "from pos_order as po,res_users as ru,res_company as rc " \
                        "where po.date_order >= %s and po.date_order <= %s " \
                        "and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s " \
                    ,(dt1,dt2,tuple(form['user_id'])))

        return self.cr.dictfetchall()


report_sxw.report_sxw('report.pos.sales.user',
                      'pos.order',
                      'addons/point_of_sale/report/pos_sales_user.rml',
                      parser=pos_sales_user,
                      header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #37
0
import time
import locale
from report import report_sxw
from osv import osv


class report_webkit_html(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(report_webkit_html, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({"time": time, "cr": cr, "uid": uid, "locale": locale})


report_sxw.report_sxw(
    "report.product.computed.report",
    "product.product",
    "addons/c2c_stock_accounting/report/product_computed_report.mako",
    parser=report_webkit_html,
)
예제 #38
0
            ctx['period_to'] = form['period_to']
        elif form['filter'] == 'filter_date':
            ctx['date_from'] = form['date_from']
            ctx['date_to'] = form['date_to']
        ctx['state'] = form['target_move']
        parents = ids
        child_ids = obj_account._get_children_and_consol(
            self.cr, self.uid, ids, ctx)
        if child_ids:
            ids = child_ids
        accounts = obj_account.read(self.cr, self.uid, ids, [
            'type', 'code', 'name', 'debit', 'credit', 'balance', 'parent_id',
            'level', 'child_id'
        ], ctx)

        for parent in parents:
            if parent in done:
                continue
            done[parent] = 1
            _process_child(accounts, form['display_account'], parent)
        return self.result_acc


report_sxw.report_sxw('report.account.account.balance',
                      'account.account',
                      'addons/account/report/account_balance.rml',
                      parser=account_balance,
                      header="internal")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        payslips, total_net = self.get_payslip_data(cr, uid, context=context)
        self.localcontext.update({
            'payslips': payslips,
            'total_net': total_net,
            })

    def get_payslip_data(self, cr, uid, context=None):
        retval = {}
        payslip_ids = []
        slip_run_ids = context.get('active_ids')
        slip_runs = self.pool.get('hr.payslip.run').browse(cr, uid, slip_run_ids, context=context)
        payslip_obj = self.pool.get('hr.payslip')
        for run in slip_runs:
            payslip_ids.extend([x.id for x in run.slip_ids])
        payslips = payslip_obj.browse(cr, uid, payslip_ids, context=context)
        net_total = 0
        for payslip in payslips:
            lines = payslip_obj.get_visible_lines(cr, uid, payslip.id, context=context)
            net_salary = sum(x.total for x in lines if x.sequence in [5000])
            net_total += net_salary
            retval[payslip] = {
                'net_salary': net_salary,
            }

        return (retval, net_total)

report_sxw.report_sxw('report.webkit.bank_information_report_pdf',
                      'hr.payslip',
                      'lct_hr/report/payslip_report.html.mako',
                      parser=bank_information_report_pdf)
예제 #40
0
            new_ids = 'active_ids' in data['form'] and data['form'][
                'active_ids'] or []
            self.query_get_clause = 'AND '
            self.query_get_clause += obj_move._query_get(
                self.cr,
                self.uid,
                obj='l',
                context=data['form'].get('used_context', {}))
            objects = self.pool.get('account.journal.period').browse(
                self.cr, self.uid, new_ids)
        if new_ids:
            self.cr.execute(
                'SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s',
                (tuple(new_ids), ))
            res = self.cr.fetchall()
            self.period_ids, self.journal_ids = zip(*res)
        return super(journal_print_i,
                     self).set_context(objects,
                                       data,
                                       ids,
                                       report_type=report_type)


report_sxw.report_sxw(
    'report.account.central.journal.optim',
    'account.journal.period',
    'addons/ad_account_optimization/report/account_central_journal.rml',
    parser=journal_print_i,
    header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #41
0
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import time
from report import report_sxw
from osv import osv

class report_account_cash_book_html(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(report_account_cash_book_html, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'cr':cr,
            'uid': uid
        })

report_sxw.report_sxw('report.l10n_lv_account.cash_book',
                       'account.bank.statement', 
                       'addons/l10n_lv_account/report/report_account_cash_book_html.mako',
                       parser=report_account_cash_book_html)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #42
0
import time
from report import report_sxw
from osv import osv
import pooler


class dept_state(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(dept_state, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })


report_sxw.report_sxw('report.dept_state',
                      'purchase.contract',
                      'purchase_contracts/report/dept_state.rml',
                      dept_state,
                      header=False)
예제 #43
0
# -*- coding: utf-8 -*-

import time
import datetime
from report import report_sxw

class medication_report(report_sxw.rml_parse):
        _name = 'report.patient.medications'
        def __init__(self, cr, uid, name, context):
            super(medication_report, self).__init__(cr, uid, name, context=context)
            self.localcontext.update({
                'time': time,
            })

report_sxw.report_sxw('report.patient.medications', 'medical.patient', 'addons/hms_plus/medical/report/patient_medications.rml', parser=medication_report, header=True )



                                                        uid,
                                                        name,
                                                        context=context)
        self.localcontext.update({
            'time': time,
            'cr': cr,
            'uid': uid,
            'amount_say': self.amount_say,
            'date_order_fmt': self.date_order_fmt,
            'get_user': self.get_user,
        })

    def amount_say(self, nbr, lang='id', currency='Rupiah'):
        return utilities.amount_to_text_id.amount_to_text(nbr,
                                                          lang=lang,
                                                          currency=currency)

    def date_order_fmt(self, value=None):
        return utilities.date_order_fmt(value=value)

    def get_user(self, cr, uid, id):
        users = self.pool.get('res.users').browse(cr, uid, id)
        return users and users.name or ''


report_sxw.report_sxw(
    'report.webkit_rfq',
    'purchase.order',
    'addons/pralon_forms/purchase/request_for_quotation.mako',
    parser=rwk_request_for_quotation)
예제 #45
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import time

from report import report_sxw
from osv import osv
from tools.translate import _

class donation_certificate(report_sxw.rml_parse):

    def __init__(self, cr, uid, name, context):
        super(donation_certificate, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'get_lines': self._get_lines,
        })
        
    def _get_lines(self, pick_id):
        pick_obj = self.pool.get('stock.picking')
        pick = pick_obj.browse(self.cr, self.uid, pick_id)
            
        return pick.move_lines
    
report_sxw.report_sxw('report.order.type.donation.certificate', 
                      'stock.picking', 
                      'addons/order_types/report/donation_certificate.rml', 
                      parser= donation_certificate)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #46
0
        date_from = data['form']['date_from']
        date_to = data['form']['date_to']
        building_id = data['form']['building_id']
        maintenance_type = data['form']['maintenance_type']
        partner_id = data['form']['partner_id']
        state = data['form']['state']
        maintenance_obj = self.pool.get('building.maintenance')
        domain = [('date', '>=', date_from), ('date', '<=', date_to)]
        if building_id:
            domain.append(('building_id', '=', building_id[0]))
        if state:
            domain.append(('state', '=', state))
        if partner_id:
            domain.append(('partner_id', '=', partner_id[0]))
        if maintenance_type:
            domain.append(('maintenance_type', '=', maintenance_type[0]))

        maintenance_ids = maintenance_obj.search(self.cr,
                                                 self.uid,
                                                 domain,
                                                 order="id")
        return maintenance_obj.browse(self.cr, self.uid, maintenance_ids)


report_sxw.report_sxw(
    'report.building_maintenance.report',
    'building.maintenance',
    'addons/building_management/report/building_maintenance_report.rml',
    parser=building_maintenance_report,
    header=False)
예제 #47
0
        debit = 0
        credit = 0
        balance = 0
        for line in self.result_acc:
            debit += line["type"] <> "view" and line["debit"] or 0
            credit += line["type"] <> "view" and line["credit"] or 0
            balance += line["type"] <> "view" and line["balance"] or 0
        self.total_debit = debit
        self.total_credit = credit
        self.total_balance = balance

    def _total_credit(self):
        return self.total_credit

    def _total_debit(self):
        return self.total_debit

    def _total_balance(self):
        return self.total_balance


report_sxw.report_sxw(
    "report.account.account.balance1",
    "account.account",
    "addons/retention/report/account_balance.rml",
    parser=account_balance,
    header="internal",
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #48
0
                          }
                        self.result_temp.append(temp)
                    if  i < len(cal_list['liability']):
                        temp={
                              'code': cal_list['liability'][i]['code'],
                              'name': cal_list['liability'][i]['name'],
                              'level': cal_list['liability'][i]['level'],
                              'balance':cal_list['liability'][i]['balance'],
                              'code1': '',
                              'name1': '',
                              'level1': False,
                              'balance1':False,
                          }
                        self.result_temp.append(temp)
        return None

    def get_lines(self):
        return self.result_temp

    def get_lines_another(self, group):
        return self.result.get(group, [])

report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account',
    'addons/account/report/account_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal,
    header='internal landscape')

report_sxw.report_sxw('report.account.balancesheet', 'account.account',
    'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal,
    header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

import time
from report import report_sxw
from account.report.account_central_journal import journal_print
#
# Use period and Journal for selection or resources
#
class journal_print_i(journal_print):

    def set_context(self, objects, data, ids, report_type=None):
        obj_move = self.pool.get('account.move.line')
        new_ids = ids
        self.query_get_clause = ''
        self.target_move = data['form'].get('target_move', 'all')
        if (data['model'] == 'ir.ui.menu'):
            new_ids = 'active_ids' in data['form'] and data['form']['active_ids'] or []
            self.query_get_clause = 'AND '
            self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
            objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
        if new_ids:
            self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
            res = self.cr.fetchall()
            self.period_ids, self.journal_ids = zip(*res)
        return super(journal_print_i, self).set_context(objects, data, ids, report_type=report_type)

report_sxw.report_sxw('report.account.central.journal.optim', 'account.journal.period', 'addons/ad_account_optimization/report/account_central_journal.rml', parser=journal_print_i, header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
				for entry in remove_item_list:
					data.remove(entry)
			data_renew.append({'cons_item': 'Grand Total', 'sub_tot': gr_tot,})				  
			return data_renew 
			
		else:
			
			print "No Data"		   

	def _get_filter(self, data):
		if data.get('form', False) and data['form'].get('filter', False):
			if data['form']['filter'] == 'filter_date':
				return _('Date')			
		return _('No Filter')
		
	def _get_start_date(self, data):
		if data.get('form', False) and data['form'].get('date_from', False):
			return data['form']['date_from']
		return ''
		
	def _get_end_date(self, data):
		if data.get('form', False) and data['form'].get('date_to', False):
			return data['form']['date_to']
		return ''		   
  

report_sxw.report_sxw('report.consumption.details.report', 'stock.picking', 
			'addons/kg_store_reports/report/consumption_details_report.rml', 
			parser=consumption_details_report, header = False)
			
예제 #51
0
    def get_analytic_lines(self, obj_id, data):
        print obj_id, data
        move = self.pool.get('account.move').browse(self.cr, self.uid, obj_id)
        lines = []
        for line in move.line_id:
            for al in line.analytic_lines:
                if al.amount == 0:
                    continue
                line_data = {'acc_name': al.account_id.complete_name,
                             'code': al.account_id.code,
                             'amount': abs(al.amount),
                             'name': al.name}
                lines.append(line_data)
        return lines

    def get_user(self, move):
        user_name = '*'
        user_pool = pooler.get_pool(self.cr.dbname).get('res.users')
        if move.line_id and move.line_id[0] and move.line_id[0].invoice:
            user_name = move.line_id[0].invoice.user_id.name
        else:
            self.cr.execute("select create_uid from account_move where id=%s" % move.id)
            data = self.cr.fetchone()
            user = user_pool.browse(self.cr, self.uid, data[0])
            user_name = user.name
        return user_name
   
report_sxw.report_sxw('report.account.move','account.move','addons/retention/report/report_move.rml',parser=move)

    def get_datelimit(self, date):
        return datetime.datetime.strptime(date,
                                          '%Y-%m-%d').strftime('%d/%m/%Y')

    def get_amount(self, amount, currency):
        amt_en = amount_to_text_es.amount_to_text(amount, 'en', currency)
        return amt_en

    def get_qrcode(self, auth_no, in_no, ncc, date, amt, keygen):
        #        date = datetime.datetime.strptime(date, '%Y-%m-%d').strftime('%Y%m%d')
        #        url = 'http://198.178.122.145:8060/cc/codigo_control.php?AUTH_NUMBER=' + str(auth_no or '') + '&INVOICE_NUMBER=' + str(in_no or '') + '&NIT_CODE_CUSTOMER=' + str(ncc or '') + '&DATE=' + str(date or '') + '&AMOUNT=' + str(amt or '') + '&KEYGEN=' + str(keygen or '')
        date = datetime.datetime.strptime(
            date, DEFAULT_SERVER_DATE_FORMAT).strftime('%Y%m%d')
        control_code = str(auth_no or '') + '|' + str(in_no or '') + '|' + str(
            ncc or '') + '|' + str(date or '') + '|' + str(
                amt or '') + '|' + str(keygen or '')
        #        resp = urllib2.urlopen(url)
        #        soup = BeautifulSoup(resp)
        qr_img = qrcode.make(control_code)
        filename = str(tempfile.gettempdir()) + '/qrtest.png'
        qr_img.save(filename)
        return base64.encodestring(file(filename, 'rb').read())


report_sxw.report_sxw(
    'report.factura_receipt',
    'account.invoice',
    'addons/account_invoice_report/report/invoice_factura.rml',
    parser=invoice_factura)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        obj_account = self.pool.get('account.account')
        if not ids:
            ids = self.ids
        if not ids:
            return []
        if not done:
            done={}

        ctx = self.context.copy()

        parents = ids
        child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
        if child_ids:
            ids = child_ids
        accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','currency_id', 'company_currency_id','active','parent_id','child_id'], ctx)

        for parent in parents:
                if parent in done:
                    continue
                done[parent] = 1
                _process_child(accounts,parent)
        return self.result_acc

report_sxw.report_sxw('report.l10n_lv_account.chart',
                       'account.account', 
                       'addons/l10n_lv_account/report/report_account_chart_html.mako',
                       parser=report_account_chart_html)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

import time
import locale
from report import report_sxw
from osv import osv

class report_webkit_html(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(report_webkit_html, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'cr':cr,
            'uid': uid,
            'locale': locale,
        })
        
report_sxw.report_sxw('report.res_partner.partner_participations',
                       'res.partner',
                       'chricar_partner_parent_companies/report/report_partner_participations.mako',
                       parser=report_webkit_html)

예제 #55
0
            return 0.0
        else:
            amt = 0.0
            for line in receipt_voucher.payment_details:
                amt += line.type == 'cash' and line.amount or 0.0
            return amt
        
    def get_payreg_transfer(self, receipt_voucher):
        if not receipt_voucher:
            return 0.0
        else:
            amt = 0.0
            for line in receipt_voucher.payment_details:
                amt += line.type == 'transfer' and line.amount or 0.0
            return amt
        
    def get_payreg_total(self, receipt_voucher):
        if not receipt_voucher:
            return 0.0
        else:
            amt = 0.0
            for line in receipt_voucher.payment_details:
                amt += line.amount or 0.0
            return amt
        
            
report_sxw.report_sxw('report.account.receipt.voucher.rjc', 'account.voucher', '', parser=receipt_voucher, header="internal")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

예제 #56
0
import time 
from report import report_sxw 
class qo_sign(report_sxw.rml_parse): 
    def __init__(self, cr, uid, name, context): 
        super(qo_sign, self).__init__(cr, uid, name, context) 
        self.localcontext.update({ 'time': time, }) 
        
report_sxw.report_sxw('report.qo_sign', 'sale.order', 'addons/vit_n_quotation_ready_print_mutif/report/qo_sign.rml', parser=qo_sign,) 
						print "new_data 2222222222222222", new_data
						delete_items.append(item2)
						print "delete_items _____________________>>>>>", delete_items
				else:
					print "Few Indent have one line"
				
			"""
		
		return data
		


	def _get_filter(self, data):
		if data.get('form', False) and data['form'].get('filter', False):
			if data['form']['filter'] == 'filter_date':
				return _('Date')
		return _('No Filter')
		
	def _get_start_date(self, data):
		if data.get('form', False) and data['form'].get('date_from', False):
			return data['form']['date_from']
		return ''
		
	def _get_end_date(self, data):
		if data.get('form', False) and data['form'].get('date_to', False):
			return data['form']['date_to']
		return '' 	   
 
report_sxw.report_sxw('report.kg.pi.detail.report','purchase.requisition','addons/kg_store_reports/report/kg_pi_detail_report.rml',
						parser=kg_pi_detail_report, header= False)
예제 #58
0
        res = self.cr.dictfetchall()
        return res

    def eur_rate(self):
        self.cr.execute("SELECT rate.rate, cur.name FROM res_currency cur INNER JOIN res_currency_rate rate ON  cur.id = rate.currency_id WHERE cur.name = 'EUR'")
        res = self.cr.dictfetchall()
        return res

    def debit(self, move_ids):
        debit = 0.0
        for move in move_ids:
            debit +=move.debit
        
        return debit

    def credit(self, move_ids):
        credit = 0.0
        for move in move_ids:
            credit +=move.credit
        
        return credit

report_sxw.report_sxw(
    'report.account.move.voucher.arabic',
    'account.move',
    'addons/account_arabic_reports/report/account_voucher_print.rml',
    parser=report_voucher_move,header="external"
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
예제 #59
0
		data=self.cr.dictfetchall()
		print "data ::::::::::::::=====>>>>", data
		gran_tot = 0.0
		for val in data:
			amt = val['net_sal']			
			val['net_amt'] = int(amt)
			print "net_amt........................",val['net_amt']		
		return data

	def _get_filter(self, data):
		if data.get('form', False) and data['form'].get('filter', False):
			if data['form']['filter'] == 'filter_date':
				return _('Date')
			
		return _('No Filter')
		
	def _get_start_date(self, data):
		if data.get('form', False) and data['form'].get('date_from', False):
			return data['form']['date_from']
		return ''
		
	def _get_end_date(self, data):
		if data.get('form', False) and data['form'].get('date_to', False):
			return data['form']['date_to']
		return ''		   
  

report_sxw.report_sxw('report.kg.bank.list', 'hr.payslip', 
			'addons/kg_payslip/report/kg_bank_list.rml', 
			parser=kg_bank_list, header = False)
예제 #60
0
        return data.get('form', {}).get(param, default) or default

    def set_context(self, objects, data, ids, report_type=None):
        """Return res.partner.category"""
        #!! data form is manually set in wizard
        agreg = {}
        for pick in objects:
            for move in pick.move_lines:
                if move.state == 'assigned':
                    key = (move.location_id, move.location_dest_id)
                    agreg.setdefault(key, []).append(move)
        objects = []
        for agr in agreg:
            print agr
            objects.append(PickingAgregation(agr[0], agr[1], agreg[agr]))
        return super(PrintPick, self).set_context(objects,
                                                  data,
                                                  ids,
                                                  report_type=report_type)


report_sxw.report_sxw('report.webkit.aggregated_picking',
                      'stock.picking',
                      'addons/stock_picking_webkit/report/picking.html.mako',
                      parser=PrintPick)

report_sxw.report_sxw('report.webkit.aggregated_delivery',
                      'stock.picking',
                      'addons/stock_picking_webkit/report/delivery.html.mako',
                      parser=PrintPick)