Skip to content

Commit

Permalink
[IMP] cooperator: Add specific income account for share increase
Browse files Browse the repository at this point in the history
Fix pre-commit
  • Loading branch information
nicolasramossomit committed Nov 13, 2024
1 parent bd9d47c commit 5885fb2
Show file tree
Hide file tree
Showing 19 changed files with 648 additions and 471 deletions.
335 changes: 176 additions & 159 deletions cooperator/README.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cooperator/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions cooperator/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
from . import share_line
from . import subscription_register
from . import subscription_request
from . import product_category
13 changes: 13 additions & 0 deletions cooperator/models/product_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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",
)
7 changes: 7 additions & 0 deletions cooperator/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 14 additions & 4 deletions cooperator/models/subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
_(
Expand Down
11 changes: 11 additions & 0 deletions cooperator/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- [Coop IT Easy SC](https://coopiteasy.be):
- Houssine Bakkali
- Robin Keunen
- Rémy Taymans
- Victor Champonnois
- Vincent Van Rossem
- Manuel Claeys Bouuaert
- Carmen Bianca Bakker
- hugues de keyzer
- 'Som IT Cooperatiu SCCL'
- Nicolás Ramos
10 changes: 0 additions & 10 deletions cooperator/readme/CONTRIBUTORS.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Manage cooperators of a cooperative.
A basic flow can be the following:

- Create subscription request for a person (moral or physical)
- Validate subscription request, a capital release request (an invoice: `account.move`).
This invoice is sent to the future cooperator.
- Validate subscription request, a capital release request (an invoice:
account.move). This invoice is sent to the future cooperator.
- Payment of the cooperator is registered and the capital Release
request is marked as paid.
- A new cooperator (a special partner) is created, and the right type
Expand All @@ -26,5 +26,6 @@ Features:

Configurations:

- on the company, set a default payment term for the capital release requests.
- on the company, set a default payment term for the capital release
requests.
- on the company, set the cooperator account.
160 changes: 160 additions & 0 deletions cooperator/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
## 16.0.1.0.2 (2024-03-12)

**Bugfixes**

- Remove duplicated member field in `res.partner` form view.
([\#47](https://github.com/OCA/cooperative/issues/47))

## 16.0.1.0.0 (2023-11-29)

**Features**

- Add a "Share Type" column to the cooperator register report.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Add a new "Registers" menu entry and move the "Subscription Register"
menu entry there.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Use default filters instead of domains in contact views.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Merge the confirmation email template for individuals and companies
into one. ([\#86](https://github.com/OCA/cooperative/issues/86))
- Rename some files and XML IDs to improve consistency.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Update email templates to the default Odoo layout (what also makes
them shorter). ([\#86](https://github.com/OCA/cooperative/issues/86))
- Add a description to email templates.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Move the "Cooperator Candidates" menu entry to the "Cooperators" menu.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Add a new "Cooperator Register" view (and menu entry) to display the
cooperative memberships and allow to print the cooperator register
(report that was previously on the partner model).
([\#86](https://github.com/OCA/cooperative/issues/86))
- Make the capital release request report inherit from the invoice
report instead of copying and modifying it.
([\#86](https://github.com/OCA/cooperative/issues/86))

**Bugfixes**

- Ensure that only shares related to the current company appear on the
cooperator certificate.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Ensure reversals of capital release requests use a name prefix to not
clash with normal entries ("RSUBJ" instead of "SUBJ").
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix subscription requests created by transfer operations: ensure that
no confirmation email is sent, that they don't appear in the list of
subscription requests and cannot be erroneously validated.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix the display of the first name in email templates and add tests to
cover this. ([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix error when creating a new partner from the normal partner form.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix the layout of all reports by rewriting them from the default
invoice layout. ([\#86](https://github.com/OCA/cooperative/issues/86))
- Ensure creating a cooperator for a non-current company works (when a
capital release request is paid).
([\#86](https://github.com/OCA/cooperative/issues/86))
- Ensure that `share.line.share_number` cannot be negative.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Don't send a cooperator certificate if there are no remaining shares
after an operation.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix the company name in confirmation email template: display the name
of the company that made the subscription request instead of the name
of the cooperative.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Ensure that the company_type value of a subscription request is copied
to the legal_form field of the created partner.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Add unique per-company constraints on the cooperator register number
and the operation register number.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix copyright statements: add missing ones and use the same format
everywhere. ([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix consistency of XML files: XML declaration, spacing.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Display an error message instead of failing when trying to create a
subscription request from a partner and no default share product is
found. ([\#86](https://github.com/OCA/cooperative/issues/86))
- Rename internal string value of "Blocked" subscription request state
from `block` to `blocked`.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Ensure per-company sequences are used (for the cooperator register
number and the operation register number).
([\#86](https://github.com/OCA/cooperative/issues/86))
- Prevent to create a subscription request where Email and Company Email
have the same value, to avoid trying to create a recursive partner
hierarchy when validating the subscription request (the partner being
the parent of itself).
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix the footer layout to add company logos: wrap the original layout
instead of overwriting it.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Fix required company fields on subscription request form.
([\#86](https://github.com/OCA/cooperative/issues/86))

**Deprecations and Removals**

- Remove the extra columns in the contacts list view; they can now be
found in the cooperator register.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Remove deprecated `subscription.request.create_comp_sub_req()`. Use
the normal `subscription.request.create()` instead.
([\#86](https://github.com/OCA/cooperative/issues/86))
- Remove the useless "subscription" operation request type.
([\#86](https://github.com/OCA/cooperative/issues/86))

## 14.0.2.0.0 (2023-07-25)

**Features**

- Each company now has their own mail templates for cooperator-related
e-mails. If no template is set, the default (global) template is used.
([\#73](https://github.com/OCA/cooperative/issues/73))
- ir.sequences used by this module are no longer global; each company
has its own sequence for cooperator memberships.
([\#74](https://github.com/OCA/cooperative/issues/74))
- Create subscription journal per company.
([\#75](https://github.com/OCA/cooperative/issues/75))
- Improve multi-company consistency by setting `company_id` on records
where needed and adding the `check_company` flag on `Many2one` fields.
([\#77](https://github.com/OCA/cooperative/issues/77))
- ir.rules for multi-company usage added. Users cannot access records of
this module if they are not members of the relevant company.
([\#78](https://github.com/OCA/cooperative/issues/78))
- Move cooperative membership properties from `res.partner` to new
`cooperative.membership` model and add company-dependent computed
fields on `res.partner` for backward compatibility.
([\#82](https://github.com/OCA/cooperative/issues/82))

## 14.0.1.6.0 (2023-02-23)

**Features**

- Removed all selection widgets.
([\#55](https://github.com/OCA/cooperative/issues/55))

## 12.0.5.3.0 (2022-09-05)

**Improved Documentation**

- Adding USAGE.rst to inform that localization modules are necessary.
([\#346](https://github.com/coopiteasy/vertical-cooperative/issues/346))

## 12.0.5.0.0 (2022-06-23)

**Deprecations and Removals**

- When no cooperator account is defined on the company, this module
previously defaulted to the account with code '416000'. This behaviour
has been removed because the code is Belgian-only. The functionality
has been moved to `l10n_be_cooperator`.
([\#314](https://github.com/coopiteasy/vertical-cooperative/issues/314))

## 12.0.3.3.2 (2022-06-20)

**Bugfixes**

- Fix name computation crash
([\#330](https://github.com/coopiteasy/vertical-cooperative/issues/330))
Loading

0 comments on commit 5885fb2

Please sign in to comment.