Add related_sudo where it may be needed
PEP8 fix
This commit is contained in:
@@ -114,7 +114,7 @@ class AccountInvoiceLine(models.Model):
|
|||||||
related='invoice_id.date_invoice', store=True, readonly=True)
|
related='invoice_id.date_invoice', store=True, readonly=True)
|
||||||
commercial_partner_id = fields.Many2one(
|
commercial_partner_id = fields.Many2one(
|
||||||
related='invoice_id.partner_id.commercial_partner_id',
|
related='invoice_id.partner_id.commercial_partner_id',
|
||||||
store=True, readonly=True)
|
store=True, readonly=True, related_sudo=True)
|
||||||
state = fields.Selection(
|
state = fields.Selection(
|
||||||
related='invoice_id.state', store=True, readonly=True,
|
related='invoice_id.state', store=True, readonly=True,
|
||||||
string='Invoice State')
|
string='Invoice State')
|
||||||
@@ -225,7 +225,7 @@ class AccountAccount(models.Model):
|
|||||||
journal_accounts_bank_type += account
|
journal_accounts_bank_type += account
|
||||||
accounts = aao.search([
|
accounts = aao.search([
|
||||||
('user_type_id', '=', bank_type.id)], order='company_id, code')
|
('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:
|
if account not in journal_accounts_bank_type:
|
||||||
account.user_type_id = asset_type.id
|
account.user_type_id = asset_type.id
|
||||||
logger.info(
|
logger.info(
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class HrExpense(models.Model):
|
|||||||
string='Untaxed Amount', currency_field='currency_id',
|
string='Untaxed Amount', currency_field='currency_id',
|
||||||
readonly=True, states={'draft': [('readonly', False)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
company_currency_id = fields.Many2one(
|
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(
|
total_amount_company_currency = fields.Monetary(
|
||||||
compute='compute_amount_company_currency', readonly=True,
|
compute='compute_amount_company_currency', readonly=True,
|
||||||
store=True, string='Total in Company Currency',
|
store=True, string='Total in Company Currency',
|
||||||
@@ -309,7 +309,7 @@ class HrExpenseSheet(models.Model):
|
|||||||
responsible_id = fields.Many2one(track_visibility='onchange')
|
responsible_id = fields.Many2one(track_visibility='onchange')
|
||||||
accounting_date = fields.Date(track_visibility='onchange')
|
accounting_date = fields.Date(track_visibility='onchange')
|
||||||
company_currency_id = fields.Many2one(
|
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(
|
total_amount_company_currency = fields.Monetary(
|
||||||
compute='compute_total_company_currency',
|
compute='compute_total_company_currency',
|
||||||
currency_field='company_currency_id', readonly=True, store=True,
|
currency_field='company_currency_id', readonly=True, store=True,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class PurchaseConfigSettings(models.TransientModel):
|
|||||||
_inherit = 'purchase.config.settings'
|
_inherit = 'purchase.config.settings'
|
||||||
|
|
||||||
lunch_voucher_product_id = fields.Many2one(
|
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(
|
lunch_voucher_employer_price = fields.Monetary(
|
||||||
related='company_id.lunch_voucher_employer_price',
|
related='company_id.lunch_voucher_employer_price',
|
||||||
currency_field='company_currency_id')
|
currency_field='company_currency_id', related_sudo=True)
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ class PurchaseConfigSettings(models.TransientModel):
|
|||||||
_inherit = 'purchase.config.settings'
|
_inherit = 'purchase.config.settings'
|
||||||
|
|
||||||
lunch_voucher_natixis_customer_code = fields.Char(
|
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(
|
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)
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class HrHolidays(models.Model):
|
|||||||
readonly=True)
|
readonly=True)
|
||||||
limit = fields.Boolean( # pose des pbs de droits
|
limit = fields.Boolean( # pose des pbs de droits
|
||||||
related='holiday_status_id.limit', string='Allow to Override Limit',
|
related='holiday_status_id.limit', string='Allow to Override Limit',
|
||||||
readonly=True)
|
readonly=True, related_sudo=True)
|
||||||
payslip_date = fields.Date(
|
payslip_date = fields.Date(
|
||||||
string='Transfer to Payslip Date', track_visibility='onchange',
|
string='Transfer to Payslip Date', track_visibility='onchange',
|
||||||
readonly=True)
|
readonly=True)
|
||||||
@@ -245,7 +245,7 @@ class HrHolidays(models.Model):
|
|||||||
# by default, there is no company_id field on hr.holidays !
|
# by default, there is no company_id field on hr.holidays !
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
related='employee_id.resource_id.company_id', store=True,
|
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'
|
state = fields.Selection(default='draft') # hr_holidays, default='confirm'
|
||||||
|
|
||||||
@api.constrains(
|
@api.constrains(
|
||||||
@@ -441,4 +441,4 @@ class BaseConfigSettings(models.TransientModel):
|
|||||||
_inherit = 'base.config.settings'
|
_inherit = 'base.config.settings'
|
||||||
|
|
||||||
mass_allocation_default_holiday_status_id = fields.Many2one(
|
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)
|
||||||
|
|||||||
@@ -69,5 +69,5 @@ class ProductPriceHistory(models.Model):
|
|||||||
_inherit = 'product.price.history'
|
_inherit = 'product.price.history'
|
||||||
|
|
||||||
company_currency_id = fields.Many2one(
|
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')
|
string='Company Currency')
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class SaleOrderLine(models.Model):
|
|||||||
# Also defined in bi_sale_company_currency
|
# Also defined in bi_sale_company_currency
|
||||||
company_currency_id = fields.Many2one(
|
company_currency_id = fields.Many2one(
|
||||||
related='order_id.company_id.currency_id',
|
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(
|
standard_price_company_currency = fields.Float(
|
||||||
string='Cost Price in Company Currency', readonly=True,
|
string='Cost Price in Company Currency', readonly=True,
|
||||||
digits=dp.get_precision('Product Price'),
|
digits=dp.get_precision('Product Price'),
|
||||||
@@ -108,7 +108,7 @@ class SaleOrder(models.Model):
|
|||||||
|
|
||||||
# Also defined in bi_sale_company_currency
|
# Also defined in bi_sale_company_currency
|
||||||
company_currency_id = fields.Many2one(
|
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")
|
string="Company Currency")
|
||||||
margin_sale_currency = fields.Monetary(
|
margin_sale_currency = fields.Monetary(
|
||||||
string='Margin in Sale Currency',
|
string='Margin in Sale Currency',
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ class MrpBom(models.Model):
|
|||||||
_inherit = 'mrp.bom'
|
_inherit = 'mrp.bom'
|
||||||
_rec_name = 'product_id'
|
_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)
|
||||||
|
|||||||
Reference in New Issue
Block a user