Skip to content

Commit

Permalink
[IMP] fiscal_company_*: more security regarding the impossibility to …
Browse files Browse the repository at this point in the history
…create items on group company, or other kinds of companies
  • Loading branch information
legalsylvain committed Nov 19, 2024
1 parent 5dab85e commit 5c1fc49
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fiscal_company_account/models/account_bank_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class AccountBankStatement(models.Model):
_name = "account.bank.statement"
_inherit = ["account.bank.statement", "fiscal.company.check.company.mixin"]

_fiscal_company_forbid_fiscal_type = ["fiscal_mother"]
_fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"]

company_id = fields.Many2one(related=False)
3 changes: 3 additions & 0 deletions fiscal_company_account/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ class AccountJournal(models.Model):
_inherit = [
"account.journal",
"fiscal.company.change.search.domain.mixin",
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["group"]

def _get_journal_dashboard_data_batched(self):
# Modify Context to add domain based on allowed companies
# when making request on account.move
Expand Down
2 changes: 1 addition & 1 deletion fiscal_company_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AccountMove(models.Model):
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["fiscal_mother"]
_fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"]

journal_id = fields.Many2one(check_company=False)

Expand Down
2 changes: 1 addition & 1 deletion fiscal_company_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AccountMoveLine(models.Model):
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["fiscal_mother"]
_fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"]

account_id = fields.Many2one(check_company=False)

Expand Down
8 changes: 7 additions & 1 deletion fiscal_company_account/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@


class AccountPayment(models.Model):
_inherit = "account.payment"
_name = "account.payment"
_inherit = [
"account.payment",
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["group"]

destination_account_id = fields.Many2one(check_company=False)

Expand Down
2 changes: 1 addition & 1 deletion fiscal_company_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class AccountTax(models.Model):
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["fiscal_child"]
_fiscal_company_forbid_fiscal_type = ["group", "fiscal_child"]
8 changes: 7 additions & 1 deletion fiscal_company_point_of_sale/models/pos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@


class PosConfig(models.Model):
_inherit = "pos.config"
_name = "pos.config"
_inherit = [
"pos.config",
"fiscal.company.check.company.mixin",
]

_fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"]

# Overwrite company constrains
@api.constrains("company_id", "invoice_journal_id")
Expand Down
2 changes: 1 addition & 1 deletion fiscal_company_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class SaleOrder(models.Model):
_name = "sale.order"
_inherit = ["sale.order", "fiscal.company.check.company.mixin"]

_fiscal_company_forbid_fiscal_type = ["fiscal_mother"]
_fiscal_company_forbid_fiscal_type = ["group", "fiscal_mother"]

0 comments on commit 5c1fc49

Please sign in to comment.