Skip to content

Commit

Permalink
Merge pull request OCA#19 from leemannd/add_suggestions
Browse files Browse the repository at this point in the history
Add suggested products in SO
  • Loading branch information
gurneyalex authored Feb 15, 2017
2 parents 403ce50 + 139d261 commit b7cc221
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ latest (unreleased)

**Features and Improvements**

* Add product options on SO

**Bugfixes**

**Build**
Expand Down
24 changes: 24 additions & 0 deletions odoo/local-src/specific_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,27 @@ def onchange_opportunity_id(self):
),
'project_market_id': self.opportunity_id.project_market_id.id,
})

@api.onchange('order_line')
def onchange_order_line(self):
order_line = self.order_line
option_lines = []
for line in order_line:
if line.product_id:
for product in line.product_id.optional_product_ids:
if self.pricelist_id:
price = self.pricelist_id.with_context(
uom=product.uom_id.id).get_product_price(
product, 1, False)
else:
price = product.list_price
data = {
'product_id': product.id,
'name': product.name,
'quantity': 1,
'uom_id': product.uom_id.id,
'price_unit': price,
'discount': 0,
}
option_lines.append((0, 0, data))
self.options = option_lines
1 change: 1 addition & 0 deletions odoo/migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ migration:
- l10n_jp
- l10n_us
- l10n_de_skr03
- website_sale

0 comments on commit b7cc221

Please sign in to comment.