Odoo Help


how price_total field compute?

on 6/3/16, 8:03 AM 520 views

could anyone explain me this below code .here what is sub and how price total compute


def _select(self):

select_str = """

SELECT sub.id, sub.date, sub.product_id, sub.partner_id, sub.country_id, sub.account_analytic_id,

sub.payment_term_id, sub.uom_name, sub.currency_id, sub.journal_id,

sub.fiscal_position_id, sub.user_id, sub.company_id, sub.nbr, sub.type, sub.state,

sub.categ_id, sub.date_due, sub.account_id, sub.account_line_id, sub.partner_bank_id,

sub.product_qty, sub.price_total as price_total, sub.price_average as price_average,

COALESCE(cr.rate, 1) as currency_rate, sub.residual as residual, sub.commercial_partner_id as commercial_partner_id


return select_str


Prakash Sharma

--Prakash Sharma--
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 6/3/16, 9:56 AM

    def init(self, cr):
# self._table = account_invoice_report
tools.drop_view_if_exists(cr, self._table)
cr.execute("""CREATE or REPLACE VIEW %s as (
WITH currency_rate AS (%s)
%s %s %s
) AS sub
LEFT JOIN currency_rate cr ON
(cr.currency_id = sub.currency_id AND
cr.company_id = sub.company_id AND
cr.date_start <= COALESCE(sub.date, NOW()) AND
(cr.date_end IS NULL OR cr.date_end > COALESCE(sub.date, NOW())))
)""" % (
self._table, self.pool['res.currency']._select_companies_rates(),
self._select(), self._sub_select(), self._from(), self._group_by()))

sub is the combination of sub_select,_from and _group_by

"%s %s %s"%(self._sub_select(), self._from(), self._group_by())

Hope it may help in your case

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/3/16, 8:03 AM
Seen: 520 times
Last updated: 6/3/16, 9:56 AM