Add location properties on partner and fix indent

This commit is contained in:
Cédric Krier committed 2008-05-05 12:21:56 +02:00
1 parent 4f90704513
commit 99d616bc43
2 files changed
+43 -1

No files matched your search

+21 -1
View File
@@ -8,6 +8,8 @@ STATES_WH = {
'invisible': "type != 'warehouse'",
'readonly': "not active",
}
class Location(OSV):
"Stock Location"
_name = 'stock.location'
@@ -49,7 +51,7 @@ class Location(OSV):
return True
def default_type(self, cursor, user, context=None):
return 'storage'
return 'storage'
def name_search(self, cursor, user, name, args=None, operator='ilike',
context=None, limit=None):
@@ -66,3 +68,21 @@ class Location(OSV):
return result
Location()
class Partner(OSV):
_name = 'partner.partner'
supplier_location = fields.Property(type='many2one',
relation='stock.location', string='Supplier Location',
group_name='Stock Properties', view_load=True,
domain=[('type', '=', 'supplier')],
help='The default source location ' \
'when receiving products from the partner.')
customer_location = fields.Property(type='many2one',
relation='stock.location', string='Customer Location',
group_name='Stock Properties', view_load=True,
domain=[('type', '=', 'customer')],
help='The default destination location ' \
'when sending products to the partner.')
Partner()
+22
View File
@@ -160,6 +160,28 @@
<field name="output_location" ref="location_output"/>
<field name="storage_location" ref="location_storage"/>
</record>
<record model="stock.location" id="location_supplier">
<field name="name">Supplier</field>
<field name="code">SUP</field>
<field name="type">supplier</field>
</record>
<record model="stock.location" id="location_customer">
<field name="name">Customer</field>
<field name="code">CUS</field>
<field name="type">customer</field>
</record>
<record model="ir.property" id="property_supplier_location">
<field name="name">supplier_location</field>
<field name="field"
search="[('model.model', '=', 'partner.partner'), ('name', '=', 'supplier_location')]"/>
<field name="value" eval="'stock.location,' + str(ref('location_supplier'))"/>
</record>
<record model="ir.property" id="property_customer_location">
<field name="name">customer_location</field>
<field name="field"
search="[('model.model', '=', 'partner.partner'), ('name', '=', 'customer_location')]"/>
<field name="value" eval="'stock.location,' + str(ref('location_customer'))"/>
</record>
</data>
</tryton>