12345678910111213141516171819202122232425 |
- # -*- coding: utf-8 -*-
- from openerp import api, fields, models
- from openerp.exceptions import except_orm
- class SaleOrderInsert(models.Model):
- _inherit = 'sale.order'
- @api.model
- def sale_insert_lines_by_eiru_original(self, values):
- sale_lines_eiru = self.env['sale.order.line']
- lines = sale_lines_eiru.search([
- ('order_id', '=', values['id']),
- ('product_id', '=', values['product_id']),
- ])
- if len(lines) == 0:
- lines = {
- 'order_id' : values['id'],
- 'product_id': values['product_id'],
- }
- sale_lines_eiru.create(lines);
- if len(lines) == 1:
- lines.write({
- 'product_uom_qty': lines.product_uom_qty + 1,
- })
|