change propietary cross-equipment
This commit is contained in:
parent
6274e72221
commit
d44f213d18
19
equipment.py
19
equipment.py
@ -325,8 +325,9 @@ class ChangePropietary(ModelView):
|
|||||||
__name__ = 'optical_equipment.change_propietary.form'
|
__name__ = 'optical_equipment.change_propietary.form'
|
||||||
|
|
||||||
old_propietary = fields.Many2One('party.party', 'Old Propietary')
|
old_propietary = fields.Many2One('party.party', 'Old Propietary')
|
||||||
equipments = fields.Many2Many('optical_equipment.equipment-change_propietary.form', 'equipment', 'change', "Equipments")
|
equipments = fields.Many2Many('optical_equipment.equipment', None, None, "Equipments",
|
||||||
#equipment = fields.Many2One('optical_equipment.equipment', "Equipment")
|
domain=[('propietary', '=', Eval('old_propietary'))],
|
||||||
|
depends=['old_propietary'])
|
||||||
new_propietary = fields.Many2One('party.party', "New Propietary")
|
new_propietary = fields.Many2One('party.party', "New Propietary")
|
||||||
new_address = fields.Many2One('party.address', "New Address", required=True,
|
new_address = fields.Many2One('party.address', "New Address", required=True,
|
||||||
domain=[('party', '=', Eval('new_propietary'))],)
|
domain=[('party', '=', Eval('new_propietary'))],)
|
||||||
@ -351,15 +352,17 @@ class NewPropietary(Wizard):
|
|||||||
change_propietary = StateAction('optical_equipment.act_optical_equipment_form')
|
change_propietary = StateAction('optical_equipment.act_optical_equipment_form')
|
||||||
|
|
||||||
def do_change_propietary(self, action):
|
def do_change_propietary(self, action):
|
||||||
equipment = self.start.equipment
|
old_propietary = self.start.old_propietary
|
||||||
|
equipments = self.start.equipments
|
||||||
new_propietary = self.start.new_propietary
|
new_propietary = self.start.new_propietary
|
||||||
new_address = self.start.new_address
|
new_address = self.start.new_address
|
||||||
|
|
||||||
equipment.propietarys += (equipment.propietary,)
|
for equipment in equipments:
|
||||||
equipment.propietary = new_propietary
|
equipment.propietarys += (equipment.propietary,)
|
||||||
equipment.propietary_address = new_address
|
equipment.propietary = new_propietary
|
||||||
equipment.maintenance_frequency = "6" if new_propietary.client_type == 'ips' else "12"
|
equipment.propietary_address = new_address
|
||||||
equipment.save()
|
equipment.maintenance_frequency = "6" if new_propietary.client_type == 'ips' else "12"
|
||||||
|
equipment.save()
|
||||||
|
|
||||||
|
|
||||||
class ChangeEquipment(ModelSQL):
|
class ChangeEquipment(ModelSQL):
|
||||||
|
@ -4,8 +4,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<form>
|
<form>
|
||||||
<label name="old_propietary"/>
|
<label name="old_propietary"/>
|
||||||
<field name="old_propietary"/>
|
<field name="old_propietary"/>
|
||||||
<label name="equipments"/>
|
<newline/>
|
||||||
<field name="equipments" colspan="3"/>
|
<field name="equipments" colspan="3"/>
|
||||||
|
<newline/>
|
||||||
<label name="new_propietary"/>
|
<label name="new_propietary"/>
|
||||||
<field name="new_propietary" colspan="3"/>
|
<field name="new_propietary" colspan="3"/>
|
||||||
<label name="new_address"/>
|
<label name="new_address"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user