Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Show history sale by partner by product

By
abdelwahed chiheb
on 3/9/14, 4:21 AM 1,054 views

I want to show a history of sale by partner by product: when i open the form view of sale qutation and when i choose a product i want to have a button when i click a popup apper to list the history sale for this partner and this product (qty,price ....)

this is my module.py :

def product_history_client(self, cr, uid, ids, context=None):
    ir_model_data = self.pool.get('ir.model.data')
    try:
        compose_form_id = ir_model_data.get_object_reference(cr, uid, 'sms_product_client_hist', 'hist_product_cust')[1]
    except ValueError:
        compose_form_id = False
    return {
        'name': _('Customer sale history'),
        'type': 'ir.actions.act_window',
        'view_type': 'form',
        'view_mode': 'form',
        'res_model': 'sale.order.line',
        'views': [(compose_form_id, 'form')],
        'view_id': compose_form_id,
        'target': 'new',
        'context': context,
    }

and module.xml:

<?xml version="1.0"?>

<openerp> <data>

  <record id="hist_product_cust" model="ir.ui.view">
    <field name="name">hist.product.cust</field>
    <field name="model">product.product</field>
    <field name="type">tree</field>
    <field name="priority">16</field>
    <field name="arch" type="xml">
        <tree string="product cust">
            <field name="id"/>
            <field name="name"/>
        </tree>
    </field>
  </record>


  <record id="view_order_form_histo" model="ir.ui.view">
  <field name="name">sale.order.form.histo</field>
  <field name="model">sale.order</field>
  <field name="inherit_id" ref="sale.view_order_form"/>
  <field name="arch" type="xml">
    <data>
      <xpath expr="/form/sheet/notebook/page/field[@name='order_line']/form/group/group/div/field[@name='product_uom_qty']" position="after">
          <!-- <button name="%(pop_hist_product)d" string="historique client" type="action" class="oe_highlight" /> -->
          <button name="product_history_client" string="historique client" type="object" class="oe_highlight oe_link" />
      </xpath>

    </data>
  </field>
  </record>






</data>

</openerp>

the popup window appear normally but when i close it a got this error :(

DataError: invalid input syntax for integer: "one2many_v_id_370" LINE 1: ...OM "sale_order_line" WHERE sale_order_line.id IN ('one2many_...

how can i fix this, i'm blocked please any idea will be appreciated

Thanks :)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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/9/14, 4:21 AM
Seen: 1054 times
Last updated: 3/16/15, 8:10 AM