Convert M2O fields to M2M
Add explainations to the user about the algo Update translation files
This commit is contained in:
@@ -33,10 +33,10 @@ class PurchaseSuggestionGenerate(models.TransientModel):
|
||||
_name = 'purchase.suggest.generate'
|
||||
_description = 'Start to generate the purchase suggestions'
|
||||
|
||||
categ_id = fields.Many2one(
|
||||
'product.category', string='Product Category')
|
||||
seller_id = fields.Many2one(
|
||||
'res.partner', string='Supplier',
|
||||
categ_ids = fields.Many2many(
|
||||
'product.category', string='Product Categories')
|
||||
seller_ids = fields.Many2many(
|
||||
'res.partner', string='Suppliers',
|
||||
domain=[('supplier', '=', True), ('is_company', '=', True)])
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', string='Stock Location', required=True,
|
||||
@@ -77,14 +77,14 @@ class PurchaseSuggestionGenerate(models.TransientModel):
|
||||
('company_id', '=', self.env.user.company_id.id),
|
||||
('location_id', 'child_of', self.location_id.id),
|
||||
]
|
||||
if self.categ_id or self.seller_id:
|
||||
if self.categ_ids or self.seller_ids:
|
||||
product_domain = []
|
||||
if self.categ_id:
|
||||
if self.categ_ids:
|
||||
product_domain.append(
|
||||
('categ_id', 'child_of', self.categ_id.id))
|
||||
if self.seller_id:
|
||||
('categ_id', 'in', self.categ_ids.ids))
|
||||
if self.seller_ids:
|
||||
product_domain.append(
|
||||
('seller_id', '=', self.seller_id.id))
|
||||
('seller_id', 'in', self.seller_ids.ids))
|
||||
products_subset = ppo.search(product_domain)
|
||||
op_domain.append(('product_id', 'in', products_subset.ids))
|
||||
ops = swoo.search(op_domain)
|
||||
@@ -160,8 +160,7 @@ class PurchaseSuggestionGenerate(models.TransientModel):
|
||||
return action
|
||||
else:
|
||||
raise Warning(_(
|
||||
"The virtual stock for all related products is above the "
|
||||
"minimum stock level."))
|
||||
"There are no purchase suggestions to generate."))
|
||||
|
||||
|
||||
class PurchaseSuggest(models.TransientModel):
|
||||
@@ -172,7 +171,8 @@ class PurchaseSuggest(models.TransientModel):
|
||||
product_id = fields.Many2one(
|
||||
'product.product', string='Product', required=True, readonly=True)
|
||||
seller_id = fields.Many2one(
|
||||
'res.partner', string='Supplier', readonly=True)
|
||||
'res.partner', string='Supplier', readonly=True,
|
||||
domain=[('supplier', '=', True)])
|
||||
qty_available = fields.Float(
|
||||
string='Quantity On Hand', readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
|
||||
@@ -14,9 +14,18 @@
|
||||
<field name="model">purchase.suggest.generate</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Generate Purchase Suggestions">
|
||||
<p>This wizard will generate purchase suggestions based on the following rules:</p>
|
||||
<ol>
|
||||
<li>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</li>
|
||||
<li>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</li>
|
||||
</ol>
|
||||
|
||||
<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, enter that value in the last column.</p>
|
||||
|
||||
<p>Once you have entered a Quantity to Order for all the lines you would like to re-order, select all the lines and click on <i>More</i> > <i>Create Purchase Orders</i>.</p>
|
||||
<group name="name">
|
||||
<field name="categ_id"/>
|
||||
<field name="seller_id"/>
|
||||
<field name="categ_ids" widget="many2many_tags"/>
|
||||
<field name="seller_ids" widget="many2many_tags"/>
|
||||
<field name="location_id"/>
|
||||
</group>
|
||||
<footer>
|
||||
@@ -86,7 +95,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Purchase Orders">
|
||||
<p class="oe_grey">
|
||||
This wizard will create Purchase Orders.
|
||||
Click on the red button below to create the purchase orders.
|
||||
</p>
|
||||
<footer>
|
||||
<button type="object" name="create_po"
|
||||
|
||||
Reference in New Issue
Block a user