[IMP] better price fields
This commit is contained in:
@@ -493,9 +493,8 @@ class product_template(osv.osv):
|
||||
string='Currency'),
|
||||
'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price to compute the customer price. Sometimes called the catalog price."),
|
||||
'lst_price' : fields.related('list_price', type="float", string='Public Price', digits_compute=dp.get_precision('Product Price')),
|
||||
'standard_price': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Cost Price', digits_compute=dp.get_precision('Product Price'),
|
||||
help="Cost price of the product template used for standard stock valuation in accounting and used as a base price on purchase orders. "
|
||||
"Expressed in the default unit of measure of the product..", groups="base.group_user", store=True),
|
||||
'standard_price': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Cost', digits_compute=dp.get_precision('Product Price'),
|
||||
help="Cost of the product, in the default unit of measure of the product.", groups="base.group_user", store=True),
|
||||
'volume': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Volume', help="The volume in m3.", store=True),
|
||||
'weight': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, multi='_compute_product_template_field', type='float', string='Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The weight of the contents in Kg, not including any packaging, etc.", store=True),
|
||||
'warranty': fields.float('Warranty'),
|
||||
@@ -506,7 +505,6 @@ class product_template(osv.osv):
|
||||
('end','End of Lifecycle'),
|
||||
('obsolete','Obsolete')], 'Status'),
|
||||
'uom_id': fields.many2one('product.uom', 'Unit of Measure', required=True, help="Default Unit of Measure used for all stock operation."),
|
||||
'uom_rel_id': fields.related('uom_id', type="many2one", relation="product.uom", readonly=True, string='Default UoM'),
|
||||
'uom_po_id': fields.many2one('product.uom', 'Purchase Unit of Measure', required=True, help="Default Unit of Measure used for purchase orders. It must be in the same category than the default unit of measure."),
|
||||
'company_id': fields.many2one('res.company', 'Company', select=1),
|
||||
# image: all image fields are base64 encoded and PIL-supported
|
||||
@@ -569,7 +567,7 @@ class product_template(osv.osv):
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
for product in products:
|
||||
# standard_price field can only be seen by users in base.group_user
|
||||
# Thus, in order to compute the sale price from the cost price for users not in this group
|
||||
# Thus, in order to compute the sale price from the cost for users not in this group
|
||||
# We fetch the standard price as the superuser
|
||||
if ptype != 'standard_price':
|
||||
res[product.id] = product[ptype] or 0.0
|
||||
@@ -962,9 +960,9 @@ class product_product(osv.osv):
|
||||
string="Medium-sized image", type="binary",
|
||||
help="Image of the product variant (Medium-sized image of product template if false)."),
|
||||
'standard_price': fields.property(type = 'float', digits_compute=dp.get_precision('Product Price'),
|
||||
help="Cost price of the product template used for standard stock valuation in accounting and used as a base price on purchase orders. "
|
||||
help="Cost of the product template used for standard stock valuation in accounting and used as a base price on purchase orders. "
|
||||
"Expressed in the default unit of measure of the product.",
|
||||
groups="base.group_user", string="Cost Price"),
|
||||
groups="base.group_user", string="Cost"),
|
||||
'volume': fields.float('Volume', help="The volume in m3."),
|
||||
'weight': fields.float('Gross Weight', digits_compute=dp.get_precision('Stock Weight'), help="The weight of the contents in Kg, not including any packaging, etc."),
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@
|
||||
<page string="General Information">
|
||||
<group>
|
||||
<group name="group_general">
|
||||
<field name="categ_id" string="Internal Category"/>
|
||||
<field name="type" on_change="onchange_type(type, context)"/>
|
||||
</group>
|
||||
<group name="group_standard_price">
|
||||
@@ -104,13 +103,11 @@
|
||||
<field name="list_price"/>
|
||||
<label for="standard_price" groups="base.group_user"/>
|
||||
<div name="standard_price_uom" groups="base.group_user">
|
||||
<field name="standard_price" class="oe_inline"/>
|
||||
<field name="currency_id" readonly="1" class="oe_inline" nolabel="1"/>
|
||||
<label string="/" class="oe_inline" groups="product.group_uom"/>
|
||||
<field name="uom_rel_id" class="oe_inline" groups="product.group_uom"/>
|
||||
<field name="standard_price" widget='monetary' options="{'currency_field': 'currency_id'}" class="oe_inline"/>
|
||||
</div>
|
||||
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
|
||||
<field name="uom_po_id" groups="product.group_uom"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -119,6 +116,7 @@
|
||||
<group>
|
||||
<field name="company_id" groups="base.group_multi_company"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="categ_id" string="Internal Category"/>
|
||||
</group>
|
||||
<group name="group_lots_and_weight">
|
||||
<field digits="(14, 3)" name="weight" string="Weight"
|
||||
@@ -231,8 +229,9 @@
|
||||
</group>
|
||||
<group>
|
||||
<group name="pricing" string="Pricing">
|
||||
<field name="lst_price"/>
|
||||
<field name="standard_price"/>
|
||||
<field name="lst_price" widget='monetary' options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="standard_price" widget='monetary' options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="currency_id" invisible='1'/>
|
||||
</group>
|
||||
<group name="weight">
|
||||
<group name="weight" string="Weights">
|
||||
@@ -449,7 +448,8 @@
|
||||
<field name="product_tmpl_id" class="oe_inline" readonly="1" attrs="{'invisible': [('id', '=', False)], 'required': [('id', '!=', False)]}"/>
|
||||
</field>
|
||||
<field name="standard_price" position="replace">
|
||||
<field name="standard_price" attrs="{'invisible':[('product_variant_count','=', 1)]}"/>
|
||||
<field name="standard_price" attrs="{'invisible':[('product_variant_count','=', 1)]}"
|
||||
widget='monetary' options="{'currency_field': 'currency_id'}"/>
|
||||
</field>
|
||||
<field name="weight" position="replace">
|
||||
<field digits="(14, 3)" name="volume"
|
||||
|
||||
+2
-1
@@ -769,5 +769,6 @@ class ProductTemplate(models.Model):
|
||||
invoice_policy = fields.Selection(
|
||||
[('order', 'Ordered quantities'),
|
||||
('delivery', 'Delivered quantities'),
|
||||
('cost', 'Invoice at cost (time and material, expenses)')],
|
||||
('cost', 'Invoice based on time and material')],
|
||||
string='Invoicing Policy', default='order')
|
||||
|
||||
|
||||
@@ -36,12 +36,10 @@
|
||||
<field name="property_cost_method" groups="stock_account.group_inventory_valuation" invisible="1"/>
|
||||
</field>
|
||||
<field name="standard_price" position="replace">
|
||||
<field name="standard_price" attrs="{'readonly':['&', ('valuation','=','real_time'), ('cost_method', 'in', ['standard', 'average'])]}" class="oe_inline"/>
|
||||
<field name="standard_price"
|
||||
attrs="{'readonly':['&', ('valuation','=','real_time'), ('cost_method', 'in', ['standard', 'average'])]}" class="oe_inline"
|
||||
widget='monetary' options="{'currency_field': 'currency_id'}"/>
|
||||
</field>
|
||||
<field name="currency_id" position="after">
|
||||
<label string="/" class="oe_inline" groups="product.group_uom"/>
|
||||
<field name="uom_rel_id" class="oe_inline" groups="product.group_uom"/>
|
||||
</field>
|
||||
<div name="standard_price_uom" position="after">
|
||||
<button string="Compute from average price" type="action"
|
||||
name="%(action_view_change_standard_price)d"
|
||||
|
||||
Reference in New Issue
Block a user