Ejemplo n.º 1
0
def publish_account_invoice():
    openerp.report.interface.report_int.remove('report.account.invoice')

    report_sxw.report_sxw(
        'report.account.invoice',
        'account.invoice',
        'addons/l10n_ar_wsafip/report/invoice.rml',
        parser=ar_account_invoice,
        header=False
    )
Ejemplo n.º 2
0
    def __init__(self, cr, uid, name, context):
        super(hr_payrolls,self).__init__(cr, uid, name, context)
        self.localcontext.update({'time' : time, 'num_let' : self._num_let })
        self.context = context
	
	report_sxw.report_sxw(
		'report.hrpayroll',
		'hr.payroll',
		'addons/hr_ecuador/report/hr_payroll.rml', 
		parser=hr_payrolls,
		header=False)
Ejemplo n.º 3
0
def publish_account_invoice():
	try:
	    del openerp.report.interface.report_int._reports['report.account.invoice']
	except:
	    pass

	report_sxw.report_sxw(
        	'report.account.invoice',
	        'account.invoice',
        	'addons/l10n_ar_invoice/report/invoice.rml',
	        parser=ar_account_invoice,
        	header=False
	    )
Ejemplo n.º 4
0
    def _lookup_report(self, cr, name):
        """
        Look up a report definition.
        """
        opj = os.path.join
 
        # First lookup in the deprecated place, because if the report definition
        # has not been updated, it is more likely the correct definition is there.
        # Only reports with custom parser sepcified in Python are still there.
        if 'report.' + name in openerp.report.interface.report_int._reports:
            new_report = openerp.report.interface.report_int._reports['report.' + name]
        else:
            cr.execute("SELECT * FROM ir_act_report_xml WHERE report_name=%s", (name,))
            r = cr.dictfetchone()
            if r:
                if r['report_type'] in ['qweb-pdf', 'qweb-html']:
                    return r['report_name']
                elif r['report_type'] == 'aeroo':
                    new_report = self.unregister_report(cr, r['report_name'])
                elif r['report_rml'] or r['report_rml_content_data']:
                    if r['parser']:
                        kwargs = {'parser': operator.attrgetter(r['parser'])(openerp.addons)}
                    else:
                        kwargs = {}
                    new_report = report_sxw('report.' + r['report_name'], r['model'],
                        opj('addons', r['report_rml'] or '/'), header=r['header'], register=False, **kwargs)
                elif r['report_xsl'] and r['report_xml']:
                    new_report = report_rml('report.' + r['report_name'], r['model'],
                        opj('addons', r['report_xml']),
                        r['report_xsl'] and opj('addons', r['report_xsl']), register=False)
                else:
                    raise Exception, "Unhandled report type: %s" % r
            else:
                raise Exception, "Required report does not exist: %s (Type: %s" % r
        return new_report
Ejemplo n.º 5
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']))
            return 'TARJETA DE DÉBITO'
        elif nombre == '17':
            return 'DINERO ELECTRÓNICO'
        elif nombre == '18':
            return 'TARJETA PREPAGO'
        elif nombre == '19':
            return 'TARJETA DE CRÉDITO'
        elif nombre == '20':
            return 'OTROS CON UTILIZACION DEL SISTEMA FINANCIERO'
        elif nombre == '21':
            return 'ENDOSO DE TÍTULOS'
        else:
            return ''

    def _get_event(self, event):
        if event == 'perf':
            return 'PERFORACION'
        elif event == 'complt':
            return 'COMPLETACION'
        elif event == 'work':
            return 'WORKOVER'
        else:
            return ''


report_sxw.report_sxw('report.account.invoice.indfe',
                      'account.invoice',
                      'addons_tiw/o2s_felectronica/report/invoice_ind.rml',
                      parser=account_invoice_indfe,
                      header=False)
Ejemplo n.º 7
0
        for order in objects:
            for line in order.lines:
                if len(line.product_id.taxes_id):
                    tax = line.product_id.taxes_id[0]
                    res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
                    list_ids.append(tax.id)
        return res

    def _get_sales_total(self, objects):
        return reduce(lambda x, o: x + len(o.lines), objects, 0)

    def _get_start_period(self, objects):
        date_orders = sorted([obj.date_order for obj in objects])
        min_date = date_orders[0]
        return '%s' % min_date


    def _get_end_period(self, objects):
        date_orders = sorted([obj.date_order for obj in objects])
        max_date = date_orders[-1]
        return '%s' % max_date


report_sxw.report_sxw('report.pos.details_summary',
                                            'pos.order',
                                            'addons/point_of_sale/report/pos_details_summary.rml',
                                            parser=pos_details_summary,
                                            header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        super(doctor_clinical_laboratory, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'select_type': self.select_type,
            'select_age': self.select_age,
        })

    def select_type(self, tipo_usuario):
        context = {}
        context.update({'lang' : self.pool.get('res.users').browse(self.cr, self.uid, self.uid, context=context).lang})
        patient = self.pool.get('doctor.patient')
        tipo = dict(patient.fields_get(self.cr, self.uid, 'tipo_usuario',context=context).get('tipo_usuario').get('selection')).get(
            str(tipo_usuario))
        return tipo

    def select_age(self, age):
        context = {}
        context.update({'lang' : self.pool.get('res.users').browse(self.cr, self.uid, self.uid, context=context).lang})
        attentions = self.pool.get('doctor.attentions')
        age_unit = dict(attentions.fields_get(self.cr, self.uid, 'age_unit',context=context).get('age_unit').get('selection')).get(
            str(age))
        return age_unit

report_sxw.report_sxw('report.doctor_clinical_laboratory', 'doctor.attentions',
                      'addons/l10n_co_doctor/report/doctor_clinical_laboratory.rml',
                      parser=doctor_clinical_laboratory)
        
        
        
        
