diff --git a/cooperator/README.rst b/cooperator/README.rst index 261cff0eb..e4161aa38 100644 --- a/cooperator/README.rst +++ b/cooperator/README.rst @@ -7,7 +7,7 @@ Cooperators !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:fc9abf44c53ec9ed50ac717e7fa26489ddc8765fd713c8db92f40bc077d5b1ce + !! source digest: sha256:4adbd8d94496075c68a7aa4ac052869f770abfc54315cb337d0d77536d4980ea !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -267,6 +267,10 @@ Contributors * Carmen Bianca Bakker * hugues de keyzer +* 'Som IT Cooperatiu SCCL' + + * Nicolás Ramos + Maintainers ~~~~~~~~~~~ diff --git a/cooperator/__manifest__.py b/cooperator/__manifest__.py index 593a7100f..851103ff6 100644 --- a/cooperator/__manifest__.py +++ b/cooperator/__manifest__.py @@ -40,6 +40,7 @@ "views/operation_request_view.xml", "views/account_move_views.xml", "views/product_view.xml", + "views/product_category_view.xml", "views/res_company_view.xml", "views/account_journal_views.xml", "views/cooperative_membership_view.xml", diff --git a/cooperator/models/__init__.py b/cooperator/models/__init__.py index f1b70f3ff..e450515fe 100644 --- a/cooperator/models/__init__.py +++ b/cooperator/models/__init__.py @@ -16,3 +16,4 @@ from . import share_line from . import subscription_register from . import subscription_request +from . import product_category diff --git a/cooperator/models/product_category.py b/cooperator/models/product_category.py new file mode 100644 index 000000000..dc7288ba2 --- /dev/null +++ b/cooperator/models/product_category.py @@ -0,0 +1,12 @@ +from odoo import fields, models + +class ProductCategory(models.Model): + _inherit = 'product.category' + + property_account_income_increase_categ_id = fields.Many2one( + 'account.account', + company_dependent=True, + string="Income Account for Share Increase", + domain="[('deprecated', '=', False), ('company_id', '=', current_company_id)]", + help="This account will be used when validating a share increase subscription request instead of the default income account" + ) diff --git a/cooperator/models/product_template.py b/cooperator/models/product_template.py index 976cea340..59090a8c3 100644 --- a/cooperator/models/product_template.py +++ b/cooperator/models/product_template.py @@ -18,6 +18,13 @@ class ProductTemplate(models.Model): by_company = fields.Boolean(string="Can be subscribed by companies?") by_individual = fields.Boolean(string="Can be subscribed by individuals?") mail_template = fields.Many2one("mail.template", string="Mail template") + property_account_income_increase_id = fields.Many2one( + 'account.account', + company_dependent=True, + string="Income Account for Share Increase", + domain="[('deprecated', '=', False), ('company_id', '=', current_company_id)]", + help="This account will be used when validating a share increase subscription request instead of the default income account" + ) def get_web_share_products(self, is_company): if is_company is True: diff --git a/cooperator/models/subscription_request.py b/cooperator/models/subscription_request.py index afa646ffd..26935cf7c 100644 --- a/cooperator/models/subscription_request.py +++ b/cooperator/models/subscription_request.py @@ -531,10 +531,20 @@ def _prepare_invoice_line(self, move_id, product, partner, qty): # request for a company other than the current one, which can happen # when a user is "logged in" to multiple companies. product = product.with_company(self.company_id) - account = ( - product.property_account_income_id - or product.categ_id.property_account_income_categ_id - ) + + if self.type == 'increase': + account = ( + product.property_account_income_increase_id + or product.categ_id.property_account_income_increase_categ_id + or product.property_account_income_id + or product.categ_id.property_account_income_categ_id + ) + else: + account = ( + product.property_account_income_id + or product.categ_id.property_account_income_categ_id + ) + if not account: raise UserError( _( diff --git a/cooperator/readme/CONTRIBUTORS.rst b/cooperator/readme/CONTRIBUTORS.rst index c3e148a98..5c97a79d8 100644 --- a/cooperator/readme/CONTRIBUTORS.rst +++ b/cooperator/readme/CONTRIBUTORS.rst @@ -8,3 +8,7 @@ * Manuel Claeys Bouuaert * Carmen Bianca Bakker * hugues de keyzer + +* 'Som IT Cooperatiu SCCL' + + * Nicolás Ramos diff --git a/cooperator/static/description/index.html b/cooperator/static/description/index.html index 8da67eeaa..911778159 100644 --- a/cooperator/static/description/index.html +++ b/cooperator/static/description/index.html @@ -367,7 +367,7 @@
Manage cooperators of a cooperative.
@@ -611,6 +611,10 @@