[IMP] l10n_ch: treat BVR number as structured communication

Now, Swiss users can auto populate BVR number generated for invoice in it's 'Payment Ref.' field
by simply configure it in 'Communication Standard' of invoice's journal.

task: 1999530

closes odoo/odoo#36253

Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
Hardik Prajapati
2019-08-30 05:10:14 +00:00
parent d1ee54450a
commit 8d7d2aeef3
2 changed files with 15 additions and 0 deletions
+14
View File
@@ -185,3 +185,17 @@ class AccountInvoice(models.Model):
if self.env.context.get('l10n_ch_mark_isr_as_sent'):
self.filtered(lambda inv: not inv.l10n_ch_isr_sent).write({'l10n_ch_isr_sent': True})
return super(AccountInvoice, self.with_context(mail_post_autofollow=True)).message_post(**kwargs)
def _get_reference_ch_invoice(self):
""" This sets ISR reference number which is generated based on customer's `Bank Account` and set it as
`Payment Reference` of the invoice when invoice's journal is using Switzerland's communication standard
"""
self.ensure_one()
return self.l10n_ch_isr_number_spaced
def _get_reference_ch_partner(self):
""" This sets ISR reference number which is generated based on customer's `Bank Account` and set it as
`Payment Reference` of the invoice when invoice's journal is using Switzerland's communication standard
"""
self.ensure_one()
return self.l10n_ch_isr_number_spaced
+1
View File
@@ -14,6 +14,7 @@ class AccountJournal(models.Model):
# 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', readonly=False)
invoice_reference_model = fields.Selection(selection_add=[('ch', 'Switzerland')])
@api.model
def create(self, vals):