Ejemplo n.º 9
0
	def select_type_attention(self, type_atention):
		context = {}
		context.update({'lang' : self.pool.get('res.users').browse(self.cr, self.uid, self.uid, context=context).lang})

		patient = self.pool.get('doctor.attentions.referral')
		type = dict(patient.fields_get(self.cr, self.uid, 'referral_ids',context=context).get('referral_ids').get('selection')).get(
			str(type_atention))
		return type

	def select_type_interconsultation(self, type_interconsultation):
		if type_interconsultation:
			return "Si"
		return "No"

	def select_age(self, age):
		context = {}
		context.update({'lang' : self.pool.get('res.users').browse(self.cr, self.uid, self.uid, context=context).lang})
		attentions = self.pool.get('doctor.attentions')
		age_unit = dict(attentions.fields_get(self.cr, self.uid, 'age_unit',context=context).get('age_unit').get('selection')).get(
			str(age))
		return age_unit

report_sxw.report_sxw('report.doctor_referral', 'doctor.attentions',
					  'addons/l10n_co_doctor/report/doctor_referral.rml',
					  parser=doctor_referral)
		
		
		
		
Ejemplo n.º 10
0
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero 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 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 openerp.report import report_sxw
from openerp.osv import osv
from openerp import pooler

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

report_sxw.report_sxw('report.purchase.order_laredo','purchase.order','addons/purchase/reportes/order_laredo.rml',parser=order_laredo)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 11
0
class report_webkit_html(report_sxw.rml_parse):

#inventory value for product
    def _get_product_values(self):
        res = {}
        product_obj = self.pool['product.product']
        product_ids = product_obj.search(self.cr, self.uid, [])
        for product in product_obj.browse(self.cr, self.uid, product_ids):
            if product.cost_price:
                res.update({product.id: product.cost_price})
            else:
                res.update({product.id: 0.0})
        return res

    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,
            'get_products': self._get_product_values,
        })

    def set_context(self, objects, data, ids, report_type=None):
        return super(report_webkit_html, self).set_context(objects, data, ids, report_type=report_type)

report_sxw.report_sxw('report.stock.inventory.webkit',
                       'stock.inventory',
                       'addons/stock_product_zero/report/stock_inventory.mako',
                       parser=report_webkit_html)
Ejemplo n.º 12
0
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
#
##############################################################################

from openerp.report import report_sxw
from openerp.addons.dm_base.rml import rml_parser_ext  
class mto_design_print(rml_parser_ext):
    def __init__(self, cr, uid, name, context):
        super(mto_design_print, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'get_attr': self.get_attr,
            'attr_value': self.attr_value,
        })
    def get_attr(self,data,attr_name,attr_type=None):
        attr_val = getattr(data,attr_name)
        if attr_val and attr_type == 'multiselect':
            opt_ids = [opt.id for opt in attr_val]
            attr_val = opt_ids
        print '%s=%s'%(attr_name,attr_val)
        return attr_val
    def attr_value(self,data,attr):
        attr_value = getattr(data,attr.name)
        if attr_value and attr.attribute_type == 'select':
            attr_value = attr_value.name
        if attr_value and attr.attribute_type == 'multiselect':
            attr_value = ','.join([opt.name for opt in attr_value])
        return attr_value
report_sxw.report_sxw('report.mto.design.print', 'mto.design','addons/dmp_mto/report/mto_design.rml',parser=mto_design_print)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Ejemplo n.º 13
0
        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:
Ejemplo n.º 14
0
#    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 openerp.report import report_sxw
from openerp.osv import osv


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

    def get_product_desc(self, move_line):
        desc = move_line.product_id.name
        if move_line.product_id.default_code:
            desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
        return desc


report_sxw.report_sxw('report.stock.picking.list',
                      'stock.picking',
                      'addons/stock/report/picking.rml',
                      parser=picking)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 15
0
        self.localcontext.update({
            'time': time,
            'get_alicuota': self._get_alicuota,
            'get_rif': self._get_rif
        })

    def _get_alicuota(self, tnom=None):
        if not tnom:
            return []

        tax_obj = self.pool.get('account.tax')
        tax_ids = tax_obj.search(self.cr, self.uid, [('name', '=', tnom)])
        if not tax_ids:
            tax_ids = tax_obj.search(self.cr, self.uid,
                                     [('description', '=', tnom)])
        tax = tax_obj.browse(self.cr, self.uid, tax_ids)[0]
        return tax.amount * 100

    def _get_rif(self, vat=''):
        if not vat:
            return []
        return vat[2:].replace(' ', '')


