mrp_average_cost: Fix decimal precision
product_usability: add link to show history of standard price
This commit is contained in:
committed by
Raphaël Valyi
parent
fc29b2b480
commit
ae9a73488e
@@ -16,6 +16,17 @@ class ProductTemplate(models.Model):
|
||||
purchase_ok = fields.Boolean(track_visibility='onchange')
|
||||
active = fields.Boolean(track_visibility='onchange')
|
||||
|
||||
def show_product_price_history(self):
|
||||
self.ensure_one()
|
||||
products = self.env['product.product'].search(
|
||||
[('product_tmpl_id', '=', self._context['active_id'])])
|
||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||
'product_usability', 'product_price_history_action')
|
||||
action.update({
|
||||
'domain': "[('id', 'in', %s)]" % products.ids,
|
||||
})
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
@@ -38,9 +49,26 @@ class ProductProduct(models.Model):
|
||||
'unique(default_code)',
|
||||
'This internal reference already exists!')]
|
||||
|
||||
def show_product_price_history(self):
|
||||
self.ensure_one()
|
||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||
'product_usability', 'product_price_history_action')
|
||||
action.update({
|
||||
'domain': "[('product_id', '=', %d)]" % self.ids[0],
|
||||
})
|
||||
return action
|
||||
|
||||
|
||||
class ProductSupplierinfo(models.Model):
|
||||
_inherit = 'product.supplierinfo'
|
||||
|
||||
name = fields.Many2one(
|
||||
domain=[('supplier', '=', True), ('parent_id', '=', False)])
|
||||
|
||||
|
||||
class ProductPriceHistory(models.Model):
|
||||
_inherit = 'product.price.history'
|
||||
|
||||
company_currency_id = fields.Many2one(
|
||||
related='company_id.currency_id', readonly=True,
|
||||
string='Company Currency')
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
<group name="main">
|
||||
<field name="product_id" invisible="not context.get('product_price_history_main_view')"/>
|
||||
<field name="datetime"/>
|
||||
<field name="cost"/>
|
||||
<field name="cost" widget="monetary" options="{'currency_field': 'company_currency_id'}"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
@@ -30,8 +31,9 @@
|
||||
<tree string="Product Price History" editable="bottom">
|
||||
<field name="product_id" invisible="not context.get('product_price_history_main_view')"/>
|
||||
<field name="datetime"/>
|
||||
<field name="cost"/>
|
||||
<field name="cost" widget="monetary" options="{'currency_field': 'company_currency_id'}"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -67,13 +69,9 @@
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
<group name="general" position="after">
|
||||
<group name="price_history" string="Price History">
|
||||
<field name="price_history_ids" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
-->
|
||||
<field name="standard_price" class="oe_inline" position="after">
|
||||
<button name="show_product_price_history" class="oe_inline oe_link" type="object" string="Show History" context="{'active_id': active_id}"/>
|
||||
</field>
|
||||
<!-- START for wider 'name' field -->
|
||||
<!-- Don't make it too big, othesize computers with small resolutions
|
||||
will see the product name + image under the block of buttons -->
|
||||
|
||||
Reference in New Issue
Block a user