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

[10.0][FIX]sale generation don't keep the correct uom #284

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions contract_sale_generation/models/account_analytic_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,29 @@ def _prepare_sale_line(self, line, order_id):
sale_line = self.env['sale.order.line'].new({
'order_id': order_id,
'product_id': line.product_id.id,
'product_qty': line.quantity,
'product_uom_qty': line.quantity,
'product_uom': line.uom_id.id,
})
# Get other sale line values from product onchange
sale_line.product_id_change()
sale_line_vals = sale_line._convert_to_write(sale_line._cache)
# Insert markers
name = self._insert_markers(line.name)
name = line.name
contract = line.analytic_account_id
if 'old_date' in self.env.context and 'next_date' in self.env.context:
lang_obj = self.env['res.lang']
lang = lang_obj.search(
[('code', '=', contract.partner_id.lang)])
date_format = lang.date_format or '%m/%d/%Y'
name = self._insert_markers(
line, self.env.context['old_date'],
self.env.context['next_date'], date_format)

sale_line_vals = sale_line._convert_to_write(sale_line._cache)
sale_line_vals.update({
'name': name,
'discount': line.discount,
'price_unit': line.price_unit,
'product_qty': line.quantity,
'product_uom_qty': line.quantity,
'product_uom': line.uom_id.id,
})
return sale_line_vals

Expand Down