Odoo Help

0
1
Pascal Tremblay
On 3/6/17, 3:28 PM

After 24 hours... We have found an EASY solution.

I'm sorry if somebody has lost time to help us on this post.

No need to add a new field on account.invoice. No need to add a new field to the account.invoice.report.2.

Just use interval="week" in the column field....

I will remember this one for long time.

We will use this code for the graph view :

<record id="view_account_invoice_report_period_graph_vtm2" model="ir.ui.view">
         <field name="name">account.invoice.report.period.graph.vtm2</field>
         <field name="model">account.invoice.report.vtm2</field>
         <field name="arch" type="xml">
             <graph string="Invoices Analysis" type="pivot">
                 <field name="fiscal_position" type="row"/>
                 <field name="date" interval="week" type="col"/>
                 <field name="price_total" type="measure"/>
             </graph>
         </field>
    </record>
1
Axel Mendoza
On 3/6/17, 9:06 AM

Hi Pascal

No need to be a persisted since there is no persistence table on the model because this is a model with an sql view behind, not a table, but also include it on the sql query that create the view just like a dummy value. So you could define a new regular field on your model like you did but not as a computed field. Also I think that you may need to redefine the read_group method of that model to include the values for your field.

There is a very complete example of how to include values in the read_group at the product_margin module, you can check it to build your

Thanks for all these words.

When you say to 'redefine the read_group method of that model', do you talk about the 'account.invoice.report' model or the 'account.invoice' model?

Pascal Tremblay
on 3/6/17, 9:20 AM

in the account.invoice.report model

Axel Mendoza
on 3/6/17, 9:25 AM

So, you say to me that the account.invoice.report model use the read_group method even if it is a postgresql view?

Will give it a try.

Pascal Tremblay
on 3/6/17, 9:49 AM

Yes, that's were the error came on the first time, from read_group

Axel Mendoza
on 3/6/17, 9:57 AM

You are right. I have a defined a new method read_group in my new model account.invoice.report.2. And like you said, the read_group method is trigerred when I display my report. Will now try to compute the invoice_week value. THanks

Pascal Tremblay
on 3/6/17, 9:59 AM

I won't be able to realize this project overriding the read_group method. The original account.invoice.report is very complicated. The SQL query is long long long. I'm totally lost in it. I think I will create a new stored field 'invoice_week' on the account.invoice model.

Pascal Tremblay
on 3/6/17, 1:14 PM

post how you calculate the invoice_week for give you a solution about that in the read_group

Axel Mendoza
on 3/6/17, 1:23 PM

If you make a move, don't forget that our account.invoice.report.2 new report is in the old api. We took the code in odoo 8. We are on odoo 8.

Pascal Tremblay
on 3/6/17, 1:32 PM

My post has been updated. Thanks

Pascal Tremblay
on 3/6/17, 1:48 PM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/5/17, 4:48 PM
Seen: 1140 times
Last updated: 3/6/17, 3:28 PM