Odoo Help

0

Customer's first command

v6
By
fdim
on 4/23/13, 10:36 AM 918 views

Hi, I am new in OpenERP's domain.

My question is : I want to show in customer view the date of his first command, may u plz help me?

This is my code, but it doesn't work :

class res_partner(osv.osv):
    _inherit = "res.partner"
        def _get_date_first_order(self, cr, uid, ids, name, partner_id, arg, context=None):
        res = {}
        for id in ids :
            cr.execute("""select
                    min(date_order)
                from
                    sale_order """,(tuple(ids),))
        return res

    _columns = {
        'customer_date_order': fields.function(_get_date_first_order, method=True, store=True, type='datetime', string='Date First order', select=1),
        }
res_partner()

anyone can help?!

fdim
on 5/2/13, 8:08 AM
1
Gilles Major (gim)
On 4/24/13, 1:03 PM

v7: Hello, the simplest way to do this would be to go to that customer's form view, click the "Quotations and Sales" button and then sort the orders by clicking on the the Date column.

V6: go to Sales => Address Book => Customers, select a customer, then click on the "Sales" link on the right of the window. A new popup will open. You can then sort sales orders by the same method as above.

I prefer to add a field fuction in form view, but my code desn't work !!

fdim
on 4/26/13, 7:25 AM
0
Dharmesh Rathod
On 4/25/13, 5:40 AM

Hi,

In case to see date without open any other form, add new field function type into customer and write SQL query or use search method (with order='date' and limit=1).

Email : info@acespritech.com
Skype : acespritech
Blog : acespritechblog.wordpress.com

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 4/23/13, 10:36 AM
Seen: 918 times
Last updated: 3/16/15, 8:10 AM