Debian Codegraph @

addons/l10n_fr_account/models/account_move.py

raw
1 from odoo import fields, models, api
2
3
4 class AccountMove(models.Model):
5 _inherit = "account.move"
6
7 l10n_fr_is_company_french = fields.Boolean(compute='_compute_l10n_fr_is_company_french')
8
9 @api.model
10 def _get_view(self, view_id=None, view_type='form', **options):
11 arch, view = super()._get_view(view_id, view_type, **options)
12 company = self.env.company
13 if view_type == 'form' and company.country_code in company._get_france_country_codes():
14 shipping_fields = arch.xpath("//field[@name='partner_shipping_id']")
15 if shipping_fields:
16 shipping_fields[0].attrib.pop("groups", None)
17 return arch, view
18
19 @api.depends('company_id.country_code')
20 def _compute_l10n_fr_is_company_french(self):
21 for record in self:
22 record.l10n_fr_is_company_french = record.country_code in record.company_id._get_france_country_codes()
23
24 @api.depends("country_code", "move_type")
25 def _compute_show_delivery_date(self):
26 # EXTEND 'account'
27 super()._compute_show_delivery_date()
28 for move in self.filtered(lambda m: m.country_code == 'FR'):
29 move.show_delivery_date = move.is_sale_document()