mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] contract_recurring_invoicing_marker: Better inherability
This commit is contained in:
@@ -24,6 +24,12 @@ class AccountAnalyticAccount(models.Model):
|
|||||||
obj = self.with_context(old_date=old_date, next_date=new_date)
|
obj = self.with_context(old_date=old_date, next_date=new_date)
|
||||||
return super(AccountAnalyticAccount, obj)._prepare_invoice(contract)
|
return super(AccountAnalyticAccount, obj)._prepare_invoice(contract)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _insert_markers(self, line, date_start, date_end, date_format):
|
||||||
|
line = line.replace('#START#', date_start.strftime(date_format))
|
||||||
|
line = line.replace('#END#', date_end.strftime(date_format))
|
||||||
|
return line
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _prepare_invoice_line(self, line, invoice_id):
|
def _prepare_invoice_line(self, line, invoice_id):
|
||||||
res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
|
res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
|
||||||
@@ -34,8 +40,7 @@ class AccountAnalyticAccount(models.Model):
|
|||||||
lang = lang_obj.search(
|
lang = lang_obj.search(
|
||||||
[('code', '=', contract.partner_id.lang)])
|
[('code', '=', contract.partner_id.lang)])
|
||||||
date_format = lang.date_format or '%d/%M/%Y'
|
date_format = lang.date_format or '%d/%M/%Y'
|
||||||
res['name'] = res['name'].replace(
|
res['name'] = self._insert_markers(
|
||||||
'#START#', self.env.context['old_date'].strftime(date_format))
|
res['name'], self.env.context['old_date'],
|
||||||
res['name'] = res['name'].replace(
|
self.env.context['next_date'], date_format)
|
||||||
'#END#', self.env.context['next_date'].strftime(date_format))
|
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<field name="inherit_id" ref="account_analytic_analysis.account_analytic_account_form_form"/>
|
<field name="inherit_id" ref="account_analytic_analysis.account_analytic_account_form_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="recurring_invoice_line_ids" position="after">
|
<field name="recurring_invoice_line_ids" position="after">
|
||||||
<group string="Legend (for the markers inside invoice lines description)">
|
<group string="Legend (for the markers inside invoice lines description)" name="group_legend">
|
||||||
<p colspan="2"> <strong>#START#</strong>: Start date of the invoiced period</p>
|
<p colspan="2"> <strong>#START#</strong>: Start date of the invoiced period</p>
|
||||||
<p colspan="2"> <strong>#END#</strong>: End date of the invoiced period</p>
|
<p colspan="2"> <strong>#END#</strong>: End date of the invoiced period</p>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user