report_sxw.report_sxw('report.stock.guia_ve',
                      'stock.picking',
                      'addons/l10n_ve_stock/report/guiadespacho.rml',
                      parser=stock_valued,
                      header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 16
0
            if voucher_lines[i]:
                if i < self.number_lines:
                    res = {
                        'date_due' : voucher_lines[i].date_due,
                        'name' : voucher_lines[i].name,
                        'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False,
                        'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False,
                        'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False,
#                         'pur_order': voucher_lines[i].invoice_id and voucher_lines[i].invoice_id.origin or ' ',
                        'discount_used': 'discount_used' in voucher_lines[i]._columns and voucher_lines[i].discount_used or ' ',	
                    }
                else :
                    res = {
                        'date_due' : False,
                        'name' : False,
                        'amount_original' : False,
                        'amount_due' : False,
                        'amount' : False,
                    }
                result.append(res)
        return result

report_sxw.report_sxw(
    'report.account.print.check.top.oddello',
    'account.voucher',
    'oddello_check_writing/report/check_print_top.rml',
    parser=report_print_check,header=False
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 17
0
from metro.utils import cnumber


class account_move_print(rml_parser_ext):
    def __init__(self, cr, uid, name, context=None):
        super(account_move_print, self).__init__(cr,
                                                 uid,
                                                 name,
                                                 context=context)
        self.localcontext.update({
            'time': time,
            'to_cn': self.to_cn,
        })

    def to_cn(self, amount):
        pt = cnumber()
        if not isinstance(amount, str):
            str_amount = str(amount).replace(',', '')  #delete the ','
            cn_amt = pt.cwchange(str_amount)
        else:
            cn_amt = pt.cwchange(amount)
        return cn_amt


report_sxw.report_sxw('report.account.move.print',
                      'account.move',
                      'addons/metro_accounts/account_move.rml',
                      parser=account_move_print,
                      header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 18
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/>.
#
######################################s########################################

from account.report.account_partner_balance import partner_balance
from openerp.report import report_sxw


class partner_balance_ext(partner_balance):

    def set_context(self, objects, data, ids, report_type=None):
        partner_ids = data['form'].get('partner_ids', False)
        if partner_ids:
            res = super(partner_balance_ext, self).set_context(objects, data, partner_ids, report_type)
            self.query += ' AND l.partner_id in (%s) ' % ','.join(str(x) for x in partner_ids)
        else:
            res = super(partner_balance_ext, self).set_context(objects, data, ids, report_type)
        return res

report_sxw.report_sxw('report.account.partner.balance.ext', 'res.partner',
        'addons/account/report/account_partner_balance.rml', parser=partner_balance_ext,
        header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
            ctx = data['form'].get('used_context', {})
            if ctx:
                data['form']['used_context'].update({'partner_id': data['form']['partner_id'][0]})
            else:
                data['form'].update({'used_context': {'partner_id': data['form']['partner_id'][0]}})
        res = super(partner_ledger_zateg, self).set_context(objects, data, ids, report_type=report_type)
        if data['form']['hide_zero']:
            objects = self.localcontext['objects']
            new_objs = []
            for partner in objects:
                debit = self._sum_debit_partner(partner)
                credit = self._sum_credit_partner(partner)
                if debit or credit:
                    new_objs.append(partner)
            self.localcontext['objects'] = new_objs

        return res

from openerp.netsvc import Service
del Service._services['report.account.third_party_ledger']
del Service._services['report.account.third_party_ledger_other']

report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
        'addons/z_account/report/account_partner_ledger.rml',parser=partner_ledger_zateg,
        header='internal')

report_sxw.report_sxw('report.account.third_party_ledger_other', 'res.partner',
        'addons/z_account/report/account_partner_ledger_other.rml',parser=partner_ledger_zateg,
        header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 20
0
          for record in result:
              if record['currency']=='EUR' :
                  total_amount += record['total_fees']
                  remain_amount += record['remain']
                  payed_amount += record['payable']
              elif record['currency']=='SDG':
                  total_amount += currency_obj.compute(self.cr, self.uid, euro_id,record['cur_id'], record['total_fees'], to_date)
                  remain_amount += currency_obj.compute(self.cr, self.uid, euro_id,record['cur_id'], record['remain'], to_date)
                  payed_amount += currency_obj.compute(self.cr, self.uid, euro_id,record['cur_id'], record['payable'], to_date)
              else:
                  total_amount += currency_obj.compute(self.cr, self.uid, record['cur_id'],euro_id, record['total_fees'], to_date)
                  remain_amount += currency_obj.compute(self.cr, self.uid, record['cur_id'],euro_id, record['remain'], to_date)
                  payed_amount += currency_obj.compute(self.cr, self.uid, record['cur_id'], euro_id, record['payable'], to_date) 
          amounts = {
                  'total_amount':total_amount,
                  'remain_amount':remain_amount,
                  'payed_amount': payed_amount,
                    }
          return amounts

      def get_rate(self,data,curency):
           to_date = data['form']['to_date']
           currency_obj = self.pool.get('res.currency')
           currency_id = currency_obj.search(self.cr, self.uid, [('name','=',curency)],limit=1)[0]
           self.cr.execute("SELECT rate FROM res_currency_rate WHERE currency_id = %s AND name <= %s ORDER BY name desc LIMIT 1" ,(currency_id, to_date))
           res = self.cr.dictfetchall()
           return res[0]['rate'] 

report_sxw.report_sxw('report.programming_contracts','purchase.contract','purchase_contracts/report/programming_contracts.rml',parser=programming_contracts,header=False)

Ejemplo n.º 21
0
import time
from openerp.report import report_sxw

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,rp.name as user,po.state,rc.name " \
                        "from pos_order as po,res_users as ru,res_company as rc, res_partner as rp " \
                        "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 and ru.partner_id = rp.id" \
                    ,(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:
Ejemplo n.º 22
0
#    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 openerp.report import report_sxw


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

    def get_product_desc(self, move_line):
        desc = move_line.product_id.name
        if move_line.product_id.default_code:
            desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
        return desc


for suffix in ['', '.in', '.out']:
    report_sxw.report_sxw('report.crea8s.stock.picking.list' + suffix,
                          'stock.picking' + suffix,
                          'addons/crea8s_derick/report/picking_oqty.rml',
                          parser=picking)
#    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 openerp.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,
            'get_total_discount': self._get_total_discount,
            'get_total_net': self._get_total_net,
        })
        
    def _get_total_discount(self, invoice):
        disc_total = 0
        for line in invoice.invoice_line:
            disc_total += line.quantity * line.price_unit * line.discount / 100
        return disc_total
    
    def _get_total_net(self, invoice):
        value_total = 0
        for line in invoice.invoice_line:
            value_total += line.quantity * line.price_unit
        return value_total

report_sxw.report_sxw('report.account.invoice.mentis', 'account.invoice', 'mentis_reports/report/account_print_invoice.rml', parser=account_invoice)
Ejemplo n.º 24
0
        deal_info = NL.join(
            [sale_num, deal_num, api_info, buyer, create_date, user])
        return deal_info

    def _get_pay_info(self, obj):
        """支付信息"""
        NL = '\n'
        HX = '-'
        trade_state = u'交易状态:' + dict(Sale_Back_Trade_Status)[obj.trade_state]
        amount = u'退款金额:' + str(obj.amount or HX)
        alipay_name = u'支付宝姓名:' + (obj.alipay_name or HX)
        alipay_nick = u'支付宝账号:' + (obj.alipay_nick or HX)
        alipay_phone = u'客户电话:' + (obj.alipay_phone or HX)
        carrier = u'快递方式:' + (obj.carrier_id and obj.carrier_id.name or HX)
        carrier_tracking = u'快递号码:' + (obj.carrier_tracking or HX)

        pay_info = NL.join([
            trade_state, amount, alipay_nick, alipay_name, alipay_phone,
            carrier, carrier_tracking
        ])
        return pay_info


report_sxw.report_sxw('report.sale_back_report',
                      'sale.back',
                      'addons/yks/report/sale_back_report.rml',
                      parser=sale_back_report,
                      header="Report")

# report_sxw.report_sxw('report.sale_back_report', 'sale.back',
#                       'addons/yks/report/sale_back_report.mako', parser=sale_back_report, header='Report')
        if i < len(cat):
            for ii in cat:
                product_code = ii['product_code']
                if not product_code:
                    return move_line.product_id.code
                return product_code

    def total_ctn(self, move_line):
        i = 0
        print move_line.picking_id.id

        self.cr.execute("   select count(distinct(a.ctn_no)) as total from stock_move a \
                                left join stock_picking b on a.picking_id = b.id \
                            where a.picking_id = %s \
        " % move_line.picking_id.id)

        cat = self.cr.dictfetchall()
        for ii in cat:
            print ii['total']
            total = ii['total']

            return total

for suffix in ['', '.in', '.out']:
    report_sxw.report_sxw('report.stock.packing_list' + suffix,
                          'stock.picking' + suffix,
                          'addons/fb_fd_industri/report/packing_list.rml',
                          parser=packing_list, header=False)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 26
0

class general_ledger_ext(general_ledger):

    def set_context(self, objects, data, ids, report_type=None):
        account_ids = data['form'].get('account_ids', False)
        if not account_ids:
            account_ids = []
        res = super(general_ledger_ext, self).set_context(objects, data, account_ids, report_type)
        #self.query+=" AND l.account_id = (select id from account_account a  where a.id = l.account_id and  type1 not in ('view') )"
        start = self.query.lower().index('and l.account_id in')
        end = self.query.lower().index(')', start)
        self.query = self.query[:start] + self.query[(end+1):]
        if account_ids:
            self.query += ' AND l.account_id in (%s) ' % ','.join(str(x) for x in account_ids)
        else:
            self.query += ' AND false '
        start = self.init_query.lower().index('and l.account_id in')
        end = self.init_query.lower().index(')', start)
        self.init_query = self.init_query[:start] + self.init_query[(end+1):]     
        if account_ids:
            self.init_query += ' AND l.account_id in (%s) ' % ','.join(str(x) for x in account_ids)
        else:
            self.init_query += ' AND false '
        return res

report_sxw.report_sxw('report.account.general.ledger_ext', 'account.account', 'account_general_ledger.rml', parser=general_ledger_ext, header='internal')
report_sxw.report_sxw('report.account.general.ledger_landscape_ext', 'account.account', 'account_general_ledger_landscape.rml', parser=general_ledger_ext, header='internal landscape')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 27
0
        return res

    def _object_find(self, module):
        ids2 = self.pool['ir.model.data'].search(self.cr, self.uid, [('module','=',module), ('model','=','ir.model')])
        ids = []
        for mod in self.pool['ir.model.data'].browse(self.cr, self.uid, ids2):
            ids.append(mod.res_id)
        modobj = self.pool['ir.model']
        return modobj.browse(self.cr, self.uid, ids)

    def _fields_find(self, obj, module):
        res = []
        data_obj = self.pool['ir.model.data']
        modobj = self.pool[obj]
        fname_wildcard = 'field_' + modobj._name.replace('.', '_') + '_%'
        module_fields_ids = data_obj.search(self.cr, self.uid, [('model', '=', 'ir.model.fields'), ('module', '=', module), ('name', 'like', fname_wildcard)])
        if module_fields_ids:
            module_fields_res_ids = [x['res_id'] for x in data_obj.read(self.cr, self.uid, module_fields_ids, ['res_id'])]
            module_fields_names = [x['name'] for x in self.pool['ir.model.fields'].read(self.cr, self.uid, module_fields_res_ids, ['name'])]
            res = modobj.fields_get(self.cr, self.uid, allfields=module_fields_names).items()
            res.sort()
        return res

report_sxw.report_sxw('report.ir.module.reference', 'ir.module.module',
        'addons/base/module/report/ir_module_reference.rml',
        parser=ir_module_reference_print, header=False)


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

Ejemplo n.º 28
0
            producto = product.browse(self.cr, self.uid, id_producto[0])
            qty = producto.qty_available
            qty2 = producto.virtual_available
            res = [qty, qty2]
            return res
        except:
            res = [qty, qty2]
            return res

    def get_code(self, id_template):
        code = "-"
        product = self.pool.get('product.product')
        try:
            id_producto = product.search(self.cr, self.uid, [
                                         ('product_tmpl_id', '=', id_template.id)])
            producto = product.browse(self.cr, self.uid, id_producto[0])
            code = producto.code
            return code
        except:
            return code


report_sxw.report_sxw(
    'report.hoja222',
    'stock.total',
    'addons/inventory_stock_report/report/hoja_conteo_qty2.rml',
    parser=RepConteoStock2,
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
                totals.setdefault(str(i), 0.0)
                totals[str(i)] += float(r[str(i)] or 0.0)
        return res

    def _get_total(self,pos):
        period = self.total_account[int(pos)]
        return period or 0.0

    def _get_direction(self,pos):
        period = self.total_account[int(pos)]
        return period or 0.0

    def _get_for_period(self,pos):
        period = self.total_account[int(pos)]
        return period or 0.0

    def _get_partners(self,data):
        if data['form']['result_selection'] == 'customer':
            return 'Receivable Accounts'
        elif data['form']['result_selection'] == 'supplier':
            return 'Payable Accounts'
        elif data['form']['result_selection'] == 'customer_supplier':
            return 'Receivable and Payable Accounts'
        return ''

report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
        'addons/account/report/account_aged_partner_balance.rml',parser=aged_trial_report, header="internal landscape")


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
class stock_inventory_move(stock_inventory_move_report.stock_inventory_move):

    def __init__(self, cr, uid, name, context):
        super(stock_inventory_move, self).__init__(cr, uid, name, context=context)
        self.total_valuation = 0
        self.localcontext.update({
            'total_valuation': self._get_total_valuation,
        })


    def _get_total_valuation(self, objects):
        total = 0.0
        for obj in objects:
            total += obj.valuation
        return total

# remove previous sale.report service :
from netsvc import Service
del Service._services['report.stock.inventory.move']

# register the new report service :
report_sxw.report_sxw(
    'report.stock.inventory.move',
    'stock.inventory',
    'addons/stock_inventory_valuation/report/stock_inventory_move.rml',
    parser=stock_inventory_move,
    header='internal'
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
                           ('journal_id', 'in', journal_ids),
                           ('state', '<>', 'draft')],
                order=data['form']['sort_selection'] + ', id')
        else:
            move_ids = []
            journalperiods = self.pool['account.journal.period'].browse(
                self.cr, self.uid, ids)
            for jp in journalperiods:
                move_ids = self.pool['account.move'].search(
                    self.cr,
                    self.uid, [('period_id', '=', jp.period_id.id),
                               ('journal_id', '=', jp.journal_id.id),
                               ('state', '<>', 'draft')],
                    order='date,id')
        objects = self.pool['account.move'].browse(self.cr, self.uid, move_ids)
        super(JournalPrint, self).set_context(objects, data, ids, report_type)


report_sxw.report_sxw(
    'report.account.journal.entries.report.wzd',
    'account.journal.period',
    'account_journal_book/report/account_move_line_record.rml',
    parser=JournalPrint,
    header=False)
report_sxw.report_sxw(
    'report.account.journal.entries.report.wzd1',
    'account.journal.period',
    'account_journal_book/report/account_move_line_record_h.rml',
    parser=JournalPrint,
    header=False)
Ejemplo n.º 32
0
                                  'convert':self.convert,
                                  'get_serial':self.get_serial,
                                  })
        
    def convert(self, amount, cur):
        amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
        return amt_en
    
    def get_serial(self,line):
        result = ''
        if line:
            for val in line:
                result = result + " " + val.name
        return result
    
