Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] *_operating_unit: add check_company in field OU #736

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_asset_operating_unit/models/account_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AccountAsset(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(
self.env.user.id
),
Expand Down
1 change: 1 addition & 0 deletions account_operating_unit/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AccountJournal(models.Model):

operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
check_company=True,
help="Operating Unit that will be used in payments, "
"when this journal is used.",
)
Expand Down
2 changes: 2 additions & 0 deletions account_operating_unit/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AccountMoveLine(models.Model):

operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
check_company=True,
)
is_ou_balance = fields.Boolean(readonly=True)

Expand Down Expand Up @@ -141,6 +142,7 @@ def _default_operating_unit_id(self):
default=_default_operating_unit_id,
help="This operating unit will be defaulted in the move lines.",
readonly=True,
check_company=True,
states={"draft": [("readonly", False)]},
)

Expand Down
1 change: 1 addition & 0 deletions account_operating_unit/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AccountPayment(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
compute="_compute_operating_unit_id",
check_company=True,
store=True,
)

Expand Down
1 change: 1 addition & 0 deletions contract_operating_unit/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ContractContract(models.Model):
operating_unit_id = fields.Many2one(
"operating.unit",
"Operating Unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(
self._uid
),
Expand Down
2 changes: 2 additions & 0 deletions hr_expense_operating_unit/models/hr_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class HrExpenseExpense(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(),
)

Expand Down Expand Up @@ -91,6 +92,7 @@ class HrExpenseSheet(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(),
)

Expand Down
1 change: 1 addition & 0 deletions mrp_operating_unit/models/mrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MrpProduction(models.Model):
"operating.unit",
"Operating Unit",
readonly=True,
check_company=True,
states={"confirmed": [("readonly", False)], "draft": [("readonly", False)]},
default=lambda self: self.env["res.users"].operating_unit_default_get(
self._uid
Expand Down
1 change: 1 addition & 0 deletions project_operating_unit/models/project_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ProjectProject(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(
self._uid
),
Expand Down
1 change: 1 addition & 0 deletions project_operating_unit/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ class ProjectTask(models.Model):
comodel_name="operating.unit",
related="project_id.operating_unit_id",
string="Operating Unit",
check_company=True,
)
6 changes: 5 additions & 1 deletion purchase_operating_unit/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PurchaseOrder(models.Model):
comodel_name="operating.unit",
string="Operating Unit",
states=READONLY_STATES,
check_company=True,
default=lambda self: (
self.env["res.users"].operating_unit_default_get(self.env.uid)
),
Expand All @@ -28,6 +29,7 @@ class PurchaseOrder(models.Model):
comodel_name="operating.unit",
string="Requesting Operating Unit",
states=READONLY_STATES,
check_company=True,
default=lambda self: (
self.env["res.users"].operating_unit_default_get(self.env.uid)
),
Expand Down Expand Up @@ -58,5 +60,7 @@ class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

operating_unit_id = fields.Many2one(
related="order_id.operating_unit_id", string="Operating Unit"
related="order_id.operating_unit_id",
string="Operating Unit",
check_company=True,
)
2 changes: 2 additions & 0 deletions purchase_request_operating_unit/model/purchase_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class PurchaseRequest(models.Model):
"approved": [("readonly", True)],
"done": [("readonly", True)],
},
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(
self._uid
),
Expand Down Expand Up @@ -83,4 +84,5 @@ class PurchaseRequestLine(models.Model):
related="request_id.operating_unit_id",
string="Operating Unit",
store=True,
check_company=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PurchaseRequisition(models.Model):
comodel_name="operating.unit",
string="Operating Unit",
readonly=True,
check_company=True,
states={"draft": [("readonly", False)]},
default=lambda self: self.env["res.users"].operating_unit_default_get(
self.env.uid
Expand Down
1 change: 1 addition & 0 deletions sale_operating_unit/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def _default_operating_unit(self):
comodel_name="operating.unit",
string="Operating Unit",
default=_default_operating_unit,
check_company=True,
readonly=True,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
)
Expand Down
1 change: 1 addition & 0 deletions sales_team_operating_unit/models/crm_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CrmTeam(models.Model):

operating_unit_id = fields.Many2one(
"operating.unit",
check_company=True,
default=lambda self: self.env["res.users"].operating_unit_default_get(),
)

Expand Down
1 change: 1 addition & 0 deletions stock_operating_unit/model/stock_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class StockLocation(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
)

@api.constrains("operating_unit_id")
Expand Down
1 change: 1 addition & 0 deletions stock_operating_unit/model/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class StockPicking(models.Model):
comodel_name="operating.unit",
string="Requesting Operating Unit",
readonly=True,
check_company=True,
states={"draft": [("readonly", False)]},
)

Expand Down
1 change: 1 addition & 0 deletions stock_operating_unit/model/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def _default_operating_unit(self):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
check_company=True,
default=_default_operating_unit,
)

Expand Down
Loading