text
stringlengths
249
4.58k
__index_level_0__
int64
0
99
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with journal_id attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' journal_id = fields.Many2one( 'account.journal', string='Financial Journal', check_company=True, readonly=True, related='move_line_id.journal_id', store=True, ) <|endoftext|>
48
<|endoftext|> Prompt: Create an Odoo model class named AccountMove with statement_line_ids attribute Completion: class AccountMove(models.Model): _name = "account.move" _inherit = ['account.move'] statement_line_ids = fields.One2many('account.bank.statement.line', 'move_id', string='Statements') <|endoftext|>
92
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with currency_id attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" currency_id = fields.Many2one( comodel_name='res.currency', string='Journal Currency', compute='_compute_currency_id', store=True, ) @api.depends('journal_id.currency_id') def _compute_currency_id(self): for st_line in self: st_line.currency_id = st_line.journal_id.currency_id or st_line.company_id.currency_id <|endoftext|>
81
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with company_currency_id attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" company_currency_id = fields.Many2one(related='company_id.currency_id') <|endoftext|>
2
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticApplicability with account_prefix attribute Completion: class AccountAnalyticApplicability(models.Model): _inherit = 'account.analytic.applicability' _description = "Analytic Plan's Applicabilities" account_prefix = fields.Char( string='Financial Accounts Prefix', help="Prefix that defines which accounts from the financial accounting this applicability should apply on.", ) <|endoftext|>
55
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with sequence attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" sequence = fields.Integer(default=1) <|endoftext|>
75
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with name attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' name = fields.Char('Tag Name', required=True) <|endoftext|>
33
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with payment_ref attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" payment_ref = fields.Char(string='Label') <|endoftext|>
80
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticAccount with credit attribute Completion: class AccountAnalyticAccount(models.Model): _inherit = 'account.analytic.account' credit = fields.Monetary(groups='account.group_account_readonly') <|endoftext|>
42
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with foreign_currency_id attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" foreign_currency_id = fields.Many2one( comodel_name='res.currency', string="Foreign Currency", help="The optional other currency if it is a multi-currency entry.", ) <|endoftext|>
84
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with amount_currency attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" amount_currency = fields.Monetary( compute='_compute_amount_currency', store=True, readonly=False, string="Amount in Currency", currency_field='foreign_currency_id', help="The amount expressed in an optional other currency if it is a multi-currency entry.", ) @api.depends('foreign_currency_id', 'date', 'amount', 'company_id') def _compute_amount_currency(self): for st_line in self: if not st_line.foreign_currency_id: st_line.amount_currency = False elif st_line.date and not st_line.amount_currency: # only convert if it hasn't been set already st_line.amount_currency = st_line.currency_id._convert( from_amount=st_line.amount, to_currency=st_line.foreign_currency_id, company=st_line.company_id, date=st_line.date, ) <|endoftext|>
85
<|endoftext|> Prompt: Create an Odoo model class named AccountRoot with company_id attribute Completion: class AccountRoot(models.Model): _name = 'account.root' _description = 'Account codes first 2 digits' company_id = fields.Many2one('res.company') <|endoftext|>
32
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with statement_valid attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" statement_valid = fields.Boolean( related='statement_id.is_valid', ) <|endoftext|>
91
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticDistributionModel with product_categ_id attribute Completion: class AccountAnalyticDistributionModel(models.Model): _inherit = 'account.analytic.distribution.model' product_categ_id = fields.Many2one( 'product.category', string='Product Category', ondelete='cascade', help="Select a product category which will use analytic account specified in analytic default (e.g. create new customer invoice or Sales order if we select this product, it will automatically take this as an analytic account) <|endoftext|>
45
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with category attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' category = fields.Selection(selection_add=[('invoice', 'Customer Invoice') <|endoftext|>
53
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with code attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" code = fields.Char(size=64, required=True, tracking=True, unaccent=False) <|endoftext|>
3
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with transaction_type attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" transaction_type = fields.Char() <|endoftext|>
79
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with currency_id attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" currency_id = fields.Many2one( comodel_name='res.currency', compute='_compute_currency_id', ) @api.depends('journal_id') def _compute_currency_id(self): for statement in self: statement.currency_id = statement.journal_id.currency_id or statement.company_id.currency_id <|endoftext|>
65
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticApplicability with product_categ_id attribute Completion: class AccountAnalyticApplicability(models.Model): _inherit = 'account.analytic.applicability' _description = "Analytic Plan's Applicabilities" product_categ_id = fields.Many2one( 'product.category', string='Product Category' ) <|endoftext|>
56
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with attachment_ids attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" attachment_ids = fields.Many2many( comodel_name='ir.attachment', string="Attachments", ) <|endoftext|>
71
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticDistributionModel with account_prefix attribute Completion: class AccountAnalyticDistributionModel(models.Model): _inherit = 'account.analytic.distribution.model' account_prefix = fields.Char( string='Accounts Prefix', help="Prefix that defines which accounts from the financial accounting this model should apply on.", ) <|endoftext|>
43
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with name attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" name = fields.Char(string="Account Name", required=True, index='trigram', tracking=True) <|endoftext|>
0
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with balance_start attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" balance_start = fields.Monetary( string='Starting Balance', compute='_compute_balance_start', store=True, readonly=False, ) @api.depends('create_date') def _compute_balance_start(self): for stmt in self.sorted(lambda x: x.first_line_index or '0'): journal_id = stmt.journal_id.id or stmt.line_ids.journal_id.id previous_line_with_statement = self.env['account.bank.statement.line'].search([ ('internal_index', '<', stmt.first_line_index), ('journal_id', '=', journal_id), ('state', '=', 'posted'), ('statement_id', '!=', False), ], limit=1) balance_start = previous_line_with_statement.statement_id.balance_end_real lines_in_between_domain = [ ('internal_index', '<', stmt.first_line_index), ('journal_id', '=', journal_id), ('state', '=', 'posted'), ] if previous_line_with_statement: lines_in_between_domain.append(('internal_index', '>', previous_line_with_statement.internal_index)) # remove lines from previous statement (when multi-editing a line already in another statement) previous_st_lines = previous_line_with_statement.statement_id.line_ids lines_in_common = previous_st_lines.filtered(lambda l: l.id in stmt.line_ids._origin.ids) balance_start -= sum(lines_in_common.mapped('amount')) lines_in_between = self.env['account.bank.statement.line'].search(lines_in_between_domain) balance_start += sum(lines_in_between.mapped('amount')) stmt.balance_start = balance_start <|endoftext|>
61
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with allowed_journal_ids attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" allowed_journal_ids = fields.Many2many('account.journal', string="Allowed Journals", help="Define in which journals this account can be used. If empty, can be used in all journals.") <|endoftext|>
16
<|endoftext|> Prompt: Create an Odoo model class named AccountGroup with parent_path attribute Completion: class AccountGroup(models.Model): _name = "account.group" _description = 'Account Group' parent_path = fields.Char(index=True, unaccent=False) <|endoftext|>
25
<|endoftext|> Prompt: Create an Odoo model class named AccountGroup with name attribute Completion: class AccountGroup(models.Model): _name = "account.group" _description = 'Account Group' name = fields.Char(required=True) <|endoftext|>
26
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with include_initial_balance attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" include_initial_balance = fields.Boolean(string="Bring Accounts Balance Forward", help="Used in reports to know if we should consider journal items from the beginning of time instead of from the fiscal year only. Account types that should be reset to zero at each new fiscal year (like expenses, revenue..) <|endoftext|>
7
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with profit_account_id attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' profit_account_id = fields.Many2one('account.account', string='Profit Account', company_dependent=True, domain="[('deprecated', '=', False) <|endoftext|>
96
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticAccount with vendor_bill_count attribute Completion: class AccountAnalyticAccount(models.Model): _inherit = 'account.analytic.account' vendor_bill_count = fields.Integer( "Vendor Bill Count", compute='_compute_vendor_bill_count', ) @api.depends('line_ids') def _compute_vendor_bill_count(self): purchase_types = self.env['account.move'].get_purchase_types(include_receipts=True) query = self.env['account.move.line']._search([ ('parent_state', '=', 'posted'), ('move_id.move_type', 'in', purchase_types), ]) query.add_where( 'account_move_line.analytic_distribution ?| %s', [[str(account_id) for account_id in self.ids]], ) query.order = None query_string, query_param = query.select( 'jsonb_object_keys(account_move_line.analytic_distribution) as account_id', 'COUNT(DISTINCT(account_move_line.move_id)) as move_count', ) query_string = f"{query_string} GROUP BY jsonb_object_keys(account_move_line.analytic_distribution)" self._cr.execute(query_string, query_param) data = {int(record.get('account_id')): record.get('move_count') for record in self._cr.dictfetchall()} for account in self: account.vendor_bill_count = data.get(account.id, 0) <|endoftext|>
40
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with opening_debit attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" opening_debit = fields.Monetary(string="Opening Debit", compute='_compute_opening_debit_credit', inverse='_set_opening_debit', currency_field='company_currency_id') def _compute_opening_debit_credit(self): self.opening_debit = 0 self.opening_credit = 0 self.opening_balance = 0 if not self.ids: return self.env.cr.execute(""" SELECT line.account_id, SUM(line.balance) AS balance, SUM(line.debit) AS debit, SUM(line.credit) AS credit FROM account_move_line line JOIN res_company comp ON comp.id = line.company_id WHERE line.move_id = comp.account_opening_move_id AND line.account_id IN %s GROUP BY line.account_id """, [tuple(self.ids)]) result = {r['account_id']: r for r in self.env.cr.dictfetchall()} for record in self: res = result.get(record.id) or {'debit': 0, 'credit': 0, 'balance': 0} record.opening_debit = res['debit'] record.opening_credit = res['credit'] record.opening_balance = res['balance'] <|endoftext|>
17
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with non_trade attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" non_trade = fields.Boolean(default=False, help="If set, this account will belong to Non Trade Receivable/Payable in reports and filters.\n" "If not, this account will belong to Trade Receivable/Payable in reports and filters.") <|endoftext|>
23
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with account_number attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" account_number = fields.Char(string='Bank Account Number') <|endoftext|>
77
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with statement_complete attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" statement_complete = fields.Boolean( related='statement_id.is_complete', ) <|endoftext|>
90
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticDistributionModel with product_id attribute Completion: class AccountAnalyticDistributionModel(models.Model): _inherit = 'account.analytic.distribution.model' product_id = fields.Many2one( 'product.product', string='Product', ondelete='cascade', help="Select a product for which the analytic distribution will be used (e.g. create new customer invoice or Sales order if we select this product, it will automatically take this as an analytic account) <|endoftext|>
44
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with general_account_id attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' general_account_id = fields.Many2one( 'account.account', string='Financial Account', ondelete='restrict', domain="[('deprecated', '=', False) <|endoftext|>
47
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with country_code attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" country_code = fields.Char( related='company_id.account_fiscal_country_id.code' ) <|endoftext|>
87
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with related_taxes_amount attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" related_taxes_amount = fields.Integer(compute='_compute_related_taxes_amount') def _compute_related_taxes_amount(self): for record in self: record.related_taxes_amount = self.env['account.tax'].search_count([ '|', ('invoice_repartition_line_ids.account_id', '=', record.id), ('refund_repartition_line_ids.account_id', '=', record.id), ]) <|endoftext|>
22
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with journal_id attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" journal_id = fields.Many2one( comodel_name='account.journal', compute='_compute_journal_id', store=True, check_company=True, ) @api.depends('line_ids.journal_id') def _compute_journal_id(self): for statement in self: statement.journal_id = statement.line_ids.journal_id <|endoftext|>
66
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with running_balance attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" running_balance = fields.Monetary( compute='_compute_running_balance' ) def _compute_running_balance(self): # It looks back to find the latest statement and uses its balance_start as an anchor point for calculation, so # that the running balance is always relative to the latest statement. In this way we do not need to calculate # the running balance for all statement lines every time. # If there are statements inside the computed range, their balance_start has priority over calculated balance. # we have to compute running balance for draft lines because they are visible and also # the user can split on that lines, but their balance should be the same as previous posted line # we do the same for the canceled lines, in order to keep using them as anchor points self.statement_id.flush_model(['balance_start', 'first_line_index']) self.flush_model(['internal_index', 'date', 'journal_id', 'statement_id', 'amount', 'state']) record_by_id = {x.id: x for x in self} for journal in self.journal_id: journal_lines_indexes = self.filtered(lambda line: line.journal_id == journal)\ .sorted('internal_index')\ .mapped('internal_index') min_index, max_index = journal_lines_indexes[0], journal_lines_indexes[-1] # Find the oldest index for each journal. self._cr.execute( """ SELECT first_line_index, COALESCE(balance_start, 0.0) FROM account_bank_statement WHERE first_line_index < %s AND journal_id = %s ORDER BY first_line_index DESC LIMIT 1 """, [min_index, journal.id], ) current_running_balance = 0.0 extra_clause = '' extra_params = [] row = self._cr.fetchone() if row: starting_index, current_running_balance = row extra_clause = "AND st_line.internal_index >= %s" extra_params.append(starting_index) self._cr.execute( f""" SELECT st_line.id, st_line.amount, st.first_line_index = st_line.internal_index AS is_anchor, COALESCE(st.balance_start, 0.0), move.state FROM account_bank_statement_line st_line JOIN account_move move ON move.id = st_line.move_id LEFT JOIN account_bank_statement st ON st.id = st_line.statement_id WHERE st_line.internal_index <= %s AND move.journal_id = %s {extra_clause} ORDER BY st_line.internal_index """, [max_index, journal.id] + extra_params, ) for st_line_id, amount, is_anchor, balance_start, state in self._cr.fetchall(): if is_anchor: current_running_balance = balance_start if state == 'posted': current_running_balance += amount if record_by_id.get(st_line_id): record_by_id[st_line_id].running_balance = current_running_balance <|endoftext|>
83
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with active attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' active = fields.Boolean(default=True, help="Set active to false to hide the Account Tag without removing it.") <|endoftext|>
36
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with current_balance attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" current_balance = fields.Float(compute='_compute_current_balance') def _compute_current_balance(self): balances = { read['account_id'][0]: read['balance'] for read in self.env['account.move.line']._read_group( domain=[('account_id', 'in', self.ids), ('parent_state', '=', 'posted')], fields=['balance', 'account_id'], groupby=['account_id'], ) } for record in self: record.current_balance = balances.get(record.id, 0) <|endoftext|>
21
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with color attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' color = fields.Integer('Color Index') <|endoftext|>
35
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with move_line_id attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' move_line_id = fields.Many2one( 'account.move.line', string='Journal Item', ondelete='cascade', index=True, check_company=True, ) <|endoftext|>
50
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with name attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" name = fields.Char( string='Reference', compute='_compute_name', store=True, readonly=False, copy=False, ) @api.depends('create_date') def _compute_name(self): for stmt in self: stmt.name = _("%s Statement %s", stmt.journal_id.code, stmt.date) <|endoftext|>
57
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with first_line_index attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" first_line_index = fields.Char( comodel_name='account.bank.statement.line', compute='_compute_date_index', store=True, index=True, ) @api.depends('line_ids.internal_index', 'line_ids.state') def _compute_date_index(self): for stmt in self: sorted_lines = stmt.line_ids.sorted('internal_index') stmt.first_line_index = sorted_lines[:1].internal_index stmt.date = sorted_lines.filtered(lambda l: l.state == 'posted')[-1:].date <|endoftext|>
60
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with company_id attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' company_id = fields.Many2one('res.company', related='profit_account_id.company_id') <|endoftext|>
99
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with reference attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" reference = fields.Char( string='External Reference', copy=False, ) <|endoftext|>
58
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with internal_index attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" internal_index = fields.Char( string='Internal Reference', compute='_compute_internal_index', store=True, index=True, ) @api.depends('date', 'sequence') def _compute_internal_index(self): """ Internal index is a field that holds the combination of the date, compliment of sequence and id of each line. Using this prevents us having a compound index, and extensive where clauses. Without this finding lines before current line (which we need for calculating the running balance) would need a query like this: date < current date OR (date = current date AND sequence > current date) or ( date = current date AND sequence = current sequence AND id < current id) which needs to be repeated all over the code. This would be simply "internal index < current internal index" using this field. Also, we would need a compound index of date + sequence + id on the table which is not possible because date is not in this table (it is in the account move table) unless we use a sql view which is more complicated. """ # ensure we are using correct value for reversing sequence in the index (2147483647) # NOTE: assert self._fields['sequence'].column_type[1] == 'int4' # if for any reason it changes (how unlikely), we need to update this code for st_line in self.filtered(lambda line: line._origin.id): st_line.internal_index = f'{st_line.date.strftime("%Y%m%d")}' \ f'{MAXINT - st_line.sequence:0>10}' \ f'{st_line._origin.id:0>10}' <|endoftext|>
88
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with rounding attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' rounding = fields.Float(string='Rounding Precision', required=True, default=0.01, help='Represent the non-zero value smallest coinage (for example, 0.05) <|endoftext|>
94
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with ref attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' ref = fields.Char(string='Ref.') <|endoftext|>
52
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with strategy attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' strategy = fields.Selection([('biggest_tax', 'Modify tax amount') <|endoftext|>
95
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with statement_id attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" statement_id = fields.Many2one( comodel_name='account.bank.statement', string='Statement', ) <|endoftext|>
73
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with company_id attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" company_id = fields.Many2one( comodel_name='res.company', related='journal_id.company_id', store=True, ) <|endoftext|>
64
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with applicability attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' applicability = fields.Selection([('accounts', 'Accounts') <|endoftext|>
34
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with used attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" used = fields.Boolean(compute='_compute_used', search='_search_used') def _compute_used(self): ids = set(self._search_used('=', True)[0][2]) for record in self: record.used = record.id in ids <|endoftext|>
5
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with deprecated attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" deprecated = fields.Boolean(default=False, tracking=True) <|endoftext|>
4
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with rounding_method attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' rounding_method = fields.Selection(string='Rounding Method', required=True, selection=[('UP', 'UP') <|endoftext|>
98
<|endoftext|> Prompt: Create an Odoo model class named AccountCashRounding with loss_account_id attribute Completion: class AccountCashRounding(models.Model): _name = 'account.cash.rounding' _description = 'Account Cash Rounding' loss_account_id = fields.Many2one('account.account', string='Loss Account', company_dependent=True, domain="[('deprecated', '=', False) <|endoftext|>
97
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with is_valid attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" is_valid = fields.Boolean( compute='_compute_is_valid', search='_search_is_valid', ) @api.depends('balance_end', 'balance_end_real') def _compute_is_valid(self): # we extract the invalid statements, the statements with no lines and the first statement are not in the query # because they don't have a previous statement, so they are excluded from the join, and we consider them valid. # if we have extracted the valid ones, we would have to mark above-mentioned statements valid manually # For new statements, a sql query can't be used if len(self) == 1: self.is_valid = self._get_statement_validity() else: invalids = self.filtered(lambda s: s.id in self._get_invalid_statement_ids()) invalids.is_valid = False (self - invalids).is_valid = True <|endoftext|>
69
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticLine with code attribute Completion: class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' _description = 'Analytic Line' code = fields.Char(size=8) <|endoftext|>
51
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with company_id attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company) <|endoftext|>
12
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with country_id attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' country_id = fields.Many2one(string="Country", comodel_name='res.country', help="Country for which this tag is available, when applied on taxes.") <|endoftext|>
38
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with currency_id attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" currency_id = fields.Many2one('res.currency', string='Account Currency', tracking=True, help="Forces all journal items in this account to have a specific currency (i.e. bank journals) <|endoftext|>
1
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with date attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" date = fields.Date( compute='_compute_date_index', store=True, index=True, ) @api.depends('line_ids.internal_index', 'line_ids.state') def _compute_date_index(self): for stmt in self: sorted_lines = stmt.line_ids.sorted('internal_index') stmt.first_line_index = sorted_lines[:1].internal_index stmt.date = sorted_lines.filtered(lambda l: l.state == 'posted')[-1:].date <|endoftext|>
59
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with reconcile attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" reconcile = fields.Boolean(string='Allow Reconciliation', tracking=True, compute='_compute_reconcile', store=True, readonly=False, help="Check this box if this account allows invoices & payments matching of journal items.") @api.depends('account_type') def _compute_reconcile(self): for account in self: account.reconcile = account.account_type in ('asset_receivable', 'liability_payable') <|endoftext|>
9
<|endoftext|> Prompt: Create an Odoo model class named AccountGroup with code_prefix_start attribute Completion: class AccountGroup(models.Model): _name = "account.group" _description = 'Account Group' code_prefix_start = fields.Char() <|endoftext|>
27
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with amount attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" amount = fields.Monetary() <|endoftext|>
82
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatement with line_ids attribute Completion: class AccountBankStatement(models.Model): _name = "account.bank.statement" _description = "Bank Statement" line_ids = fields.One2many( comodel_name='account.bank.statement.line', inverse_name='statement_id', string='Statement lines', required=True, ) <|endoftext|>
67
<|endoftext|> Prompt: Create an Odoo model class named AccountAccountTag with tax_negate attribute Completion: class AccountAccountTag(models.Model): _name = 'account.account.tag' _description = 'Account Tag' tax_negate = fields.Boolean(string="Negate Tax Balance", help="Check this box to negate the absolute value of the balance of the lines associated with this tag in tax report computation.") <|endoftext|>
37
<|endoftext|> Prompt: Create an Odoo model class named AccountGroup with code_prefix_end attribute Completion: class AccountGroup(models.Model): _name = "account.group" _description = 'Account Group' code_prefix_end = fields.Char() <|endoftext|>
28
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with tax_ids attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" tax_ids = fields.Many2many('account.tax', 'account_account_tax_default_rel', 'account_id', 'tax_id', string='Default Taxes', check_company=True, context={'append_type_to_tax_name': True}) <|endoftext|>
10
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with group_id attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" group_id = fields.Many2one('account.group', compute='_compute_account_group', store=True, readonly=True, help="Account prefixes can determine account groups.") @api.depends('code') def _compute_account_group(self): if self.ids: self.env['account.group']._adapt_accounts_for_account_groups(self) else: self.group_id = False <|endoftext|>
14
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with move_id attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" move_id = fields.Many2one( comodel_name='account.move', auto_join=True, string='Journal Entry', required=True, readonly=True, ondelete='cascade', index=True, check_company=True) <|endoftext|>
72
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with partner_name attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" partner_name = fields.Char() <|endoftext|>
78
<|endoftext|> Prompt: Create an Odoo model class named AccountBankStatementLine with partner_id attribute Completion: class AccountBankStatementLine(models.Model): _name = "account.bank.statement.line" _inherits = {'account.move': 'move_id'} _description = "Bank Statement Line" partner_id = fields.Many2one( comodel_name='res.partner', string='Partner', ondelete='restrict', domain="['|', ('parent_id','=', False) <|endoftext|>
76
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with root_id attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" root_id = fields.Many2one('account.root', compute='_compute_account_root', store=True) @api.depends('code') def _compute_account_root(self): # this computes the first 2 digits of the account. # This field should have been a char, but the aim is to use it in a side panel view with hierarchy, and it's only supported by many2one fields so far. # So instead, we make it a many2one to a psql view with what we need as records. for record in self: record.root_id = (ord(record.code[0]) * 1000 + ord(record.code[1:2] or '\x00')) if record.code else False <|endoftext|>
15
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticApplicability with business_domain attribute Completion: class AccountAnalyticApplicability(models.Model): _inherit = 'account.analytic.applicability' _description = "Analytic Plan's Applicabilities" business_domain = fields.Selection( selection_add=[ ('invoice', 'Invoice') <|endoftext|>
54
<|endoftext|> Prompt: Create an Odoo model class named AccountAnalyticAccount with debit attribute Completion: class AccountAnalyticAccount(models.Model): _inherit = 'account.analytic.account' debit = fields.Monetary(groups='account.group_account_readonly') <|endoftext|>
41
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with opening_balance attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" opening_balance = fields.Monetary(string="Opening Balance", compute='_compute_opening_debit_credit', inverse='_set_opening_balance', currency_field='company_currency_id') def _compute_opening_debit_credit(self): self.opening_debit = 0 self.opening_credit = 0 self.opening_balance = 0 if not self.ids: return self.env.cr.execute(""" SELECT line.account_id, SUM(line.balance) AS balance, SUM(line.debit) AS debit, SUM(line.credit) AS credit FROM account_move_line line JOIN res_company comp ON comp.id = line.company_id WHERE line.move_id = comp.account_opening_move_id AND line.account_id IN %s GROUP BY line.account_id """, [tuple(self.ids)]) result = {r['account_id']: r for r in self.env.cr.dictfetchall()} for record in self: res = result.get(record.id) or {'debit': 0, 'credit': 0, 'balance': 0} record.opening_debit = res['debit'] record.opening_credit = res['credit'] record.opening_balance = res['balance'] <|endoftext|>
19
<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with note attribute Completion: class AccountAccount(models.Model): _name = "account.account" _inherit = ['mail.thread'] _description = "Account" note = fields.Text('Internal Notes', tracking=True) <|endoftext|>
11