report_sxw.report_sxw('report.genius.delivery.challan', 'stock.picking', 'addons/geniusmind/report/delivery_challan.rml', parser=genius_delivery_challan)

class genius_purchase_order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(genius_purchase_order, 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.genius.purchase.order', 'purchase.order', 'addons/geniusmind/report/purchase_order.rml', parser=genius_purchase_order)
Ejemplo n.º 33
0
                   'WHERE'+ domain
        , args)

        _bodega = self.cr.fetchall()

        if _bodega:
            bodega = _bodega[0][0]
        else:
            bodega = "..........."

        return bodega


    def lineas_factura(self, lineas):

        new_lines = []

        for l in lineas:
            if l.price_unit != 0:
                new_lines.append(l)

        return new_lines

report_sxw.report_sxw(
    'report.factura.eventos',
    'account.invoice',
    'sbg/reportes/factura_eventos.rml',
    parser=report_factura_eventos
)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 34
0
                    inner_dict['inst_8'] = str(rec.amount) + str(
                        rec.state) + str(rec.paid_on) + str(rec.name)
                else:
                    inner_dict['inst_8'] = str(rec.amount) + str(
                        rec.state) + str(rec.name)

                child_result.append(inner_dict)
                my_dict['inner_dict'] = child_result

            serial_no = serial_no + 1
            my_dict['s_no'] = serial_no

        result.append(my_dict)
        return result

    def get_user_name(self):
        user_name = self.pool.get('res.users').browse(self.cr, self.uid,
                                                      self.uid).name
        return user_name

    def get_today(self):
        today = date.today()
        return today


report_sxw.report_sxw('report.sale_invoice_print_receipt',
                      'account.invoice',
                      'addons/sms/report/sale_invoice_report_print.rml',
                      parser=sale_invoice_print,
                      header='External')
Ejemplo n.º 35
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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################

import time

from openerp.report import report_sxw

class sunat_3_7_report(report_sxw.rml_parse):

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

report_sxw.report_sxw('report.l10n_pe.sunat_3_7', 'l10n_pe.ple_3_7',
    'addons/l10n_pe_ple03/report/sunat_3_7.rml', parser=sunat_3_7_report, header=False)


# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 36
0
#    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 openerp.report import report_sxw


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


report_sxw.report_sxw('report.express_qf_continuously',
                      'sale.order',
                      'addons/yks/report/express_qf_continuously.rml',
                      parser=express_qf_continuously,
                      header="Express")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
        })
    def _get_product_desc(self,move_line):
        if move_line.sale_line_id.name:
            desc = move_line.sale_line_id.name
        else:
            desc = move_line.product_id.name
        return desc
    
    def _get_product_notes(self,move_line):
        if move_line.sale_line_id.product_notes:
            return move_line.sale_line_id.product_notes
        else:
            return ''

    def _get_product_price(self,move_line):
        if move_line.picking_id.partner_id.delivery_prices:
            context = {}
            _price = move_line.sale_line_id.price_unit * (1 - (move_line.sale_line_id.discount or 0.0) / 100.0)
            _price_tax = self.pool.get('account.tax').compute_all(cr, uid, move_line.sale_line_id.tax_id, _price, 1, move_line.sale_line_id.product_id, move_line.sale_line_id.order_id.partner_id)['total']
            return _price_tax
        else:
            return ''

    def _get_product_order_qty(self,move_line):
        if move_line.sale_line_id.product_uos_qty:
            return move_line.sale_line_id.product_uos_qty
        else:
            return ''
        
report_sxw.report_sxw('report.stock.picking.list.pekarna.delivery','stock.picking','pekarna_reports/report/stock_picking.rml',parser=picking)
Ejemplo n.º 38
0
    def _get_total_qty(self, move_list):
        total = 0.0
        for m in move_list:
            total += m.product_qty
        return total

    def _get_rep_list(self, move_list):
        return ', '.join(
            list(
                set([
                    o.partner_id and o.partner_id.group_id
                    and o.partner_id.group_id.name or '<sin grupo>'
                    for o in move_list
                ])))

    def _get_ordered(self, moves):
        return sorted(moves,
                      key=lambda x:
                      (x.origin or '', x.partner_id and x.partner_id.name or
                       '', x.product_id and x.product_id.name or ''))


