Skip to content

Commit e7d37d0

Browse files
[FIX] multicompany_properties
1 parent 146f30c commit e7d37d0

39 files changed

Lines changed: 353 additions & 106 deletions

File tree

multicompany_property_account/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'sequence': 30,
1010
'category': 'Creu Blanca',
1111
'website': 'http://www.creublanca.es',
12-
'depends': ['account', 'multicompany_property',
12+
'depends': ['account', 'multicompany_property_base',
1313
'multicompany_property_product',
1414
'payment'],
1515
'data': [
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
22
from . import res_partner
3+
from . import res_company
34
from . import product
45
from . import product_category

multicompany_property_account/models/product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ProductTemplate(models.Model):
1010

1111

1212
class ProductProperty(models.TransientModel):
13-
_inherit = 'multicompany.property.product'
13+
_inherit = 'product.property'
1414

1515
property_account_income_id = fields.Many2one(
1616
comodel_name='account.account',
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# -*- coding: utf-8 -*-
2+
from odoo import fields, models, api
3+
4+
5+
class Company(models.Model):
6+
_inherit = 'res.company'
7+
8+
property_stock_account_input_categ_id = fields.Many2one(readonly=True)
9+
property_stock_account_output_categ_id = fields.Many2one(readonly=True)
10+
property_stock_valuation_account_id = fields.Many2one(readonly=True)
11+
12+
13+
class CompanyProperty(models.TransientModel):
14+
_inherit = 'res.company.property'
15+
16+
property_stock_account_input_categ_id = fields.Many2one(
17+
comodel_name='account.account',
18+
string="Input Account for Stock Valuation",
19+
compute='_compute_property_fields',
20+
readonly=False, store=False,
21+
)
22+
property_stock_account_output_categ_id = fields.Many2one(
23+
comodel_name='account.account',
24+
string="Output Account for Stock Valuation",
25+
compute='_compute_property_fields',
26+
readonly=False, store=False,
27+
)
28+
property_stock_valuation_account_id = fields.Many2one(
29+
comodel_name='account.account',
30+
string="Account Template for Stock Valuation",
31+
compute='_compute_property_fields',
32+
readonly=False, store=False,
33+
)
34+
35+
@api.one
36+
def get_property_fields(self, object, properties):
37+
super(CompanyProperty, self).get_property_fields(object, properties)
38+
self.property_stock_account_input_categ_id = \
39+
self.get_property_value('property_stock_account_input_categ_id',
40+
object, properties)
41+
self.property_stock_account_output_categ_id = \
42+
self.get_property_value('property_stock_account_output_categ_id',
43+
object, properties)
44+
self.property_stock_valuation_account_id = \
45+
self.get_property_value('property_stock_valuation_account_id',
46+
object, properties)
47+
48+
@api.multi
49+
def get_property_fields_list(self):
50+
res = super(CompanyProperty, self).get_property_fields_list()
51+
res.append('property_stock_account_input_categ_id')
52+
res.append('property_stock_account_output_categ_id')
53+
res.append('property_stock_valuation_account_id')
54+
return res
55+
56+
@api.model
57+
def set_properties(self, object, properties=False):
58+
super(CompanyProperty, self).set_properties(object, properties)
59+
self.set_property(object, 'property_stock_account_input_categ_id',
60+
self.property_stock_account_input_categ_id.id,
61+
properties)
62+
self.set_property(object, 'property_stock_account_output_categ_id',
63+
self.property_stock_account_output_categ_id.id,
64+
properties)
65+
self.set_property(object, 'property_stock_valuation_account_id',
66+
self.property_stock_valuation_account_id.id,
67+
properties)

multicompany_property_account/models/res_partner.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from odoo import fields, models, api
33

44

5-
class ResPartner(models.Model):
5+
class Partner(models.Model):
66
_inherit = 'res.partner'
77

88
property_account_payable_id = fields.Many2one(readonly=True)
@@ -12,7 +12,7 @@ class ResPartner(models.Model):
1212
property_supplier_payment_term_id = fields.Many2one(readonly=True)
1313

1414

15-
class ResPartnerProperty(models.TransientModel):
15+
class PartnerProperty(models.TransientModel):
1616
_inherit = 'res.partner.property'
1717

1818
property_account_payable_id = fields.Many2one(
@@ -64,7 +64,7 @@ class ResPartnerProperty(models.TransientModel):
6464

6565
@api.one
6666
def get_property_fields(self, object, properties):
67-
super(ResPartnerProperty, self).get_property_fields(object, properties)
67+
super(PartnerProperty, self).get_property_fields(object, properties)
6868
self.property_account_payable_id =\
6969
self.get_property_value('property_account_payable_id', object,
7070
properties)
@@ -83,7 +83,7 @@ def get_property_fields(self, object, properties):
8383

8484
@api.multi
8585
def get_property_fields_list(self):
86-
res = super(ResPartnerProperty, self).get_property_fields_list()
86+
res = super(PartnerProperty, self).get_property_fields_list()
8787
res.append('property_account_payable_id')
8888
res.append('property_account_receivable_id')
8989
res.append('property_account_position_id')
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
3-
3+
<record id="view_company_property_form" model="ir.ui.view">
4+
<field name="name">res.company.property.form</field>
5+
<field name="model">res.company.property</field>
6+
<field name="inherit_id" ref="multicompany_property_base.view_company_property_form"/>
7+
<field name="arch" type="xml">
8+
<notebook position="inside">
9+
<page name="accounting" string="Accounting">
10+
<group>
11+
<field name="property_stock_account_input_categ_id"/>
12+
<field name="property_stock_account_output_categ_id"/>
13+
<field name="property_stock_valuation_account_id"/>
14+
</group>
15+
</page>
16+
</notebook>
17+
</field>
18+
</record>
419
</odoo>

multicompany_property_account/views/partner.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<record id="view_partner_property_tree" model="ir.ui.view">
55
<field name="name">res.partner.property.tree</field>
66
<field name="model">res.partner.property</field>
7-
<field name="inherit_id" ref="multicompany_property.view_partner_property_tree"/>
7+
<field name="inherit_id" ref="multicompany_property_base.view_partner_property_tree"/>
88
<field name="arch" type="xml">
99
<field name="company_id" position="after">
1010
<field name="property_account_payable_id"
@@ -18,7 +18,7 @@
1818
<record id="view_partner_property_form" model="ir.ui.view">
1919
<field name="name">res.partner.property.form</field>
2020
<field name="model">res.partner.property</field>
21-
<field name="inherit_id" ref="multicompany_property.view_partner_property_form"/>
21+
<field name="inherit_id" ref="multicompany_property_base.view_partner_property_form"/>
2222
<field name="arch" type="xml">
2323
<notebook position="inside">
2424
<page name="accounting" string="Accounting">

multicompany_property_account/views/product.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<record id="view_multicompany_property_product_form" model="ir.ui.view">
5-
<field name="name">multicompany.property.product.form</field>
6-
<field name="model">multicompany.property.product</field>
7-
<field name="inherit_id" ref="multicompany_property_product.view_multicompany_property_product_form"/>
4+
<record id="view_product_property_form" model="ir.ui.view">
5+
<field name="name">product.property.form</field>
6+
<field name="model">product.property</field>
7+
<field name="inherit_id" ref="multicompany_property_product.view_product_property_form"/>
88
<field name="arch" type="xml">
99
<notebook position="inside">
1010
<page name="accounting" string="Accounting">

multicompany_property_account_asset/models/product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ProductTemplate(models.Model):
1010

1111

1212
class ProductProperty(models.TransientModel):
13-
_inherit = 'multicompany.property.product'
13+
_inherit = 'product.property'
1414

1515
asset_category_id = fields.Many2one(
1616
'account.asset.category',

multicompany_property_account_asset/views/product.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<record id="view_multicompany_property_product_form" model="ir.ui.view">
5-
<field name="name">multicompany.property.product.form</field>
6-
<field name="model">multicompany.property.product</field>
7-
<field name="inherit_id" ref="multicompany_property_account.view_multicompany_property_product_form"/>
4+
<record id="view_product_property_form" model="ir.ui.view">
5+
<field name="name">product.property.form</field>
6+
<field name="model">product.property</field>
7+
<field name="inherit_id" ref="multicompany_property_account.view_product_property_form"/>
88
<field name="arch" type="xml">
99
<field name="property_account_expense_id" position="before">
1010
<field name="asset_category_id"

0 commit comments

Comments
 (0)