Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] purchase_last_price_info: Migration to 10.0 #406

Closed
wants to merge 1 commit into from

Conversation

kittiu
Copy link
Member

@kittiu kittiu commented Jun 5, 2017

Propose to merge this module.

@kittiu kittiu mentioned this pull request Jun 5, 2017
38 tasks
@kittiu
Copy link
Member Author

kittiu commented Jun 26, 2017

Can this one be merged?
(I see the runbot failed but with no reason).

@@ -14,16 +11,22 @@ def _get_last_purchase(self):
""" Get last purchase price, last purchase date and last supplier """
lines = self.env['purchase.order.line'].search(
[('product_id', '=', self.id),
('state', 'in', ['confirmed', 'done'])]).sorted(
('state', 'in', ['purchase', 'done'])]).sorted(
key=lambda l: l.order_id.date_order, reverse=True)
self.last_purchase_date = lines[:1].order_id.date_order
self.last_purchase_price = lines[:1].price_unit
self.last_supplier_id = lines[:1].order_id.partner_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The search and sorted could be replaced by:
self.env['purchase.order.line'].search( [('product_id', '=', self.id), ('state', 'in', ['purchase', 'done'])], order='date_order DESC', limit=1)

Then you can change lines[:1] to lines.

Also you can take the date_order and partner_id from lines directly.

string='Last Purchase Price', compute='_get_last_purchase')
string='Last Purchase Price',
compute='_get_last_purchase',
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the digits=dp.get_precision('Product Price') for display the same decimal precisions as in the lines.

@Abranes
Copy link
Member

Abranes commented Sep 17, 2018

Change @api.one for @api.multi.

For the rest, the module is working.

@kittiu if you can't do the changes I can do it.

@JayVora-SerpentCS
Copy link
Sponsor

ping @kittiu

Copy link
Member

@nikul-serpentcs nikul-serpentcs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve Code

"category": "Purchase Management",
"license": "AGPL-3",
"author": "OdooMRP team, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
"Ecosoft - Kitti U., "
"Odoo Community Association (OCA)",
"website": "http://www.odoomrp.com",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace website URL as per this

##############################################################################

# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odoo

@pedrobaeza
Copy link
Member

Superseeded by #587

@pedrobaeza pedrobaeza closed this Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants