Remove _inherits

review670002
This commit is contained in:
Cédric Krier
2013-03-20 22:50:36 +01:00
parent 341562de7d
commit db56538df4
6 changed files with 16 additions and 77 deletions
-16
View File
@@ -10,7 +10,6 @@ __all__ = ['Carrier']
class Carrier(ModelSQL, ModelView):
'Carrier'
__name__ = 'carrier'
_inherits = {'party.party': 'party'}
party = fields.Many2One('party.party', 'Party', required=True,
ondelete='CASCADE')
carrier_product = fields.Many2One('product.product', 'Carrier Product',
@@ -29,21 +28,6 @@ class Carrier(ModelSQL, ModelView):
def get_rec_name(self, name):
return '%s - %s' % (self.party.rec_name, self.carrier_product.rec_name)
@classmethod
def copy(self, carriers, default=None):
Party = Pool().get('party.party')
if default is None:
default = {}
default = default.copy()
new_carriers = []
for carrier in carriers:
party, = Party.copy([carrier.party])
default['party'] = party.id
new_carriers.extend(super(Carrier, self).copy([carrier],
default=default))
return new_carriers
def get_sale_price(self):
'Compute carrier sale price with currency'
User = Pool().get('res.user')
+2 -18
View File
@@ -20,33 +20,17 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.ui.view" id="carrier_view_form">
<field name="model">carrier</field>
<field name="type">form</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="priority">10</field>
<field name="name">carrier_form</field>
</record>
<record model="ir.ui.view" id="carrier_view_form2">
<field name="model">carrier</field>
<field name="type">form</field>
<field name="priority">20</field>
<field name="name">carrier_form2</field>
</record>
<record model="ir.ui.view" id="carrier_view_tree">
<field name="model">carrier</field>
<field name="type">tree</field>
<field name="inherit" ref="party.party_view_tree"/>
<field name="priority">10</field>
<field name="name">carrier_tree</field>
</record>
<record model="ir.ui.view" id="carrier_view_tree2">
<field name="model">carrier</field>
<field name="type">tree</field>
<field name="priority">20</field>
<field name="name">carrier_tree2</field>
</record>
<record model="ir.action.act_window" id="act_carrier_form">
<field name="name">Carriers</field>
<field name="res_model">carrier</field>
@@ -54,13 +38,13 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window.view"
id="act_carrier_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="carrier_view_tree2"/>
<field name="view" ref="carrier_view_tree"/>
<field name="act_window" ref="act_carrier_form"/>
</record>
<record model="ir.action.act_window.view"
id="act_carrier_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="carrier_view_form2"/>
<field name="view" ref="carrier_view_form"/>
<field name="act_window" ref="act_carrier_form"/>
</record>
<menuitem parent="menu_carrier" action="act_carrier_form"
+9 -14
View File
@@ -1,17 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form" position="replace_attributes">
<form string="Carrier"/>
</xpath>
<xpath expr="/form/notebook" position="inside">
<page string="Carrier" id="carrier">
<label name="carrier_product"/>
<field name="carrier_product"/>
<newline/>
<label name="carrier_cost_method"/>
<field name="carrier_cost_method"/>
</page>
</xpath>
</data>
<form string="Carrier">
<label name="party"/>
<field name="party"/>
<newline/>
<label name="carrier_product"/>
<field name="carrier_product"/>
<label name="carrier_cost_method"/>
<field name="carrier_cost_method"/>
</form>
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form string="Carrier">
<label name="party"/>
<field name="party"/>
<newline/>
<label name="carrier_product"/>
<field name="carrier_product"/>
<label name="carrier_cost_method"/>
<field name="carrier_cost_method"/>
</form>
+5 -9
View File
@@ -1,12 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree" position="replace_attributes">
<tree string="Carriers"/>
</xpath>
<xpath expr="/tree/field[@name='name']" position="after">
<field name="carrier_product"/>
<field name="carrier_cost_method"/>
</xpath>
</data>
<tree string="Carriers">
<field name="party"/>
<field name="carrier_product"/>
<field name="carrier_cost_method"/>
</tree>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree string="Carriers">
<field name="party"/>
<field name="carrier_product"/>
<field name="carrier_cost_method"/>
</tree>