Debian Codegraph @

addons/l10n_cz/models/account_move.py

raw symbols SCIP
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2 from odoo import models, fields, api
3
4
5 class AccountMove(models.Model):
6 _inherit = 'account.move'
7
8 @api.depends('country_code')
9 def _compute_taxable_supply_date(self):
10 super()._compute_taxable_supply_date()
11 for move in self.filtered(lambda m: m.country_code == 'CZ' and not m.taxable_supply_date):
12 move.taxable_supply_date = fields.Date.context_today(move)
13
14 @api.depends('country_code')
15 def _compute_show_taxable_supply_date(self):
16 super()._compute_show_taxable_supply_date()
17 for move in self.filtered(lambda m: m.country_code == 'CZ' and m.move_type != 'entry'):
18 move.show_taxable_supply_date = True
19
20 def _compute_date(self):
21 super()._compute_date()
22 for move in self:
23 if move.country_code == 'CZ' and move.taxable_supply_date and move.state == 'draft' and not move.statement_line_id:
24 move.date = move.taxable_supply_date
25
26 def _get_invoice_currency_rate_date(self):
27 self.ensure_one()
28 if self.country_code == 'CZ' and self.taxable_supply_date:
29 return self.taxable_supply_date
30 return super()._get_invoice_currency_rate_date()