Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
We use re-ordering rules in order to automate generating purchase orders for products.
However, we need to delay the generation of the purchase order until the user confirms the sales order by setting a custom flag on the sale order itself.
I am thinking of overriding the "procurement_order._procure_orderpoint_confirm" method in ordet to check the value of the custom flag before creating a new procurement order record. However, there is no "ids" parameter in the method "procurement_order._procure_orderpoint_confirm" signature. I need the "ids" parameter in order to be able to access the procurement order object.
How can I delay generating purchase orders based on reordering rules, until the users sets my custom flag on the sale order?
Well, I do not like to answer my own questions. But this code seems to suffice:class
_inherit = "procurement.order"
def _product_virtual_get(self, cr, uid, order_point):
product_virtual_available = super(jamalon_auto_generate_po_procurement_order, self)._product_virtual_get(cr, uid, order_point)
not_confirmed_procurements = 0
for procurement_order in self.browse(cr, uid, self.search(cr, uid, [('product_id','=',order_point.product_id.id),('group_id','!=',False)])):
if not procurement_order.sale_line_id.order_id.x_distribution_confirmed:
not_confirmed_procurements += procurement_order.product_qty
product_virtual_available += not_confirmed_procurements
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/7/16, 3:58 AM|
|Seen: 771 times|
|Last updated: 3/7/16, 8:11 AM|