Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Javascript error when Expend all in pivot table

Naroči se

Get notified when there's activity on this post

This question has been flagged
javascriptpivotv9.0
1 Odgovori
5288 Prikazi
Avatar
Mathieu Laflamme

I make a module to add invoice pivot table.


report_stock_owner_invoice.py

import logging

import os

from openerp import models, fields, modules, api

from openerp.tools.sql import drop_view_if_exists

import openerp.addons.decimal_precision as dp

_logger = logging.getLogger(__name__)


class ReportStockOwnerInvoice(models.AbstractModel):

_name = 'report.stock.owner.invoice'

_auto = False

invoice_id = fields.Many2one('account.invoice', string='Invoice Reference', readonly=True)

invoice_state = fields.Selection([

('draft','Draft'),

('proforma', 'Pro-forma'),

('proforma2', 'Pro-forma'),

('open', 'Open'),

('paid', 'Paid'),

('cancel', 'Cancelled'),

], string='Invoice Status', readonly=True)

amount_total = fields.Monetary(string='Invoice Total', readonly=True)

sale_order_name = fields.Char(string='Order Reference', readonly=True)

client_order_ref = fields.Char(string='Customer Reference', readonly=True)

order_state = fields.Selection([

('draft', 'Quotation'),

('sent', 'Quotation Sent'),

('sale', 'Sale Order'),

('done', 'Done'),

('cancel', 'Cancelled'),

], string='Order Status', readonly=True)

product_id = fields.Many2one('product.product', string='Product', readonly=True)

categ_id = fields.Many2one('product.category', string='Internal Category', readonly=True)

quantity = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), readonly=True)

uom_id = fields.Many2one('product.uom', string='Unit of Measure', readonly=True)

price_unit = fields.Float(string='Unit Price', readonly=True)

price_subtotal = fields.Monetary(string='Amount', readonly=True)

partner_invoice_id = fields.Many2one('res.partner', string='Invoiced Partner', readonly=True)

partner_shipping_id = fields.Many2one('res.partner', string='Delivery Partner', readonly=True)

partner_shipping_street = fields.Char('Delivery Street', readonly=True)

partner_shipping_street2 = fields.Char('Delivery Street2', readonly=True)

partner_shipping_state_id = fields.Many2one("res.country.state", 'Delivery State', readonly=True)

partner_shipping_zip = fields.Char('Delivery Zip', readonly=True)

partner_shipping_city = fields.Char('Delivery City', readonly=True)

partner_shipping_country_id = fields.Many2one('res.country', 'Delivery Country', readonly=True)

currency_id = fields.Many2one('res.currency', readonly=True)


def init(self, cr):

path_data = os.path.join(modules.get_module_path('stock_owner_account'), 'sql')

path_view = os.path.join(path_data, 'report_stock_owner_invoice.sql')

drop_view_if_exists(cr, self._table)

with open(path_view) as f:

cr.execute(f.read())


@api.v7

def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False,

lazy=True):

if 'price_unit' in fields:

fields.remove('price_unit')

if 'amount_total' in fields:

fields.remove('amount_total')

return super(ReportStockOwnerInvoice, self).read_group(cr, uid, domain, fields, groupby, offset=0, limit=None,

context=None, orderby=False, lazy=True)


report_stock_owner_invoice.sql

CREATE OR replace VIEW report_stock_owner_invoice

AS

SELECT row_number() OVER () AS id,

account_invoice.id AS invoice_id,

account_invoice.create_date,

account_invoice.state AS invoice_state,

account_invoice.amount_total,

account_invoice.currency_id,

sale_order.name AS sale_order_name,

sale_order.client_order_ref,

sale_order.state AS order_state,

account_invoice_line.product_id,

product_template.categ_id,

account_invoice_line.quantity,

account_invoice_line.uom_id,

account_invoice_line.price_unit,

account_invoice_line.price_subtotal,

account_invoice.partner_id AS partner_invoice_id,

sale_order.partner_shipping_id,

partner_shipping.street AS partner_shipping_street,

partner_shipping.street2 AS partner_shipping_street2,

partner_shipping.city AS partner_shipping_city,

partner_shipping.state_id AS partner_shipping_state_id,

partner_shipping.zip AS partner_shipping_zip,

partner_shipping.country_id AS partner_shipping_country_id

FROM account_invoice_line

join account_invoice

ON account_invoice_line.invoice_id = account_invoice.id

left join (sale_order_line

join sale_order

ON sale_order_line.order_id = sale_order.id

join res_partner partner_shipping

ON sale_order.partner_shipping_id = partner_shipping.id

join res_country

ON partner_shipping.country_id = res_country.id

join sale_order_line_invoice_rel

ON sale_order_line_invoice_rel.order_line_id =

sale_order_line.id)

ON sale_order_line_invoice_rel.invoice_line_id =

account_invoice_line.id

join product_product

ON account_invoice_line.product_id = product_product.id

join product_template

ON product_product.product_tmpl_id = product_template.id

join product_category

ON product_template.categ_id = product_category.id

join product_uom

ON account_invoice_line.uom_id = product_uom.id;


report_stock_owner_invoice.xml

{

# The human-readable name of your module, displayed in the interface

'name': "",

# A more extensive description

'description': """

""",

'author': "Transcontinental",

# Categories can be used to filter modules in modules listing

# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml

# for the full list

'category': 'Warehouse',

'version': '0.1',

# Which modules must be installed for this one to work

'depends': [

'account',

],

# data files which are always installed

'data': [

'views/report_stock_owner_invoice.xml',

],

# data files which are only installed in "demonstration mode"

'demo': [],

}


I try to figure what is causing this. Anyone can help?

0
Avatar
Opusti
Avatar
Mathieu Laflamme
Avtor Best Answer

My problem was that line of code:

return super(ReportStockOwnerInvoice, self).read_group(cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True)

It must be:

return super(ReportStockOwnerInvoice, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby, lazy)



0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Pivot table with multiple fields per group
request groupby pivot v9.0
Avatar
0
avg. 16
7217
Cannot import @website_sale/js/utils
javascript
Avatar
Avatar
2
nov. 25
589
Cómo cerrar una transferencia interna al recibirla desde la vista de código de barras stock.picking
javascript
Avatar
0
jul. 25
1133
Why use the Lazy Translation function _lt()
javascript
Avatar
Avatar
1
jul. 25
6442
How to use ReactJS and Next.js to build a fully customizable, open-source headless frontend for Odoo
javascript
Avatar
0
jul. 25
2234
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now