mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] Add link to contract in invoice chatter
This commit is contained in:
@@ -603,9 +603,28 @@ class ContractContract(models.Model):
|
|||||||
partner_ids=partner_ids.ids
|
partner_ids=partner_ids.ids
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _add_contract_origin(self, invoices):
|
||||||
|
for item in self:
|
||||||
|
for move in invoices & item._get_related_invoices():
|
||||||
|
move.message_post(
|
||||||
|
body=(
|
||||||
|
_(
|
||||||
|
(
|
||||||
|
"%(msg)s by contract <a href=# data-oe-model=contract.contract"
|
||||||
|
" data-oe-id=%(contract_id)d>%(contract)s</a>."
|
||||||
|
),
|
||||||
|
msg=move._creation_message(),
|
||||||
|
contract_id=item.id,
|
||||||
|
contract=item.display_name,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def _recurring_create_invoice(self, date_ref=False):
|
def _recurring_create_invoice(self, date_ref=False):
|
||||||
invoices_values = self._prepare_recurring_invoices_values(date_ref)
|
invoices_values = self._prepare_recurring_invoices_values(date_ref)
|
||||||
moves = self.env["account.move"].create(invoices_values)
|
moves = self.env["account.move"].create(invoices_values)
|
||||||
|
self._add_contract_origin(moves)
|
||||||
self._invoice_followers(moves)
|
self._invoice_followers(moves)
|
||||||
self._compute_recurring_next_date()
|
self._compute_recurring_next_date()
|
||||||
return moves
|
return moves
|
||||||
|
|||||||
Reference in New Issue
Block a user