Compare commits

...

4 Commits

8 changed files with 367 additions and 10 deletions

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-16 21:21+0000\n"
"PO-Revision-Date: 2015-09-16 21:21+0000\n"
"POT-Creation-Date: 2016-07-04 12:45+0000\n"
"PO-Revision-Date: 2016-07-04 12:45+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -58,10 +58,42 @@ msgstr "Créé par"
msgid "Created on"
msgstr "Date de création"
#. module: purchase_suggest
#: field:purchase.suggest,last_po_date:0
msgid "Date of the Last Order"
msgstr "Date de la dernière commande"
#. module: purchase_suggest
#: help:purchase.suggest,uom_id:0
msgid "Default Unit of Measure used for all stock operation."
msgstr "Unité de mesure par défaut utilisé pour toutes les opérations de stock."
#. module: purchase_suggest
#: help:purchase.suggest,uom_po_id:0
msgid "Default Unit of Measure used for purchase orders. It must be in the same category than the default unit of measure."
msgstr "Unité de mesure par défaut utilisé pour les commandes d'achat. Elle doit être dans la même catégorie que l'unité de mesure par défaut."
#. module: purchase_suggest
#: help:purchase.suggest,last_po_date:0
msgid "Depicts the date where the Quotation should be validated and converted into a Purchase Order, by default it's the creation date."
msgstr "Représente la date à laquelle le devis a été validé et converti en bon de commande, par défaut, c'est la date de création."
#. module: purchase_suggest
#: field:purchase.suggest,display_name:0
#: field:purchase.suggest.generate,display_name:0
#: field:purchase.suggest.po.create,display_name:0
msgid "Display Name"
msgstr "Display Name"
#. module: purchase_suggest
#: field:purchase.suggest,draft_po_qty:0
msgid "Draft PO Quantity"
msgstr "PO quantité (brouillon)"
msgstr "Quantité dans demande de prix"
#. module: purchase_suggest
#: help:purchase.suggest,draft_po_qty:0
msgid "Draft purchase order quantity in the unit of measure of the product (NOT in the purchase unit of measure !)"
msgstr "Quantité sur la demande de prix dans l'unité de mesure du produit (PAS dans l'unité de mesure de la commande !)"
#. module: purchase_suggest
#: view:purchase.suggest.generate:purchase_suggest.purchase_suggest_generate_form
@@ -90,6 +122,13 @@ msgstr "ID"
msgid "Incoming Quantity"
msgstr "A recevoir"
#. module: purchase_suggest
#: field:purchase.suggest,__last_update:0
#: field:purchase.suggest.generate,__last_update:0
#: field:purchase.suggest.po.create,__last_update:0
msgid "Last Modified on"
msgstr "Last Modified on"
#. module: purchase_suggest
#: field:purchase.suggest,last_po_line_id:0
msgid "Last Purchase Order Line"
@@ -110,11 +149,26 @@ msgid "Last Updated on"
msgstr "Dernière mise à jour"
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:248
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:289
#, python-format
msgid "Make sure you have at least an incoming picking type defined"
msgstr "Make sure you have at least an incoming picking type defined"
#. module: purchase_suggest
#: view:purchase.suggest:purchase_suggest.purchase_suggest_tree
msgid "Max Qty"
msgstr "Qté Max"
#. module: purchase_suggest
#: field:purchase.suggest,max_qty:0
msgid "Max Quantity"
msgstr "Quantité Max"
#. module: purchase_suggest
#: view:purchase.suggest:purchase_suggest.purchase_suggest_tree
msgid "Min Qty"
msgstr "Qté Min"
#. module: purchase_suggest
#: field:purchase.suggest,min_qty:0
msgid "Min Quantity"
@@ -131,13 +185,13 @@ msgid "More"
msgstr "Plus"
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:337
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:382
#, python-format
msgid "No purchase orders created or updated"
msgstr "Aucune commande fournisseur créée ou mise-à-jour"
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:327
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:372
#, python-format
msgid "No supplier configured for product '%s'."
msgstr "Aucune fournisseur configuré pour l'article '%s'."
@@ -173,7 +227,12 @@ msgid "Purchase Suggestions"
msgstr "Suggestion réappro"
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:298
#: field:purchase.suggest,uom_po_id:0
msgid "Purchase UoM"
msgstr "Purchase UoM"
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:343
#, python-format
msgid "Purchase order updated from purchase suggestions."
msgstr "Purchase order updated from purchase suggestions."
@@ -188,11 +247,21 @@ msgstr "PurchaseSuggestPoCreate"
msgid "Quantity On Hand"
msgstr "Stock réel"
#. module: purchase_suggest
#: field:purchase.suggest,last_po_qty:0
msgid "Quantity of the Last Order"
msgstr "Quantité de la dernière commande"
#. module: purchase_suggest
#: field:purchase.suggest,qty_to_order:0
msgid "Quantity to Order"
msgstr "Quantité à commander"
#. module: purchase_suggest
#: help:purchase.suggest,qty_to_order:0
msgid "Quantity to order in the purchase unit of measure for the product"
msgstr "Quantity to order in the purchase unit of measure for the product"
#. module: purchase_suggest
#: field:purchase.suggest,orderpoint_id:0
msgid "Re-ordering Rule"
@@ -241,13 +310,13 @@ msgid "The purchase suggestion lines display as much information as possible to
msgstr "Les lignes de suggestion affichent de nombreuses informations afin de vous aider à déterminer la quantité à commander. Une fois votre décision prise, saisissez la quantité dans la dernière colonne."
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:103
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:120
#, python-format
msgid "There are 2 orderpoints (%s and %s) for the same product on stock location %s or its children."
msgstr "Il y a 2 règles de réassort (%s et %s) pour le même article pour l'emplacement de stock %s ou l'un de ses enfants."
#. module: purchase_suggest
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:172
#: code:addons/purchase_suggest/wizard/purchase_suggest.py:192
#, python-format
msgid "There are no purchase suggestions to generate."
msgstr "Aucune suggestion d'achat à faire."
@@ -257,12 +326,36 @@ msgstr "Aucune suggestion d'achat à faire."
msgid "This wizard will generate purchase suggestions based on the following rules:"
msgstr "Cet assistant va créer des suggestions d'achat en fonction des règles suivantes:"
#. module: purchase_suggest
#: field:purchase.suggest,uom_id:0
msgid "UoM"
msgstr "UoM"
#. module: purchase_suggest
#: field:purchase.suggest,last_po_uom:0
msgid "UoM of the Last Order"
msgstr "UoM de la dernière commande"
#. module: purchase_suggest
#: view:purchase.suggest.generate:purchase_suggest.purchase_suggest_generate_form
msgid "if the quantity on hand + incoming quantity - outgoing quantity + quantity in draft purchase orders is strictly inferior to the minimum stock level, it will create a purchase suggestion line"
msgstr "si le stock réel + la quantité à recevoir - la quantité sortante + la quantité commandée (brouillon) est strictement inférieure au stock minimum, une ligne de suggestion sera créé."
#. module: purchase_suggest
#: help:purchase.suggest,max_qty:0
#: help:purchase.suggest,min_qty:0
msgid "in the unit of measure for the product"
msgstr "dans l'unité de mesure du produit"
#. module: purchase_suggest
#: help:purchase.suggest,incoming_qty:0
#: help:purchase.suggest,outgoing_qty:0
#: help:purchase.suggest,qty_available:0
msgid "in the unit of measure of the product"
msgstr "dans l'unité de mesure du produit"
#. module: purchase_suggest
#: view:purchase.suggest.generate:purchase_suggest.purchase_suggest_generate_form
msgid "it will search all the re-ordering rules linked to the selected stock location, limited to the product categories and the suppliers if some were selected"
msgstr "Pour chercher toutes les règles de réassort liées à l'emplacement sélectionné, à la catégorie d'article et aux fournisseurs (si ils sont sélectionnés)"

