diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index a4c1d36b5e5..3f86952b009 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -44,7 +44,7 @@ Customer Code:

-

+
Reference:

diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py index 2df7f63a702..fb21171ed23 100644 --- a/addons/sale/res_config.py +++ b/addons/sale/res_config.py @@ -51,6 +51,9 @@ Example: 10% for retailers, promotion of 5 EUR on this product, etc."""), 'group_discount_per_so_line': fields.boolean("Allow setting a discount on the sales order lines", implied_group='sale.group_discount_per_so_line', help="Allows you to apply some discount per sales order line."), + 'group_display_incoterm':fields.boolean("Display incoterms on the printed sale orders and invoices reports", + implied_group='sale.group_display_incoterm', + help="The printed reports will display the incoterms for the sale orders and the related invoices"), 'module_warning': fields.boolean("Allow configuring alerts by customer or products", help='Allow to configure notification on products and trigger them when a user wants to sell a given product or a given customer.\n' 'Example: Product: this product is deprecated, do not purchase more than 5.\n' diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml index 1859599a719..e564028a811 100644 --- a/addons/sale/res_config_view.xml +++ b/addons/sale/res_config_view.xml @@ -44,6 +44,10 @@
+
+ +
-
+
Payment Term:

diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index 622ec172081..7d0200319ef 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -55,6 +55,7 @@ You can choose flexible invoicing methods: 'stock_view.xml', 'res_config_view.xml', 'report/sale_report_view.xml', + 'account_invoice_view.xml', ], 'demo': ['sale_stock_demo.xml'], 'test': [ diff --git a/addons/sale_stock/account_invoice_view.xml b/addons/sale_stock/account_invoice_view.xml new file mode 100644 index 00000000000..e9b8c44cba3 --- /dev/null +++ b/addons/sale_stock/account_invoice_view.xml @@ -0,0 +1,24 @@ + + + + account.invoice.form.sale.stock + account.invoice + + + + + + + + + + + + diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 89b6c3680f6..52e63fe8508 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -80,8 +80,15 @@ class sale_order(osv.osv): vals['partner_dest_id'] = order.partner_shipping_id.id return vals + def _prepare_invoice(self, cr, uid, order, lines, context=None): + if context is None: + context = {} + invoice_vals = super(sale_order, self)._prepare_invoice(cr, uid, order, lines, context=context) + invoice_vals['incoterms_id'] = order.incoterm.id or False + return invoice_vals + _columns = { - 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="International Commercial Terms are a series of predefined commercial terms used in international transactions."), + 'incoterm': fields.many2one('stock.incoterms', 'Incoterms', help="International Commercial Terms are a series of predefined commercial terms used in international transactions."), 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], 'Shipping Policy', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="""Pick 'Deliver each product when available' if you allow partial delivery."""), @@ -442,3 +449,32 @@ class stock_picking(osv.osv): created_lines = sale_line_obj.invoice_line_create(cr, uid, sale_line_ids, context=context) invoice_line_obj.write(cr, uid, created_lines, {'invoice_id': invoice_id}, context=context) return invoice_id + + +class account_invoice(osv.Model): + _inherit = 'account.invoice' + _columns = { + 'incoterms_id': fields.many2one( + 'stock.incoterms', + "Incoterms", + help="Incoterms are series of sales terms. They are used to divide transaction costs and responsibilities between buyer and seller and reflect state-of-the-art transportation practices.", + readonly=True, + states={'draft': [('readonly', False)]}), + } + +class sale_advance_payment_inv(osv.TransientModel): + _inherit = 'sale.advance.payment.inv' + + def _prepare_advance_invoice_vals(self, cr, uid, ids, context=None): + result = super(sale_advance_payment_inv,self)._prepare_advance_invoice_vals(cr, uid, ids, context=context) + if context is None: + context = {} + + sale_obj = self.pool.get('sale.order') + sale_ids = context.get('active_ids', []) + res = [] + for sale in sale_obj.browse(cr, uid, sale_ids, context=context): + elem = filter(lambda t: t[0] == sale.id, result)[0] + elem[1]['incoterms_id'] = sale.incoterm.id or False + res.append(elem) + return res diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index f1a68f78834..f75a00632bb 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -142,5 +142,15 @@ + + +