Odoo Help

Welcome!

This community 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.

0

how price_total field compute?

By
madan
on 6/3/16, 8:03 AM 158 views

hi
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

    
0

Prakash Sharma

--Prakash Sharma--
815
| 2 1 4
Delhi, India
--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
FROM (
%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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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