New product types: Goods, Assets and Service
review260001
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* New product types: Goods, Assets and Service
|
||||
* Category is no more required on product
|
||||
|
||||
Version 2.2.0 - 2011-10-24
|
||||
|
||||
+16
-3
@@ -20,10 +20,16 @@ class Template(ModelSQL, ModelView):
|
||||
name = fields.Char('Name', size=None, required=True, translate=True,
|
||||
select=True, states=STATES, depends=DEPENDS)
|
||||
type = fields.Selection([
|
||||
('stockable', 'Stockable'),
|
||||
('consumable', 'Consumable'),
|
||||
('goods', 'Goods'),
|
||||
('assets', 'Assets'),
|
||||
('service', 'Service')
|
||||
], 'Type', required=True, states=STATES, depends=DEPENDS)
|
||||
consumable = fields.Boolean('Consumable',
|
||||
states={
|
||||
'readonly': ~Eval('active', True),
|
||||
'invisible': Eval('type', 'goods') != 'goods',
|
||||
},
|
||||
depends=['active', 'type'])
|
||||
category = fields.Many2One('product.category', 'Category',
|
||||
states=STATES, depends=DEPENDS)
|
||||
list_price = fields.Property(fields.Numeric('List Price', states=STATES,
|
||||
@@ -54,11 +60,18 @@ class Template(ModelSQL, ModelView):
|
||||
# Migration from 2.2: category is no more required
|
||||
table.not_null_action('category', 'remove')
|
||||
|
||||
# Migration from 2.2: new types
|
||||
cursor.execute('UPDATE "' + self._table + '" '
|
||||
'SET consumable = %s WHERE type = %s', (True, 'consumable'))
|
||||
cursor.execute('UPDATE "' + self._table + '" '
|
||||
'SET type = %s WHERE type IN (%s, %s)',
|
||||
('goods', 'stockable', 'consumable'))
|
||||
|
||||
def default_active(self):
|
||||
return True
|
||||
|
||||
def default_type(self):
|
||||
return 'stockable'
|
||||
return 'goods'
|
||||
|
||||
def default_cost_price_method(self):
|
||||
return 'fixed'
|
||||
|
||||
+6
-5
@@ -46,16 +46,17 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<form string="Product Template">
|
||||
<form string="Product Template" col="6">
|
||||
<label name="name"/>
|
||||
<field name="name" xexpand="1"/>
|
||||
<label name="active"/>
|
||||
<field name="active" xexpand="0" width="100"/>
|
||||
<notebook colspan="4">
|
||||
<notebook colspan="6">
|
||||
<page string="General" id="general">
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
<newline/>
|
||||
<label name="consumable"/>
|
||||
<field name="consumable"/>
|
||||
<label name="category"/>
|
||||
<field name="category" />
|
||||
<label name="default_uom"/>
|
||||
@@ -109,8 +110,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Products"/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id="general"]/label[@name="type"]"
|
||||
position="before">
|
||||
expr="/form/field[@name='name']"
|
||||
position="after">
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user