*removed demo data for default sale pricelist in sale module (moved into product module)

*removed property_product_pricelist field on res_partner in sale module (moved into product module)
This hack has been done for removing dependancies to sale into event and membership modules

bzr revid: qdp-5379c6e6201bc3edd75c74bf50aa5dbf0f759fe5
This commit is contained in:
qdp 2008-05-29 06:25:12 +00:00
parent 5ae3f25038
commit dde7741563
5 changed files with 90 additions and 42 deletions

View File

@ -1,3 +1,4 @@
import product
import pricelist
import report
import partner

49
addons/product/partner.py Normal file
View File

@ -0,0 +1,49 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import fields, osv
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'property_product_pricelist': fields.property(
'product.pricelist',
type='many2one',
relation='product.pricelist',
string="Sale Pricelist",
method=True,
view_load=True,
group_name="Pricelists Properties",
help="This pricelist will be used, instead of the default one, \
for sales to the current partner"),
}
res_partner()

View File

@ -53,5 +53,45 @@ parameter) will see those record just disappear.
<field name="name">Cost Price</field>
<field name="field">standard_price</field>
</record>
<!--
Price list type
-->
<record model="product.pricelist.type" id="pricelist_type_sale">
<field name="name">Sale Pricelist</field>
<field name="key">sale</field>
</record>
<!--
Price list
-->
<record model="product.pricelist" id="list0">
<field name="name">Default Sale Pricelist</field>
<field name="type">sale</field>
</record>
<record model="product.pricelist.version" id="ver0">
<field name="pricelist_id" ref="list0"/>
<field name="name">Default Sale Pricelist Version</field>
</record>
<record model="product.pricelist.item" id="item0">
<field name="price_version_id" ref="ver0"/>
<field name="base" ref="product.list_price" />
<field name="name">Default Sale Pricelist Line</field>
</record>
<!--
Property
-->
<record model="ir.property" id="property_product_pricelist" forcecreate="True">
<field name="name">property_product_pricelist</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist')]"/>
<field name="value" eval="'product.pricelist,'+str(list0)"/>
</record>
</data>
</terp>

View File

@ -34,16 +34,6 @@ class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'property_product_pricelist': fields.property(
'product.pricelist',
type='many2one',
relation='product.pricelist',
string="Sale Pricelist",
method=True,
view_load=True,
group_name="Pricelists Properties",
help="This pricelist will be used, instead of the default one, \
for sales to the current partner"),
'sales': fields.one2many('sale.order', 'partner_id', 'Sales'),
}

View File

@ -17,39 +17,7 @@
<field name="key">sale_open</field>
</record>
<!--
Price list type
-->
<record model="product.pricelist.type" id="pricelist_type_sale">
<field name="name">Sale Pricelist</field>
<field name="key">sale</field>
</record>
<!--
Price list
-->
<record model="product.pricelist" id="list0">
<field name="name">Default Sale Pricelist</field>
<field name="type">sale</field>
</record>
<record model="product.pricelist.version" id="ver0">
<field name="pricelist_id" ref="list0"/>
<field name="name">Default Sale Pricelist Version</field>
</record>
<record model="product.pricelist.item" id="item0">
<field name="price_version_id" ref="ver0"/>
<field name="base" ref="product.list_price" />
<field name="name">Default Sale Pricelist Line</field>
</record>
<!--
Property
-->
<record model="ir.property" id="property_product_pricelist" forcecreate="True">
<field name="name">property_product_pricelist</field>
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist')]"/>
<field name="value" eval="'product.pricelist,'+str(list0)"/>
</record>
<!--
Resource: sale.shop