← Back to team overview

openerp-community team mailing list archive

Re: Multi-company cost calculation

 

Hi,

I've had a think about this overnight.  Cost method is actually a rarely
used field and to my knowledge only at inwards reception and update price
to determine whether to update average cost.  It is all the unneeded reads
and browses that will kill, therefore my answer is to not read it or browse
it.

This is a bit left field but I think would work with zero performance
impact on product reads and browses and an O(1) complexity for the needed
writes as cost method is only needed one time regardless of number of
products.  I accept it is a workaround but thought I'd put it out there.

If product average cost == incoming move cost then average cost behaves
like standard cost.
It assumes that one company uses only one cost method.

Set a cost method res_company with new field cost_method - with options of
['average', 'standard']
Set all products to average cost. (If needed this could be added to the
module by removing the standard option and an init method)
Hide the cost field in product form(s) - it does nothing anymore.

Then in all workflow create methods (which for me would just be purchasing
and manufacturing, but for most just purchasing) which require this field
implement an override.  If the company cost method is standard over write
the move value with the current average cost.

The only way to then update product cost price is then via the update
button.  This would need extension to ensure that incoming unprocessed
moves were also updated if company cost method was standard.

But other than overwriting stock_moves cost field where needed (and these
create dicts are very accessible) no other functionality needs changing.

Not saying it is ideal or perfect, and I've not fully thought through
implications but it does save performance.





On Fri, Jun 20, 2014 at 9:07 PM, Joël Grand-Guillaume <
joel.grandguillaume@xxxxxxxxxxxxxx> wrote:

> Hi Eric,
>
>
> I think the problem is the performance issue... The property field are
> perfo killer and as this module adds quite lots of read in lot's of places,
> we already spend time to make it as quick as possible.
>
> A part from that, I agree on the principle, because of course a same
> product should not have the same costing method in each company...
>
> So, our options:
>
> 1) Make different product for each company when costing method isn't the
> same
>
> 2) Add this cost_method field as a property and test it among lots of
> products and move to ensure it's ok. If yes includer in the price_history
> module
>
> 3) Add this cost_method field as a property in a separate module, letting
> the us possibility to chose wether to include it or not. I would see this
> module in the same margin-analysis branch and would love to see a comment
> in the description of the price_history about that new module.
>
> My2cents,
>
> Joël
>
>
>
>
>
>
>
> On Fri, Jun 20, 2014 at 2:13 AM, Eric Caudal <eric.caudal@xxxxxxxxxxxxxx>
> wrote:
>
>>  Hi,
>> Currently Odoo 7 doesnot handle properly 2 type of costing for separate
>> companies inside the same instance (average cost for company A and standard
>> cost for company B for example).
>>
>> We are using the product_price_history module for multi-company price
>> logging: would it be a good idea to change the cost_method to property
>> field within this module?
>>
>> What would be the impact on performance?
>> What would be the alternative?
>> --
>>
>> Eric Caudal*CEO*
>> --*Elico Corporation, Shanghai branch
>> Odoo Premium Certified Training Partner
>> *Cell: + 86 186 2136 1670
>> Office: + 86 21 6211 8017/27/37
>> Skype: elico.corperic.caudal@elico-corp.comhttp://www.elico-corp.com
>>
>> *Elico Corp is best Partner Odoo 2014 for Asia-Pacific*
>> *Remember: with version 8, OpenERP becomes Odoo!*
>> [image: Elico Corp] [image: Odoo Silver Partner]
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
>
>
> *camptocamp*
> INNOVATIVE SOLUTIONS
> BY OPEN SOURCE EXPERTS
>
> *Joël Grand-Guillaume*
> Division Manager
> Business Solutions
>
> +41 21 619 10 28
> www.camptocamp.com
>
>
>
> _______________________________________________
> 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
>
>

PNG image

PNG image


References