1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, api
- class AccountInvoice(models.Model):
- _inherit = 'account.invoice'
- @api.model
- def getAccountInvoiceTicket(self,domain):
- AccountInvoice = self.env['account.invoice'].search(domain)
- values = []
- for invoice in AccountInvoice:
- values.append({
- 'id': invoice.id,
- 'number': invoice.number,
- 'date_invoice': invoice.date_invoice,
- 'user_id':{
- 'id': invoice.user_id.id,
- 'name': invoice.user_id.name,
- },
- 'partner_id':{
- 'id': invoice.partner_id.id,
- 'name': invoice.partner_id.name,
- },
- 'currency_id':{
- 'id': invoice.currency_id.id,
- 'name': invoice.currency_id.name,
- 'rate': invoice.currency_id.rate_silent,
- },
- 'company_id':{
- 'id': invoice.company_id.id,
- 'name': invoice.company_id.name,
- 'rml_header1': invoice.company_id.rml_header1,
- },
- 'amount_untaxed': invoice.amount_untaxed,
- 'amount_tax': invoice.amount_tax,
- 'amount_total': invoice.amount_total,
- })
- return values
- class AccountInvoiceLine(models.Model):
- _inherit = 'account.invoice.line'
- @api.model
- def getAccountInvoiceLineTicket(self,domain):
- AccountInvoiceLine = self.env['account.invoice.line'].search(domain)
- values = []
- for line in AccountInvoiceLine:
- values.append({
- # ID
- 'id': line.id,
- 'invoice_id': {
- 'id': line.invoice_id.id,
- 'name': line.invoice_id.name,
- },
- 'product_id':{
- 'id': line.product_id.id,
- 'name': line.product_id.display_name,
- },
- 'price_unit': line.price_unit,
- 'price_subtotal': line.price_subtotal,
- 'quantity': line.quantity,
- })
- return values
- class ResCurrency(models.Model):
- _inherit = 'res.currency'
- @api.model
- def getResCurrencyTicket(self,domain):
- ResCurrency = self.env['res.currency'].search(domain)
- values = []
- for currency in ResCurrency:
- values.append({
- 'id': currency.id,
- 'name': currency.name,
- 'symbol': currency.symbol,
- 'rate_silent': currency.rate_silent,
- 'base': currency.base,
- 'decimal_separator': currency.decimal_separator,
- 'decimal_places': currency.decimal_places,
- 'thousands_separator': currency.thousands_separator,
- 'symbol_position': currency.symbol_position,
- 'local_name': currency.local_name,
- })
- return values
|