[REF] *: adapt code to new related default behaviour

This commit adapts the business code to changes introduced by
the parent commit in order to keep the same behaviour as before.

All readonly=False fields will have to be checked afterwards to confirm
that the business case requires write access to the source field.
This commit is contained in:
Adrian Torres
2018-09-27 12:10:23 +02:00
parent 52a8ed3c0c
commit 3f4f77fd9d
123 changed files with 293 additions and 293 deletions
+3 -3
View File
@@ -465,14 +465,14 @@ class AccountJournal(models.Model):
company_partner_id = fields.Many2one('res.partner', related='company_id.partner_id', string='Account Holder', readonly=True, store=False) company_partner_id = fields.Many2one('res.partner', related='company_id.partner_id', string='Account Holder', readonly=True, store=False)
bank_account_id = fields.Many2one('res.partner.bank', string="Bank Account", ondelete='restrict', copy=False, domain="[('partner_id','=', company_partner_id)]") bank_account_id = fields.Many2one('res.partner.bank', string="Bank Account", ondelete='restrict', copy=False, domain="[('partner_id','=', company_partner_id)]")
bank_statements_source = fields.Selection(selection=_get_bank_statements_available_sources, string='Bank Feeds', default='undefined', help="Defines how the bank statements will be registered") bank_statements_source = fields.Selection(selection=_get_bank_statements_available_sources, string='Bank Feeds', default='undefined', help="Defines how the bank statements will be registered")
bank_acc_number = fields.Char(related='bank_account_id.acc_number') bank_acc_number = fields.Char(related='bank_account_id.acc_number', readonly=False)
bank_id = fields.Many2one('res.bank', related='bank_account_id.bank_id') bank_id = fields.Many2one('res.bank', related='bank_account_id.bank_id', readonly=False)
post_at_bank_rec = fields.Boolean(string="Post At Bank Reconciliation", help="Whether or not the payments made in this journal should be generated in draft state, so that the related journal entries are only posted when performing bank reconciliation.") post_at_bank_rec = fields.Boolean(string="Post At Bank Reconciliation", help="Whether or not the payments made in this journal should be generated in draft state, so that the related journal entries are only posted when performing bank reconciliation.")
# alias configuration for 'purchase' type journals # alias configuration for 'purchase' type journals
alias_id = fields.Many2one('mail.alias', string='Alias') alias_id = fields.Many2one('mail.alias', string='Alias')
alias_domain = fields.Char('Alias domain', compute='_compute_alias_domain', default=lambda self: self.env["ir.config_parameter"].sudo().get_param("mail.catchall.domain")) alias_domain = fields.Char('Alias domain', compute='_compute_alias_domain', default=lambda self: self.env["ir.config_parameter"].sudo().get_param("mail.catchall.domain"))
alias_name = fields.Char('Alias Name for Vendor Bills', related='alias_id.alias_name', help="It creates draft vendor bill by sending an email.") alias_name = fields.Char('Alias Name for Vendor Bills', related='alias_id.alias_name', help="It creates draft vendor bill by sending an email.", readonly=False)
_sql_constraints = [ _sql_constraints = [
('code_company_uniq', 'unique (code, name, company_id)', 'The code and name of the journal must be unique per company !'), ('code_company_uniq', 'unique (code, name, company_id)', 'The code and name of the journal must be unique per company !'),
@@ -143,7 +143,7 @@ class AccountBankStatement(models.Model):
state = fields.Selection([('open', 'New'), ('confirm', 'Validated')], string='Status', required=True, readonly=True, copy=False, default='open') state = fields.Selection([('open', 'New'), ('confirm', 'Validated')], string='Status', required=True, readonly=True, copy=False, default='open')
currency_id = fields.Many2one('res.currency', compute='_compute_currency', oldname='currency', string="Currency") currency_id = fields.Many2one('res.currency', compute='_compute_currency', oldname='currency', string="Currency")
journal_id = fields.Many2one('account.journal', string='Journal', required=True, states={'confirm': [('readonly', True)]}, default=_default_journal) journal_id = fields.Many2one('account.journal', string='Journal', required=True, states={'confirm': [('readonly', True)]}, default=_default_journal)
journal_type = fields.Selection(related='journal_id.type', help="Technical field used for usability purposes") journal_type = fields.Selection(related='journal_id.type', help="Technical field used for usability purposes", readonly=False)
company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True, company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True,
default=lambda self: self.env['res.company']._company_default_get('account.bank.statement')) default=lambda self: self.env['res.company']._company_default_get('account.bank.statement'))
+2 -2
View File
@@ -1575,7 +1575,7 @@ class AccountInvoiceLine(models.Model):
ondelete='set null', index=True, oldname='uos_id') ondelete='set null', index=True, oldname='uos_id')
product_id = fields.Many2one('product.product', string='Product', product_id = fields.Many2one('product.product', string='Product',
ondelete='restrict', index=True) ondelete='restrict', index=True)
product_image = fields.Binary('Product Image', related="product_id.image", store=False) product_image = fields.Binary('Product Image', related="product_id.image", store=False, readonly=False)
account_id = fields.Many2one('account.account', string='Account', domain=[('deprecated', '=', False)], account_id = fields.Many2one('account.account', string='Account', domain=[('deprecated', '=', False)],
default=_default_account, default=_default_account,
help="The income or expense account related to the selected product.") help="The income or expense account related to the selected product.")
@@ -1602,7 +1602,7 @@ class AccountInvoiceLine(models.Model):
related='invoice_id.company_id', store=True, readonly=True, related_sudo=False) related='invoice_id.company_id', store=True, readonly=True, related_sudo=False)
partner_id = fields.Many2one('res.partner', string='Partner', partner_id = fields.Many2one('res.partner', string='Partner',
related='invoice_id.partner_id', store=True, readonly=True, related_sudo=False) related='invoice_id.partner_id', store=True, readonly=True, related_sudo=False)
currency_id = fields.Many2one('res.currency', related='invoice_id.currency_id', store=True, related_sudo=False) currency_id = fields.Many2one('res.currency', related='invoice_id.currency_id', store=True, related_sudo=False, readonly=False)
company_currency_id = fields.Many2one('res.currency', related='invoice_id.company_currency_id', readonly=True, related_sudo=False) company_currency_id = fields.Many2one('res.currency', related='invoice_id.company_currency_id', readonly=True, related_sudo=False)
is_rounding_line = fields.Boolean(string='Rounding Line', help='Is a rounding line in case of cash rounding.') is_rounding_line = fields.Boolean(string='Rounding Line', help='Is a rounding line in case of cash rounding.')
+6 -6
View File
@@ -611,8 +611,8 @@ class AccountMoveLine(models.Model):
ondelete="cascade", domain=[('deprecated', '=', False)], default=lambda self: self._context.get('account_id', False)) ondelete="cascade", domain=[('deprecated', '=', False)], default=lambda self: self._context.get('account_id', False))
move_id = fields.Many2one('account.move', string='Journal Entry', ondelete="cascade", move_id = fields.Many2one('account.move', string='Journal Entry', ondelete="cascade",
help="The move of this entry line.", index=True, required=True, auto_join=True) help="The move of this entry line.", index=True, required=True, auto_join=True)
narration = fields.Text(related='move_id.narration', string='Narration') narration = fields.Text(related='move_id.narration', string='Narration', readonly=False)
ref = fields.Char(related='move_id.ref', string='Reference', store=True, copy=False, index=True) ref = fields.Char(related='move_id.ref', string='Reference', store=True, copy=False, index=True, readonly=False)
payment_id = fields.Many2one('account.payment', string="Originator Payment", help="Payment that created this entry", copy=False) payment_id = fields.Many2one('account.payment', string="Originator Payment", help="Payment that created this entry", copy=False)
statement_line_id = fields.Many2one('account.bank.statement.line', index=True, string='Bank statement line reconciled with this entry', copy=False, readonly=True) statement_line_id = fields.Many2one('account.bank.statement.line', index=True, string='Bank statement line reconciled with this entry', copy=False, readonly=True)
statement_id = fields.Many2one('account.bank.statement', related='statement_line_id.statement_id', string='Statement', store=True, statement_id = fields.Many2one('account.bank.statement', related='statement_line_id.statement_id', string='Statement', store=True,
@@ -623,13 +623,13 @@ class AccountMoveLine(models.Model):
help='Debit journal items that are matched with this journal item.') help='Debit journal items that are matched with this journal item.')
matched_credit_ids = fields.One2many('account.partial.reconcile', 'debit_move_id', String='Matched Credits', matched_credit_ids = fields.One2many('account.partial.reconcile', 'debit_move_id', String='Matched Credits',
help='Credit journal items that are matched with this journal item.') help='Credit journal items that are matched with this journal item.')
journal_id = fields.Many2one('account.journal', related='move_id.journal_id', string='Journal', journal_id = fields.Many2one('account.journal', related='move_id.journal_id', string='Journal', readonly=False,
index=True, store=True, copy=False) # related is required index=True, store=True, copy=False) # related is required
blocked = fields.Boolean(string='No Follow-up', default=False, blocked = fields.Boolean(string='No Follow-up', default=False,
help="You can check this box to mark this journal item as a litigation with the associated partner") help="You can check this box to mark this journal item as a litigation with the associated partner")
date_maturity = fields.Date(string='Due date', index=True, required=True, date_maturity = fields.Date(string='Due date', index=True, required=True,
help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.") help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.")
date = fields.Date(related='move_id.date', string='Date', index=True, store=True, copy=False) # related is required date = fields.Date(related='move_id.date', string='Date', index=True, store=True, copy=False, readonly=False) # related is required
analytic_line_ids = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines', oldname="analytic_lines") analytic_line_ids = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines', oldname="analytic_lines")
tax_ids = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)]) tax_ids = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
tax_line_id = fields.Many2one('account.tax', string='Originator tax', ondelete='restrict') tax_line_id = fields.Many2one('account.tax', string='Originator tax', ondelete='restrict')
@@ -641,7 +641,7 @@ class AccountMoveLine(models.Model):
# TODO: put the invoice link and partner_id on the account_move # TODO: put the invoice link and partner_id on the account_move
invoice_id = fields.Many2one('account.invoice', oldname="invoice") invoice_id = fields.Many2one('account.invoice', oldname="invoice")
partner_id = fields.Many2one('res.partner', string='Partner', ondelete='restrict') partner_id = fields.Many2one('res.partner', string='Partner', ondelete='restrict')
user_type_id = fields.Many2one('account.account.type', related='account_id.user_type_id', index=True, store=True, oldname="user_type") user_type_id = fields.Many2one('account.account.type', related='account_id.user_type_id', index=True, store=True, oldname="user_type", readonly=False)
tax_exigible = fields.Boolean(string='Appears in VAT report', default=True, tax_exigible = fields.Boolean(string='Appears in VAT report', default=True,
help="Technical field used to mark a tax line as exigible in the vat report or not (only exigible journal items are displayed). By default all new journal items are directly exigible, but with the feature cash_basis on taxes, some will become exigible only when the payment is recorded.") help="Technical field used to mark a tax line as exigible in the vat report or not (only exigible journal items are displayed). By default all new journal items are directly exigible, but with the feature cash_basis on taxes, some will become exigible only when the payment is recorded.")
parent_state = fields.Char(compute="_compute_parent_state", help="State of the parent account.move") parent_state = fields.Char(compute="_compute_parent_state", help="State of the parent account.move")
@@ -1376,7 +1376,7 @@ class AccountPartialReconcile(models.Model):
currency_id = fields.Many2one('res.currency', string='Currency') currency_id = fields.Many2one('res.currency', string='Currency')
company_currency_id = fields.Many2one('res.currency', string="Company Currency", related='company_id.currency_id', readonly=True, company_currency_id = fields.Many2one('res.currency', string="Company Currency", related='company_id.currency_id', readonly=True,
help='Utility field to express amount currency') help='Utility field to express amount currency')
company_id = fields.Many2one('res.company', related='debit_move_id.company_id', store=True, string='Company') company_id = fields.Many2one('res.company', related='debit_move_id.company_id', store=True, string='Company', readonly=False)
full_reconcile_id = fields.Many2one('account.full.reconcile', string="Full Reconcile", copy=False) full_reconcile_id = fields.Many2one('account.full.reconcile', string="Full Reconcile", copy=False)
max_date = fields.Date(string='Max Date of Matched Lines', compute='_compute_max_date', max_date = fields.Date(string='Max Date of Matched Lines', compute='_compute_max_date',
readonly=True, copy=False, store=True, readonly=True, copy=False, store=True,
+4 -4
View File
@@ -38,9 +38,9 @@ class ResCompany(models.Model):
('round_globally', 'Round Globally'), ('round_globally', 'Round Globally'),
], default='round_per_line', string='Tax Calculation Rounding Method') ], default='round_per_line', string='Tax Calculation Rounding Method')
currency_exchange_journal_id = fields.Many2one('account.journal', string="Exchange Gain or Loss Journal", domain=[('type', '=', 'general')]) currency_exchange_journal_id = fields.Many2one('account.journal', string="Exchange Gain or Loss Journal", domain=[('type', '=', 'general')])
income_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_credit_account_id', income_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_credit_account_id', readonly=False,
string="Gain Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]") string="Gain Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]")
expense_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_debit_account_id', expense_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_debit_account_id', readonly=False,
string="Loss Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]") string="Loss Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]")
anglo_saxon_accounting = fields.Boolean(string="Use anglo-saxon accounting") anglo_saxon_accounting = fields.Boolean(string="Use anglo-saxon accounting")
property_stock_account_input_categ_id = fields.Many2one('account.account', string="Input Account for Stock Valuation", oldname="property_stock_account_input_categ") property_stock_account_input_categ_id = fields.Many2one('account.account', string="Input Account for Stock Valuation", oldname="property_stock_account_input_categ")
@@ -73,8 +73,8 @@ Best Regards,'''))
#Fields of the setup step for opening move #Fields of the setup step for opening move
account_opening_move_id = fields.Many2one(string='Opening Journal Entry', comodel_name='account.move', help="The journal entry containing the initial balance of all this company's accounts.") account_opening_move_id = fields.Many2one(string='Opening Journal Entry', comodel_name='account.move', help="The journal entry containing the initial balance of all this company's accounts.")
account_opening_journal_id = fields.Many2one(string='Opening Journal', comodel_name='account.journal', related='account_opening_move_id.journal_id', help="Journal where the opening entry of this company's accounting has been posted.") account_opening_journal_id = fields.Many2one(string='Opening Journal', comodel_name='account.journal', related='account_opening_move_id.journal_id', help="Journal where the opening entry of this company's accounting has been posted.", readonly=False)
account_opening_date = fields.Date(string='Opening Date', related='account_opening_move_id.date', help="Date at which the opening entry of this company's accounting has been posted.") account_opening_date = fields.Date(string='Opening Date', related='account_opening_move_id.date', help="Date at which the opening entry of this company's accounting has been posted.", readonly=False)
# Fields marking the completion of a setup step # Fields marking the completion of a setup step
# YTI FIXME : The selection should be factorize as a static list in base, like ONBOARDING_STEP_STATES # YTI FIXME : The selection should be factorize as a static list in base, like ONBOARDING_STEP_STATES
+12 -12
View File
@@ -8,23 +8,23 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
has_accounting_entries = fields.Boolean(compute='_compute_has_chart_of_accounts') has_accounting_entries = fields.Boolean(compute='_compute_has_chart_of_accounts')
currency_id = fields.Many2one('res.currency', related="company_id.currency_id", required=True, currency_id = fields.Many2one('res.currency', related="company_id.currency_id", required=True, readonly=False,
string='Currency', help="Main currency of the company.") string='Currency', help="Main currency of the company.")
currency_exchange_journal_id = fields.Many2one( currency_exchange_journal_id = fields.Many2one(
'account.journal', 'account.journal',
related='company_id.currency_exchange_journal_id', related='company_id.currency_exchange_journal_id', readonly=False,
string="Exchange Gain or Loss Journal", string="Exchange Gain or Loss Journal",
domain="[('company_id', '=', company_id), ('type', '=', 'general')]", domain="[('company_id', '=', company_id), ('type', '=', 'general')]",
help='The accounting journal where automatic exchange differences will be registered') help='The accounting journal where automatic exchange differences will be registered')
has_chart_of_accounts = fields.Boolean(compute='_compute_has_chart_of_accounts', string='Company has a chart of accounts') has_chart_of_accounts = fields.Boolean(compute='_compute_has_chart_of_accounts', string='Company has a chart of accounts')
chart_template_id = fields.Many2one('account.chart.template', string='Template', chart_template_id = fields.Many2one('account.chart.template', string='Template',
domain="[('visible','=', True)]") domain="[('visible','=', True)]")
sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", related='company_id.account_sale_tax_id') sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", related='company_id.account_sale_tax_id', readonly=False)
purchase_tax_id = fields.Many2one('account.tax', string="Default Purchase Tax", related='company_id.account_purchase_tax_id') purchase_tax_id = fields.Many2one('account.tax', string="Default Purchase Tax", related='company_id.account_purchase_tax_id', readonly=False)
tax_calculation_rounding_method = fields.Selection([ tax_calculation_rounding_method = fields.Selection([
('round_per_line', 'Round calculation of taxes per line'), ('round_per_line', 'Round calculation of taxes per line'),
('round_globally', 'Round globally calculation of taxes '), ('round_globally', 'Round globally calculation of taxes '),
], related='company_id.tax_calculation_rounding_method', string='Tax calculation rounding method') ], related='company_id.tax_calculation_rounding_method', string='Tax calculation rounding method', readonly=False)
module_account_accountant = fields.Boolean(string='Accounting') module_account_accountant = fields.Boolean(string='Accounting')
group_analytic_accounting = fields.Boolean(string='Analytic Accounting', group_analytic_accounting = fields.Boolean(string='Analytic Accounting',
implied_group='analytic.group_analytic_accounting') implied_group='analytic.group_analytic_accounting')
@@ -76,19 +76,19 @@ class ResConfigSettings(models.TransientModel):
module_l10n_eu_service = fields.Boolean(string="EU Digital Goods VAT") module_l10n_eu_service = fields.Boolean(string="EU Digital Goods VAT")
module_account_taxcloud = fields.Boolean(string="Account TaxCloud") module_account_taxcloud = fields.Boolean(string="Account TaxCloud")
module_account_invoice_extract = fields.Boolean(string="Automate Bill Processing") module_account_invoice_extract = fields.Boolean(string="Automate Bill Processing")
tax_exigibility = fields.Boolean(string='Cash Basis', related='company_id.tax_exigibility') tax_exigibility = fields.Boolean(string='Cash Basis', related='company_id.tax_exigibility', readonly=False)
tax_cash_basis_journal_id = fields.Many2one('account.journal', related='company_id.tax_cash_basis_journal_id', string="Tax Cash Basis Journal") tax_cash_basis_journal_id = fields.Many2one('account.journal', related='company_id.tax_cash_basis_journal_id', string="Tax Cash Basis Journal", readonly=False)
invoice_reference_type = fields.Selection(string='Communication', invoice_reference_type = fields.Selection(string='Communication',
related='company_id.invoice_reference_type', help='Default Reference Type on Invoices.') related='company_id.invoice_reference_type', help='Default Reference Type on Invoices.', readonly=False)
account_bank_reconciliation_start = fields.Date(string="Bank Reconciliation Threshold", account_bank_reconciliation_start = fields.Date(string="Bank Reconciliation Threshold",
related='company_id.account_bank_reconciliation_start', related='company_id.account_bank_reconciliation_start', readonly=False,
help="""The bank reconciliation widget won't ask to reconcile payments older than this date. help="""The bank reconciliation widget won't ask to reconcile payments older than this date.
This is useful if you install accounting after having used invoicing for some time and This is useful if you install accounting after having used invoicing for some time and
don't want to reconcile all the past payments with bank statements.""") don't want to reconcile all the past payments with bank statements.""")
qr_code = fields.Boolean(string='Display SEPA QR code', related='company_id.qr_code') qr_code = fields.Boolean(string='Display SEPA QR code', related='company_id.qr_code', readonly=False)
invoice_is_print = fields.Boolean(string='Print', related='company_id.invoice_is_print') invoice_is_print = fields.Boolean(string='Print', related='company_id.invoice_is_print', readonly=False)
invoice_is_email = fields.Boolean(string='Send Email', related='company_id.invoice_is_email') invoice_is_email = fields.Boolean(string='Send Email', related='company_id.invoice_is_email', readonly=False)
@api.multi @api.multi
def set_values(self): def set_values(self):
+2 -2
View File
@@ -10,11 +10,11 @@ class FinancialYearOpeningWizard(models.TransientModel):
company_id = fields.Many2one(comodel_name='res.company', required=True) company_id = fields.Many2one(comodel_name='res.company', required=True)
opening_move_posted = fields.Boolean(string='Opening Move Posted', compute='_compute_opening_move_posted') opening_move_posted = fields.Boolean(string='Opening Move Posted', compute='_compute_opening_move_posted')
opening_date = fields.Date(string='Opening Date', required=True, related='company_id.account_opening_date', help="Date from which the accounting is managed in Odoo. It is the date of the opening entry.") opening_date = fields.Date(string='Opening Date', required=True, related='company_id.account_opening_date', help="Date from which the accounting is managed in Odoo. It is the date of the opening entry.", readonly=False)
fiscalyear_last_day = fields.Integer(related="company_id.fiscalyear_last_day", required=True, fiscalyear_last_day = fields.Integer(related="company_id.fiscalyear_last_day", required=True,
help="The last day of the month will be taken if the chosen day doesn't exist.") help="The last day of the month will be taken if the chosen day doesn't exist.")
fiscalyear_last_month = fields.Selection(selection=[(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], fiscalyear_last_month = fields.Selection(selection=[(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')],
related="company_id.fiscalyear_last_month", related="company_id.fiscalyear_last_month", readonly=False,
required=True, required=True,
help="The last day of the month will be taken if the chosen day doesn't exist.") help="The last day of the month will be taken if the chosen day doesn't exist.")
+2 -2
View File
@@ -109,7 +109,7 @@ class AccountAssetAsset(models.Model):
salvage_value = fields.Float(string='Salvage Value', digits=0, readonly=True, states={'draft': [('readonly', False)]}, salvage_value = fields.Float(string='Salvage Value', digits=0, readonly=True, states={'draft': [('readonly', False)]},
help="It is the amount you plan to have that you cannot depreciate.") help="It is the amount you plan to have that you cannot depreciate.")
invoice_id = fields.Many2one('account.invoice', string='Invoice', states={'draft': [('readonly', False)]}, copy=False) invoice_id = fields.Many2one('account.invoice', string='Invoice', states={'draft': [('readonly', False)]}, copy=False)
type = fields.Selection(related="category_id.type", string='Type', required=True) type = fields.Selection(related="category_id.type", string='Type', required=True, readonly=False)
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account') account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tag') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tag')
date_first_depreciation = fields.Selection([ date_first_depreciation = fields.Selection([
@@ -477,7 +477,7 @@ class AccountAssetDepreciationLine(models.Model):
name = fields.Char(string='Depreciation Name', required=True, index=True) name = fields.Char(string='Depreciation Name', required=True, index=True)
sequence = fields.Integer(required=True) sequence = fields.Integer(required=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset', required=True, ondelete='cascade') asset_id = fields.Many2one('account.asset.asset', string='Asset', required=True, ondelete='cascade')
parent_state = fields.Selection(related='asset_id.state', string='State of Asset') parent_state = fields.Selection(related='asset_id.state', string='State of Asset', readonly=False)
amount = fields.Float(string='Current Depreciation', digits=0, required=True) amount = fields.Float(string='Current Depreciation', digits=0, required=True)
remaining_value = fields.Float(string='Next Period Depreciation', digits=0, required=True) remaining_value = fields.Float(string='Next Period Depreciation', digits=0, required=True)
depreciated_value = fields.Float(string='Cumulative Depreciation', required=True) depreciated_value = fields.Float(string='Cumulative Depreciation', required=True)
@@ -11,13 +11,13 @@ class ResConfigSettings(models.TransientModel):
account_check_printing_layout = fields.Selection(related='company_id.account_check_printing_layout', string="Check Layout", account_check_printing_layout = fields.Selection(related='company_id.account_check_printing_layout', string="Check Layout",
help="Select the format corresponding to the check paper you will be printing your checks on.\n" help="Select the format corresponding to the check paper you will be printing your checks on.\n"
"In order to disable the printing feature, select 'None'.") "In order to disable the printing feature, select 'None'.")
account_check_printing_date_label = fields.Boolean(related='company_id.account_check_printing_date_label', string="Print Date Label", account_check_printing_date_label = fields.Boolean(related='company_id.account_check_printing_date_label', string="Print Date Label", readonly=False,
help="This option allows you to print the date label on the check as per CPA. Disable this if your pre-printed check includes the date label.") help="This option allows you to print the date label on the check as per CPA. Disable this if your pre-printed check includes the date label.")
account_check_printing_multi_stub = fields.Boolean(related='company_id.account_check_printing_multi_stub', string='Multi-Pages Check Stub', account_check_printing_multi_stub = fields.Boolean(related='company_id.account_check_printing_multi_stub', string='Multi-Pages Check Stub', readonly=False,
help="This option allows you to print check details (stub) on multiple pages if they don't fit on a single page.") help="This option allows you to print check details (stub) on multiple pages if they don't fit on a single page.")
account_check_printing_margin_top = fields.Float(related='company_id.account_check_printing_margin_top', string='Check Top Margin', account_check_printing_margin_top = fields.Float(related='company_id.account_check_printing_margin_top', string='Check Top Margin', readonly=False,
help="Adjust the margins of generated checks to make it fit your printer's settings.") help="Adjust the margins of generated checks to make it fit your printer's settings.")
account_check_printing_margin_left = fields.Float(related='company_id.account_check_printing_margin_left', string='Check Left Margin', account_check_printing_margin_left = fields.Float(related='company_id.account_check_printing_margin_left', string='Check Left Margin', readonly=False,
help="Adjust the margins of generated checks to make it fit your printer's settings.") help="Adjust the margins of generated checks to make it fit your printer's settings.")
account_check_printing_margin_right = fields.Float(related='company_id.account_check_printing_margin_right', string='Check Right Margin', account_check_printing_margin_right = fields.Float(related='company_id.account_check_printing_margin_right', string='Check Right Margin', readonly=False,
help="Adjust the margins of generated checks to make it fit your printer's settings.") help="Adjust the margins of generated checks to make it fit your printer's settings.")
@@ -416,7 +416,7 @@ class AccountVoucherLine(models.Model):
analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags')
company_id = fields.Many2one('res.company', related='voucher_id.company_id', string='Company', store=True, readonly=True) company_id = fields.Many2one('res.company', related='voucher_id.company_id', string='Company', store=True, readonly=True)
tax_ids = fields.Many2many('account.tax', string='Tax', help="Only for tax excluded from price") tax_ids = fields.Many2many('account.tax', string='Tax', help="Only for tax excluded from price")
currency_id = fields.Many2one('res.currency', related='voucher_id.currency_id') currency_id = fields.Many2one('res.currency', related='voucher_id.currency_id', readonly=False)
@api.one @api.one
@api.depends('price_unit', 'tax_ids', 'quantity', 'product_id', 'voucher_id.currency_id') @api.depends('price_unit', 'tax_ids', 'quantity', 'product_id', 'voucher_id.currency_id')
+1 -1
View File
@@ -14,7 +14,7 @@ class AccountAnalyticDistribution(models.Model):
account_id = fields.Many2one('account.analytic.account', string='Analytic Account', required=True) account_id = fields.Many2one('account.analytic.account', string='Analytic Account', required=True)
percentage = fields.Float(string='Percentage', required=True, default=100.0) percentage = fields.Float(string='Percentage', required=True, default=100.0)
name = fields.Char(string='Name', related='account_id.name') name = fields.Char(string='Name', related='account_id.name', readonly=False)
tag_id = fields.Many2one('account.analytic.tag', string="Parent tag", required=True) tag_id = fields.Many2one('account.analytic.tag', string="Parent tag", required=True)
_sql_constraints = [ _sql_constraints = [
@@ -7,4 +7,4 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
ldaps = fields.One2many(related='company_id.ldaps', string="LDAP Parameters") ldaps = fields.One2many(related='company_id.ldaps', string="LDAP Parameters", readonly=False)
@@ -7,11 +7,11 @@ from odoo import api, models, fields
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
gengo_private_key = fields.Text(string="Gengo Private Key", related="company_id.gengo_private_key") gengo_private_key = fields.Text(string="Gengo Private Key", related="company_id.gengo_private_key", readonly=False)
gengo_public_key = fields.Text(string="Gengo Public Key", related="company_id.gengo_public_key") gengo_public_key = fields.Text(string="Gengo Public Key", related="company_id.gengo_public_key", readonly=False)
gengo_comment = fields.Text(string="Comments", related="company_id.gengo_comment", gengo_comment = fields.Text(string="Comments", related="company_id.gengo_comment",
help="This comment will be automatically be enclosed in each an every request sent to Gengo") help="This comment will be automatically be enclosed in each an every request sent to Gengo")
gengo_auto_approve = fields.Boolean(string="Auto Approve Translation ?", related="company_id.gengo_auto_approve", gengo_auto_approve = fields.Boolean(string="Auto Approve Translation ?", related="company_id.gengo_auto_approve", readonly=False,
help="Jobs are Automatically Approved by Gengo.") help="Jobs are Automatically Approved by Gengo.")
gengo_sandbox = fields.Boolean(string="Sandbox Mode", related="company_id.gengo_sandbox", gengo_sandbox = fields.Boolean(string="Sandbox Mode", related="company_id.gengo_sandbox", readonly=False,
help="Check this box if you're using the sandbox mode of Gengo, mainly used for testing purpose.") help="Check this box if you're using the sandbox mode of Gengo, mainly used for testing purpose.")
@@ -36,12 +36,12 @@ class ResConfigSettings(models.TransientModel):
help="Share your partners to all companies defined in your instance.\n" help="Share your partners to all companies defined in your instance.\n"
" * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n" " * Checked : Partners are visible for every companies, even if a company is defined on the partner.\n"
" * Unchecked : Each company can see only its partner (partners where company is defined). Partners not related to a company are visible for all companies.") " * Unchecked : Each company can see only its partner (partners where company is defined). Partners not related to a company are visible for all companies.")
report_footer = fields.Text(related="company_id.report_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.") report_footer = fields.Text(related="company_id.report_footer", string='Custom Report Footer', help="Footer text displayed at the bottom of all reports.", readonly=False)
group_multi_currency = fields.Boolean(string='Multi-Currencies', group_multi_currency = fields.Boolean(string='Multi-Currencies',
implied_group='base.group_multi_currency', implied_group='base.group_multi_currency',
help="Allows to work in a multi currency environment") help="Allows to work in a multi currency environment")
paperformat_id = fields.Many2one(related="company_id.paperformat_id", string='Paper format') paperformat_id = fields.Many2one(related="company_id.paperformat_id", string='Paper format', readonly=False)
external_report_layout_id = fields.Many2one(related="company_id.external_report_layout_id") external_report_layout_id = fields.Many2one(related="company_id.external_report_layout_id", readonly=False)
show_effect = fields.Boolean(string="Show Effect", config_parameter='base_setup.show_effect') show_effect = fields.Boolean(string="Show Effect", config_parameter='base_setup.show_effect')
@api.model @api.model
@@ -6,5 +6,5 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
vat_check_vies = fields.Boolean(related='company_id.vat_check_vies', vat_check_vies = fields.Boolean(related='company_id.vat_check_vies', readonly=False,
string='Verify VAT Numbers') string='Verify VAT Numbers')
@@ -7,4 +7,4 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
crm_phone_valid_method = fields.Selection(related="company_id.phone_international_format", required=True) crm_phone_valid_method = fields.Selection(related="company_id.phone_international_format", required=True, readonly=False)
+1 -1
View File
@@ -42,7 +42,7 @@ class DeliveryCarrier(models.Model):
integration_level = fields.Selection([('rate', 'Get Rate'), ('rate_and_ship', 'Get Rate and Create Shipment')], string="Integration Level", default='rate_and_ship', help="Action while validating Delivery Orders") integration_level = fields.Selection([('rate', 'Get Rate'), ('rate_and_ship', 'Get Rate and Create Shipment')], string="Integration Level", default='rate_and_ship', help="Action while validating Delivery Orders")
prod_environment = fields.Boolean("Environment", help="Set to True if your credentials are certified for production.") prod_environment = fields.Boolean("Environment", help="Set to True if your credentials are certified for production.")
debug_logging = fields.Boolean('Debug logging', help="Log requests in order to ease debugging") debug_logging = fields.Boolean('Debug logging', help="Log requests in order to ease debugging")
company_id = fields.Many2one('res.company', string='Company', related='product_id.company_id', store=True) company_id = fields.Many2one('res.company', string='Company', related='product_id.company_id', store=True, readonly=False)
product_id = fields.Many2one('product.product', string='Delivery Product', required=True, ondelete='restrict') product_id = fields.Many2one('product.product', string='Delivery Product', required=True, ondelete='restrict')
country_ids = fields.Many2many('res.country', 'delivery_carrier_country_rel', 'carrier_id', 'country_id', 'Countries') country_ids = fields.Many2many('res.country', 'delivery_carrier_country_rel', 'carrier_id', 'country_id', 'Countries')
+1 -1
View File
@@ -32,7 +32,7 @@ class Digest(models.Model):
domain="[('model','=','digest.digest')]", domain="[('model','=','digest.digest')]",
default=lambda self: self.env.ref('digest.digest_mail_template'), default=lambda self: self.env.ref('digest.digest_mail_template'),
required=True) required=True)
currency_id = fields.Many2one(related="company_id.currency_id", string='Currency') currency_id = fields.Many2one(related="company_id.currency_id", string='Currency', readonly=False)
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id.id) company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.user.company_id.id)
available_fields = fields.Char(compute='_compute_available_fields') available_fields = fields.Char(compute='_compute_available_fields')
is_subscribed = fields.Boolean('Is user subscribed', compute='_compute_is_subscribed') is_subscribed = fields.Boolean('Is user subscribed', compute='_compute_is_subscribed')
+1 -1
View File
@@ -159,7 +159,7 @@ class EventEvent(models.Model):
default=lambda self: self.env.user.company_id.partner_id, default=lambda self: self.env.user.company_id.partner_id,
readonly=False, states={'done': [('readonly', True)]}, readonly=False, states={'done': [('readonly', True)]},
track_visibility="onchange") track_visibility="onchange")
country_id = fields.Many2one('res.country', 'Country', related='address_id.country_id', store=True) country_id = fields.Many2one('res.country', 'Country', related='address_id.country_id', store=True, readonly=False)
twitter_hashtag = fields.Char('Twitter Hashtag') twitter_hashtag = fields.Char('Twitter Hashtag')
description = fields.Html( description = fields.Html(
string='Description', oldname='note', translate=html_translate, sanitize_attributes=False, string='Description', oldname='note', translate=html_translate, sanitize_attributes=False,
+5 -5
View File
@@ -26,7 +26,7 @@ class FleetVehicle(models.Model):
driver_id = fields.Many2one('res.partner', 'Driver', track_visibility="onchange", help='Driver of the vehicle', copy=False) driver_id = fields.Many2one('res.partner', 'Driver', track_visibility="onchange", help='Driver of the vehicle', copy=False)
model_id = fields.Many2one('fleet.vehicle.model', 'Model', model_id = fields.Many2one('fleet.vehicle.model', 'Model',
track_visibility="onchange", required=True, help='Model of the vehicle') track_visibility="onchange", required=True, help='Model of the vehicle')
brand_id = fields.Many2one('fleet.vehicle.model.brand', 'Brand', related="model_id.brand_id", store=True) brand_id = fields.Many2one('fleet.vehicle.model.brand', 'Brand', related="model_id.brand_id", store=True, readonly=False)
log_drivers = fields.One2many('fleet.vehicle.assignation.log', 'vehicle_id', string='Assignation Logs') log_drivers = fields.One2many('fleet.vehicle.assignation.log', 'vehicle_id', string='Assignation Logs')
log_fuel = fields.One2many('fleet.vehicle.log.fuel', 'vehicle_id', 'Fuel Logs') log_fuel = fields.One2many('fleet.vehicle.log.fuel', 'vehicle_id', 'Fuel Logs')
log_services = fields.One2many('fleet.vehicle.log.services', 'vehicle_id', 'Services Logs') log_services = fields.One2many('fleet.vehicle.log.services', 'vehicle_id', 'Services Logs')
@@ -66,9 +66,9 @@ class FleetVehicle(models.Model):
horsepower_tax = fields.Float('Horsepower Taxation') horsepower_tax = fields.Float('Horsepower Taxation')
power = fields.Integer('Power', help='Power in kW of the vehicle') power = fields.Integer('Power', help='Power in kW of the vehicle')
co2 = fields.Float('CO2 Emissions', help='CO2 emissions of the vehicle') co2 = fields.Float('CO2 Emissions', help='CO2 emissions of the vehicle')
image = fields.Binary(related='model_id.image', string="Logo") image = fields.Binary(related='model_id.image', string="Logo", readonly=False)
image_medium = fields.Binary(related='model_id.image_medium', string="Logo (medium)") image_medium = fields.Binary(related='model_id.image_medium', string="Logo (medium)", readonly=False)
image_small = fields.Binary(related='model_id.image_small', string="Logo (small)") image_small = fields.Binary(related='model_id.image_small', string="Logo (small)", readonly=False)
contract_renewal_due_soon = fields.Boolean(compute='_compute_contract_reminder', search='_search_contract_renewal_due_soon', contract_renewal_due_soon = fields.Boolean(compute='_compute_contract_reminder', search='_search_contract_renewal_due_soon',
string='Has Contracts to renew', multi='contract_info') string='Has Contracts to renew', multi='contract_info')
contract_renewal_overdue = fields.Boolean(compute='_compute_contract_reminder', search='_search_get_overdue_contract_reminder', contract_renewal_overdue = fields.Boolean(compute='_compute_contract_reminder', search='_search_get_overdue_contract_reminder',
@@ -292,7 +292,7 @@ class FleetVehicleOdometer(models.Model):
value = fields.Float('Odometer Value', group_operator="max") value = fields.Float('Odometer Value', group_operator="max")
vehicle_id = fields.Many2one('fleet.vehicle', 'Vehicle', required=True) vehicle_id = fields.Many2one('fleet.vehicle', 'Vehicle', required=True)
unit = fields.Selection(related='vehicle_id.odometer_unit', string="Unit", readonly=True) unit = fields.Selection(related='vehicle_id.odometer_unit', string="Unit", readonly=True)
driver_id = fields.Many2one(related="vehicle_id.driver_id", string="Driver") driver_id = fields.Many2one(related="vehicle_id.driver_id", string="Driver", readonly=False)
@api.depends('vehicle_id', 'date') @api.depends('vehicle_id', 'date')
def _compute_vehicle_log_name(self): def _compute_vehicle_log_name(self):
+4 -4
View File
@@ -12,7 +12,7 @@ class FleetVehicleCost(models.Model):
_description = 'Cost related to a vehicle' _description = 'Cost related to a vehicle'
_order = 'date desc, vehicle_id asc' _order = 'date desc, vehicle_id asc'
name = fields.Char(related='vehicle_id.name', string='Name', store=True) name = fields.Char(related='vehicle_id.name', string='Name', store=True, readonly=False)
vehicle_id = fields.Many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this log') vehicle_id = fields.Many2one('fleet.vehicle', 'Vehicle', required=True, help='Vehicle concerned by this log')
cost_subtype_id = fields.Many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost') cost_subtype_id = fields.Many2one('fleet.service.type', 'Type', help='Cost type purchased with this cost')
amount = fields.Float('Total Price') amount = fields.Float('Total Price')
@@ -134,7 +134,7 @@ class FleetVehicleLogContract(models.Model):
# we need to keep this field as a related with store=True because the graph view doesn't support # we need to keep this field as a related with store=True because the graph view doesn't support
# (1) to address fields from inherited table # (1) to address fields from inherited table
# (2) fields that aren't stored in database # (2) fields that aren't stored in database
cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True) cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True, readonly=False)
odometer = fields.Float(string='Odometer at creation', odometer = fields.Float(string='Odometer at creation',
help='Odometer measure of the vehicle at the moment of the contract creation') help='Odometer measure of the vehicle at the moment of the contract creation')
@@ -317,7 +317,7 @@ class FleetVehicleLogFuel(models.Model):
# we need to keep this field as a related with store=True because the graph view doesn't support # we need to keep this field as a related with store=True because the graph view doesn't support
# (1) to address fields from inherited table # (1) to address fields from inherited table
# (2) fields that aren't stored in database # (2) fields that aren't stored in database
cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True) cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True, readonly=False)
@api.onchange('vehicle_id') @api.onchange('vehicle_id')
def _onchange_vehicle(self): def _onchange_vehicle(self):
@@ -366,7 +366,7 @@ class FleetVehicleLogServices(models.Model):
vendor_id = fields.Many2one('res.partner', 'Vendor', domain="[('supplier','=',True)]") vendor_id = fields.Many2one('res.partner', 'Vendor', domain="[('supplier','=',True)]")
# we need to keep this field as a related with store=True because the graph view doesn't support # we need to keep this field as a related with store=True because the graph view doesn't support
# (1) to address fields from inherited table and (2) fields that aren't stored in database # (1) to address fields from inherited table and (2) fields that aren't stored in database
cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True) cost_amount = fields.Float(related='cost_id.amount', string='Amount', store=True, readonly=False)
notes = fields.Text() notes = fields.Text()
cost_id = fields.Many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade') cost_id = fields.Many2one('fleet.vehicle.cost', 'Cost', required=True, ondelete='cascade')
+3 -3
View File
@@ -12,9 +12,9 @@ class FleetVehicleModel(models.Model):
name = fields.Char('Model name', required=True) name = fields.Char('Model name', required=True)
brand_id = fields.Many2one('fleet.vehicle.model.brand', 'Make', required=True, help='Make of the vehicle') brand_id = fields.Many2one('fleet.vehicle.model.brand', 'Make', required=True, help='Make of the vehicle')
vendors = fields.Many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors') vendors = fields.Many2many('res.partner', 'fleet_vehicle_model_vendors', 'model_id', 'partner_id', string='Vendors')
image = fields.Binary(related='brand_id.image', string="Logo") image = fields.Binary(related='brand_id.image', string="Logo", readonly=False)
image_medium = fields.Binary(related='brand_id.image_medium', string="Logo (medium)") image_medium = fields.Binary(related='brand_id.image_medium', string="Logo (medium)", readonly=False)
image_small = fields.Binary(related='brand_id.image_small', string="Logo (small)") image_small = fields.Binary(related='brand_id.image_small', string="Logo (small)", readonly=False)
@api.multi @api.multi
@api.depends('name', 'brand_id') @api.depends('name', 'brand_id')
+1 -1
View File
@@ -21,7 +21,7 @@ class BadgeUser(models.Model):
badge_id = fields.Many2one('gamification.badge', string='Badge', required=True, ondelete="cascade", index=True) badge_id = fields.Many2one('gamification.badge', string='Badge', required=True, ondelete="cascade", index=True)
challenge_id = fields.Many2one('gamification.challenge', string='Challenge originating', help="If this badge was rewarded through a challenge") challenge_id = fields.Many2one('gamification.challenge', string='Challenge originating', help="If this badge was rewarded through a challenge")
comment = fields.Text('Comment') comment = fields.Text('Comment')
badge_name = fields.Char(related='badge_id.name', string="Badge Name") badge_name = fields.Char(related='badge_id.name', string="Badge Name", readonly=False)
def _send_badge(self): def _send_badge(self):
"""Send a notification to a user for receiving a badge """Send a notification to a user for receiving a badge
+1 -1
View File
@@ -781,7 +781,7 @@ class ChallengeLine(models.Model):
sequence = fields.Integer('Sequence', help='Sequence number for ordering', default=1) sequence = fields.Integer('Sequence', help='Sequence number for ordering', default=1)
target_goal = fields.Float('Target Value to Reach', required=True) target_goal = fields.Float('Target Value to Reach', required=True)
name = fields.Char("Name", related='definition_id.name') name = fields.Char("Name", related='definition_id.name', readonly=False)
condition = fields.Selection("Condition", related='definition_id.condition', readonly=True) condition = fields.Selection("Condition", related='definition_id.condition', readonly=True)
definition_suffix = fields.Char("Unit", related='definition_id.suffix', readonly=True) definition_suffix = fields.Char("Unit", related='definition_id.suffix', readonly=True)
definition_monetary = fields.Boolean("Monetary", related='definition_id.monetary', readonly=True) definition_monetary = fields.Boolean("Monetary", related='definition_id.monetary', readonly=True)
+1 -1
View File
@@ -172,7 +172,7 @@ class Goal(models.Model):
to_update = fields.Boolean('To update') to_update = fields.Boolean('To update')
closed = fields.Boolean('Closed goal', help="These goals will not be recomputed.") closed = fields.Boolean('Closed goal', help="These goals will not be recomputed.")
computation_mode = fields.Selection(related='definition_id.computation_mode') computation_mode = fields.Selection(related='definition_id.computation_mode', readonly=False)
remind_update_delay = fields.Integer( remind_update_delay = fields.Integer(
"Remind delay", help="The number of days after which the user " "Remind delay", help="The number of days after which the user "
"assigned to a manual goal will be reminded. " "assigned to a manual goal will be reminded. "
@@ -7,4 +7,4 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings" _inherit = "res.config.settings"
google_drive_uri_copy = fields.Char(related='google_drive_uri', string='URI Copy', help="The URL to generate the authorization code from Google") google_drive_uri_copy = fields.Char(related='google_drive_uri', string='URI Copy', help="The URL to generate the authorization code from Google", readonly=False)
+3 -3
View File
@@ -107,9 +107,9 @@ class Employee(models.Model):
# resource and user # resource and user
# required on the resource, make sure required="True" set in the view # required on the resource, make sure required="True" set in the view
name = fields.Char(related='resource_id.name', store=True, oldname='name_related') name = fields.Char(related='resource_id.name', store=True, oldname='name_related', readonly=False)
user_id = fields.Many2one('res.users', 'User', related='resource_id.user_id', store=True) user_id = fields.Many2one('res.users', 'User', related='resource_id.user_id', store=True, readonly=False)
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True) active = fields.Boolean('Active', related='resource_id.active', default=True, store=True, readonly=False)
# private partner # private partner
address_home_id = fields.Many2one( address_home_id = fields.Many2one(
'res.partner', 'Private Address', help='Enter here the private address of the employee, not the one linked to your company.', 'res.partner', 'Private Address', help='Enter here the private address of the employee, not the one linked to your company.',
+1 -1
View File
@@ -8,5 +8,5 @@ class ResConfigSettings(models.TransientModel):
resource_calendar_id = fields.Many2one( resource_calendar_id = fields.Many2one(
'resource.calendar', 'Company Working Hours', 'resource.calendar', 'Company Working Hours',
related='company_id.resource_calendar_id') related='company_id.resource_calendar_id', readonly=False)
module_hr_org_chart = fields.Boolean(string="Show Organizational Chart") module_hr_org_chart = fields.Boolean(string="Show Organizational Chart")
+3 -3
View File
@@ -77,9 +77,9 @@ class Contract(models.Model):
track_visibility='onchange', help='Status of the contract', default='draft') track_visibility='onchange', help='Status of the contract', default='draft')
company_id = fields.Many2one('res.company', default=lambda self: self.env.user.company_id) company_id = fields.Many2one('res.company', default=lambda self: self.env.user.company_id)
currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True) currency_id = fields.Many2one(string="Currency", related='company_id.currency_id', readonly=True)
permit_no = fields.Char('Work Permit No', related="employee_id.permit_no") permit_no = fields.Char('Work Permit No', related="employee_id.permit_no", readonly=False)
visa_no = fields.Char('Visa No', related="employee_id.visa_no") visa_no = fields.Char('Visa No', related="employee_id.visa_no", readonly=False)
visa_expire = fields.Date('Visa Expire Date', related="employee_id.visa_expire") visa_expire = fields.Date('Visa Expire Date', related="employee_id.visa_expire", readonly=False)
reported_to_secretariat = fields.Boolean('Social Secretariat', reported_to_secretariat = fields.Boolean('Social Secretariat',
help='Green this button when the contract information has been transfered to the social secretariat.') help='Green this button when the contract information has been transfered to the social secretariat.')
+1 -1
View File
@@ -57,7 +57,7 @@ class HrExpense(models.Model):
total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id', digits=dp.get_precision('Account')) total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id', digits=dp.get_precision('Account'))
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.user.company_id) company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.user.company_id)
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.user.company_id.currency_id) currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.user.company_id.currency_id)
company_currency_id = fields.Many2one('res.currency', string="Report Company Currency", related='sheet_id.currency_id', store=True) company_currency_id = fields.Many2one('res.currency', string="Report Company Currency", related='sheet_id.currency_id', store=True, readonly=False)
analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', states={'post': [('readonly', True)], 'done': [('readonly', True)]}, oldname='analytic_account') analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', states={'post': [('readonly', True)], 'done': [('readonly', True)]}, oldname='analytic_account')
analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags', states={'post': [('readonly', True)], 'done': [('readonly', True)]}) analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags', states={'post': [('readonly', True)], 'done': [('readonly', True)]})
account_id = fields.Many2one('account.account', string='Account', states={'post': [('readonly', True)], 'done': [('readonly', True)]}, default=_default_account_id, help="An expense account is expected") account_id = fields.Many2one('account.account', string='Account', states={'post': [('readonly', True)], 'done': [('readonly', True)]}, default=_default_account_id, help="An expense account is expected")
+1 -1
View File
@@ -7,7 +7,7 @@ class HrExpenseRegisterPaymentWizard(models.TransientModel):
_inherit = "hr.expense.sheet.register.payment.wizard" _inherit = "hr.expense.sheet.register.payment.wizard"
check_amount_in_words = fields.Char(string="Amount in Words") check_amount_in_words = fields.Char(string="Amount in Words")
check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing') check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing', readonly=False)
# Note: a check_number == 0 means that it will be attributed when the check is printed # Note: a check_number == 0 means that it will be attributed when the check is printed
check_number = fields.Integer(string="Check Number", readonly=True, copy=False, default=0, check_number = fields.Integer(string="Check Number", readonly=True, copy=False, default=0,
help="Number of the check corresponding to this payment. If your pre-printed check are not already numbered, " help="Number of the check corresponding to this payment. If your pre-printed check are not already numbered, "
+1 -1
View File
@@ -115,7 +115,7 @@ class HolidaysRequest(models.Model):
states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]}, states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]},
domain=[('valid', '=', True)]) domain=[('valid', '=', True)])
leave_type_request_unit = fields.Selection(related='holiday_status_id.request_unit', readonly=True) leave_type_request_unit = fields.Selection(related='holiday_status_id.request_unit', readonly=True)
validation_type = fields.Selection('Validation Type', related='holiday_status_id.validation_type') validation_type = fields.Selection('Validation Type', related='holiday_status_id.validation_type', readonly=False)
# HR data # HR data
employee_id = fields.Many2one( employee_id = fields.Many2one(
'hr.employee', string='Employee', index=True, readonly=True, 'hr.employee', string='Employee', index=True, readonly=True,
@@ -157,16 +157,16 @@ class Applicant(models.Model):
emp_id = fields.Many2one('hr.employee', string="Employee", track_visibility="onchange", help="Employee linked to the applicant.") emp_id = fields.Many2one('hr.employee', string="Employee", track_visibility="onchange", help="Employee linked to the applicant.")
user_email = fields.Char(related='user_id.email', type="char", string="User Email", readonly=True) user_email = fields.Char(related='user_id.email', type="char", string="User Email", readonly=True)
attachment_number = fields.Integer(compute='_get_attachment_number', string="Number of Attachments") attachment_number = fields.Integer(compute='_get_attachment_number', string="Number of Attachments")
employee_name = fields.Char(related='emp_id.name', string="Employee Name") employee_name = fields.Char(related='emp_id.name', string="Employee Name", readonly=False)
attachment_ids = fields.One2many('ir.attachment', 'res_id', domain=[('res_model', '=', 'hr.applicant')], string='Attachments') attachment_ids = fields.One2many('ir.attachment', 'res_id', domain=[('res_model', '=', 'hr.applicant')], string='Attachments')
kanban_state = fields.Selection([ kanban_state = fields.Selection([
('normal', 'Grey'), ('normal', 'Grey'),
('done', 'Green'), ('done', 'Green'),
('blocked', 'Red')], string='Kanban State', ('blocked', 'Red')], string='Kanban State',
copy=False, default='normal', required=True) copy=False, default='normal', required=True)
legend_blocked = fields.Char(related='stage_id.legend_blocked', string='Kanban Blocked') legend_blocked = fields.Char(related='stage_id.legend_blocked', string='Kanban Blocked', readonly=False)
legend_done = fields.Char(related='stage_id.legend_done', string='Kanban Valid') legend_done = fields.Char(related='stage_id.legend_done', string='Kanban Valid', readonly=False)
legend_normal = fields.Char(related='stage_id.legend_normal', string='Kanban Ongoing') legend_normal = fields.Char(related='stage_id.legend_normal', string='Kanban Ongoing', readonly=False)
@api.depends('date_open', 'date_closed') @api.depends('date_open', 'date_closed')
@@ -6,7 +6,7 @@ from odoo import api, fields, models
class Applicant(models.Model): class Applicant(models.Model):
_inherit = "hr.applicant" _inherit = "hr.applicant"
survey_id = fields.Many2one('survey.survey', related='job_id.survey_id', string="Survey") survey_id = fields.Many2one('survey.survey', related='job_id.survey_id', string="Survey", readonly=False)
response_id = fields.Many2one('survey.user_input', "Response", ondelete="set null", oldname="response") response_id = fields.Many2one('survey.user_input', "Response", ondelete="set null", oldname="response")
@api.multi @api.multi
@@ -9,7 +9,7 @@ class AccountAnalyticAccount(models.Model):
_inherit = 'account.analytic.account' _inherit = 'account.analytic.account'
_description = 'Analytic Account' _description = 'Analytic Account'
company_uom_id = fields.Many2one('uom.uom', related='company_id.project_time_mode_id', string="Company UOM") company_uom_id = fields.Many2one('uom.uom', related='company_id.project_time_mode_id', string="Company UOM", readonly=False)
project_ids = fields.One2many('project.project', 'analytic_account_id', string='Projects') project_ids = fields.One2many('project.project', 'analytic_account_id', string='Projects')
project_count = fields.Integer("Project Count", compute='_compute_project_count') project_count = fields.Integer("Project Count", compute='_compute_project_count')
+1 -1
View File
@@ -96,7 +96,7 @@ class Task(models.Model):
_inherit = "project.task" _inherit = "project.task"
analytic_account_active = fields.Boolean("Analytic Account", related='project_id.analytic_account_id.active', readonly=True) analytic_account_active = fields.Boolean("Analytic Account", related='project_id.analytic_account_id.active', readonly=True)
allow_timesheets = fields.Boolean("Allow timesheets", related='project_id.allow_timesheets', help="Timesheets can be logged on this task.") allow_timesheets = fields.Boolean("Allow timesheets", related='project_id.allow_timesheets', help="Timesheets can be logged on this task.", readonly=False)
remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Total remaining time, can be re-estimated periodically by the assignee of the task.") remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Total remaining time, can be re-estimated periodically by the assignee of the task.")
effective_hours = fields.Float("Hours Spent", compute='_compute_effective_hours', compute_sudo=True, store=True, help="Computed using the sum of the task work done.") effective_hours = fields.Float("Hours Spent", compute='_compute_effective_hours', compute_sudo=True, store=True, help="Computed using the sum of the task work done.")
total_hours_spent = fields.Float("Total Hours", compute='_compute_total_hours_spent', store=True, help="Computed as: Time Spent + Sub-tasks Hours.") total_hours_spent = fields.Float("Total Hours", compute='_compute_total_hours_spent', store=True, help="Computed as: Time Spent + Sub-tasks Hours.")
@@ -10,11 +10,11 @@ class ResConfigSettings(models.TransientModel):
module_project_timesheet_synchro = fields.Boolean("Awesome Timesheet") module_project_timesheet_synchro = fields.Boolean("Awesome Timesheet")
module_project_timesheet_holidays = fields.Boolean("Leaves") module_project_timesheet_holidays = fields.Boolean("Leaves")
project_time_mode_id = fields.Many2one( project_time_mode_id = fields.Many2one(
'uom.uom', related='company_id.project_time_mode_id', string='Project Time Unit', 'uom.uom', related='company_id.project_time_mode_id', string='Project Time Unit', readonly=False,
help="This will set the unit of measure used in projects and tasks.\n" help="This will set the unit of measure used in projects and tasks.\n"
"If you use the timesheet linked to projects, don't " "If you use the timesheet linked to projects, don't "
"forget to setup the right unit of measure in your employees.") "forget to setup the right unit of measure in your employees.")
timesheet_encode_uom_id = fields.Many2one('uom.uom', string="Encoding Unit", timesheet_encode_uom_id = fields.Many2one('uom.uom', string="Encoding Unit",
related='company_id.timesheet_encode_uom_id', related='company_id.timesheet_encode_uom_id', readonly=False,
help="""This will set the unit of measure used to encode timesheet. This will simply provide tools help="""This will set the unit of measure used to encode timesheet. This will simply provide tools
and widgets to help the encoding. All reporting will still be expressed in hours (default value).""") and widgets to help the encoding. All reporting will still be expressed in hours (default value).""")
@@ -18,11 +18,11 @@ class HrContract(models.Model):
# YTI: Check if could be removed # YTI: Check if could be removed
new_car_model_id = fields.Many2one('fleet.vehicle.model', string="Model", domain=lambda self: self._get_possible_model_domain()) new_car_model_id = fields.Many2one('fleet.vehicle.model', string="Model", domain=lambda self: self._get_possible_model_domain())
max_unused_cars = fields.Integer(compute='_compute_max_unused_cars') max_unused_cars = fields.Integer(compute='_compute_max_unused_cars')
acquisition_date = fields.Date(related='car_id.acquisition_date') acquisition_date = fields.Date(related='car_id.acquisition_date', readonly=False)
car_value = fields.Float(related="car_id.car_value") car_value = fields.Float(related="car_id.car_value", readonly=False)
fuel_type = fields.Selection(related="car_id.fuel_type") fuel_type = fields.Selection(related="car_id.fuel_type", readonly=False)
co2 = fields.Float(related="car_id.co2") co2 = fields.Float(related="car_id.co2", readonly=False)
driver_id = fields.Many2one('res.partner', related="car_id.driver_id") driver_id = fields.Many2one('res.partner', related="car_id.driver_id", readonly=False)
car_open_contracts_count = fields.Integer(compute='_compute_car_open_contracts_count') car_open_contracts_count = fields.Integer(compute='_compute_car_open_contracts_count')
recurring_cost_amount_depreciated = fields.Float( recurring_cost_amount_depreciated = fields.Float(
compute='_compute_recurring_cost_amount_depreciated', compute='_compute_recurring_cost_amount_depreciated',
@@ -6,6 +6,6 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
l10n_be_structured_comm = fields.Selection(related='company_id.l10n_be_structured_comm', l10n_be_structured_comm = fields.Selection(related='company_id.l10n_be_structured_comm', readonly=False,
string='Communication Algorithm', default='random', string='Communication Algorithm', default='random',
help='Choose an algorithm to generate the structured communication.') help='Choose an algorithm to generate the structured communication.')
+1 -1
View File
@@ -26,7 +26,7 @@ class AccountInvoice(models.Model):
l10n_ch_isr_valid = fields.Boolean(compute='_compute_l10n_ch_isr_valid', help='Boolean value. True iff all the data required to generate the ISR are present') l10n_ch_isr_valid = fields.Boolean(compute='_compute_l10n_ch_isr_valid', help='Boolean value. True iff all the data required to generate the ISR are present')
l10n_ch_isr_sent = fields.Boolean(defaut=False, help="Boolean value telling whether or not the ISR corresponding to this invoice has already been printed or sent by mail.") l10n_ch_isr_sent = fields.Boolean(defaut=False, help="Boolean value telling whether or not the ISR corresponding to this invoice has already been printed or sent by mail.")
l10n_ch_currency_name = fields.Char(related='currency_id.name', string="Currency Name", help="The name of this invoice's currency") #This field is used in the "invisible" condition field of the 'Print ISR' button. l10n_ch_currency_name = fields.Char(related='currency_id.name', readonly=False, string="Currency Name", help="The name of this invoice's currency") #This field is used in the "invisible" condition field of the 'Print ISR' button.
@api.depends('partner_bank_id.bank_id.l10n_ch_postal_eur', 'partner_bank_id.bank_id.l10n_ch_postal_chf') @api.depends('partner_bank_id.bank_id.l10n_ch_postal_eur', 'partner_bank_id.bank_id.l10n_ch_postal_chf')
def _compute_l10n_ch_isr_postal(self): def _compute_l10n_ch_isr_postal(self):
+1 -1
View File
@@ -13,7 +13,7 @@ class AccountJournal(models.Model):
_inherit = 'account.journal' _inherit = 'account.journal'
# creation of bank journals by giving the account number, allow craetion of the # creation of bank journals by giving the account number, allow craetion of the
l10n_ch_postal = fields.Char(related='bank_account_id.l10n_ch_postal') l10n_ch_postal = fields.Char(related='bank_account_id.l10n_ch_postal', readonly=False)
@api.model @api.model
def create(self, vals): def create(self, vals):
+5 -5
View File
@@ -8,13 +8,13 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
l10n_ch_isr_preprinted_account = fields.Boolean(string='Preprinted account', l10n_ch_isr_preprinted_account = fields.Boolean(string='Preprinted account',
related="company_id.l10n_ch_isr_preprinted_account") related="company_id.l10n_ch_isr_preprinted_account", readonly=False)
l10n_ch_isr_preprinted_bank = fields.Boolean(string='Preprinted bank', l10n_ch_isr_preprinted_bank = fields.Boolean(string='Preprinted bank',
related="company_id.l10n_ch_isr_preprinted_bank") related="company_id.l10n_ch_isr_preprinted_bank", readonly=False)
l10n_ch_isr_print_bank_location = fields.Boolean(string="Print bank on ISR", l10n_ch_isr_print_bank_location = fields.Boolean(string="Print bank on ISR",
related="company_id.l10n_ch_isr_print_bank_location", related="company_id.l10n_ch_isr_print_bank_location", readonly=False,
required=True) required=True)
l10n_ch_isr_scan_line_left = fields.Float(string='Horizontal offset', l10n_ch_isr_scan_line_left = fields.Float(string='Horizontal offset',
related="company_id.l10n_ch_isr_scan_line_left") related="company_id.l10n_ch_isr_scan_line_left", readonly=False)
l10n_ch_isr_scan_line_top = fields.Float(string='Vertical offset', l10n_ch_isr_scan_line_top = fields.Float(string='Vertical offset',
related="company_id.l10n_ch_isr_scan_line_top") related="company_id.l10n_ch_isr_scan_line_top", readonly=False)
+1 -1
View File
@@ -7,7 +7,7 @@ from odoo import fields, models
class ResCompany(models.Model): class ResCompany(models.Model):
_inherit = 'res.company' _inherit = 'res.company'
siret = fields.Char(related='partner_id.siret', string='SIRET', size=14) siret = fields.Char(related='partner_id.siret', string='SIRET', size=14, readonly=False)
ape = fields.Char(string='APE') ape = fields.Char(string='APE')
class ResPartner(models.Model): class ResPartner(models.Model):
@@ -7,8 +7,8 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
plafond_secu = fields.Float(related='company_id.plafond_secu', string="Plafond de la Securite Sociale") plafond_secu = fields.Float(related='company_id.plafond_secu', string="Plafond de la Securite Sociale", readonly=False)
nombre_employes = fields.Integer(related='company_id.nombre_employes', string="Nombre d'employes") nombre_employes = fields.Integer(related='company_id.nombre_employes', string="Nombre d'employes", readonly=False)
cotisation_prevoyance = fields.Float(related='company_id.cotisation_prevoyance', string='Cotisation Patronale Prevoyance') cotisation_prevoyance = fields.Float(related='company_id.cotisation_prevoyance', string='Cotisation Patronale Prevoyance', readonly=False)
org_ss = fields.Char(related='company_id.org_ss', string="Organisme de securite sociale") org_ss = fields.Char(related='company_id.org_ss', string="Organisme de securite sociale", readonly=False)
conv_coll = fields.Char(related='company_id.conv_coll', string="Convention collective") conv_coll = fields.Char(related='company_id.conv_coll', string="Convention collective", readonly=False)
@@ -168,8 +168,8 @@ class HrPayrollAdviceLine(models.Model):
employee_id = fields.Many2one('hr.employee', string='Employee', required=True) employee_id = fields.Many2one('hr.employee', string='Employee', required=True)
bysal = fields.Float(string='By Salary', digits=dp.get_precision('Payroll')) bysal = fields.Float(string='By Salary', digits=dp.get_precision('Payroll'))
debit_credit = fields.Char(string='C/D', default='C') debit_credit = fields.Char(string='C/D', default='C')
company_id = fields.Many2one('res.company', related='advice_id.company_id', string='Company', store=True) company_id = fields.Many2one('res.company', related='advice_id.company_id', string='Company', store=True, readonly=False)
ifsc = fields.Boolean(related='advice_id.neft', string='IFSC') ifsc = fields.Boolean(related='advice_id.neft', string='IFSC', readonly=False)
@api.onchange('employee_id') @api.onchange('employee_id')
def onchange_employee_id(self): def onchange_employee_id(self):
+1 -1
View File
@@ -7,4 +7,4 @@ class ResCompany(models.Model):
_description = 'Companies' _description = 'Companies'
_inherit = 'res.company' _inherit = 'res.company'
l10n_sg_unique_entity_number = fields.Char(string='UEN', related="partner_id.l10n_sg_unique_entity_number") l10n_sg_unique_entity_number = fields.Char(string='UEN', related="partner_id.l10n_sg_unique_entity_number", readonly=False)
+2 -2
View File
@@ -46,7 +46,7 @@ class LunchOrder(models.Model):
'Status', readonly=True, index=True, copy=False, 'Status', readonly=True, index=True, copy=False,
compute='_compute_order_state', store=True) compute='_compute_order_state', store=True)
alerts = fields.Text(compute='_compute_alerts_get', string="Alerts") alerts = fields.Text(compute='_compute_alerts_get', string="Alerts")
company_id = fields.Many2one('res.company', related='user_id.company_id', store=True) company_id = fields.Many2one('res.company', related='user_id.company_id', store=True, readonly=False)
currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True, store=True) currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True, store=True)
cash_move_balance = fields.Monetary(compute='_compute_cash_move_balance', multi='cash_move_balance') cash_move_balance = fields.Monetary(compute='_compute_cash_move_balance', multi='cash_move_balance')
balance_visible = fields.Boolean(compute='_compute_cash_move_balance', multi='cash_move_balance') balance_visible = fields.Boolean(compute='_compute_cash_move_balance', multi='cash_move_balance')
@@ -183,7 +183,7 @@ class LunchOrderLine(models.Model):
('cancelled', 'Cancelled')], ('cancelled', 'Cancelled')],
'Status', readonly=True, index=True, default='new') 'Status', readonly=True, index=True, default='new')
cashmove = fields.One2many('lunch.cashmove', 'order_id', 'Cash Move') cashmove = fields.One2many('lunch.cashmove', 'order_id', 'Cash Move')
currency_id = fields.Many2one('res.currency', related='order_id.currency_id') currency_id = fields.Many2one('res.currency', related='order_id.currency_id', readonly=False)
def _check_supplier_availibility(self): def _check_supplier_availibility(self):
products = self.mapped('product_id') products = self.mapped('product_id')
+8 -8
View File
@@ -122,9 +122,9 @@ class MailActivity(models.Model):
activity_type_id = fields.Many2one( activity_type_id = fields.Many2one(
'mail.activity.type', 'Activity', 'mail.activity.type', 'Activity',
domain="['|', ('res_model_id', '=', False), ('res_model_id', '=', res_model_id)]", ondelete='restrict') domain="['|', ('res_model_id', '=', False), ('res_model_id', '=', res_model_id)]", ondelete='restrict')
activity_category = fields.Selection(related='activity_type_id.category') activity_category = fields.Selection(related='activity_type_id.category', readonly=False)
activity_decoration = fields.Selection(related='activity_type_id.decoration_type') activity_decoration = fields.Selection(related='activity_type_id.decoration_type', readonly=False)
icon = fields.Char('Icon', related='activity_type_id.icon') icon = fields.Char('Icon', related='activity_type_id.icon', readonly=False)
summary = fields.Char('Summary') summary = fields.Char('Summary')
note = fields.Html('Note') note = fields.Html('Note')
feedback = fields.Html('Feedback') feedback = fields.Html('Feedback')
@@ -152,8 +152,8 @@ class MailActivity(models.Model):
'Next activities available', 'Next activities available',
compute='_compute_has_recommended_activities', compute='_compute_has_recommended_activities',
help='Technical field for UX purpose') help='Technical field for UX purpose')
mail_template_ids = fields.Many2many(related='activity_type_id.mail_template_ids') mail_template_ids = fields.Many2many(related='activity_type_id.mail_template_ids', readonly=False)
force_next = fields.Boolean(related='activity_type_id.force_next') force_next = fields.Boolean(related='activity_type_id.force_next', readonly=False)
@api.multi @api.multi
@api.onchange('previous_activity_type_id') @api.onchange('previous_activity_type_id')
@@ -502,12 +502,12 @@ class MailActivityMixin(models.AbstractModel):
'Today: Activity date is today\nPlanned: Future activities.') 'Today: Activity date is today\nPlanned: Future activities.')
activity_user_id = fields.Many2one( activity_user_id = fields.Many2one(
'res.users', 'Responsible User', 'res.users', 'Responsible User',
related='activity_ids.user_id', related='activity_ids.user_id', readonly=False,
search='_search_activity_user_id', search='_search_activity_user_id',
groups="base.group_user") groups="base.group_user")
activity_type_id = fields.Many2one( activity_type_id = fields.Many2one(
'mail.activity.type', 'Next Activity Type', 'mail.activity.type', 'Next Activity Type',
related='activity_ids.activity_type_id', related='activity_ids.activity_type_id', readonly=False,
search='_search_activity_type_id', search='_search_activity_type_id',
groups="base.group_user") groups="base.group_user")
activity_date_deadline = fields.Date( activity_date_deadline = fields.Date(
@@ -517,7 +517,7 @@ class MailActivityMixin(models.AbstractModel):
groups="base.group_user") groups="base.group_user")
activity_summary = fields.Char( activity_summary = fields.Char(
'Next Activity Summary', 'Next Activity Summary',
related='activity_ids.summary', related='activity_ids.summary', readonly=False,
search='_search_activity_summary', search='_search_activity_summary',
groups="base.group_user",) groups="base.group_user",)
+1 -1
View File
@@ -27,7 +27,7 @@ class ChannelPartner(models.Model):
_primary_email = ['partner_email'] _primary_email = ['partner_email']
partner_id = fields.Many2one('res.partner', string='Recipient', ondelete='cascade') partner_id = fields.Many2one('res.partner', string='Recipient', ondelete='cascade')
partner_email = fields.Char('Email', related='partner_id.email') partner_email = fields.Char('Email', related='partner_id.email', readonly=False)
channel_id = fields.Many2one('mail.channel', string='Channel', ondelete='cascade') channel_id = fields.Many2one('mail.channel', string='Channel', ondelete='cascade')
seen_message_id = fields.Many2one('mail.message', string='Last Seen') seen_message_id = fields.Many2one('mail.message', string='Last Seen')
fold_state = fields.Selection([('open', 'Open'), ('folded', 'Folded'), ('closed', 'Closed')], string='Conversation Fold State', default='open') fold_state = fields.Selection([('open', 'Open'), ('folded', 'Folded'), ('closed', 'Closed')], string='Conversation Fold State', default='open')
+1 -1
View File
@@ -76,7 +76,7 @@ class Message(models.Model):
'res.partner', 'Author', index=True, 'res.partner', 'Author', index=True,
ondelete='set null', default=_get_default_author, ondelete='set null', default=_get_default_author,
help="Author of the message. If not set, email_from may hold an email address that did not match any partner.") help="Author of the message. If not set, email_from may hold an email address that did not match any partner.")
author_avatar = fields.Binary("Author's avatar", related='author_id.image_small') author_avatar = fields.Binary("Author's avatar", related='author_id.image_small', readonly=False)
# recipients: include inactive partners (they may have been archived after # recipients: include inactive partners (they may have been archived after
# the message was sent, but they should remain visible in the relation) # the message was sent, but they should remain visible in the relation)
partner_ids = fields.Many2many('res.partner', string='Recipients', partner_ids = fields.Many2many('res.partner', string='Recipients',
+1 -1
View File
@@ -24,7 +24,7 @@ class Users(models.Model):
alias_contact = fields.Selection([ alias_contact = fields.Selection([
('everyone', 'Everyone'), ('everyone', 'Everyone'),
('partners', 'Authenticated Partners'), ('partners', 'Authenticated Partners'),
('followers', 'Followers only')], string='Alias Contact Security', related='alias_id.alias_contact') ('followers', 'Followers only')], string='Alias Contact Security', related='alias_id.alias_contact', readonly=False)
notification_type = fields.Selection([ notification_type = fields.Selection([
('email', 'Handle by Emails'), ('email', 'Handle by Emails'),
('inbox', 'Handle in Odoo')], ('inbox', 'Handle in Odoo')],
+2 -2
View File
@@ -101,8 +101,8 @@ class PartnerResend(models.TransientModel):
_description = 'Partner with additionnal information for mail resend' _description = 'Partner with additionnal information for mail resend'
partner_id = fields.Many2one('res.partner', string='Partner', required=True, ondelete='cascade') partner_id = fields.Many2one('res.partner', string='Partner', required=True, ondelete='cascade')
name = fields.Char(related="partner_id.name", related_sudo=False) name = fields.Char(related="partner_id.name", related_sudo=False, readonly=False)
email = fields.Char(related="partner_id.email", related_sudo=False) email = fields.Char(related="partner_id.email", related_sudo=False, readonly=False)
resend = fields.Boolean(string="Send Again", default=True) resend = fields.Boolean(string="Send Again", default=True)
resend_wizard_id = fields.Many2one('mail.resend.message', string="Resend wizard") resend_wizard_id = fields.Many2one('mail.resend.message', string="Resend wizard")
message = fields.Char(string="Help message") message = fields.Char(string="Help message")
+3 -3
View File
@@ -54,9 +54,9 @@ class MassMailingContactListRel(models.Model):
opt_out = fields.Boolean(string='Opt Out', opt_out = fields.Boolean(string='Opt Out',
help='The contact has chosen not to receive mails anymore from this list', default=False) help='The contact has chosen not to receive mails anymore from this list', default=False)
unsubscription_date = fields.Datetime(string='Unsubscription Date') unsubscription_date = fields.Datetime(string='Unsubscription Date')
contact_count = fields.Integer(related='list_id.contact_nbr', store=False) contact_count = fields.Integer(related='list_id.contact_nbr', store=False, readonly=False)
message_bounce = fields.Integer(related='contact_id.message_bounce', store=False) message_bounce = fields.Integer(related='contact_id.message_bounce', store=False, readonly=False)
is_blacklisted = fields.Boolean(related='contact_id.is_blacklisted', store=False) is_blacklisted = fields.Boolean(related='contact_id.is_blacklisted', store=False, readonly=False)
_sql_constraints = [ _sql_constraints = [
('unique_contact_list', 'unique (contact_id, list_id)', ('unique_contact_list', 'unique (contact_id, list_id)',
+2 -2
View File
@@ -213,7 +213,7 @@ class MrpBomLine(models.Model):
product_id = fields.Many2one( product_id = fields.Many2one(
'product.product', 'Component', required=True) 'product.product', 'Component', required=True)
product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id') product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id', readonly=False)
product_qty = fields.Float( product_qty = fields.Float(
'Quantity', default=1.0, 'Quantity', default=1.0,
digits=dp.get_precision('Product Unit of Measure'), required=True) digits=dp.get_precision('Product Unit of Measure'), required=True)
@@ -227,7 +227,7 @@ class MrpBomLine(models.Model):
help="Gives the sequence order when displaying.") help="Gives the sequence order when displaying.")
routing_id = fields.Many2one( routing_id = fields.Many2one(
'mrp.routing', 'Routing', 'mrp.routing', 'Routing',
related='bom_id.routing_id', store=True, related='bom_id.routing_id', store=True, readonly=False,
help="The list of operations to produce the finished product. The routing is mainly used to " help="The list of operations to produce the finished product. The routing is mainly used to "
"compute work center costs during operations and to plan future loads on work centers " "compute work center costs during operations and to plan future loads on work centers "
"based on production planning.") "based on production planning.")
+2 -2
View File
@@ -52,7 +52,7 @@ class MrpProduction(models.Model):
domain=[('type', 'in', ['product', 'consu'])], domain=[('type', 'in', ['product', 'consu'])],
readonly=True, required=True, readonly=True, required=True,
states={'confirmed': [('readonly', False)]}) states={'confirmed': [('readonly', False)]})
product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id') product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id', readonly=False)
product_qty = fields.Float( product_qty = fields.Float(
'Quantity To Produce', 'Quantity To Produce',
default=1.0, digits=dp.get_precision('Product Unit of Measure'), default=1.0, digits=dp.get_precision('Product Unit of Measure'),
@@ -163,7 +163,7 @@ class MrpProduction(models.Model):
readonly=True, states={'confirmed': [('readonly', False)]}, default='1') readonly=True, states={'confirmed': [('readonly', False)]}, default='1')
is_locked = fields.Boolean('Is Locked', default=True, copy=False) is_locked = fields.Boolean('Is Locked', default=True, copy=False)
show_final_lots = fields.Boolean('Show Final Lots', compute='_compute_show_lots') show_final_lots = fields.Boolean('Show Final Lots', compute='_compute_show_lots')
production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production') production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False)
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order') picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order')
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids') delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids')
+5 -5
View File
@@ -14,9 +14,9 @@ class MrpWorkcenter(models.Model):
_inherit = ['resource.mixin'] _inherit = ['resource.mixin']
# resource # resource
name = fields.Char('Work Center', related='resource_id.name', store=True) name = fields.Char('Work Center', related='resource_id.name', store=True, readonly=False)
time_efficiency = fields.Float('Time Efficiency', related='resource_id.time_efficiency', default=100, store=True) time_efficiency = fields.Float('Time Efficiency', related='resource_id.time_efficiency', default=100, store=True, readonly=False)
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True) active = fields.Boolean('Active', related='resource_id.active', default=True, store=True, readonly=False)
code = fields.Char('Code', copy=False) code = fields.Char('Code', copy=False)
note = fields.Text( note = fields.Text(
@@ -205,7 +205,7 @@ class MrpWorkcenterProductivityLoss(models.Model):
sequence = fields.Integer('Sequence', default=1) sequence = fields.Integer('Sequence', default=1)
manual = fields.Boolean('Is a Blocking Reason', default=True) manual = fields.Boolean('Is a Blocking Reason', default=True)
loss_id = fields.Many2one('mrp.workcenter.productivity.loss.type', domain=([('loss_type', 'in', ['quality', 'availability'])]), string='Category') loss_id = fields.Many2one('mrp.workcenter.productivity.loss.type', domain=([('loss_type', 'in', ['quality', 'availability'])]), string='Category')
loss_type = fields.Selection(string='Effectiveness Category', related='loss_id.loss_type', store=True) loss_type = fields.Selection(string='Effectiveness Category', related='loss_id.loss_type', store=True, readonly=False)
class MrpWorkcenterProductivity(models.Model): class MrpWorkcenterProductivity(models.Model):
@@ -224,7 +224,7 @@ class MrpWorkcenterProductivity(models.Model):
'mrp.workcenter.productivity.loss', "Loss Reason", 'mrp.workcenter.productivity.loss', "Loss Reason",
ondelete='restrict', required=True) ondelete='restrict', required=True)
loss_type = fields.Selection( loss_type = fields.Selection(
"Effectiveness", related='loss_id.loss_type', store=True) "Effectiveness", related='loss_id.loss_type', store=True, readonly=False)
description = fields.Text('Description') description = fields.Text('Description')
date_start = fields.Datetime('Start Date', default=fields.Datetime.now, required=True) date_start = fields.Datetime('Start Date', default=fields.Datetime.now, required=True)
date_end = fields.Datetime('End Date') date_end = fields.Datetime('End Date')
+3 -3
View File
@@ -23,7 +23,7 @@ class MrpWorkorder(models.Model):
'mrp.workcenter', 'Work Center', required=True, 'mrp.workcenter', 'Work Center', required=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}) states={'done': [('readonly', True)], 'cancel': [('readonly', True)]})
working_state = fields.Selection( working_state = fields.Selection(
'Workcenter Status', related='workcenter_id.working_state', 'Workcenter Status', related='workcenter_id.working_state', readonly=False,
help='Technical: used in views only') help='Technical: used in views only')
production_id = fields.Many2one( production_id = fields.Many2one(
@@ -47,7 +47,7 @@ class MrpWorkorder(models.Model):
related='production_id.state', related='production_id.state',
help='Technical: used in views only.') help='Technical: used in views only.')
product_tracking = fields.Selection( product_tracking = fields.Selection(
'Product Tracking', related='production_id.product_id.tracking', 'Product Tracking', related='production_id.product_id.tracking', readonly=False,
help='Technical: used in views only.') help='Technical: used in views only.')
qty_production = fields.Float('Original Production Quantity', readonly=True, related='production_id.product_qty') qty_production = fields.Float('Original Production Quantity', readonly=True, related='production_id.product_qty')
qty_remaining = fields.Float('Quantity To Be Produced', compute='_compute_qty_remaining', digits=dp.get_precision('Product Unit of Measure')) qty_remaining = fields.Float('Quantity To Be Produced', compute='_compute_qty_remaining', digits=dp.get_precision('Product Unit of Measure'))
@@ -124,7 +124,7 @@ class MrpWorkorder(models.Model):
next_work_order_id = fields.Many2one('mrp.workorder', "Next Work Order") next_work_order_id = fields.Many2one('mrp.workorder', "Next Work Order")
scrap_ids = fields.One2many('stock.scrap', 'workorder_id') scrap_ids = fields.One2many('stock.scrap', 'workorder_id')
scrap_count = fields.Integer(compute='_compute_scrap_move_count', string='Scrap Move') scrap_count = fields.Integer(compute='_compute_scrap_move_count', string='Scrap Move')
production_date = fields.Datetime('Production Date', related='production_id.date_planned_start', store=True) production_date = fields.Datetime('Production Date', related='production_id.date_planned_start', store=True, readonly=False)
color = fields.Integer('Color', compute='_compute_color') color = fields.Integer('Color', compute='_compute_color')
capacity = fields.Float( capacity = fields.Float(
'Capacity', default=1.0, 'Capacity', default=1.0,
+1 -1
View File
@@ -7,7 +7,7 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
manufacturing_lead = fields.Float(related='company_id.manufacturing_lead', string="Manufacturing Lead Time") manufacturing_lead = fields.Float(related='company_id.manufacturing_lead', string="Manufacturing Lead Time", readonly=False)
use_manufacturing_lead = fields.Boolean(string="Default Manufacturing Lead Time", config_parameter='mrp.use_manufacturing_lead', oldname='default_use_manufacturing_lead') use_manufacturing_lead = fields.Boolean(string="Default Manufacturing Lead Time", config_parameter='mrp.use_manufacturing_lead', oldname='default_use_manufacturing_lead')
module_mrp_byproduct = fields.Boolean("By-Products") module_mrp_byproduct = fields.Boolean("By-Products")
module_mrp_mps = fields.Boolean("Master Production Schedule") module_mrp_mps = fields.Boolean("Master Production Schedule")
+1 -1
View File
@@ -17,7 +17,7 @@ class StockMoveLine(models.Model):
'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'), 'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'),
help="Informative, not used in matching") help="Informative, not used in matching")
done_wo = fields.Boolean('Done for Work Order', default=True, help="Technical Field which is False when temporarily filled in in work order") # TDE FIXME: naming done_wo = fields.Boolean('Done for Work Order', default=True, help="Technical Field which is False when temporarily filled in in work order") # TDE FIXME: naming
done_move = fields.Boolean('Move Done', related='move_id.is_done', store=True) # TDE FIXME: naming done_move = fields.Boolean('Move Done', related='move_id.is_done', readonly=False, store=True) # TDE FIXME: naming
def _get_similar_move_lines(self): def _get_similar_move_lines(self):
lines = super(StockMoveLine, self)._get_similar_move_lines() lines = super(StockMoveLine, self)._get_similar_move_lines()
+2 -2
View File
@@ -46,7 +46,7 @@ class MrpProductProduce(models.TransientModel):
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure') product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure')
lot_id = fields.Many2one('stock.production.lot', string='Lot/Serial Number') lot_id = fields.Many2one('stock.production.lot', string='Lot/Serial Number')
produce_line_ids = fields.One2many('mrp.product.produce.line', 'product_produce_id', string='Product to Track') produce_line_ids = fields.One2many('mrp.product.produce.line', 'product_produce_id', string='Product to Track')
product_tracking = fields.Selection(related="product_id.tracking") product_tracking = fields.Selection(related="product_id.tracking", readonly=False)
@api.multi @api.multi
def do_produce(self): def do_produce(self):
@@ -172,7 +172,7 @@ class MrpProductProduceLine(models.TransientModel):
product_produce_id = fields.Many2one('mrp.product.produce') product_produce_id = fields.Many2one('mrp.product.produce')
product_id = fields.Many2one('product.product', 'Product') product_id = fields.Many2one('product.product', 'Product')
product_tracking = fields.Selection(related="product_id.tracking") product_tracking = fields.Selection(related="product_id.tracking", readonly=False)
lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number') lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number')
qty_to_consume = fields.Float('To Consume', digits=dp.get_precision('Product Unit of Measure')) qty_to_consume = fields.Float('To Consume', digits=dp.get_precision('Product Unit of Measure'))
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure') product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure')
+2 -2
View File
@@ -7,5 +7,5 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
pad_server = fields.Char(related='company_id.pad_server', string="Pad Server *") pad_server = fields.Char(related='company_id.pad_server', string="Pad Server *", readonly=False)
pad_key = fields.Char(related='company_id.pad_key', string="Pad Api Key *") pad_key = fields.Char(related='company_id.pad_key', string="Pad Api Key *", readonly=False)
+2 -2
View File
@@ -147,7 +147,7 @@ class PaymentAcquirer(models.Model):
# TDE FIXME: remove that brol # TDE FIXME: remove that brol
module_id = fields.Many2one('ir.module.module', string='Corresponding Module') module_id = fields.Many2one('ir.module.module', string='Corresponding Module')
module_state = fields.Selection(selection=ir_module.STATES, string='Installation State', related='module_id.state') module_state = fields.Selection(selection=ir_module.STATES, string='Installation State', related='module_id.state', readonly=False)
image = fields.Binary( image = fields.Binary(
"Image", attachment=True, "Image", attachment=True,
@@ -168,7 +168,7 @@ class PaymentAcquirer(models.Model):
('s2s','Payment from Odoo')], ('s2s','Payment from Odoo')],
default='form', required=True, string='Payment Flow', default='form', required=True, string='Payment Flow',
help="""Note: Subscriptions does not take this field in account, it uses server to server by default.""") help="""Note: Subscriptions does not take this field in account, it uses server to server by default.""")
inbound_payment_method_ids = fields.Many2many('account.payment.method', related='journal_id.inbound_payment_method_ids') inbound_payment_method_ids = fields.Many2many('account.payment.method', related='journal_id.inbound_payment_method_ids', readonly=False)
@api.onchange('payment_flow') @api.onchange('payment_flow')
def _onchange_payment_flow(self): def _onchange_payment_flow(self):
+2 -2
View File
@@ -343,8 +343,8 @@ class PaymentToken(models.Model):
authorize_profile = fields.Char(string='Authorize.net Profile ID', help='This contains the unique reference ' authorize_profile = fields.Char(string='Authorize.net Profile ID', help='This contains the unique reference '
'for this partner/payment token combination in the Authorize.net backend') 'for this partner/payment token combination in the Authorize.net backend')
provider = fields.Selection(string='Provider', related='acquirer_id.provider') provider = fields.Selection(string='Provider', related='acquirer_id.provider', readonly=False)
save_token = fields.Selection(string='Save Cards', related='acquirer_id.save_token') save_token = fields.Selection(string='Save Cards', related='acquirer_id.save_token', readonly=False)
@api.model @api.model
def authorize_create(self, values): def authorize_create(self, values):
+1 -1
View File
@@ -71,7 +71,7 @@ class PosConfig(models.Model):
'pos_config_id', 'journal_id', string='Available Payment Methods', 'pos_config_id', 'journal_id', string='Available Payment Methods',
domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",) domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",)
picking_type_id = fields.Many2one('stock.picking.type', string='Operation Type') picking_type_id = fields.Many2one('stock.picking.type', string='Operation Type')
use_existing_lots = fields.Boolean(related='picking_type_id.use_existing_lots') use_existing_lots = fields.Boolean(related='picking_type_id.use_existing_lots', readonly=False)
stock_location_id = fields.Many2one( stock_location_id = fields.Many2one(
'stock.location', string='Stock Location', 'stock.location', string='Stock Location',
domain=[('usage', '=', 'internal')], required=True, default=_get_default_location) domain=[('usage', '=', 'internal')], required=True, default=_get_default_location)
+5 -5
View File
@@ -504,8 +504,8 @@ class PosOrder(models.Model):
'pos.session', string='Session', required=True, index=True, 'pos.session', string='Session', required=True, index=True,
domain="[('state', '=', 'opened')]", states={'draft': [('readonly', False)]}, domain="[('state', '=', 'opened')]", states={'draft': [('readonly', False)]},
readonly=True, default=_default_session) readonly=True, default=_default_session)
config_id = fields.Many2one('pos.config', related='session_id.config_id', string="Point of Sale") config_id = fields.Many2one('pos.config', related='session_id.config_id', string="Point of Sale", readonly=False)
invoice_group = fields.Boolean(related="config_id.module_account") invoice_group = fields.Boolean(related="config_id.module_account", readonly=False)
state = fields.Selection( state = fields.Selection(
[('draft', 'New'), ('cancel', 'Cancelled'), ('paid', 'Paid'), ('done', 'Posted'), ('invoiced', 'Invoiced')], [('draft', 'New'), ('cancel', 'Cancelled'), ('paid', 'Paid'), ('done', 'Posted'), ('invoiced', 'Invoiced')],
'Status', readonly=True, copy=False, default='draft') 'Status', readonly=True, copy=False, default='draft')
@@ -513,7 +513,7 @@ class PosOrder(models.Model):
invoice_id = fields.Many2one('account.invoice', string='Invoice', copy=False) invoice_id = fields.Many2one('account.invoice', string='Invoice', copy=False)
account_move = fields.Many2one('account.move', string='Journal Entry', readonly=True, copy=False) account_move = fields.Many2one('account.move', string='Journal Entry', readonly=True, copy=False)
picking_id = fields.Many2one('stock.picking', string='Picking', readonly=True, copy=False) picking_id = fields.Many2one('stock.picking', string='Picking', readonly=True, copy=False)
picking_type_id = fields.Many2one('stock.picking.type', related='session_id.config_id.picking_type_id', string="Operation Type") picking_type_id = fields.Many2one('stock.picking.type', related='session_id.config_id.picking_type_id', string="Operation Type", readonly=False)
location_id = fields.Many2one( location_id = fields.Many2one(
comodel_name='stock.location', comodel_name='stock.location',
related='session_id.config_id.stock_location_id', related='session_id.config_id.stock_location_id',
@@ -1056,9 +1056,9 @@ class PosOrderLineLot(models.Model):
_description = "Specify product lot/serial number in pos order line" _description = "Specify product lot/serial number in pos order line"
pos_order_line_id = fields.Many2one('pos.order.line') pos_order_line_id = fields.Many2one('pos.order.line')
order_id = fields.Many2one('pos.order', related="pos_order_line_id.order_id") order_id = fields.Many2one('pos.order', related="pos_order_line_id.order_id", readonly=False)
lot_name = fields.Char('Lot Name') lot_name = fields.Char('Lot Name')
product_id = fields.Many2one('product.product', related='pos_order_line_id.product_id') product_id = fields.Many2one('product.product', related='pos_order_line_id.product_id', readonly=False)
class ReportSaleDetails(models.AbstractModel): class ReportSaleDetails(models.AbstractModel):
+1 -1
View File
@@ -55,7 +55,7 @@ class PosSession(models.Model):
readonly=True, readonly=True,
states={'opening_control': [('readonly', False)]}, states={'opening_control': [('readonly', False)]},
default=lambda self: self.env.uid) default=lambda self: self.env.uid)
currency_id = fields.Many2one('res.currency', related='config_id.currency_id', string="Currency") currency_id = fields.Many2one('res.currency', related='config_id.currency_id', string="Currency", readonly=False)
start_at = fields.Datetime(string='Opening Date', readonly=True) start_at = fields.Datetime(string='Opening Date', readonly=True)
stop_at = fields.Datetime(string='Closing Date', readonly=True, copy=False) stop_at = fields.Datetime(string='Closing Date', readonly=True, copy=False)
+1 -1
View File
@@ -49,4 +49,4 @@ class UomCateg(models.Model):
class Uom(models.Model): class Uom(models.Model):
_inherit = 'uom.uom' _inherit = 'uom.uom'
is_pos_groupable = fields.Boolean(related='category_id.is_pos_groupable') is_pos_groupable = fields.Boolean(related='category_id.is_pos_groupable', readonly=False)
@@ -6,7 +6,7 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", related='company_id.account_sale_tax_id') sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", related='company_id.account_sale_tax_id', readonly=False)
module_pos_mercury = fields.Boolean(string="Integrated Card Payments", help="The transactions are processed by Vantiv. Set your Vantiv credentials on the related payment journal.") module_pos_mercury = fields.Boolean(string="Integrated Card Payments", help="The transactions are processed by Vantiv. Set your Vantiv credentials on the related payment journal.")
pos_sales_price = fields.Boolean("Multiple Product Prices", config_parameter='point_of_sale.pos_sales_price') pos_sales_price = fields.Boolean("Multiple Product Prices", config_parameter='point_of_sale.pos_sales_price')
pos_pricelist_setting = fields.Selection([ pos_pricelist_setting = fields.Selection([
+2 -2
View File
@@ -626,7 +626,7 @@ class SupplierInfo(models.Model):
'Sequence', default=1, help="Assigns the priority to the list of product vendor.") 'Sequence', default=1, help="Assigns the priority to the list of product vendor.")
product_uom = fields.Many2one( product_uom = fields.Many2one(
'uom.uom', 'Unit of Measure', 'uom.uom', 'Unit of Measure',
readonly="1", related='product_tmpl_id.uom_po_id', related='product_tmpl_id.uom_po_id',
help="This comes from the product form.") help="This comes from the product form.")
min_qty = fields.Float( min_qty = fields.Float(
'Minimal Quantity', default=0.0, required=True, 'Minimal Quantity', default=0.0, required=True,
@@ -649,7 +649,7 @@ class SupplierInfo(models.Model):
product_tmpl_id = fields.Many2one( product_tmpl_id = fields.Many2one(
'product.template', 'Product Template', 'product.template', 'Product Template',
index=True, ondelete='cascade', oldname='product_id') index=True, ondelete='cascade', oldname='product_id')
product_variant_count = fields.Integer('Variant Count', related='product_tmpl_id.product_variant_count') product_variant_count = fields.Integer('Variant Count', related='product_tmpl_id.product_variant_count', readonly=False)
delay = fields.Integer( delay = fields.Integer(
'Delivery Lead Time', default=1, required=True, 'Delivery Lead Time', default=1, required=True,
help="Lead time in days between the confirmation of the purchase order and the receipt of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning.") help="Lead time in days between the confirmation of the purchase order and the receipt of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning.")
+2 -2
View File
@@ -69,7 +69,7 @@ class ProductTemplate(models.Model):
digits=dp.get_precision('Product Price'), digits=dp.get_precision('Product Price'),
help="Price at which the product is sold to customers.") help="Price at which the product is sold to customers.")
lst_price = fields.Float( lst_price = fields.Float(
'Public Price', related='list_price', 'Public Price', related='list_price', readonly=False,
digits=dp.get_precision('Product Price')) digits=dp.get_precision('Product Price'))
standard_price = fields.Float( standard_price = fields.Float(
'Cost', compute='_compute_standard_price', 'Cost', compute='_compute_standard_price',
@@ -123,7 +123,7 @@ class ProductTemplate(models.Model):
'# Product Variants', compute='_compute_product_variant_count') '# Product Variants', compute='_compute_product_variant_count')
# related to display product product information if is_product_variant # related to display product product information if is_product_variant
barcode = fields.Char('Barcode', oldname='ean13', related='product_variant_ids.barcode') barcode = fields.Char('Barcode', oldname='ean13', related='product_variant_ids.barcode', readonly=False)
default_code = fields.Char( default_code = fields.Char(
'Internal Reference', compute='_compute_default_code', 'Internal Reference', compute='_compute_default_code',
inverse='_set_default_code', store=True) inverse='_set_default_code', store=True)
+1 -1
View File
@@ -7,7 +7,7 @@ from odoo import api, fields, models
class StockQuant(models.Model): class StockQuant(models.Model):
_inherit = 'stock.quant' _inherit = 'stock.quant'
removal_date = fields.Datetime(related='lot_id.removal_date', store=True) removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False)
@api.model @api.model
def _get_removal_strategy_order(self, removal_strategy): def _get_removal_strategy_order(self, removal_strategy):
@@ -7,5 +7,5 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
leave_timesheet_project_id = fields.Many2one(related='company_id.leave_timesheet_project_id', string="Internal Project") leave_timesheet_project_id = fields.Many2one(related='company_id.leave_timesheet_project_id', string="Internal Project", readonly=False)
leave_timesheet_task_id = fields.Many2one(related='company_id.leave_timesheet_task_id', string="Leave Task") leave_timesheet_task_id = fields.Many2one(related='company_id.leave_timesheet_task_id', string="Leave Task", readonly=False)
+3 -3
View File
@@ -121,7 +121,7 @@ class PurchaseOrder(models.Model):
payment_term_id = fields.Many2one('account.payment.term', 'Payment Terms') payment_term_id = fields.Many2one('account.payment.term', 'Payment Terms')
incoterm_id = fields.Many2one('account.incoterms', 'Incoterm', states={'done': [('readonly', True)]}, help="International Commercial Terms are a series of predefined commercial terms used in international transactions.") incoterm_id = fields.Many2one('account.incoterms', 'Incoterm', states={'done': [('readonly', True)]}, help="International Commercial Terms are a series of predefined commercial terms used in international transactions.")
product_id = fields.Many2one('product.product', related='order_line.product_id', string='Product') product_id = fields.Many2one('product.product', related='order_line.product_id', string='Product', readonly=False)
user_id = fields.Many2one('res.users', string='Purchase Representative', index=True, track_visibility='onchange', default=lambda self: self.env.user) user_id = fields.Many2one('res.users', string='Purchase Representative', index=True, track_visibility='onchange', default=lambda self: self.env.user)
company_id = fields.Many2one('res.company', 'Company', required=True, index=True, states=READONLY_STATES, default=lambda self: self.env.user.company_id.id) company_id = fields.Many2one('res.company', 'Company', required=True, index=True, states=READONLY_STATES, default=lambda self: self.env.user.company_id.id)
@@ -408,7 +408,7 @@ class PurchaseOrderLine(models.Model):
product_uom = fields.Many2one('uom.uom', string='Product Unit of Measure', required=True) product_uom = fields.Many2one('uom.uom', string='Product Unit of Measure', required=True)
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=True) product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=True)
product_image = fields.Binary( product_image = fields.Binary(
'Product Image', related="product_id.image", 'Product Image', related="product_id.image", readonly=False,
help="Non-stored related field to allow portal user to see the image of the product he has ordered") help="Non-stored related field to allow portal user to see the image of the product he has ordered")
product_type = fields.Selection(related='product_id.type', readonly=True) product_type = fields.Selection(related='product_id.type', readonly=True)
price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price')) price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price'))
@@ -421,7 +421,7 @@ class PurchaseOrderLine(models.Model):
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account') account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags')
company_id = fields.Many2one('res.company', related='order_id.company_id', string='Company', store=True, readonly=True) company_id = fields.Many2one('res.company', related='order_id.company_id', string='Company', store=True, readonly=True)
state = fields.Selection(related='order_id.state', store=True) state = fields.Selection(related='order_id.state', store=True, readonly=False)
invoice_lines = fields.One2many('account.invoice.line', 'purchase_line_id', string="Bill Lines", readonly=True, copy=False) invoice_lines = fields.One2many('account.invoice.line', 'purchase_line_id', string="Bill Lines", readonly=True, copy=False)
@@ -8,10 +8,10 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
lock_confirmed_po = fields.Boolean("Lock Confirmed Orders", default=lambda self: self.env.user.company_id.po_lock == 'lock') lock_confirmed_po = fields.Boolean("Lock Confirmed Orders", default=lambda self: self.env.user.company_id.po_lock == 'lock')
po_lock = fields.Selection(related='company_id.po_lock', string="Purchase Order Modification *") po_lock = fields.Selection(related='company_id.po_lock', string="Purchase Order Modification *", readonly=False)
po_order_approval = fields.Boolean("Purchase Order Approval", default=lambda self: self.env.user.company_id.po_double_validation == 'two_step') po_order_approval = fields.Boolean("Purchase Order Approval", default=lambda self: self.env.user.company_id.po_double_validation == 'two_step')
po_double_validation = fields.Selection(related='company_id.po_double_validation', string="Levels of Approvals *") po_double_validation = fields.Selection(related='company_id.po_double_validation', string="Levels of Approvals *", readonly=False)
po_double_validation_amount = fields.Monetary(related='company_id.po_double_validation_amount', string="Minimum Amount", currency_field='company_currency_id') po_double_validation_amount = fields.Monetary(related='company_id.po_double_validation_amount', string="Minimum Amount", currency_field='company_currency_id', readonly=False)
company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string="Company Currency", readonly=True, company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string="Company Currency", readonly=True,
help='Utility field to express amount currency') help='Utility field to express amount currency')
default_purchase_method = fields.Selection([ default_purchase_method = fields.Selection([
@@ -25,7 +25,7 @@ class ResConfigSettings(models.TransientModel):
implied_group="purchase.group_manage_vendor_price") implied_group="purchase.group_manage_vendor_price")
module_account_3way_match = fields.Boolean("3-way matching: purchases, receptions and bills") module_account_3way_match = fields.Boolean("3-way matching: purchases, receptions and bills")
module_purchase_requisition = fields.Boolean("Purchase Agreements") module_purchase_requisition = fields.Boolean("Purchase Agreements")
po_lead = fields.Float(related='company_id.po_lead') po_lead = fields.Float(related='company_id.po_lead', readonly=False)
use_po_lead = fields.Boolean( use_po_lead = fields.Boolean(
string="Security Lead Time for Purchase", string="Security Lead Time for Purchase",
oldname='default_new_po_lead', oldname='default_new_po_lead',
@@ -184,7 +184,7 @@ class SupplierInfo(models.Model):
_inherit = "product.supplierinfo" _inherit = "product.supplierinfo"
_order = 'sequence, purchase_requisition_id desc, min_qty desc, price' _order = 'sequence, purchase_requisition_id desc, min_qty desc, price'
purchase_requisition_id = fields.Many2one('purchase.requisition', related='purchase_requisition_line_id.requisition_id', string='Blanket order') purchase_requisition_id = fields.Many2one('purchase.requisition', related='purchase_requisition_line_id.requisition_id', string='Blanket order', readonly=False)
purchase_requisition_line_id = fields.Many2one('purchase.requisition.line') purchase_requisition_line_id = fields.Many2one('purchase.requisition.line')
@@ -296,7 +296,7 @@ class PurchaseOrder(models.Model):
_inherit = "purchase.order" _inherit = "purchase.order"
requisition_id = fields.Many2one('purchase.requisition', string='Purchase Agreement', copy=False) requisition_id = fields.Many2one('purchase.requisition', string='Purchase Agreement', copy=False)
is_quantity_copy = fields.Selection(related='requisition_id.is_quantity_copy') is_quantity_copy = fields.Selection(related='requisition_id.is_quantity_copy', readonly=False)
@api.onchange('requisition_id') @api.onchange('requisition_id')
def _onchange_requisition_id(self): def _onchange_requisition_id(self):
+3 -3
View File
@@ -38,7 +38,7 @@ class Rating(models.Model):
res_id = fields.Integer(string='Document', required=True, help="Identifier of the rated object", index=True) res_id = fields.Integer(string='Document', required=True, help="Identifier of the rated object", index=True)
parent_res_name = fields.Char('Parent Document Name', compute='_compute_parent_res_name', store=True) parent_res_name = fields.Char('Parent Document Name', compute='_compute_parent_res_name', store=True)
parent_res_model_id = fields.Many2one('ir.model', 'Parent Related Document Model', index=True, ondelete='cascade') parent_res_model_id = fields.Many2one('ir.model', 'Parent Related Document Model', index=True, ondelete='cascade')
parent_res_model = fields.Char('Parent Document Model', store=True, related='parent_res_model_id.model', index=True) parent_res_model = fields.Char('Parent Document Model', store=True, related='parent_res_model_id.model', index=True, readonly=False)
parent_res_id = fields.Integer('Parent Document', index=True) parent_res_id = fields.Integer('Parent Document', index=True)
rated_partner_id = fields.Many2one('res.partner', string="Rated person", help="Owner of the rated resource") rated_partner_id = fields.Many2one('res.partner', string="Rated person", help="Owner of the rated resource")
partner_id = fields.Many2one('res.partner', string='Customer', help="Author of the rating") partner_id = fields.Many2one('res.partner', string='Customer', help="Author of the rating")
@@ -139,8 +139,8 @@ class RatingMixin(models.AbstractModel):
rating_ids = fields.One2many('rating.rating', 'res_id', string='Rating', domain=lambda self: [('res_model', '=', self._name)], auto_join=True) rating_ids = fields.One2many('rating.rating', 'res_id', string='Rating', domain=lambda self: [('res_model', '=', self._name)], auto_join=True)
rating_last_value = fields.Float('Rating Last Value', compute='_compute_rating_last_value', compute_sudo=True, store=True) rating_last_value = fields.Float('Rating Last Value', compute='_compute_rating_last_value', compute_sudo=True, store=True)
rating_last_feedback = fields.Text('Rating Last Feedback', related='rating_ids.feedback') rating_last_feedback = fields.Text('Rating Last Feedback', related='rating_ids.feedback', readonly=False)
rating_last_image = fields.Binary('Rating Last Image', related='rating_ids.rating_image') rating_last_image = fields.Binary('Rating Last Image', related='rating_ids.rating_image', readonly=False)
rating_count = fields.Integer('Rating count', compute="_compute_rating_count") rating_count = fields.Integer('Rating count', compute="_compute_rating_count")
@api.multi @api.multi
+1 -1
View File
@@ -114,7 +114,7 @@ class Repair(models.Model):
amount_untaxed = fields.Float('Untaxed Amount', compute='_amount_untaxed', store=True) amount_untaxed = fields.Float('Untaxed Amount', compute='_amount_untaxed', store=True)
amount_tax = fields.Float('Taxes', compute='_amount_tax', store=True) amount_tax = fields.Float('Taxes', compute='_amount_tax', store=True)
amount_total = fields.Float('Total', compute='_amount_total', store=True) amount_total = fields.Float('Total', compute='_amount_total', store=True)
tracking = fields.Selection('Product Tracking', related="product_id.tracking") tracking = fields.Selection('Product Tracking', related="product_id.tracking", readonly=False)
@api.one @api.one
@api.depends('partner_id') @api.depends('partner_id')
+1 -1
View File
@@ -11,4 +11,4 @@ class ResUsers(models.Model):
'resource.resource', 'user_id', 'Resources') 'resource.resource', 'user_id', 'Resources')
resource_calendar_id = fields.Many2one( resource_calendar_id = fields.Many2one(
'resource.calendar', 'Default Working Hours', 'resource.calendar', 'Default Working Hours',
related='resource_ids.calendar_id') related='resource_ids.calendar_id', readonly=False)
+3 -3
View File
@@ -22,13 +22,13 @@ class ResourceMixin(models.AbstractModel):
company_id = fields.Many2one( company_id = fields.Many2one(
'res.company', 'Company', 'res.company', 'Company',
default=lambda self: self.env['res.company']._company_default_get(), default=lambda self: self.env['res.company']._company_default_get(),
index=True, related='resource_id.company_id', store=True) index=True, related='resource_id.company_id', store=True, readonly=False)
resource_calendar_id = fields.Many2one( resource_calendar_id = fields.Many2one(
'resource.calendar', 'Working Hours', 'resource.calendar', 'Working Hours',
default=lambda self: self.env['res.company']._company_default_get().resource_calendar_id, default=lambda self: self.env['res.company']._company_default_get().resource_calendar_id,
index=True, related='resource_id.calendar_id', store=True) index=True, related='resource_id.calendar_id', store=True, readonly=False)
tz = fields.Selection( tz = fields.Selection(
string='Timezone', related='resource_id.tz', string='Timezone', related='resource_id.tz', readonly=False,
help="This field is used in order to define in which timezone the resources will work.") help="This field is used in order to define in which timezone the resources will work.")
@api.model @api.model
+4 -4
View File
@@ -7,18 +7,18 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
sale_note = fields.Text(related='company_id.sale_note', string="Terms & Conditions") sale_note = fields.Text(related='company_id.sale_note', string="Terms & Conditions", readonly=False)
use_sale_note = fields.Boolean( use_sale_note = fields.Boolean(
string='Default Terms & Conditions', string='Default Terms & Conditions',
oldname='default_use_sale_note', oldname='default_use_sale_note',
config_parameter='sale.use_sale_note') config_parameter='sale.use_sale_note')
group_discount_per_so_line = fields.Boolean("Discounts", implied_group='sale.group_discount_per_so_line') group_discount_per_so_line = fields.Boolean("Discounts", implied_group='sale.group_discount_per_so_line')
module_sale_margin = fields.Boolean("Margins") module_sale_margin = fields.Boolean("Margins")
quotation_validity_days = fields.Integer(related='company_id.quotation_validity_days', string="Default Quotation Validity (Days)") quotation_validity_days = fields.Integer(related='company_id.quotation_validity_days', string="Default Quotation Validity (Days)", readonly=False)
use_quotation_validity_days = fields.Boolean("Default Quotation Validity", config_parameter='sale.use_quotation_validity_days') use_quotation_validity_days = fields.Boolean("Default Quotation Validity", config_parameter='sale.use_quotation_validity_days')
group_warning_sale = fields.Boolean("Sale Order Warnings", implied_group='sale.group_warning_sale') group_warning_sale = fields.Boolean("Sale Order Warnings", implied_group='sale.group_warning_sale')
portal_confirmation_sign = fields.Boolean(related='company_id.portal_confirmation_sign', string='Online Signature') portal_confirmation_sign = fields.Boolean(related='company_id.portal_confirmation_sign', string='Online Signature', readonly=False)
portal_confirmation_pay = fields.Boolean(related='company_id.portal_confirmation_pay', string='Online Payment') portal_confirmation_pay = fields.Boolean(related='company_id.portal_confirmation_pay', string='Online Payment', readonly=False)
group_sale_delivery_address = fields.Boolean("Customer Addresses", implied_group='sale.group_delivery_invoice_address') group_sale_delivery_address = fields.Boolean("Customer Addresses", implied_group='sale.group_delivery_invoice_address')
multi_sales_price = fields.Boolean("Multiple Sales Prices per Product") multi_sales_price = fields.Boolean("Multiple Sales Prices per Product")
multi_sales_price_method = fields.Selection([ multi_sales_price_method = fields.Selection([
+2 -2
View File
@@ -1136,7 +1136,7 @@ class SaleOrderLine(models.Model):
# It allows keeping track of the extra_price associated to those attribute values and add them to the SO line description # It allows keeping track of the extra_price associated to those attribute values and add them to the SO line description
product_no_variant_attribute_values = fields.Many2many('product.template.attribute.value', string='Product attribute values that do not create variants') product_no_variant_attribute_values = fields.Many2many('product.template.attribute.value', string='Product attribute values that do not create variants')
# Non-stored related field to allow portal user to see the image of the product he has ordered # Non-stored related field to allow portal user to see the image of the product he has ordered
product_image = fields.Binary('Product Image', related="product_id.image", store=False) product_image = fields.Binary('Product Image', related="product_id.image", store=False, readonly=False)
qty_delivered_method = fields.Selection([ qty_delivered_method = fields.Selection([
('manual', 'Manual'), ('manual', 'Manual'),
@@ -1162,7 +1162,7 @@ class SaleOrderLine(models.Model):
salesman_id = fields.Many2one(related='order_id.user_id', store=True, string='Salesperson', readonly=True) salesman_id = fields.Many2one(related='order_id.user_id', store=True, string='Salesperson', readonly=True)
currency_id = fields.Many2one(related='order_id.currency_id', depends=['order_id'], store=True, string='Currency', readonly=True) currency_id = fields.Many2one(related='order_id.currency_id', depends=['order_id'], store=True, string='Currency', readonly=True)
company_id = fields.Many2one(related='order_id.company_id', string='Company', store=True, readonly=True) company_id = fields.Many2one(related='order_id.company_id', string='Company', store=True, readonly=True)
order_partner_id = fields.Many2one(related='order_id.partner_id', store=True, string='Customer') order_partner_id = fields.Many2one(related='order_id.partner_id', store=True, string='Customer', readonly=False)
analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags') analytic_tag_ids = fields.Many2many('account.analytic.tag', string='Analytic Tags')
analytic_line_ids = fields.One2many('account.analytic.line', 'so_line', string="Analytic lines") analytic_line_ids = fields.One2many('account.analytic.line', 'so_line', string="Analytic lines")
is_expense = fields.Boolean('Is expense', help="Is true if the sales order line comes from an expense or a vendor bills") is_expense = fields.Boolean('Is expense', help="Is true if the sales order line comes from an expense or a vendor bills")
@@ -23,7 +23,7 @@ class SaleOrderTemplate(models.Model):
class SaleOrderTemplateLine(models.Model): class SaleOrderTemplateLine(models.Model):
_inherit = "sale.order.template.line" _inherit = "sale.order.template.line"
website_description = fields.Html('Website Description', related='product_id.product_tmpl_id.quotation_only_description', translate=html_translate) website_description = fields.Html('Website Description', related='product_id.product_tmpl_id.quotation_only_description', translate=html_translate, readonly=False)
@api.onchange('product_id') @api.onchange('product_id')
def _onchange_product_id(self): def _onchange_product_id(self):
@@ -7,7 +7,7 @@ from odoo import api, fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
security_lead = fields.Float(related='company_id.security_lead', string="Security Lead Time") security_lead = fields.Float(related='company_id.security_lead', string="Security Lead Time", readonly=False)
group_route_so_lines = fields.Boolean("Order-Specific Routes", group_route_so_lines = fields.Boolean("Order-Specific Routes",
implied_group='sale_stock.group_route_so_lines') implied_group='sale_stock.group_route_so_lines')
group_display_incoterm = fields.Boolean("Incoterms", implied_group='sale_stock.group_display_incoterm') group_display_incoterm = fields.Boolean("Incoterms", implied_group='sale_stock.group_display_incoterm')
+1 -1
View File
@@ -63,7 +63,7 @@ class StockRule(models.Model):
class StockPicking(models.Model): class StockPicking(models.Model):
_inherit = 'stock.picking' _inherit = 'stock.picking'
sale_id = fields.Many2one(related="group_id.sale_id", string="Sales Order", store=True) sale_id = fields.Many2one(related="group_id.sale_id", string="Sales Order", store=True, readonly=False)
def _log_less_quantities_than_expected(self, moves): def _log_less_quantities_than_expected(self, moves):
@@ -31,7 +31,7 @@ class ProjectCreateSalesOrder(models.TransientModel):
partner_id = fields.Many2one('res.partner', string="Customer", domain=[('customer', '=', True)], required=True, help="Customer of the sales order") partner_id = fields.Many2one('res.partner', string="Customer", domain=[('customer', '=', True)], required=True, help="Customer of the sales order")
product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.") product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.")
price_unit = fields.Float("Unit Price", help="Unit price of the sales order item.") price_unit = fields.Float("Unit Price", help="Unit price of the sales order item.")
currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id') currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id', readonly=False)
billable_type = fields.Selection([ billable_type = fields.Selection([
('project_rate', 'At Project Rate'), ('project_rate', 'At Project Rate'),
@@ -201,7 +201,7 @@ class ProjectCreateSalesOrderLine(models.TransientModel):
product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", required=True, product_id = fields.Many2one('product.product', domain=[('type', '=', 'service'), ('invoice_policy', '=', 'delivery'), ('service_type', '=', 'timesheet')], string="Service", required=True,
help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.") help="Product of the sales order item. Must be a service invoiced based on timesheets on tasks.")
price_unit = fields.Float("Unit Price", default=1.0, help="Unit price of the sales order item.") price_unit = fields.Float("Unit Price", default=1.0, help="Unit price of the sales order item.")
currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id') currency_id = fields.Many2one('res.currency', string="Currency", related='product_id.currency_id', readonly=False)
employee_id = fields.Many2one('hr.employee', string="Employee", required=True, help="Employee that has timesheets on the project.") employee_id = fields.Many2one('hr.employee', string="Employee", required=True, help="Employee that has timesheets on the project.")
_sql_constraints = [ _sql_constraints = [
@@ -7,5 +7,5 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
snailmail_color = fields.Boolean(string='Print In Color', related='company_id.snailmail_color') snailmail_color = fields.Boolean(string='Print In Color', related='company_id.snailmail_color', readonly=False)
snailmail_duplex = fields.Boolean(string='Print Both sides', related='company_id.snailmail_duplex') snailmail_duplex = fields.Boolean(string='Print Both sides', related='company_id.snailmail_duplex', readonly=False)
@@ -7,4 +7,4 @@ from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
invoice_is_snailmail = fields.Boolean(string='Send by Post', related='company_id.invoice_is_snailmail') invoice_is_snailmail = fields.Boolean(string='Send by Post', related='company_id.invoice_is_snailmail', readonly=False)
+1 -1
View File
@@ -451,7 +451,7 @@ class ProductTemplate(models.Model):
# TDE FIXME: seems only visible in a view - remove me ? # TDE FIXME: seems only visible in a view - remove me ?
route_from_categ_ids = fields.Many2many( route_from_categ_ids = fields.Many2many(
relation="stock.location.route", string="Category Routes", relation="stock.location.route", string="Category Routes",
related='categ_id.total_route_ids') related='categ_id.total_route_ids', readonly=False)
def _is_cost_method_standard(self): def _is_cost_method_standard(self):
return True return True
+1 -1
View File
@@ -26,7 +26,7 @@ class ResConfigSettings(models.TransientModel):
implied_group='stock.group_adv_location', implied_group='stock.group_adv_location',
help="Add and customize route operations to process product moves in your warehouse(s): e.g. unload > quality control > stock for incoming products, pick > pack > ship for outgoing products. \n You can also set putaway strategies on warehouse locations in order to send incoming products into specific child locations straight away (e.g. specific bins, racks).") help="Add and customize route operations to process product moves in your warehouse(s): e.g. unload > quality control > stock for incoming products, pick > pack > ship for outgoing products. \n You can also set putaway strategies on warehouse locations in order to send incoming products into specific child locations straight away (e.g. specific bins, racks).")
group_warning_stock = fields.Boolean("Warnings for Stock", implied_group='stock.group_warning_stock') group_warning_stock = fields.Boolean("Warnings for Stock", implied_group='stock.group_warning_stock')
propagation_minimum_delta = fields.Integer(related='company_id.propagation_minimum_delta', string="Minimum Delta for Propagation") propagation_minimum_delta = fields.Integer(related='company_id.propagation_minimum_delta', string="Minimum Delta for Propagation", readonly=False)
use_propagation_minimum_delta = fields.Boolean( use_propagation_minimum_delta = fields.Boolean(
string="No Rescheduling Propagation", string="No Rescheduling Propagation",
oldname='default_new_propagation_minimum_delta', oldname='default_new_propagation_minimum_delta',
+1 -1
View File
@@ -352,7 +352,7 @@ class InventoryLine(models.Model):
'Theoretical Quantity', compute='_compute_theoretical_qty', 'Theoretical Quantity', compute='_compute_theoretical_qty',
digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True)
inventory_location_id = fields.Many2one( inventory_location_id = fields.Many2one(
'stock.location', 'Inventory Location', related='inventory_id.location_id', related_sudo=False) 'stock.location', 'Inventory Location', related='inventory_id.location_id', related_sudo=False, readonly=False)
product_tracking = fields.Selection('Tracking', related='product_id.tracking', readonly=True) product_tracking = fields.Selection('Tracking', related='product_id.tracking', readonly=True)
@api.one @api.one
+5 -5
View File
@@ -65,7 +65,7 @@ class StockMove(models.Model):
# TDE FIXME: make it stored, otherwise group will not work # TDE FIXME: make it stored, otherwise group will not work
product_tmpl_id = fields.Many2one( product_tmpl_id = fields.Many2one(
'product.template', 'Product Template', 'product.template', 'Product Template',
related='product_id.product_tmpl_id', related='product_id.product_tmpl_id', readonly=False,
help="Technical: used in views") help="Technical: used in views")
product_packaging = fields.Many2one( product_packaging = fields.Many2one(
'product.packaging', 'Preferred Packaging', 'product.packaging', 'Preferred Packaging',
@@ -91,7 +91,7 @@ class StockMove(models.Model):
copy=False, copy=False,
help="Optional: previous stock move when chaining them") help="Optional: previous stock move when chaining them")
picking_id = fields.Many2one('stock.picking', 'Transfer Reference', index=True, states={'done': [('readonly', True)]}) picking_id = fields.Many2one('stock.picking', 'Transfer Reference', index=True, states={'done': [('readonly', True)]})
picking_partner_id = fields.Many2one('res.partner', 'Transfer Destination Address', related='picking_id.partner_id') picking_partner_id = fields.Many2one('res.partner', 'Transfer Destination Address', related='picking_id.partner_id', readonly=False)
note = fields.Text('Notes') note = fields.Text('Notes')
state = fields.Selection([ state = fields.Selection([
('draft', 'New'), ('cancel', 'Cancelled'), ('draft', 'New'), ('cancel', 'Cancelled'),
@@ -109,7 +109,7 @@ class StockMove(models.Model):
price_unit = fields.Float( price_unit = fields.Float(
'Unit Price', help="Technical field used to record the product cost set by the user during a picking confirmation (when costing " 'Unit Price', help="Technical field used to record the product cost set by the user during a picking confirmation (when costing "
"method used is 'average price' or 'real'). Value given in company currency and in product uom.", copy=False) # as it's a technical field, we intentionally don't provide the digits attribute "method used is 'average price' or 'real'). Value given in company currency and in product uom.", copy=False) # as it's a technical field, we intentionally don't provide the digits attribute
backorder_id = fields.Many2one('stock.picking', 'Back Order of', related='picking_id.backorder_id', index=True) backorder_id = fields.Many2one('stock.picking', 'Back Order of', related='picking_id.backorder_id', index=True, readonly=False)
origin = fields.Char("Source Document") origin = fields.Char("Source Document")
procure_method = fields.Selection([ procure_method = fields.Selection([
('make_to_stock', 'Default: Take From Stock'), ('make_to_stock', 'Default: Take From Stock'),
@@ -145,9 +145,9 @@ class StockMove(models.Model):
restrict_partner_id = fields.Many2one('res.partner', 'Owner ', help="Technical field used to depict a restriction on the ownership of quants to consider when marking this move as 'done'") restrict_partner_id = fields.Many2one('res.partner', 'Owner ', help="Technical field used to depict a restriction on the ownership of quants to consider when marking this move as 'done'")
route_ids = fields.Many2many('stock.location.route', 'stock_location_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route") route_ids = fields.Many2many('stock.location.route', 'stock_location_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route")
warehouse_id = fields.Many2one('stock.warehouse', 'Warehouse', help="Technical field depicting the warehouse to consider for the route selection on the next procurement (if any).") warehouse_id = fields.Many2one('stock.warehouse', 'Warehouse', help="Technical field depicting the warehouse to consider for the route selection on the next procurement (if any).")
has_tracking = fields.Selection(related='product_id.tracking', string='Product with Tracking') has_tracking = fields.Selection(related='product_id.tracking', string='Product with Tracking', readonly=False)
quantity_done = fields.Float('Quantity Done', compute='_quantity_done_compute', digits=dp.get_precision('Product Unit of Measure'), inverse='_quantity_done_set') quantity_done = fields.Float('Quantity Done', compute='_quantity_done_compute', digits=dp.get_precision('Product Unit of Measure'), inverse='_quantity_done_set')
show_operations = fields.Boolean(related='picking_id.picking_type_id.show_operations') show_operations = fields.Boolean(related='picking_id.picking_type_id.show_operations', readonly=False)
show_details_visible = fields.Boolean('Details Visible', compute='_compute_show_details_visible') show_details_visible = fields.Boolean('Details Visible', compute='_compute_show_details_visible')
show_reserved_availability = fields.Boolean('From Supplier', compute='_compute_show_reserved_availability') show_reserved_availability = fields.Boolean('From Supplier', compute='_compute_show_reserved_availability')
picking_code = fields.Selection(related='picking_id.picking_type_id.code', readonly=True) picking_code = fields.Selection(related='picking_id.picking_type_id.code', readonly=True)
+3 -3
View File
@@ -44,12 +44,12 @@ class StockMoveLine(models.Model):
lots_visible = fields.Boolean(compute='_compute_lots_visible') lots_visible = fields.Boolean(compute='_compute_lots_visible')
picking_type_use_create_lots = fields.Boolean(related='picking_id.picking_type_id.use_create_lots', readonly=True) picking_type_use_create_lots = fields.Boolean(related='picking_id.picking_type_id.use_create_lots', readonly=True)
picking_type_use_existing_lots = fields.Boolean(related='picking_id.picking_type_id.use_existing_lots', readonly=True) picking_type_use_existing_lots = fields.Boolean(related='picking_id.picking_type_id.use_existing_lots', readonly=True)
state = fields.Selection(related='move_id.state', store=True, related_sudo=False) state = fields.Selection(related='move_id.state', store=True, related_sudo=False, readonly=False)
is_initial_demand_editable = fields.Boolean(related='move_id.is_initial_demand_editable') is_initial_demand_editable = fields.Boolean(related='move_id.is_initial_demand_editable', readonly=False)
is_locked = fields.Boolean(related='move_id.is_locked', default=True, readonly=True) is_locked = fields.Boolean(related='move_id.is_locked', default=True, readonly=True)
consume_line_ids = fields.Many2many('stock.move.line', 'stock_move_line_consume_rel', 'consume_line_id', 'produce_line_id', help="Technical link to see who consumed what. ") consume_line_ids = fields.Many2many('stock.move.line', 'stock_move_line_consume_rel', 'consume_line_id', 'produce_line_id', help="Technical link to see who consumed what. ")
produce_line_ids = fields.Many2many('stock.move.line', 'stock_move_line_consume_rel', 'produce_line_id', 'consume_line_id', help="Technical link to see which line was produced with this. ") produce_line_ids = fields.Many2many('stock.move.line', 'stock_move_line_consume_rel', 'produce_line_id', 'consume_line_id', help="Technical link to see which line was produced with this. ")
reference = fields.Char(related='move_id.reference', store=True, related_sudo=False) reference = fields.Char(related='move_id.reference', store=True, related_sudo=False, readonly=False)
tracking = fields.Selection(related='product_id.tracking', readonly=True) tracking = fields.Selection(related='product_id.tracking', readonly=True)
picking_type_entire_packs = fields.Boolean(related='picking_id.picking_type_id.show_entire_packs', readonly=True) picking_type_entire_packs = fields.Boolean(related='picking_id.picking_type_id.show_entire_packs', readonly=True)
+1 -1
View File
@@ -27,7 +27,7 @@ class StockPackageLevel(models.Model):
],string='State', compute='_compute_state') ],string='State', compute='_compute_state')
is_fresh_package = fields.Boolean(compute='_compute_fresh_pack') is_fresh_package = fields.Boolean(compute='_compute_fresh_pack')
picking_source_location = fields.Many2one('stock.location', related='picking_id.location_id') picking_source_location = fields.Many2one('stock.location', related='picking_id.location_id', readonly=False)
show_lots_m2o = fields.Boolean(compute='_compute_show_lot') show_lots_m2o = fields.Boolean(compute='_compute_show_lot')
show_lots_text = fields.Boolean(compute='_compute_show_lot') show_lots_text = fields.Boolean(compute='_compute_show_lot')
+1 -1
View File
@@ -294,7 +294,7 @@ class Picking(models.Model):
'initial demand. When the picking is done this allows ' 'initial demand. When the picking is done this allows '
'changing the done quantities.') 'changing the done quantities.')
# Used to search on pickings # Used to search on pickings
product_id = fields.Many2one('product.product', 'Product', related='move_lines.product_id') product_id = fields.Many2one('product.product', 'Product', related='move_lines.product_id', readonly=False)
show_operations = fields.Boolean(compute='_compute_show_operations') show_operations = fields.Boolean(compute='_compute_show_operations')
show_lots_text = fields.Boolean(compute='_compute_show_lots_text') show_lots_text = fields.Boolean(compute='_compute_show_lots_text')
has_tracking = fields.Boolean(compute='_compute_has_tracking') has_tracking = fields.Boolean(compute='_compute_has_tracking')
+1 -1
View File
@@ -19,7 +19,7 @@ class ProductionLot(models.Model):
domain=[('type', 'in', ['product', 'consu'])], required=True) domain=[('type', 'in', ['product', 'consu'])], required=True)
product_uom_id = fields.Many2one( product_uom_id = fields.Many2one(
'uom.uom', 'Unit of Measure', 'uom.uom', 'Unit of Measure',
related='product_id.uom_id', store=True) related='product_id.uom_id', store=True, readonly=False)
quant_ids = fields.One2many('stock.quant', 'lot_id', 'Quants', readonly=True) quant_ids = fields.One2many('stock.quant', 'lot_id', 'Quants', readonly=True)
product_qty = fields.Float('Quantity', compute='_product_qty') product_qty = fields.Float('Quantity', compute='_product_qty')
+1 -1
View File
@@ -24,7 +24,7 @@ class StockQuant(models.Model):
# so user can filter on template in webclient # so user can filter on template in webclient
product_tmpl_id = fields.Many2one( product_tmpl_id = fields.Many2one(
'product.template', string='Product Template', 'product.template', string='Product Template',
related='product_id.product_tmpl_id') related='product_id.product_tmpl_id', readonly=False)
product_uom_id = fields.Many2one( product_uom_id = fields.Many2one(
'uom.uom', 'Unit of Measure', 'uom.uom', 'Unit of Measure',
readonly=True, related='product_id.uom_id') readonly=True, related='product_id.uom_id')
+1 -1
View File
@@ -49,7 +49,7 @@ class StockRule(models.Model):
default='make_to_stock', required=True, default='make_to_stock', required=True,
help="""Create Procurement: A procurement will be created in the source location and the system will try to find a rule to resolve it. The available stock will be ignored. help="""Create Procurement: A procurement will be created in the source location and the system will try to find a rule to resolve it. The available stock will be ignored.
Take from Stock: The products will be taken from the available stock.""") Take from Stock: The products will be taken from the available stock.""")
route_sequence = fields.Integer('Route Sequence', related='route_id.sequence', store=True) route_sequence = fields.Integer('Route Sequence', related='route_id.sequence', store=True, readonly=False)
picking_type_id = fields.Many2one( picking_type_id = fields.Many2one(
'stock.picking.type', 'Operation Type', 'stock.picking.type', 'Operation Type',
required=True) required=True)
@@ -13,7 +13,7 @@ class ProductChangeQuantity(models.TransientModel):
# TDE FIXME: strange dfeault method, was present before migration ? to check # TDE FIXME: strange dfeault method, was present before migration ? to check
product_id = fields.Many2one('product.product', 'Product', required=True) product_id = fields.Many2one('product.product', 'Product', required=True)
product_tmpl_id = fields.Many2one('product.template', 'Template', required=True) product_tmpl_id = fields.Many2one('product.template', 'Template', required=True)
product_variant_count = fields.Integer('Variant Count', related='product_tmpl_id.product_variant_count') product_variant_count = fields.Integer('Variant Count', related='product_tmpl_id.product_variant_count', readonly=False)
new_quantity = fields.Float( new_quantity = fields.Float(
'New Quantity on Hand', default=1, 'New Quantity on Hand', default=1,
digits=dp.get_precision('Product Unit of Measure'), required=True, digits=dp.get_precision('Product Unit of Measure'), required=True,
+1 -1
View File
@@ -14,7 +14,7 @@ class ReturnPickingLine(models.TransientModel):
product_id = fields.Many2one('product.product', string="Product", required=True, domain="[('id', '=', product_id)]") product_id = fields.Many2one('product.product', string="Product", required=True, domain="[('id', '=', product_id)]")
quantity = fields.Float("Quantity", digits=dp.get_precision('Product Unit of Measure'), required=True) quantity = fields.Float("Quantity", digits=dp.get_precision('Product Unit of Measure'), required=True)
uom_id = fields.Many2one('uom.uom', string='Unit of Measure', related='move_id.product_uom') uom_id = fields.Many2one('uom.uom', string='Unit of Measure', related='move_id.product_uom', readonly=False)
wizard_id = fields.Many2one('stock.return.picking', string="Wizard") wizard_id = fields.Many2one('stock.return.picking', string="Wizard")
move_id = fields.Many2one('stock.move', "Move") move_id = fields.Many2one('stock.move', "Move")
@@ -52,7 +52,7 @@ class LandedCost(models.Model):
'account.journal', 'Account Journal', 'account.journal', 'Account Journal',
required=True, states={'done': [('readonly', True)]}) required=True, states={'done': [('readonly', True)]})
company_id = fields.Many2one('res.company', string="Company", company_id = fields.Many2one('res.company', string="Company",
related='account_journal_id.company_id') related='account_journal_id.company_id', readonly=False)
@api.one @api.one
@api.depends('cost_lines.price_unit') @api.depends('cost_lines.price_unit')

Some files were not shown because too many files have changed in this diff Show More