diff --git a/account_usability/account.py b/account_usability/account.py index 1491e19..7f12dfa 100644 --- a/account_usability/account.py +++ b/account_usability/account.py @@ -114,7 +114,7 @@ class AccountInvoiceLine(models.Model): related='invoice_id.date_invoice', store=True, readonly=True) commercial_partner_id = fields.Many2one( related='invoice_id.partner_id.commercial_partner_id', - store=True, readonly=True) + store=True, readonly=True, related_sudo=True) state = fields.Selection( related='invoice_id.state', store=True, readonly=True, string='Invoice State') @@ -225,7 +225,7 @@ class AccountAccount(models.Model): journal_accounts_bank_type += account accounts = aao.search([ ('user_type_id', '=', bank_type.id)], order='company_id, code') - for account in aao.search([('user_type_id', '=', bank_type.id)]): + for account in accounts: if account not in journal_accounts_bank_type: account.user_type_id = asset_type.id logger.info( diff --git a/hr_expense_usability/hr_expense.py b/hr_expense_usability/hr_expense.py index e3210e0..a4b9614 100644 --- a/hr_expense_usability/hr_expense.py +++ b/hr_expense_usability/hr_expense.py @@ -103,7 +103,7 @@ class HrExpense(models.Model): string='Untaxed Amount', currency_field='currency_id', readonly=True, states={'draft': [('readonly', False)]}) company_currency_id = fields.Many2one( - related='company_id.currency_id', readonly=True, store=True) + related='company_id.currency_id', readonly=True, store=True, related_sudo=True) total_amount_company_currency = fields.Monetary( compute='compute_amount_company_currency', readonly=True, store=True, string='Total in Company Currency', @@ -309,7 +309,7 @@ class HrExpenseSheet(models.Model): responsible_id = fields.Many2one(track_visibility='onchange') accounting_date = fields.Date(track_visibility='onchange') company_currency_id = fields.Many2one( - related='company_id.currency_id', readonly=True, store=True) + related='company_id.currency_id', readonly=True, store=True, related_sudo=True) total_amount_company_currency = fields.Monetary( compute='compute_total_company_currency', currency_field='company_currency_id', readonly=True, store=True, diff --git a/hr_holidays_lunch_voucher/purchase_config_settings.py b/hr_holidays_lunch_voucher/purchase_config_settings.py index b90c155..c59f802 100644 --- a/hr_holidays_lunch_voucher/purchase_config_settings.py +++ b/hr_holidays_lunch_voucher/purchase_config_settings.py @@ -9,7 +9,7 @@ class PurchaseConfigSettings(models.TransientModel): _inherit = 'purchase.config.settings' lunch_voucher_product_id = fields.Many2one( - related='company_id.lunch_voucher_product_id') + related='company_id.lunch_voucher_product_id', related_sudo=True) lunch_voucher_employer_price = fields.Monetary( related='company_id.lunch_voucher_employer_price', - currency_field='company_currency_id') + currency_field='company_currency_id', related_sudo=True) diff --git a/hr_holidays_lunch_voucher_natixis/purchase_config_settings.py b/hr_holidays_lunch_voucher_natixis/purchase_config_settings.py index 295cf96..cc599f9 100644 --- a/hr_holidays_lunch_voucher_natixis/purchase_config_settings.py +++ b/hr_holidays_lunch_voucher_natixis/purchase_config_settings.py @@ -10,6 +10,6 @@ class PurchaseConfigSettings(models.TransientModel): _inherit = 'purchase.config.settings' lunch_voucher_natixis_customer_code = fields.Char( - related='company_id.lunch_voucher_natixis_customer_code') + related='company_id.lunch_voucher_natixis_customer_code', related_sudo=True) lunch_voucher_natixis_delivery_code = fields.Char( - related='company_id.lunch_voucher_natixis_delivery_code') + related='company_id.lunch_voucher_natixis_delivery_code', related_sudo=True) diff --git a/hr_holidays_usability/hr_holidays.py b/hr_holidays_usability/hr_holidays.py index 971b501..2746f6c 100644 --- a/hr_holidays_usability/hr_holidays.py +++ b/hr_holidays_usability/hr_holidays.py @@ -223,7 +223,7 @@ class HrHolidays(models.Model): readonly=True) limit = fields.Boolean( # pose des pbs de droits related='holiday_status_id.limit', string='Allow to Override Limit', - readonly=True) + readonly=True, related_sudo=True) payslip_date = fields.Date( string='Transfer to Payslip Date', track_visibility='onchange', readonly=True) @@ -245,7 +245,7 @@ class HrHolidays(models.Model): # by default, there is no company_id field on hr.holidays ! company_id = fields.Many2one( related='employee_id.resource_id.company_id', store=True, - readonly=True) + readonly=True, related_sudo=True) state = fields.Selection(default='draft') # hr_holidays, default='confirm' @api.constrains( @@ -441,4 +441,4 @@ class BaseConfigSettings(models.TransientModel): _inherit = 'base.config.settings' mass_allocation_default_holiday_status_id = fields.Many2one( - related='company_id.mass_allocation_default_holiday_status_id') + related='company_id.mass_allocation_default_holiday_status_id', related_sudo=True) diff --git a/product_usability/product.py b/product_usability/product.py index 9ad246a..9d1cca0 100644 --- a/product_usability/product.py +++ b/product_usability/product.py @@ -69,5 +69,5 @@ class ProductPriceHistory(models.Model): _inherit = 'product.price.history' company_currency_id = fields.Many2one( - related='company_id.currency_id', readonly=True, + related='company_id.currency_id', readonly=True, related_sudo=True, string='Company Currency') diff --git a/sale_margin_no_onchange/sale.py b/sale_margin_no_onchange/sale.py index 1d9663d..0060061 100644 --- a/sale_margin_no_onchange/sale.py +++ b/sale_margin_no_onchange/sale.py @@ -14,7 +14,7 @@ class SaleOrderLine(models.Model): # Also defined in bi_sale_company_currency company_currency_id = fields.Many2one( related='order_id.company_id.currency_id', - readonly=True, store=True, string='Company Currency') + readonly=True, store=True, related_sudo=True, string='Company Currency') standard_price_company_currency = fields.Float( string='Cost Price in Company Currency', readonly=True, digits=dp.get_precision('Product Price'), @@ -108,7 +108,7 @@ class SaleOrder(models.Model): # Also defined in bi_sale_company_currency company_currency_id = fields.Many2one( - related='company_id.currency_id', readonly=True, store=True, + related='company_id.currency_id', readonly=True, store=True, related_sudo=True, string="Company Currency") margin_sale_currency = fields.Monetary( string='Margin in Sale Currency', diff --git a/sale_order_add_bom/mrp_bom.py b/sale_order_add_bom/mrp_bom.py index b2799b8..90ebce4 100644 --- a/sale_order_add_bom/mrp_bom.py +++ b/sale_order_add_bom/mrp_bom.py @@ -9,4 +9,4 @@ class MrpBom(models.Model): _inherit = 'mrp.bom' _rec_name = 'product_id' - sale_ok = fields.Boolean(related='product_id.sale_ok', store=True) + sale_ok = fields.Boolean(related='product_id.sale_ok', store=True, related_sudo=True)