forked from OCA/l10n-brazil
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsale.py
More file actions
64 lines (54 loc) · 3.18 KB
/
sale.py
File metadata and controls
64 lines (54 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2013 Raphaël Valyi - Akretion #
# Copyright (C) 2014 Renato Lima - Akretion #
# #
#This program is free software: you can redistribute it and/or modify #
#it under the terms of the GNU Affero General Public License as published by #
#the Free Software Foundation, either version 3 of the License, or #
#(at your option) any later version. #
# #
#This program is distributed in the hope that it will be useful, #
#but WITHOUT ANY WARRANTY; without even the implied warranty of #
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
#GNU Affero General Public License for more details. #
# #
#You should have received a copy of the GNU Affero General Public License #
#along with this program. If not, see <http://www.gnu.org/licenses/>. #
###############################################################################
from openerp.osv import orm
class SaleOrder(orm.Model):
_inherit = 'sale.order'
def _prepare_invoice(self, cr, uid, order, lines, context=None):
"""Prepare the dict of values to create the new invoice for a
sale order. This method may be overridden to implement custom
invoice generation (making sure to call super() to establish
a clean extension chain).
:param browse_record order: sale.order record to invoice
:param list(int) line: list of invoice line IDs that must be
attached to the invoice
:return: dict of value to create() the invoice
"""
result = super(SaleOrder, self)._prepare_invoice(
cr, uid, order, lines, context)
if order.incoterm:
result['incoterm'] = order.incoterm.id
return result
def _prepare_order_picking(self, cr, uid, order, context=None):
result = super(SaleOrder, self)._prepare_order_picking(cr, uid,
order, context)
result['fiscal_category_id'] = order.fiscal_category_id and \
order.fiscal_category_id.id
result['fiscal_position'] = order.fiscal_position and \
order.fiscal_position.id
result['ind_pres'] = order.ind_pres or False
return result
def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, context=None):
result = super(SaleOrder, self)._prepare_order_line_move( cr, uid,
order, line, picking_id, date_planned, context)
result['fiscal_category_id'] = line.fiscal_category_id and \
line.fiscal_category_id.id
result['fiscal_position'] = line.fiscal_position and \
line.fiscal_position.id
return result