diff options
| author | Hardik Prajapati <hpr@odoo.com> | 2019-08-30 05:10:14 +0000 |
|---|---|---|
| committer | Hardik Prajapati <hpr@odoo.com> | 2019-08-30 05:10:14 +0000 |
| commit | 8d7d2aeef30567eae47043a720d17aab8aa14cb6 (patch) | |
| tree | b69b3f3ee0752578865c1a26a76bd8d1836b4f72 /addons/l10n_ch/models | |
| parent | d1ee54450aff9f260c98960636795387b4256b3b (diff) | |
[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>
Diffstat (limited to 'addons/l10n_ch/models')
| -rw-r--r-- | addons/l10n_ch/models/account_invoice.py | 14 | ||||
| -rw-r--r-- | addons/l10n_ch/models/account_journal.py | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/addons/l10n_ch/models/account_invoice.py b/addons/l10n_ch/models/account_invoice.py index b8982977552..ec2a94abef9 100644 --- a/addons/l10n_ch/models/account_invoice.py +++ b/addons/l10n_ch/models/account_invoice.py @@ -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 diff --git a/addons/l10n_ch/models/account_journal.py b/addons/l10n_ch/models/account_journal.py index a42e163a299..85646dfa396 100644 --- a/addons/l10n_ch/models/account_journal.py +++ b/addons/l10n_ch/models/account_journal.py @@ -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): |
