← Back to team overview

openerp-community team mailing list archive

Re: Update a field in model product.template when PO is confirmed

 

Hi Mohamed, thanks for your reply.

This method is not a solution for me.

For example:
-We have a product A.
1. We confirm a PO with unit price of $10 for 1 product A.
2. We confirm a PO with unit price of $20 for 1 product A.

With the real price method, the cost price is $15. But in the method I need, the cost price is $20 (the last unit price confirmed).

How can I do this?

Thanks!

El 01/12/2014 06:30 p.m., Mohamed M. Hagag escribió:

Hi José,


I believe this function already exists in v.8 .


Use the real price costing method .


to activate it go to Purchase settings and activate the option contains real and average price then apply.



test it by creating POs for the one product and every new PO increase or decrease the price and check the product cost price after each PO confirmation.


Regards,




On 12/01/2014 11:24 PM, José Persichini wrote:


  Update a field in model product.template when PO is confirmed

Hello, I have Odoo 8 running over Win 7 x64.

I am developing a new module, I have created a class that inherit from product.template:

    from openerp import fields, models

    class Product(models.Model):
        _inherit = 'product.template'

        last_cost_price = fields.Float(digits=(8,2), string="Last
    cost price", readonly=True)

When the user confirms a PO, I want to read every line order and set the unit_price of this order_line in last_cost_price of the corresponding product.template.

Have I to override wkf_confirm_order() method of purchase_order class? In this case, how can I access to product.last_cost_price attribute to edit it?

Thanks!



_______________________________________________
Mailing list:https://launchpad.net/~openerp-community
Post to     :openerp-community@xxxxxxxxxxxxxxxxxxx
Unsubscribe :https://launchpad.net/~openerp-community
More help   :https://help.launchpad.net/ListHelp



_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp


Follow ups

References