View File

@@ -366,7 +366,7 @@ class PurchaseSuggestPoCreate(models.TransientModel):
for line in self.env['purchase.suggest'].browse(psuggest_ids):
if not location:
location = line.location_id
if not line.qty_to_order:
if line.qty_to_order == 0.0:
continue
if not line.product_id.seller_id:
raise Warning(_(

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import wizard

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Purchase Suggest Supplierinfo on Product',
'summary': 'Replace orderpoints by supplierinfo on product',
'version': '8.0.1.0.0',
'category': 'Purchase Management',
'website': 'http://akretion.com',
'author': 'Akretion',
'license': 'AGPL-3',
'installable': True,
'depends': [
'purchase_suggest',
'product_variant_supplierinfo'
],
'data': [
'wizard/purchase_suggest_view.xml',
]
}

View File

@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_suggest_supplierinfo_on_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-04 13:57+0000\n"
"PO-Revision-Date: 2016-07-04 13:57+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "Create Purchase Orders"
msgstr "Créer les commandes d'achat"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "More"
msgstr "Autres options"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "Once you have changed the Draft PO Quantity for all the lines you would like to re-order, select this lines and click on"
msgstr "Une fois que vous avez modifié la quantité de la demande de prix pour toutes les lignes pour lesquelles vous souhaitez re-commander, sélectionnez ces lignes et cliquer sur"
#. module: purchase_suggest_supplierinfo_on_product
#: model:ir.model,name:purchase_suggest_supplierinfo_on_product.model_purchase_suggest
msgid "Purchase Suggestions"
msgstr "Suggestion réappro"
#. module: purchase_suggest_supplierinfo_on_product
#: model:ir.model,name:purchase_suggest_supplierinfo_on_product.model_purchase_suggest_generate
msgid "Start to generate the purchase suggestions"
msgstr "Commencer à générer les suggestions d'achat"
#. module: purchase_suggest_supplierinfo_on_product
#: code:addons/purchase_suggest_supplierinfo_on_product/wizard/purchase_suggest.py:111
#, python-format
msgid "The new quantity for the existing purchase order line can not be less than the old quantity"
msgstr "La nouvelle quantité pour la ligne de commande d'achat existante ne peut pas être inférieure à l'ancienne quantité"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "The purchase suggestion lines display as much information as possible to help you take the decision on the quantity that you would like to re-order. When you have decided the quantity you want to re-order, add the quantity at the value in the Draft PO Quantity column."
msgstr "Les lignes de suggestion d'achat affichent autant d'informations que possible afin de vous aider à évaluer la quantité à re-commander. Quand vous avez décidé de la quantité à re-commander, ajouter cette quantité à la valeur de la colonne Quantité Demande de Prix."
#. module: purchase_suggest_supplierinfo_on_product
#: code:addons/purchase_suggest_supplierinfo_on_product/wizard/purchase_suggest.py:95
#, python-format
msgid "There are no purchase suggestions to generate."
msgstr "Aucune suggestion d'achat à faire."
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest:purchase_suggest_supplierinfo_on_product.purchase_suggest_tree
msgid "context.get('purchase_suggest_supplier')"
msgstr "context.get('purchase_suggest_supplier')"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "if found product then it will create a purchase suggestion line"
msgstr "il sera créé autant de lignes de suggestion d'achat que de produits trouvés"
#. module: purchase_suggest_supplierinfo_on_product
#: view:purchase.suggest.generate:purchase_suggest_supplierinfo_on_product.purchase_suggest_generate_form
msgid "it will search all the products linked to the selected stock location and suppliers, limited to the product categories if some were selected"
msgstr "il recherchera tous les produits pour les emplacements et les fournisseurs sélectionnés, en filtrant également sur la catégorie si l'option a été renseignée"

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import purchase_suggest

View File

@@ -0,0 +1,117 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
class PurchaseSuggestionGenerate(models.TransientModel):
_inherit = 'purchase.suggest.generate'
seller_ids = fields.Many2many(
required=True,
domain=[('supplier', '=', True), ('parent_id', '=', False)])
@api.model
def _prepare_suggest_line(self, product_id, qty_dict):
sline = super(PurchaseSuggestionGenerate, self)._prepare_suggest_line(
product_id, qty_dict)
sline['company_id'] = self.env.user.company_id.id
sline['qty_to_order'] = 0.0
if sline['seller_id'] not in self.seller_ids.ids:
product = self.env['product.product'].browse(sline['product_id'])
for supplierinfo in product.seller_ids:
if supplierinfo.name in self.seller_ids:
sline['seller_id'] = supplierinfo.name.id
porderlines = self.env['purchase.order.line'].search([
('state', 'not in', ('draft', 'cancel')),
('product_id', '=', product_id),
('partner_id', '=', sline['seller_id'])],
order='id desc', limit=1)
if not porderlines:
sline['last_po_line_id'] = False
return sline
@api.model
def generate_products_dict(self):
ppo = self.env['product.product']
products = {}
product_domain = self._prepare_product_domain()
product_domain.append(('purchase_ok', '=', True))
product_to_analyse = ppo.search(product_domain)
for product in product_to_analyse:
products[product.id] = {
'min_qty': 0.0,
'max_qty': 0.0,
'draft_po_qty': 0.0, # This value is set later on
'orderpoint': False,
'product': product,
}
return products
@api.multi
def run(self):
self.ensure_one()
pso = self.env['purchase.suggest']
polo = self.env['purchase.order.line']
puo = self.env['product.uom']
p_suggest_lines = []
products = self.generate_products_dict()
polines = polo.search([
('state', '=', 'draft'), ('product_id', 'in', products.keys())])
for line in polines:
qty_product_po_uom = puo._compute_qty_obj(
line.product_uom, line.product_qty, line.product_id.uom_id)
products[line.product_id.id]['draft_po_qty'] += qty_product_po_uom
virtual_qties = self.pool['product.product']._product_available(
self._cr, self._uid, products.keys(),
context={'location': self.location_id.id})
for product_id, qty_dict in products.iteritems():
qty_dict['virtual_available'] =\
virtual_qties[product_id]['virtual_available']
qty_dict['incoming_qty'] =\
virtual_qties[product_id]['incoming_qty']
qty_dict['outgoing_qty'] =\
virtual_qties[product_id]['outgoing_qty']
qty_dict['qty_available'] =\
virtual_qties[product_id]['qty_available']
vals = self._prepare_suggest_line(product_id, qty_dict)
if vals:
p_suggest_lines.append(vals)
p_suggest_lines_sorted = sorted(
p_suggest_lines, key=lambda to_sort: to_sort['seller_id'])
if p_suggest_lines_sorted:
p_suggest_ids = []
for p_suggest_line in p_suggest_lines_sorted:
p_suggest = pso.create(p_suggest_line)
p_suggest_ids.append(p_suggest.id)
action = self.env['ir.actions.act_window'].for_xml_id(
'purchase_suggest', 'purchase_suggest_action')
action.update({
'target': 'current',
'domain': [('id', 'in', p_suggest_ids)],
'context': {'purchase_suggest_supplier': True}
})
return action
else:
raise Warning(_(
"There are no purchase suggestions to generate."))
class PurchaseSuggest(models.TransientModel):
_inherit = 'purchase.suggest'
draft_po_qty = fields.Float(readonly=False)
@api.multi
def write(self, vals):
#vals['qty_to_order'] = 0.0
if 'draft_po_qty' in vals:
if vals['draft_po_qty'] > self.draft_po_qty:
vals['qty_to_order'] = vals['draft_po_qty'] - self.draft_po_qty
else:
raise Warning(_('The new quantity for the existing '
'purchase order line can not be less than '
'the old quantity'))
super(PurchaseSuggest, self).write(vals)
return True

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purchase_suggest_tree" model="ir.ui.view">
<field name="model">purchase.suggest</field>
<field name="inherit_id" ref="purchase_suggest.purchase_suggest_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree[@string='Purchase Suggestions']/field[@name='min_qty']" position="attributes">
<attribute name="invisible">context.get('purchase_suggest_supplier')</attribute>
</xpath>
<xpath expr="//tree[@string='Purchase Suggestions']/field[@name='max_qty']" position="attributes">
<attribute name="invisible">context.get('purchase_suggest_supplier')</attribute>
</xpath>
<xpath expr="//tree[@string='Purchase Suggestions']/field[@name='qty_to_order']" position="attributes">
<attribute name="invisible">context.get('purchase_suggest_supplier')</attribute>
</xpath>
</field>
</record>
<record id="purchase_suggest_generate_form" model="ir.ui.view">
<field name="model">purchase.suggest.generate</field>
<field name="inherit_id" ref="purchase_suggest.purchase_suggest_generate_form"/>
<field name="arch" type="xml">
<xpath expr="//form[@string='Generate Purchase Suggestions']/ol" position="replace">
<ol>
<li>it will search all the products linked to the selected stock location and suppliers, limited to the product categories if some were selected</li>
<li>if found product then it will create a purchase suggestion line</li>
</ol>
</xpath>
<xpath expr="//form[@string='Generate Purchase Suggestions']/p[2]" position="replace">
<p>The purchase suggestion lines display as much information as possible to help you take the decision on the quantity that you would like to re-order. When you have decided the quantity you want to re-order, add the quantity at the value in the Draft PO Quantity column.</p>
</xpath>
<xpath expr="//form[@string='Generate Purchase Suggestions']/p[3]" position="replace">
<p>Once you have changed the Draft PO Quantity for all the lines you would like to re-order, select this lines and click on <i>More</i> > <i>Create Purchase Orders</i></p>
</xpath>
</field>
</record>
</data>
</openerp>