Move cost price to product level instead of template

issue6515
review41321002
This commit is contained in:
Cédric Krier committed 2017-07-05 14:51:46 +02:00
1 parent 025ad0f9f0
commit be2fa6fa5b
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -23,7 +23,7 @@ class ProductCostHistory(ModelSQL, ModelView):
'History of Product Cost'
__name__ = 'product.product.cost_history'
_rec_name = 'date'
template = fields.Many2One('product.template', 'Product')
product = fields.Many2One('product.product', "Product")
date = fields.DateTime('Date')
cost_price = fields.Numeric('Cost Price')
@@ -44,11 +44,11 @@ class ProductCostHistory(ModelSQL, ModelView):
Max(history.write_date).as_('write_date'),
Coalesce(history.write_date,
history.create_date).as_('date'),
history.template.as_('template'),
history.product.as_('product'),
history.cost_price.as_('cost_price'),
group_by=(history.id,
Coalesce(history.write_date, history.create_date),
history.template, history.cost_price))
history.product, history.cost_price))
class OpenProductCostHistory(Wizard):
@@ -64,11 +64,11 @@ class OpenProductCostHistory(Wizard):
active_id = Transaction().context.get('active_id')
if not active_id or active_id < 0:
action['pyson_domain'] = PYSONEncoder().encode([
('template', '=', None),
('product', '=', None),
])
else:
product = Product(active_id)
action['pyson_domain'] = PYSONEncoder().encode([
('template', '=', product.template.id),
('product', '=', product.id),
])
return action, {}
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="template"/>
<field name="product"/>
<field name="date" widget="date"/>
<field name="date" widget="time" string="Time"/>
<field name="cost_price"/>