Skip to content
Snippets Groups Projects
Commit 25105e32 authored by Daniil Digtyar Vasilieva's avatar Daniil Digtyar Vasilieva :call_me:
Browse files

Merge conflict

parent 8a1985ea
No related branches found
No related tags found
2 merge requests!86Fix partners company,!6614.0 fix migration error and nice to have
......@@ -30,6 +30,7 @@
'security/res_users_role_data.xml',
'data/utm_data.xml',
'data/crm_lead_tag.xml',
'data/product_data.xml',
'data/auth_oauth_provider_data.xml',
'views/crm_lead_views.xml',
'views/res_company_views.xml',
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="share_capital_product_template" model="product.template">
<field name="name">Contribution to Share Capital</field>
<field name="short_name">Share Capital</field>
<field name="sale_ok">False</field>
<field name="purchase_ok">False</field>
<field name="is_share">True</field>
<field name="display_on_website">True</field>
<field name="categ_id" ref="cooperator.product_category_company_share"></field>
<field name="type">service</field>
<field name="default_share_product">True</field>
<field name="list_price">0</field>
<field name="by_company">True</field>
<field name="by_individual">True</field>
<field name="company_id" ref="base.main_company"></field>
</record>
</data>
</odoo>
\ No newline at end of file
from odoo import fields, models, api
from odoo import fields, models, api, _
import logging
_logger = logging.getLogger(__name__)
class AccountMulticompanyEasyCreationWiz(models.TransientModel):
_inherit = "account.multicompany.easy.creation.wiz"
......@@ -18,6 +21,7 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
" receivable account for the"
" cooperators",
)
capital_share = fields.Monetary(string="Initial capital share", default=100)
def update_product_category_company_share(self):
new_company_id = self.new_company_id.id
......@@ -48,8 +52,18 @@ class AccountMulticompanyEasyCreationWiz(models.TransientModel):
values['property_account_expense_categ_id'] = self.env.ref(values['property_account_expense_categ_id'])
product_category_company_share.write(values)
def create_capital_share_product_template(self):
# We use sudo to be able to copy the product and not needing to be in the main company
new_share_product = self.sudo().env.ref('energy_communities.share_capital_product_template').copy()
new_share_product.write({
'name': _('Contribution to Share Capital'),
'company_id': self.new_company_id.id,
'list_price': self.capital_share
})
def action_accept(self):
action = super(AccountMulticompanyEasyCreationWiz, self).action_accept()
self.new_company_id.property_cooperator_account = self.property_cooperator_account
self.update_product_category_company_share()
self.create_capital_share_product_template()
return action
......@@ -12,6 +12,7 @@
<page string="Cooperator">
<group string="Cooperator">
<field name="property_cooperator_account"/>
<field name="capital_share"/>
</group>
</page>
</xpath>
......
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