You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
468 B
15 lines
468 B
from odoo import fields, models
|
|
|
|
|
|
class PosOrderReport(models.Model):
|
|
_inherit = 'report.pos.order'
|
|
|
|
margin_total = fields.Float(string='Margin Total')
|
|
margin_rate = fields.Float(string='Margin Rate', group_operator='avg')
|
|
|
|
def _select(self):
|
|
return super(PosOrderReport, self)._select() + """,
|
|
SUM(l.margin) as margin_total,
|
|
(SUM(l.margin / nullif(l.qty,0)) * 100 /
|
|
SUM(nullif(l.purchase_price,0)))::decimal as margin_rate
|
|
"""
|