mikel arregi has proposed merging lp:~mikelarregi/avanzosc/phonelift_account_invoice_report into lp:~avanzosc-security-team/avanzosc/72horas.
Requested reviews: Avanzosc_security (avanzosc-security-team) For more details, see: https://code.launchpad.net/~mikelarregi/avanzosc/phonelift_account_invoice_report/+merge/225630 phonelift_account_invoice_report -- https://code.launchpad.net/~mikelarregi/avanzosc/phonelift_account_invoice_report/+merge/225630 Your team Avanzosc_security is requested to review the proposed merge of lp:~mikelarregi/avanzosc/phonelift_account_invoice_report into lp:~avanzosc-security-team/avanzosc/72horas.
=== modified file 'phonelift_account_invoice_report/__init__.py' --- phonelift_account_invoice_report/__init__.py 2014-06-11 10:23:47 +0000 +++ phonelift_account_invoice_report/__init__.py 2014-07-04 10:10:55 +0000 @@ -1,5 +1,5 @@ ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2014 Nayar Systems (<http://www.72horas.net/>) # @author: Javier Sancho <[email protected]> @@ -15,11 +15,10 @@ # 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/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -import report +from . import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - === modified file 'phonelift_account_invoice_report/__openerp__.py' --- phonelift_account_invoice_report/__openerp__.py 2014-06-11 10:23:47 +0000 +++ phonelift_account_invoice_report/__openerp__.py 2014-07-04 10:10:55 +0000 @@ -20,20 +20,17 @@ ############################################################################## { - "name" : "Phonelift Account Invoice Report", - "version" : "1.0", + "name": "Phonelift Account Invoice Report", + "version": "1.0", "license": "AGPL-3", - "author" : "Nayar Systems", - "category" : "Enterprise Specific Modules", + "author": "Nayar Systems", + "category": "Enterprise Specific Modules", "description": "Module to print account invoice with custom format.", - "depends" : ["account"], - "init_xml" : [], - "demo_xml" : [], - "update_xml" : [ - 'account_invoice_report.xml', + "depends": ["account"], + "data": [ + 'report/account_invoice_report.xml', ], "website": 'http://www.72horas.net/', - "active": False, "installable": True, } === modified file 'phonelift_account_invoice_report/report/__init__.py' --- phonelift_account_invoice_report/report/__init__.py 2014-06-11 10:23:47 +0000 +++ phonelift_account_invoice_report/report/__init__.py 2014-07-04 10:10:55 +0000 @@ -19,6 +19,6 @@ # ############################################################################## -import report_account_invoice +from . import report_account_invoice # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === renamed file 'phonelift_account_invoice_report/account_invoice_report.xml' => 'phonelift_account_invoice_report/report/account_invoice_report.xml' === modified file 'phonelift_account_invoice_report/report/report_account_invoice.py' --- phonelift_account_invoice_report/report/report_account_invoice.py 2014-06-11 10:23:47 +0000 +++ phonelift_account_invoice_report/report/report_account_invoice.py 2014-07-04 10:10:55 +0000 @@ -24,9 +24,10 @@ import time from tools.bank import format_acc_number -class account_invoice_1(report_sxw.rml_parse): + +class AccountInvoice1(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_invoice_1, self).__init__(cr, uid, name, context=context) + super(AccountInvoice1, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'invoice_lines': self.invoice_lines, @@ -43,47 +44,66 @@ invoice_list = [] res = {} list_in_seq = {} - ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)]) + ids = self.pool[ + 'account.invoice.line'].search(self.cr, self.uid, + [('invoice_id', '=', invoice.id)], + context=self.context.copy()) ids.sort() for id in range(0, len(ids)): - info = self.pool.get('account.invoice.line').browse(self.cr, self.uid, ids[id], self.context.copy()) + info = self.pool[ + 'account.invoice.line'].browse(self.cr, self.uid, ids[id], + self.context.copy()) list_in_seq[info] = info.sequence i = 1 j = 0 - final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) + final = sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1])) invoice_list = [x[0] for x in final] sum_flag = {} sum_flag[j] = -1 for entry in invoice_list: res = {} if entry.state == 'article': - self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%s', (entry.id,)) + self.cr.execute('select tax_id from account_invoice_line_tax ' + 'where invoice_line_id=%s', (entry.id,)) tax_ids = self.cr.fetchall() if tax_ids == []: res['tax_types'] = '' else: tax_names_dict = {} for item in range(0, len(tax_ids)): - self.cr.execute('select name from account_tax where id=%s', (tax_ids[item][0],)) + self.cr.execute('select name from account_tax ' + 'where id=%s', (tax_ids[item][0],)) type = self.cr.fetchone() tax_names_dict[item] = type[0] - tax_names = ','.join([tax_names_dict[x] for x in range(0, len(tax_names_dict))]) + tax_names = ','.join( + [tax_names_dict[x] for x in + range(0, len(tax_names_dict))]) res['tax_types'] = tax_names res['name'] = entry.name - res['quantity'] = self.formatLang(entry.quantity, digits=self.get_digits(dp='Account')) - res['price_unit'] = self.formatLang(entry.price_unit, digits=self.get_digits(dp='Account')) - res['discount'] = self.formatLang(entry.discount, digits=self.get_digits(dp='Account')) - res['price_subtotal'] = self.formatLang(entry.price_subtotal, digits=self.get_digits(dp='Account')) + res['quantity'] = ( + self.formatLang(entry.quantity, + digits=self.get_digits(dp='Account'))) + res['price_unit'] = ( + self.formatLang(entry.price_unit, + digits=self.get_digits(dp='Account'))) + res['discount'] = ( + self.formatLang(entry.discount, + digits=self.get_digits(dp='Account'))) + res['price_subtotal'] = ( + self.formatLang(entry.price_subtotal, + digits=self.get_digits(dp='Account'))) sub_total[i] = entry.price_subtotal i = i + 1 res['note'] = entry.note res['currency'] = invoice.currency_id.symbol res['type'] = entry.state - if entry.uos_id.id == False: + if not entry.uos_id.id: res['uos'] = '' else: - uos_name = self.pool.get('product.uom').read(self.cr, self.uid, entry.uos_id.id, ['name'], self.context.copy()) + uos_name = self.pool['product.uom'].read( + self.cr, self.uid, entry.uos_id.id, ['name'], + self.context.copy()) res['uos'] = uos_name['name'] else: res['quantity'] = '' @@ -105,7 +125,7 @@ for sum_id in range(temp, len(sub_total)+1): sum += sub_total[sum_id] - sum_flag[j+1] = sum_id +1 + sum_flag[j+1] = sum_id + 1 j = j + 1 res['price_subtotal'] = "%.2f" % (sum) @@ -129,7 +149,8 @@ res['discount'] = '____________' res['tax_types'] = '____________________' res['uos'] = '_____' - res['name'] = '_______________________________________________' + res['name'] = ( + '_______________________________________________') res['price_subtotal'] = '____________' res['currency'] = '____' elif entry.state == 'break': @@ -145,56 +166,61 @@ result.append(res) return result - def formatted_vat(self, vat): if vat[:2] == "ES": return vat[2:] else: return vat - def get_account_number(self, invoice): bank_text = "" - - if invoice.payment_type and ("TRANSFERENCIA" in invoice.payment_type.name.upper() or "CONFIRMING" in invoice.payment_type.name.upper()): - if invoice.type in ("in_invoice", "out_invoice"): - # Cuenta bancaria de la empresa - if self.company.partner_id: - partner_id = self.company.partner_id.id - - pool = pooler.get_pool(self.cr.dbname) - bank_obj = pool.get('res.partner.bank') - bank_ids = bank_obj.search(self.cr, self.uid, [ ('partner_id','=', partner_id), ('default_bank','=', 'true')], limit=1) - - for bank in bank_obj.browse(self.cr, self.uid, bank_ids): - bank_text = format_acc_number(bank.iban or bank.acc_number or "") - - else: # ("out_refund", "in_refund") - # Cuenta bancaria del cliente - if invoice.partner_bank_id: - bank_text = format_acc_number(invoice.partner_bank_id.iban or invoice.partner_bank_id.acc_number or "", masked=True) - - elif invoice.payment_type and "RECIBO" in invoice.payment_type.name.upper(): - if invoice.type in ("in_invoice", "out_invoice"): - # Cuenta bancaria del cliente - if invoice.partner_bank_id: - bank_text = format_acc_number(invoice.partner_bank_id.iban or invoice.partner_bank_id.acc_number or "", masked=True) - else: # ("out_refund", "in_refund") - # Cuenta bancaria de la empresa - if self.company.partner_id: - partner_id = self.company.partner_id.id - - pool = pooler.get_pool(self.cr.dbname) - bank_obj = pool.get('res.partner.bank') - bank_ids = bank_obj.search(self.cr, self.uid, [ ('partner_id','=', partner_id), ('default_bank','=', 'true')], limit=1) - - for bank in bank_obj.browse(self.cr, self.uid, bank_ids): - bank_text = format_acc_number(bank.iban or bank.acc_number or "") - + if (invoice.payment_type and + ("TRANSFERENCIA" in invoice.payment_type.name.upper() or + "CONFIRMING" in invoice.payment_type.name.upper())): + if invoice.type in ("in_invoice", "out_invoice"): + # Cuenta bancaria de la empresa + if self.company.partner_id: + partner_id = self.company.partner_id.id + pool = pooler.get_pool(self.cr.dbname) + bank_obj = pool.get('res.partner.bank') + bank_ids = bank_obj.search( + self.cr, self.uid, [('partner_id', '=', partner_id), + ('default_bank', '=', 'true')], + limit=1) + for bank in bank_obj.browse(self.cr, self.uid, bank_ids): + bank_text = format_acc_number(bank.iban or + bank.acc_number or "") + else: # ("out_refund", "in_refund") + # Cuenta bancaria del cliente + if invoice.partner_bank_id: + bank_text = format_acc_number( + invoice.partner_bank_id.iban or + invoice.partner_bank_id.acc_number or "", masked=True) + elif (invoice.payment_type and "RECIBO" in + invoice.payment_type.name.upper()): + if invoice.type in ("in_invoice", "out_invoice"): + # Cuenta bancaria del cliente + if invoice.partner_bank_id: + bank_text = format_acc_number( + invoice.partner_bank_id.iban or + invoice.partner_bank_id.acc_number or "", masked=True) + else: # ("out_refund", "in_refund") + # Cuenta bancaria de la empresa + if self.company.partner_id: + partner_id = self.company.partner_id.id + pool = pooler.get_pool(self.cr.dbname) + bank_obj = pool.get('res.partner.bank') + bank_ids = bank_obj.search( + self.cr, self.uid, [('partner_id', '=', partner_id), + ('default_bank', '=', 'true')], + limit=1) + for bank in bank_obj.browse(self.cr, self.uid, bank_ids): + bank_text = format_acc_number(bank.iban or + bank.acc_number or "") return bank_text - -report_sxw.report_sxw('report.phonelift.account.invoice', 'account.invoice', 'addons/phonelift_account_invoice_report/report/report_account_invoice.rml', parser=account_invoice_1) +report_sxw.report_sxw('report.phonelift.account.invoice', 'account.invoice', + 'addons/phonelift_account_invoice_report/report/' + 'report_account_invoice.rml', parser=AccountInvoice1) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -
-- Mailing list: https://launchpad.net/~avanzosc Post to : [email protected] Unsubscribe : https://launchpad.net/~avanzosc More help : https://help.launchpad.net/ListHelp