report_sxw.report_sxw('report.stock_move_print',
                      'stock.move',
                      'addons/numa_uniqs_impresos/report/stock_move_form.rml',
                      parser=report_stock_move_form,
                      header="external")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
                iflag = iflag2 = False
                for account2 in account_obj.browse(self.cr, self.uid, acc2_id, context=data['form']['used_context']):
                    vals2 = {
                        'name': 'Total ' + account2.name,
                        'balance2': account2.balance != 0 and account2.balance * report.sign or account2.balance,
                        'type': 'account',
                        'level': 2,
                        'account_type': account2.type,
                    }
                    if not currency_obj.is_zero(self.cr, self.uid, account2.company_id.currency_id, vals2['balance2']):
                        iflag = True
                    if iflag:
                        for key, values in zip(main_dict.keys(), main_dict.values()):
                            if account2.id == key:
                                values.update({'balance2': account2.balance != 0 and account2.balance * report.sign or account2.balance})
                                iflag2=True
                        if not iflag2:
                            lines.append(vals2)
                acc2_id = []
            for report in financial_report_obj.browse(self.cr, self.uid, [report.id], context=data['form']['used_context']):
                valss2.update({'balance2': report.balance * report.sign or 0.0})
                lines.append(valss2)

        return lines


report_sxw.report_sxw('report.account.pl.extended', 'accounting.report', 'profit_and_loss_report/report/account_profit_and_loss.rml', parser=account_report, header=False)

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

Ejemplo n.º 40
0
            self._check_access_rights
        })

    def _check_access_rights(self, sale_order, context=None):
        sale_obj = self.pool.get('sale.order')
        res = True
        try:
            sale_obj.check_access_rule(self.cr, self.uid, [sale_order.id],
                                       'read')
        except (orm.except_orm, ValueError):
            res = False
        return res

    def _get_total_qty(self, so):
        qty = sum([x.product_uom_qty for x in so.order_line])
        return qty


report_sxw.report_sxw(
    'report.print.delivery.note.internal',
    'stock.picking',
    'addons/stock_report_with_sale_price/report/delivery_note.rml',
    parser=delivery_note,
    header="external")
report_sxw.report_sxw(
    'report.print.delivery.note.out',
    'stock.picking.out',
    'addons/stock_report_with_sale_price/report/delivery_note.rml',
    parser=delivery_note,
    header="external")
