[FIX] Update average price creates incorrect entries
[odoo/odoo.git] / addons / account_anglo_saxon / product.py
1 ##############################################################################
2 #    
3 #    OpenERP, Open Source Management Solution
4 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
5 #
6 #    This program is free software: you can redistribute it and/or modify
7 #    it under the terms of the GNU Affero General Public License as
8 #    published by the Free Software Foundation, either version 3 of the
9 #    License, or (at your option) any later version.
10 #
11 #    This program is distributed in the hope that it will be useful,
12 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #    GNU Affero General Public License for more details.
15 #
16 #    You should have received a copy of the GNU Affero General Public License
17 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
18 #
19 ##############################################################################
20
21 from osv import fields, osv
22
23 class product_category(osv.osv):
24     _inherit = "product.category"
25     _columns = {
26         'property_account_creditor_price_difference_categ': fields.property(
27             'account.account',
28             type='many2one',
29             relation='account.account',
30             string="Price Difference Account",
31             method=True,
32             view_load=True,
33             help="This account will be used to value price difference between purchase price and cost price."),
34
35         #Redefine fields to change help text for anglo saxon methodology.            
36         'property_account_income_categ': fields.property(
37             'account.account',
38             type='many2one',
39             relation='account.account',
40             string="Income Account",
41             method=True,
42             view_load=True,
43             help="This account will be used to value outgoing stock for the current product category using sale price"),
44         'property_account_expense_categ': fields.property(
45             'account.account',
46             type='many2one',
47             relation='account.account',
48             string="Expense Account",
49             method=True,
50             view_load=True,
51             help="This account will be used to value outgoing stock for the current product category using cost price"),                
52
53     }
54 product_category()
55
56 class product_template(osv.osv):
57     _inherit = "product.template"
58     _columns = {
59         'property_account_creditor_price_difference': fields.property(
60             'account.account',
61             type='many2one',
62             relation='account.account',
63             string="Price Difference Account",
64             method=True,
65             view_load=True,
66             help="This account will be used to value price difference between purchase price and cost price."),
67             
68         #Redefine fields to change help text for anglo saxon methodology.
69         'property_account_income': fields.property(
70             'account.account',
71             type='many2one',
72             relation='account.account',
73             string="Income Account",
74             method=True,
75             view_load=True,
76             help="This account will be used to value outgoing stock for the current product category using sale price"),
77         'property_account_expense': fields.property(
78             'account.account',
79             type='many2one',
80             relation='account.account',
81             string="Expense Account",
82             method=True,
83             view_load=True,
84             help="This account will be used to value outgoing stock for the current product category using cost price"),                
85
86     }
87 product_template()
88
89
90 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
91