Skip to content
Snippets Groups Projects
Commit 4afe45b1 authored by Benjami's avatar Benjami
Browse files

Added some company fields and create a company with wizard values :rainbow:

parent e822bb14
No related branches found
No related tags found
2 merge requests!253[REL] Release 06/11/23,!191V1 imrpvements to CompanyEasyCreation wizard (CRM Lead execution)🙋‍
Pipeline #47782 passed with warnings
......@@ -14,6 +14,22 @@ _HIERARCHY_LEVEL_VALUES = [
("community", _("Community")),
]
_LEGAL_FROM_VALUES = [
("Societat Cooperativa", _("Societat Cooperativa")),
("Associació sense ànim de lucre", _("Associació sense ànim de lucre")),
("Societat Limitada", _("Societat Limitada")),
("Societat Col·lectiva", _("Societat Col·lectiva")),
("Comunitat de Bens", _("Comunitat de Bens")),
("Societat Comanditària", _("Societat Comanditària")),
("Societat Anónima", _("Societat Anónima")),
("Empresari Individual", _("Empresari Individual")),
]
_CE_STATUS_VALUES = [
("active", _("active")),
("building", _("building")),
]
class ResCompany(models.Model):
_name = "res.company"
......@@ -85,6 +101,16 @@ class ResCompany(models.Model):
readonly=True,
store=False,
)
legal_form = fields.Selection(
selection=_LEGAL_FROM_VALUES,
string="Legal form",
)
legal_name = fields.Char(string="Legal name")
ce_status = fields.Selection(
selection=_CE_STATUS_VALUES,
string="Energy Community state",
)
landing_page_id = fields.Many2one("landing.page", string=_("Landing Page"))
wordpress_db_username = fields.Char(string=_("Wordpress DB Admin Username"))
wordpress_db_password = fields.Char(string=_("Wordpress DB Admin Password"))
......
......@@ -13,30 +13,43 @@
</xpath>
<xpath expr="//sheet" position="before">
<header>
<field name="landing_page_id" invisible="1"/>
<field name="landing_page_id" invisible="1" />
<button
name="create_landing"
type="object"
string="Create landing page"
attrs="{'invisible': [('landing_page_id','!=',False)]}"
/>
name="create_landing"
type="object"
string="Create landing page"
attrs="{'invisible': [('landing_page_id','!=',False)]}"
/>
</header>
</xpath>
<xpath expr="//field[@name='logo']" position="before">
<div class='oe_button_box'>
<button name="get_landing_page_form" type="object" string="My landing page" class="oe_stat_button" icon="fa-globe" attrs="{'invisible': [('landing_page_id','=',False)]}" />
<button
name="get_landing_page_form"
type="object"
string="My landing page"
class="oe_stat_button"
icon="fa-globe"
attrs="{'invisible': [('landing_page_id','=',False)]}"
/>
</div>
<field name="admins" invisible="True"></field>
<field name="admins" invisible="True" />
</xpath>
<xpath expr="//notebook" position="inside">
<page string="Energy Communities">
<group>
<field name="hierarchy_level"></field>
<field name="parent_id_filtered_ids" invisible="True"></field>
<field name="parent_id" domain="[('id', 'in', parent_id_filtered_ids)]"></field>
<field name="voluntary_share_id"></field>
<field name="ce_tag_ids"/>
<field name="admins"/>
<field name="hierarchy_level" />
<field name="parent_id_filtered_ids" invisible="True" />
<field
name="parent_id"
domain="[('id', 'in', parent_id_filtered_ids)]"
/>
<field name="legal_form" />
<field name="legal_name" />
<field name="ce_status" />
<field name="voluntary_share_id" />
<field name="ce_tag_ids" />
<field name="admins" />
</group>
</page>
</xpath>
......@@ -59,9 +72,9 @@
</xpath>
<xpath expr="//form" position="inside">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</xpath>
</field>
......
......@@ -2,6 +2,8 @@ import logging
from odoo import _, api, fields, models
from ..models.res_company import _CE_STATUS_VALUES, _LEGAL_FROM_VALUES
_logger = logging.getLogger(__name__)
......@@ -69,7 +71,7 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
foundation_date = fields.Date(string="Foundation date")
vat = fields.Char(
string="ZIP code",
string="VAT",
)
email = fields.Char(
......@@ -88,6 +90,15 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
comodel_name="res.country.state",
string="State",
)
legal_form = fields.Selection(
selection=_LEGAL_FROM_VALUES,
string="Legal form",
)
legal_name = fields.Char(string="Legal name")
ce_status = fields.Selection(
selection=_CE_STATUS_VALUES,
string="Energy Community state",
)
def add_company_managers(self):
coord_members = self.parent_id.get_users(
......@@ -169,11 +180,6 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
self.capital_share
)
def update_values_from_crm_lead(self):
if self.crm_lead_id:
vals = self.crm_lead_id._get_default_community_wizard()
self.new_company_id.write(vals)
def set_cooperative_account(self):
self_new_company = self.with_company(self.new_company_id)
new_company = self_new_company.new_company_id
......@@ -202,7 +208,6 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
def action_accept(self):
action = super().action_accept()
# self.update_values_from_crm_lead()
if self.property_cooperator_account:
self.set_cooperative_account()
self_new_company = self.with_company(self.new_company_id)
......@@ -222,6 +227,18 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
"name": self.name,
"user_ids": [(6, 0, self.user_ids.ids)],
"parent_id": self.parent_id.id,
"street": self.street,
"website": self.website,
"email": self.email,
"foundation_date": self.foundation_date,
"vat": self.vat,
"city": self.city,
"state_id": self.state_id,
"legal_form": self.legal_form,
"legal_name": self.legal_name,
"ce_status": self.ce_status,
"phone": self.phone,
"default_lang_id": self.default_lang_id.id,
}
)
)
......
......@@ -33,6 +33,9 @@
<field name="zip_code" required="1" />
<field name="foundation_date" required="1" />
<field name="email" required="1" />
<field name="legal_form" required="1" />
<field name="legal_name" required="1" />
<field name="ce_status" />
<field name="phone" required="1" />
<field name="default_lang_id" required="1" />
<field name="website" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment