This commit is contained in:
Benoît Vézina 2024-01-01 14:52:23 -05:00
parent cc8677c8f9
commit 43940f428e
6 changed files with 57 additions and 38 deletions

View file

@ -74,42 +74,30 @@
<page string="Property" name="bemade_sethy_configuration.res_partner.defaults.form">
<field name="relation_property_ids" string="All Owners" invisible="is_property == False">
<tree editable="top">
<field name="this_partner_id"
required="True"
options="{'no_create': True}"
invisible="1"/>
<field name="type_selection_id"
required="True"
options="{'no_create': True}"
invisible="1"/>
<field name="other_partner_id"
required="True"
options="{'no_create': True}"
string="Owner"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="active" invisible="1"/>
</tree>
</field>
<field name="relation_owner_ids" string="All Properties" invisible="is_property == True">
<tree editable="top">
<field name="this_partner_id" required="True"
<field name="other_partner_id"
required="True"
options="{'no_create': True}"
invisible="1"
/>
<field name="type_selection_id" required="True" options="{'no_create': True}"
invisible="1"/>
<field name="other_partner_id" required="True" options="{'no_create': True}"
string="Property"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="active" invisible="1"/>
</tree>
</field>
<button name="%(action_add_property)d"
type="action"
class="oe_highlight"
string="Add Property" />
string="Add Property"
invisible="is_property == True"
/>
</page>
</xpath>
<xpath expr="//page[@name='contact_addresses']" position="after">

View file

@ -1 +1 @@
from . import create_property_wizard
from . import property_wizard

View file

@ -1,10 +0,0 @@
from odoo import models, fields, api
class CreatePropertyWizard(models.TransientModel):
_name = 'create.property.wizard'
property_id = fields.Many2one('res.partner', string='Property', domain=[('is_property', '=', True)])
def action_done(self):
# Here process your data, for example:
self.env['res.partner'].browse(self._context.get('active_ids')).write({'property_id': self.property_id.id})

View file

@ -0,0 +1,31 @@
from odoo import models, fields, api
class CreatePropertyWizard(models.TransientModel):
_name = 'create.property.wizard'
_description = 'Property Wizard'
property_id = fields.Many2one(
comodel_name='res.partner',
string='Property',
domain=[('is_property', '=', True)],
required=True
)
def action_done(self):
# Here process your data, for example:
self.env['res.partner'].browse(self._context.get('active_ids')).write({'property_id': self.property_id.id})
def action_create_property(self):
# Redirect to the form view of 'res.partner' for user to create new property
return {
'type': 'ir.actions.act_window',
'res_model': 'res.partner',
'view_mode': 'form',
'view_type': 'form',
'context': {"default_is_property": True},
'target': 'new',
}
def action_select_property(self):
# wizard action goes here. Use self.partner_id for selected property
pass

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="property_wizard_form_view" model="ir.ui.view">
<field name="name">property.wizard.form</field>
<field name="model">property.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Property Wizard">
<group>
<field name="partner_id"/>
</group>
<footer>
<button name="action_create_property" string="Create new Property" type="object" class="btn-primary"/>
<button name="action_select_property" string="Select Property" type="object" class="btn-primary"/>
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>

View file

@ -1,10 +0,0 @@
from odoo import models, fields, api
class AddPropertyWizard(models.TransientModel):
_name = 'add.property.wizard'
property_id = fields.Many2one('res.partner', string='Property', domain=[('is_property', '=', True)])
def action_done(self):
# Here process your data, for example:
self.env['res.partner'].browse(self._context.get('active_ids')).write({'property_id': self.property_id.id})