Ejemplo n.º 41
0
    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]/1.18

    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

    def _get_journal_amt(self, order_id):
        data={}
        sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs
                        LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
                        LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
                        WHERE absl.pos_statement_id =%d"""%(order_id)
        self.cr.execute(sql)
        data = self.cr.dictfetchall()
        return data

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:
Ejemplo n.º 42
0
        }

    def preview(self, cr, uid, ids, context=None):
        xml_data = self._get_datas(cr, uid, ids, context=context)
        datas = {'ids': [], 'model': 'partner.vat.intra', 'form': xml_data}
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'partner.vat.intra.print',
            'datas': datas,
        }


partner_vat_intra()


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


report_sxw.report_sxw('report.partner.vat.intra.print',
                      'partner.vat.intra',
                      'addons/l10n_be/wizard/l10n_be_vat_intra_print.rml',
                      parser=vat_intra_print,
                      header="internal")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP
#    Copyright (C) 2013 
#
##############################################################################
import time
from openerp.report import report_sxw

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

report_sxw.report_sxw(
    'report.account.invoice.custom',
    'account.invoice',
    'addons/business_id_finland/report/account_print_invoice.rml',
    parser=account_invoice_finland
)
Ejemplo n.º 44
0
        quantities_res = self._get_part_quantities(group)
        date_now = datetime.now().date()
        week_day = date_now.weekday()
        for d in range(7):
            result[d] = ''
        for r in quantities_res:
            result['need_qty'] = result['need_qty'] + r['need_qty']
            result['done_qty'] = result['done_qty'] + r['done_qty']
        result[week_day] = result['done_qty']
        return result


#tasks by group
report_sxw.report_sxw(
    'report.task.group.by_assignee_full',
    'task.group',
    'addons/metro_mrp_drawing/report/task_group_by_assignee_full.rml',
    parser=project_task_print_with_parts,
    header='internal')
report_sxw.report_sxw(
    'report.task.group.by_employee_full',
    'task.group',
    'addons/metro_mrp_drawing/report/task_group_by_employee_full.rml',
    parser=project_task_print_with_parts,
    header='internal')
report_sxw.report_sxw(
    'report.task.group.by_team_full',
    'task.group',
    'addons/metro_mrp_drawing/report/task_group_by_team_full.rml',
    parser=project_task_print_with_parts,
    header='internal')
report_sxw.report_sxw(
Ejemplo n.º 45
0
            if context['mode_df'] == 'in_production':
                return 'consume_produce'
        return 'consume'
    
    _defaults = {
         'mode': get_mode
    }
mrp_product_produce()

class stock_move(osv.osv):
    _inherit = "stock.move"
    _columns = {
        'warehouse_id': fields.related('picking_id', 'purchase_id', 'warehouse_id', type='many2one', relation='stock.warehouse', string='Warehouse'),
    }
stock_move()
from openerp.report import report_sxw

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

report_sxw.report_sxw('report.crea8s.purchase.order.sekai','purchase.order','addons/crea8s_sekai/order.rml',parser=crea8s_po_order)

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

report_sxw.report_sxw('report.crea8s.workcenter.sekai','mrp.routing.workcenter','addons/crea8s_sekai/workcenter.rml',parser=crea8s_workcenter)
Ejemplo n.º 46
0
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero 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 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 openerp.report import report_sxw

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

report_sxw.report_sxw('report.designer.agreement', 'designer.agreement', 'addons/designer/report/designer_agreement.rml', parser=designer_agreement, header="external")

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

            return_field = str(total[0]) + self.account_currency
            return return_field
        else:
            currency_total = self.tot_currency = 0.0
            return currency_total

    def _display_initial_balance(self, data):
        if self.initial_balance:
            return True
        return False

    def _display_currency(self, data):
        if self.amount_currency:
            return True
        return False
        
    def _display_no_payments(self, data):
        if self.no_pmts:
            return True
        return False

report_sxw.report_sxw('report.partner_statements.third_party_ledger', 'res.partner',
        'addons/ursa_partner_statements/report/account_partner_ledger.rml',parser=ursa_third_party_ledger,
        header='external')

report_sxw.report_sxw('report.partner_statements.third_party_ledger_other', 'res.partner',
        'addons/ursa_partner_statements/report/account_partner_ledger_other.rml',parser=ursa_third_party_ledger,
        header='external')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 48
0
        if (voucher.invoice_id):
            invoice = self._invoice_get(voucher.invoice_id.id)
            disc_account_obj = pooler.get_pool(
                self.cr.dbname).get('account.account')
            if (invoice.discount_acc_id):
                disc_account = disc_account_obj.browse(
                    self.cr, self.uid, invoice.discount_acc_id.id)
                disc_head = disc_account.name
        return disc_head

    def _invoice_roundoff_get(self, voucher):
        round_off = 0.0
        if (voucher.invoice_id):
            invoice = self._invoice_get(voucher.invoice_id.id)
            round_off = invoice.round_off
        return round_off

    def _remove_internal_ref(self, name):
        name = re.sub(r"\[.*\]", "", name)
        return name

    def _invoice_get(self, invoice_id):
        invoice_obj = pooler.get_pool(self.cr.dbname).get('account.invoice')
        return invoice_obj.browse(self.cr, self.uid, invoice_id)


report_sxw.report_sxw('report.account_voucher',
                      'account.voucher',
                      'addons/print_receipt/reports/account_voucher.rml',
                      parser=account_voucher)
Ejemplo n.º 49
0
#    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 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 openerp.report import report_sxw
from tools.translate import _
from netsvc import Service
#del Service._services['report.translat

class invoice_new(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(invoice_new, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })
report_sxw.report_sxw(
    'report.invoice_new',
    'account.invoice',
    'addons/lingua_co/report/invoice_new.rml',
    parser=invoice_new, header=True
)
Ejemplo n.º 50
0
    
    def get_platform_so_info(self, picking):
        if picking.type != 'out':
            return ''
        
        NL = '\n'
        so = picking.sale_id
        platform_user_id = so and so.platform_user_id and u'买家昵称:' + so.platform_user_id or ''
        platform_so_id = picking.platform_so_id and u'交易编号:' + picking.platform_so_id  or ''
        receive_user = picking.receive_user and u'收货人:' + picking.receive_user or ''
        receive_address = picking.receive_address and u'收货地址:' + picking.receive_address or ''
        receive_phone = picking.receive_phone and u'收货电话:' + picking.receive_phone or ''
        res = NL.join([platform_user_id, platform_so_id, receive_user, receive_address, receive_phone])
        
        return res
    
    def get_user_info(self, picking, user):
        if picking.type != 'out':
            return ''
        
        NL = '\n'
        so = picking.sale_id
        sale_man = so and so.user_id and u'业务员:' + so.user_id.name or ''
        print_user = user.name and u'打印人:' + user.name or ''
        print_time = u'打印时间:' + time.strftime(DF)
        res = NL.join([sale_man, print_user, print_time])
        return res

report_sxw.report_sxw('report.yks_sale_shipping', 'stock.picking.out', 'addons/delivery/report/yks_sale_shipping.rml', parser=yks_sale_shipping)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 51
0
#    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 openerp.report import report_sxw
from openerp.osv import osv
from openerp import pooler

class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(order, self).__init__(cr, uid, name, context=context)
        active_id = context.get('active_id')
        obj = self.pool.get('purchase.order')
        po = obj.browse(cr, uid, active_id, context=context )
        self.localcontext.update({
            'time': time,
            'user': self.pool.get('res.users').browse(cr, uid, uid, context),
            'uid':uid,
            'currency_obj':po.pricelist_id.currency_id,
        })
report_sxw.report_sxw('report.purchase.order.cluster','purchase.order','addons/purchase_reports/report/order_purchase.rml',parser=order)

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

Ejemplo n.º 52
0
        return title

    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

    def _get_ref(self, voucher_id, move_ids):
        voucher_line_obj = self.pool.get('account.voucher.line')
        voucher_line = voucher_line_obj.search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
        if voucher_line:
            voucher = voucher_line_obj.browse(self.cr, self.uid, voucher_line)[0]
            return voucher.name
        else:
            return
report_sxw.report_sxw(
    'report.voucher.cash_receipt.drcr',
    'account.voucher',
    'addons/account_voucher/report/account_voucher.rml',
    parser=report_voucher,header="external"
)

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
    def _get_tot_hours(self, ts_lines):
        tot = 0.0
        deduced = 0.0
        for line in ts_lines:
            if line.product_uom_id:
                factor = line.product_uom_id.factor
                if factor == 0.0:
                    factor = 1.0
            else:
                factor = 1.0
            factor_invoicing = 1.0
            if line.to_invoice and line.to_invoice.factor != 0.0:
                factor_invoicing = 1.0 - line.to_invoice.factor / 100
            if factor_invoicing > 1.0:
                deduced += ((line.unit_amount / factor) * factor_invoicing)
                tot += ((line.unit_amount / factor) * factor_invoicing)
            elif factor_invoicing <= 1.0:
                tot += (line.unit_amount / factor)
                deduced += ((line.unit_amount / factor) * factor_invoicing)

        return {'total': tot, 'deduced': deduced}

    def _get_and_change_date_format_for_swiss(self, date_to_format):
        date_formatted = ''
        if date_to_format:
            date_formatted = datetime.strptime(date_to_format, '%Y-%m-%d').strftime('%d.%m.%Y')
        return date_formatted

report_sxw.report_sxw('report.hr.analytic.timesheet.report', 'hr.analytic.timesheet', 'addons/hr_timesheet_print/report/timesheet_report.rml', parser=timesheet_report)
report_sxw.report_sxw('report.analytic.line.timesheet.report', 'account.analytic.line', 'addons/hr_timesheet_print/report/timesheet_report.rml', parser=timesheet_report)
Ejemplo n.º 54
0

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

        self.no = 0

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

    def terbilang(self, amount):
        hasil = fungsi_terbilang.terbilang(amount, "idr", 'id')
        return hasil


report_sxw.report_sxw(
    'report.rml.advance.payment.done',
    'dym.advance.payment',
    'addons/dym_advance_payment/report/dym_advance_payment_done_report.rml',
    parser=dym_advance_payment,
    header=False)
Ejemplo n.º 55
0
    }
crea8s_invoice_commercial_line()
class crea8s_invoice_commercial_report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(crea8s_invoice_commercial_report, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'get_total': self.get_total,
        })
    def get_total(self, obj):
        total = sum([x.amount for x in obj])
        return total        

report_sxw.report_sxw(
    'report.rp_crea8s_invoice_commercial',
    'crea8s.invoice.commercial',
    'addons/crea8s_address_delivery/account_print_invoice.rml',
    parser=crea8s_invoice_commercial_report, header=False
)

class stock_picking(osv.osv):
    _inherit = 'stock.picking'
    _columns = {
        'other_add': fields.text('Opt Delivery Address'),
        'is_add': fields.boolean('Other Address'),
        'inv_comc': fields.many2one('crea8s.invoice.commercial', 'Commercial Invoice'),
    }
stock_picking()

class stock_picking_out(osv.osv):
    _name = "stock.picking.out"
    _inherit = "stock.picking"
Ejemplo n.º 56
0
        super(pos_details, self).__init__(cr, uid, name, context=context)
        self.total = 0.0
        self.qty = 0.0
        self.total_invoiced = 0.0
        self.discount = 0.0
        self.total_discount = 0.0
        self.localcontext.update({
            'time': time,
            'strip_name': self._strip_name,
            'getpayments': self._get_payments,
            'getsumdisc': self._get_sum_discount,
            'gettotalofthaday': self._total_of_the_day,
            'gettaxamount': self._get_tax_amount,
            'pos_sales_details': self._pos_sales_details,
            'getqtytotal2': self._get_qty_total_2,
            'getsalestotal2': self._get_sales_total_2,
            'getsuminvoice2': self._get_sum_invoice_2,
            'getpaidtotal2': self._paid_total_2,
            'getinvoice': self._get_invoice,
            'get_user_names': self._get_user_names,
        })


report_sxw.report_sxw('report.pos.details',
                      'pos.order',
                      'addons/point_of_sale_singer/report/pos_details.rml',
                      parser=pos_details,
                      header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 57
0
            'start_date': self._get_start_date,
            'end_date': self._get_end_date,
            'invoice_total': self._get_invoice_total,
        })
        self.context = context
        return res

    def set_context(self, objects, data, ids, report_type=None):
        self.localcontext.update({
            'fiscal_page_base': data.get('fiscal_page_base'),
        })
        return super(Parser, self).set_context(
            objects, data, ids, report_type=report_type)


report_sxw.report_sxw(
    'report.registro_iva_vendite',
    'registro_iva_vendite',
    'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako',
    parser=Parser)
report_sxw.report_sxw(
    'report.registro_iva_acquisti',
    'registro_iva_acquisti',
    'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako',
    parser=Parser)
report_sxw.report_sxw(
    'report.registro_iva_corrispettivi',
    'registro_iva_corrispettivi',
    'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako',
    parser=Parser)
Ejemplo n.º 58
0
            return_field = str(total[0]) + self.account_currency
            return return_field
        else:
            currency_total = self.tot_currency = 0.0
            return currency_total

    def _display_initial_balance(self, data):
        if self.initial_balance:
            return True
        return False

    def _display_currency(self, data):
        if self.amount_currency:
            return True
        return False


report_sxw.report_sxw('report.account.third_party_ledger',
                      'res.partner',
                      'addons/account/report/account_partner_ledger.rml',
                      parser=third_party_ledger,
                      header='internal')

report_sxw.report_sxw('report.account.third_party_ledger_other',
                      'res.partner',
                      'addons/account/report/account_partner_ledger_other.rml',
                      parser=third_party_ledger,
                      header='internal')

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Ejemplo n.º 59
0
            start=datetime.strptime(start,'%Y-%m-%d')
            end=datetime.strptime(end,'%Y-%m-%d')
            self.cr.execute("select dev.name,city.name,dev.mobile1 from jkp_devotees as dev left join res_city as city on  \
             (dev.city_id=city.id) where dev.today_date >='"+str(start)+"' and dev.today_date <= '"+str(end)+"'\
              and dev.id in (select devotees_id from rel_devotees_category where category_id in (select id from jkp_category where name = 'Prominent') ) order by city.name,dev.name ")
            data=self.cr.fetchall()
        else:
            self.cr.execute("select dev.name,city.name,dev.mobile1 from jkp_devotees as dev left join \
            res_city as city on (dev.city_id=city.id) where  dev.id \
            in (select devotees_id from rel_devotees_category where category_id in \
            (select id from jkp_category where name = 'Prominent') ) order by city.name,dev.name ")
            data=self.cr.fetchall()
        print "data...............",data
        return data

report_sxw.report_sxw('report.prominent.devotees','prominent.wise.report','addons/jkp_devotees/wiazard/prominent_devotees.rml',parser=prominent_devotees) 
    

class prominent_wise_report(osv.osv_memory):
    _name="prominent.wise.report"
    
    _columns={'all_devotees':fields.boolean('All Devotees'),
              'devotee_details':fields.many2many('jkp.devotees','prominent_devotees_rel','devotee_prominent','prominent_devotee','Devotees List'),
              'from_date':fields.date('From (Creation Date)',),
              'to_date':fields.date('To (Creation Date)',),
              }
    _defaults={'all_devotees':True}
    
    
    
    def get_devotee_list(self,cr,uid,ids,context=None):
Ejemplo n.º 60
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: