31
31
class product_historical(osv.Model):
35
37
def _get_historical_price(self, cr, uid, ids, field_name, field_value,
40
42
if self.browse(cr, uid, id).list_price != self.browse(cr, uid,
42
list_price_historical:
44
list_price_historical:
43
45
res[id] = self.browse(cr, uid, id).list_price
44
46
product_hist.create(cr, uid, {
66
68
_inherit = 'product.product'
68
70
'list_price_historical':
69
fields.function(_get_historical_price,
70
method=True, string='Latest Price',
72
digits_compute=dp.get_precision(
73
'List_Price_Historical'),
74
store={'product.product': ( lambda
71
fields.function(_get_historical_price,
72
method=True, string='Latest Price',
74
digits_compute=dp.get_precision(
75
'List_Price_Historical'),
76
store={'product.product': (lambda
75
77
self, cr, uid, ids, c={}: ids, [
76
78
'list_price'], 50), },
77
help="""Latest Recorded Historical
79
help="""Latest Recorded Historical
79
81
'cost_historical': fields.function(_get_historical_cost, method=True,
80
82
string=' Latest Cost', type='float',
81
83
digits_compute=dp.get_precision(
82
84
'Cost_Historical'),
83
store={'product.product': ( lambda
85
store={'product.product': (lambda
84
86
self, cr, uid, ids, c={}: ids, [
85
87
'standard_price'], 50), },
86
help="""Latest Recorded
88
help="""Latest Recorded
87
89
Historical Cost"""),
88
90
'list_price_historical_ids': fields.one2many('product.historic.price',
104
106
'product_id': fields.many2one('product.product',
105
107
string='Product related to this Price',
107
'name': fields.datetime(string='Date', required=True),
109
'name': fields.datetime(string='Date', required=True),
108
110
'price': fields.float(string='Price',
109
111
digits_compute=dp.get_precision('Price')),
110
112
'product_uom': fields.many2one('product.uom', string="Supplier UoM",