Skip to content
Extraits de code Groupes Projets
Valider 0bb11f2d rédigé par jordan's avatar jordan
Parcourir les fichiers

[update] add field source to deal with multiple modules for report invoice

parent 04ae1637
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -27,6 +27,10 @@ class AccountInvoiceReport(models.Model): ...@@ -27,6 +27,10 @@ class AccountInvoiceReport(models.Model):
('paid', 'Payée'), ('paid', 'Payée'),
('cancel', 'Annulée') ('cancel', 'Annulée')
], string='Statut', readonly=True) ], string='Statut', readonly=True)
source = fields.Selection(
string='Source',
selection=[('odoo', 'Odoo')],
required=True,)
date_due = fields.Date(string='Date échéance', readonly=True) date_due = fields.Date(string='Date échéance', readonly=True)
residual_company_signed = fields.Float(string='Montant dû', readonly=True) residual_company_signed = fields.Float(string='Montant dû', readonly=True)
amount_total_signed = fields.Float(string='Total TTC', readonly=True) amount_total_signed = fields.Float(string='Total TTC', readonly=True)
...@@ -52,6 +56,7 @@ class AccountInvoiceReport(models.Model): ...@@ -52,6 +56,7 @@ class AccountInvoiceReport(models.Model):
select_str = """ select_str = """
SELECT SELECT
ROW_NUMBER() OVER(ORDER BY c.date_invoice, c.partner_id) AS id, ROW_NUMBER() OVER(ORDER BY c.date_invoice, c.partner_id) AS id,
c.source,
c.invoice_id, c.invoice_id,
c.date_invoice, c.date_invoice,
c.date_due, c.date_due,
...@@ -72,6 +77,7 @@ class AccountInvoiceReport(models.Model): ...@@ -72,6 +77,7 @@ class AccountInvoiceReport(models.Model):
def _subquery(self): def _subquery(self):
select_str = """ select_str = """
(SELECT (SELECT
'odoo' as source,
id AS invoice_id, id AS invoice_id,
date_invoice, date_invoice,
date_due, date_due,
...@@ -107,7 +113,7 @@ class AccountInvoiceReport(models.Model): ...@@ -107,7 +113,7 @@ class AccountInvoiceReport(models.Model):
@api.multi @api.multi
def _compute_lines(self): def _compute_lines(self):
for inv in self: for inv in self:
if inv.invoice_id: if inv.source == 'odoo' and inv.invoice_id:
inv.lines = "<table class='table table-hover table-striped table-sm'>"\ inv.lines = "<table class='table table-hover table-striped table-sm'>"\
"<thead class='thead-light'><tr><th>Description</th><th>Quantité</th><th>P.U</th>"\ "<thead class='thead-light'><tr><th>Description</th><th>Quantité</th><th>P.U</th>"\
"<th>Total HT</th><th>Total TTC</th></tr></thead><tbody>" + \ "<th>Total HT</th><th>Total TTC</th></tr></thead><tbody>" + \
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter