From 79dcae42b2839d7d792cc3b39ace9810e43ad237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Thu, 3 Jan 2013 17:07:50 +0000 Subject: [PATCH 001/241] [MIGR][l10n_br_sale_stock] extracted product_packaging module in new l10n_br_sale_stock module to accomodate to the increased modulrity in OpenERP 7 where sale modules doesn't force you to install the stock module aymore --- l10n_br_sale_stock/TODO.txt | 1 + l10n_br_sale_stock/__init__.py | 1 + l10n_br_sale_stock/__openerp__.py | 39 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 l10n_br_sale_stock/TODO.txt create mode 100644 l10n_br_sale_stock/__init__.py create mode 100644 l10n_br_sale_stock/__openerp__.py diff --git a/l10n_br_sale_stock/TODO.txt b/l10n_br_sale_stock/TODO.txt new file mode 100644 index 000000000000..36a465bec4ce --- /dev/null +++ b/l10n_br_sale_stock/TODO.txt @@ -0,0 +1 @@ +override product_id_change in sale order from view to pass the product_packaging field just like sale_stock does diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py new file mode 100644 index 000000000000..f9bf1abc1309 --- /dev/null +++ b/l10n_br_sale_stock/__init__.py @@ -0,0 +1 @@ +#TODO diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py new file mode 100644 index 000000000000..a6f7922199b1 --- /dev/null +++ b/l10n_br_sale_stock/__openerp__.py @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 Raphaël Valyi - 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 . # +############################################################################### + +{ + 'name': 'l10n_br_sale_stock', + 'description': 'Brazilian Localization for sale_stock_module', + 'category': 'Localisation', + 'license': 'AGPL-3', + 'author': 'Akretion, OpenERPBrasil.org', + 'website': 'http://openerpbrasil.org', + 'version': '0.1', + 'depends': [ + 'l10n_br_sale', + 'sale_stock', + ], + 'init_xml': [], + 'update_xml': [ +# 'sale_stock_view.xml', + ], + 'demo_xml': [], + 'installable': True, + 'auto_install': True +} From 57876c75a2d7b98ff4ca5c39d44c2e8bc8bb1ce3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 16 Jan 2013 16:41:15 -0200 Subject: [PATCH 002/241] =?UTF-8?q?[MIGR]=20finaliza=C3=A7=C3=A3o=20do=20m?= =?UTF-8?q?=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fstock=20e=20corre=C3=A7=C3=B5es?= =?UTF-8?q?=20do=20l10n=5Fbr=5Faccount=20e=20l10n=5Fbr=5Faccount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/TODO.txt | 1 - l10n_br_sale_stock/__init__.py | 22 ++++++++++++++++- l10n_br_sale_stock/__openerp__.py | 5 ++-- l10n_br_sale_stock/sale_stock.py | 34 ++++++++++++++++++++++++++ l10n_br_sale_stock/sale_stock_view.xml | 21 ++++++++++++++++ 5 files changed, 79 insertions(+), 4 deletions(-) delete mode 100644 l10n_br_sale_stock/TODO.txt create mode 100644 l10n_br_sale_stock/sale_stock.py create mode 100644 l10n_br_sale_stock/sale_stock_view.xml diff --git a/l10n_br_sale_stock/TODO.txt b/l10n_br_sale_stock/TODO.txt deleted file mode 100644 index 36a465bec4ce..000000000000 --- a/l10n_br_sale_stock/TODO.txt +++ /dev/null @@ -1 +0,0 @@ -override product_id_change in sale order from view to pass the product_packaging field just like sale_stock does diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index f9bf1abc1309..82fb07838cdc 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -1 +1,21 @@ -#TODO +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 Raphaël Valyi - Akretion # +# Copyright (C) 2013 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 . # +############################################################################### + +import sale_stock \ No newline at end of file diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index a6f7922199b1..30a81440f9b8 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -2,6 +2,7 @@ ############################################################################### # # # Copyright (C) 2013 Raphaël Valyi - Akretion # +# Copyright (C) 2013 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 # @@ -31,8 +32,8 @@ ], 'init_xml': [], 'update_xml': [ -# 'sale_stock_view.xml', - ], + 'sale_stock_view.xml', + ], 'demo_xml': [], 'installable': True, 'auto_install': True diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py new file mode 100644 index 000000000000..28acc57201e7 --- /dev/null +++ b/l10n_br_sale_stock/sale_stock.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +import decimal_precision as dp +from osv import fields, osv + + +class sale_order(osv.Model): + _inherit = 'sale.order' + + def _prepare_order_picking(self, cr, uid, order, context=None): + result = super(sale_order, 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 + return result + +sale_order() diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml new file mode 100644 index 000000000000..d7290ef065e4 --- /dev/null +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -0,0 +1,21 @@ + + + + + + l10n_br_sale_stock.order.form + sale.order + + + + + + + + + + + \ No newline at end of file From 04ac3b9d48cfbd0c085abd135573e8335f7d00d7 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 18 Jan 2013 22:22:49 -0200 Subject: [PATCH 003/241] =?UTF-8?q?Formata=C3=A7=C3=A3o=20do=20c=C3=B3digo?= =?UTF-8?q?=20dos=20modulos=20l10n=5Fbr=5Faccount,=20l10n=5Fbr=5Fbase,=20l?= =?UTF-8?q?10n=5Fbr=5Fcrm,=20l10n=5Fbr=5Fdata=5Fbase,=20l10n=5Fbr=5Fdata?= =?UTF-8?q?=5Fzip=20e=20l10n=5Fbr=5Fsale=5Fstock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale_stock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index 28acc57201e7..08367ac6e824 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -26,9 +26,10 @@ class sale_order(osv.Model): _inherit = 'sale.order' def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(sale_order, 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 = super(sale_order, 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 return result - -sale_order() From 1230a0b3a210fd9e7d6649ac9705cb3ddccb5b7a Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Tue, 22 Jan 2013 23:46:42 -0200 Subject: [PATCH 004/241] =?UTF-8?q?[MIGR]=20l10n=5Fbr=5Fsale,=20l10n=5Fbr?= =?UTF-8?q?=5Fsale=5Fstock=20e=20l10n=5Fbr=5Faccount:=20migra=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20vis=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale_stock_view.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml index d7290ef065e4..46158635369a 100644 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -7,13 +7,9 @@ sale.order - - + + product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos,name, parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context, parent.fiscal_category_id, parent.shop_id, False, parent.partner_invoice_id) - From 95fd0f018428c74cf73d7ca01b8aac309bb7e589 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Tue, 29 Jan 2013 01:08:16 -0200 Subject: [PATCH 005/241] =?UTF-8?q?formata=C3=A7=C3=A3o=20do=20c=C3=B3digo?= =?UTF-8?q?=20PEP8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 12 ++++++------ l10n_br_sale_stock/sale_stock.py | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 30a81440f9b8..657c87bc9ae4 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -27,14 +27,14 @@ 'website': 'http://openerpbrasil.org', 'version': '0.1', 'depends': [ - 'l10n_br_sale', - 'sale_stock', - ], + 'l10n_br_sale', + 'sale_stock', + ], 'init_xml': [], 'update_xml': [ - 'sale_stock_view.xml', - ], + 'sale_stock_view.xml', + ], 'demo_xml': [], 'installable': True, - 'auto_install': True + 'auto_install': True, } diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index 08367ac6e824..c61b3129a027 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -18,8 +18,7 @@ #along with this program. If not, see . # ############################################################################### -import decimal_precision as dp -from osv import fields, osv +from osv import osv class sale_order(osv.Model): From 0d2a4ac510093b0bf78666151f290f5b2e446a18 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 4 Feb 2013 12:20:13 -0200 Subject: [PATCH 006/241] =?UTF-8?q?[MIGR]=20Formata=C3=A7=C3=A3o=20do=20c?= =?UTF-8?q?=C3=B3digo=20PEP8,=20corrigida=20vis=C3=B5es=20do=20modulo=20l1?= =?UTF-8?q?0n=5Fbr=5Fstock=20e=20corrigido=20m=C3=A9todos=20onchange=20do?= =?UTF-8?q?=20objeto=20stock.picking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale_stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index c61b3129a027..c626a1ba0ac1 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -28,7 +28,7 @@ def _prepare_order_picking(self, cr, uid, order, context=None): result = super(sale_order, self)._prepare_order_picking( cr, uid, order, context) result['fiscal_category_id'] = order.fiscal_category_id and \ - order.fiscal_category_id.id + order.fiscal_category_id.id result['fiscal_position'] = order.fiscal_position and \ - order.fiscal_position.id + order.fiscal_position.id return result From 2bd2f2abfa3cc9be6a9eccde64fe96bb9a879989 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 11 Feb 2013 13:51:01 -0200 Subject: [PATCH 007/241] =?UTF-8?q?[MIGR]=20trocadas=20chaves=20update=5Fx?= =?UTF-8?q?ml,=20init=5Fxml=20por=20data=20e=20demo=5Fxml=20por=20demo=20n?= =?UTF-8?q?os=20arquivos=20=5F=5Fopenerp=5F=5F.py=20de=20todos=20modulos?= =?UTF-8?q?=20da=20localiza=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 657c87bc9ae4..59024c5da868 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -30,11 +30,11 @@ 'l10n_br_sale', 'sale_stock', ], - 'init_xml': [], - 'update_xml': [ + 'data': [ 'sale_stock_view.xml', ], - 'demo_xml': [], + 'demo': [], + 'demo': [], 'installable': True, 'auto_install': True, } From de24baa0eb261701fa345c66c045dd3917250ed4 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Tue, 16 Apr 2013 12:07:09 -0300 Subject: [PATCH 008/241] =?UTF-8?q?[MERGE]=20migra=C3=A7=C3=A3o=20do=20m?= =?UTF-8?q?=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fstock=20para=20vers=C3=A3o=207.?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale_stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index c626a1ba0ac1..fddd94967f50 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -18,10 +18,10 @@ #along with this program. If not, see . # ############################################################################### -from osv import osv +from openerp.osv import orm -class sale_order(osv.Model): +class sale_order(orm.Model): _inherit = 'sale.order' def _prepare_order_picking(self, cr, uid, order, context=None): From e68259317ca8b96f7c8b97f55080fb0dddd2d499 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 May 2013 16:36:26 -0300 Subject: [PATCH 009/241] =?UTF-8?q?[FIX]=20Inclu=C3=ADdo=20m=C3=B3dulo=20l?= =?UTF-8?q?10n=5Fbr=5Fstock=20na=20depend=C3=AAncia=20do=20m=C3=B3dulo=20l?= =?UTF-8?q?10n=5Fbr=5Fsale=5Fstock,=20removido=20chave=20'demo'=20duplicad?= =?UTF-8?q?a=20no=20l10n=5Fbr=5Fsale=5Fstock/=5F=5Fopenerp=5F=5F.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 59024c5da868..53a53e5d9b57 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -27,14 +27,14 @@ 'website': 'http://openerpbrasil.org', 'version': '0.1', 'depends': [ - 'l10n_br_sale', 'sale_stock', + 'l10n_br_sale', + 'l10n_br_stock', ], 'data': [ 'sale_stock_view.xml', ], 'demo': [], - 'demo': [], 'installable': True, 'auto_install': True, } From a17402299b5537f15d085d58b709d4b7f90cd341 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 10 Jun 2013 16:23:39 -0300 Subject: [PATCH 010/241] =?UTF-8?q?Corrigido=20relat=C3=B3rio=20de=20an?= =?UTF-8?q?=C3=A1lise=20de=20vendas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__init__.py | 3 +- l10n_br_sale_stock/report/__init__.py | 20 ++++++ l10n_br_sale_stock/report/sale_report.py | 89 ++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 l10n_br_sale_stock/report/__init__.py create mode 100644 l10n_br_sale_stock/report/sale_report.py diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index 82fb07838cdc..536e7a4001d0 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -18,4 +18,5 @@ #along with this program. If not, see . # ############################################################################### -import sale_stock \ No newline at end of file +import sale_stock +import report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/__init__.py b/l10n_br_sale_stock/report/__init__.py new file mode 100644 index 000000000000..87f260be81b0 --- /dev/null +++ b/l10n_br_sale_stock/report/__init__.py @@ -0,0 +1,20 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 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 . # +############################################################################### + +import sale_report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/sale_report.py b/l10n_br_sale_stock/report/sale_report.py new file mode 100644 index 000000000000..34c818a23476 --- /dev/null +++ b/l10n_br_sale_stock/report/sale_report.py @@ -0,0 +1,89 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 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 General Public License for more details. # +# # +#You should have received a copy of the GNU General Public License # +#along with this program. If not, see . # +############################################################################### + +from openerp import tools +from openerp.osv import orm, fields + + +class sale_report(orm.Model): + _inherit = "sale.report" + _columns = { + 'fiscal_category_id': fields.many2one( + 'l10n_br_account.fiscal.category', 'Fiscal Category', + readonly=True), + 'fiscal_position': fields.many2one( + 'account.fiscal.position', 'Fiscal Position', readonly=True) + } + + def init(self, cr): + tools.drop_view_if_exists(cr, 'sale_report') + cr.execute(""" + create or replace view sale_report as ( + select + min(l.id) as id, + l.product_id as product_id, + l.fiscal_category_id as fiscal_category_id, + l.fiscal_position as fiscal_position, + t.uom_id as product_uom, + sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty, + sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total, + 1 as nbr, + s.date_order as date, + s.date_confirm as date_confirm, + to_char(s.date_order, 'YYYY') as year, + to_char(s.date_order, 'MM') as month, + to_char(s.date_order, 'YYYY-MM-DD') as day, + s.partner_id as partner_id, + s.user_id as user_id, + s.shop_id as shop_id, + s.company_id as company_id, + extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, + s.state, + t.categ_id as categ_id, + s.shipped, + s.shipped::integer as shipped_qty_1, + s.pricelist_id as pricelist_id, + s.project_id as analytic_account_id + from + sale_order s + join sale_order_line l on (s.id=l.order_id) + left join product_product p on (l.product_id=p.id) + left join product_template t on (p.product_tmpl_id=t.id) + left join product_uom u on (u.id=l.product_uom) + left join product_uom u2 on (u2.id=t.uom_id) + group by + l.product_id, + l.fiscal_category_id, + l.fiscal_position, + l.product_uom_qty, + l.order_id, + t.uom_id, + t.categ_id, + s.date_order, + s.date_confirm, + s.partner_id, + s.user_id, + s.shop_id, + s.company_id, + s.state, + s.shipped, + s.pricelist_id, + s.project_id + ) + """) From a008d346a1662b70197c386e369d891e36b1d467 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 27 Jun 2013 19:19:27 -0300 Subject: [PATCH 011/241] =?UTF-8?q?Incluido=20recurso=20para=20permitir=20?= =?UTF-8?q?incluir=20observa=C3=A7=C3=B5es=20nas=20classifica=C3=A7=C3=B5e?= =?UTF-8?q?s=20fiscais=20e=20copia-la=20nos=20documentos=20fiscais,=20corr?= =?UTF-8?q?igido=20copia=20de=20observa=C3=A7=C3=B5es=20de=20posi=C3=A7?= =?UTF-8?q?=C3=B5es=20fiscais=20por=20linhas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__init__.py | 1 + l10n_br_sale_stock/stock.py | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 l10n_br_sale_stock/stock.py diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index 536e7a4001d0..a3282952f5d2 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -19,4 +19,5 @@ ############################################################################### import sale_stock +import stock import report \ No newline at end of file diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py new file mode 100644 index 000000000000..38fc0496aba2 --- /dev/null +++ b/l10n_br_sale_stock/stock.py @@ -0,0 +1,64 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm + + +class stock_picking(orm.Model): + _inherit = 'stock.picking' + + def _prepare_invoice(self, cr, uid, picking, partner, + inv_type, journal_id, context=None): + result = super(stock_picking, self)._prepare_invoice( + cr, uid, picking, partner, inv_type, journal_id, context) + + fp_comment = [] + fc_comment = [] + fp_ids = [] + fc_ids = [] + + if picking.fiscal_position and \ + picking.fiscal_position.inv_copy_note and \ + picking.fiscal_position.note: + fp_comment.append(picking.fiscal_position.note) + + for move in picking.move_lines: + if move.sale_line_id: + line = move.sale_line_id + if line.fiscal_position and \ + line.fiscal_position.inv_copy_note and \ + line.fiscal_position.note: + if not line.fiscal_position.id in fp_ids: + fp_comment.append(line.fiscal_position.note) + fp_ids.append(line.fiscal_position.id) + + if move.product_id.property_fiscal_classification: + fc = move.product_id.property_fiscal_classification + if fc.inv_copy_note and fc.note: + if not fc.id in fc_ids: + fc_comment.append(fc.note) + fc_ids.append(fc.id) + + result['comment'] = " - ".join(fp_comment + fc_comment) + result['fiscal_category_id'] = picking.fiscal_category_id and \ + picking.fiscal_category_id.id + result['fiscal_position'] = picking.fiscal_position and \ + picking.fiscal_position.id + return result From 7737b10ddf7a07c84e6c56e6850620daa1a62ba3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 30 Aug 2013 20:38:35 -0300 Subject: [PATCH 012/241] =?UTF-8?q?Alterado=20o=20nome=20de=20alguns=20m?= =?UTF-8?q?=C3=B3dulos=20para=20deixar=20mais=20leg=C3=ADvel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 53a53e5d9b57..f2ab3c5bdafe 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -19,7 +19,7 @@ ############################################################################### { - 'name': 'l10n_br_sale_stock', + 'name': 'Brazilian Localization Sales and Warehouse', 'description': 'Brazilian Localization for sale_stock_module', 'category': 'Localisation', 'license': 'AGPL-3', From 9246448d6b75391d714127bd73a0eeb5fd606126 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 5 Sep 2013 18:08:48 -0300 Subject: [PATCH 013/241] =?UTF-8?q?l10n=5Fbr=5Fstock,=20l10n=5Fbr=5Fsale?= =?UTF-8?q?=5Fstock,=20l10n=5Fbr=5Fpurchase:=20Gera=C3=A7=C3=A3o=20de=20do?= =?UTF-8?q?cumento=20fiscal=20a=20partir=20do=20picking,=20postado=20c?= =?UTF-8?q?=C3=B3digos=20para=20manter=20modularidade.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/stock.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index 38fc0496aba2..722a6910bcd8 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -62,3 +62,29 @@ def _prepare_invoice(self, cr, uid, picking, partner, result['fiscal_position'] = picking.fiscal_position and \ picking.fiscal_position.id return result + + def _prepare_invoice_line(self, cr, uid, group, picking, move_line, + invoice_id, invoice_vals, context=None): + result = super(stock_picking, self)._prepare_invoice_line( + cr, uid, group, picking, move_line, invoice_id, invoice_vals, + context) + if move_line.sale_line_id: + fiscal_position = move_line.sale_line_id.fiscal_position or \ + move_line.sale_line_id.order_id.fiscal_position + fiscal_category_id = move_line.sale_line_id.fiscal_category_id or \ + move_line.sale_line_id.order_id.fiscal_category_id + else: + fiscal_position = move_line.picking_id.fiscal_position + fiscal_category_id = move_line.picking_id.fiscal_category_id + + result['cfop_id'] = fiscal_position and \ + fiscal_position.cfop_id and fiscal_position.cfop_id.id + result['fiscal_category_id'] = fiscal_category_id and \ + fiscal_category_id.id + result['fiscal_position'] = fiscal_position and \ + fiscal_position.id + + result['partner_id'] = picking.partner_id.id + result['company_id'] = picking.company_id.id + + return result From c648b24b796f6c1d965ea654d3de84c3127f6680 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 12 Dec 2013 14:02:17 -0200 Subject: [PATCH 014/241] =?UTF-8?q?Adicionado=20arquivos=20de=20tradu?= =?UTF-8?q?=C3=A7=C3=A3o=20vazios=20pt=5FBR.po=20para=20evitar=20mensagens?= =?UTF-8?q?=20de=20alertas=20no=20log=20e=20futura=20internacionaliza?= =?UTF-8?q?=C3=A7=C3=A3o=20dos=20termos=20da=20localiza=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/i18n/pt_BR.po | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 l10n_br_sale_stock/i18n/pt_BR.po diff --git a/l10n_br_sale_stock/i18n/pt_BR.po b/l10n_br_sale_stock/i18n/pt_BR.po new file mode 100644 index 000000000000..e69de29bb2d1 From b7060cde16c3edc1966d2c8a229cecd93fc98d45 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 12 Dec 2013 14:38:17 -0200 Subject: [PATCH 015/241] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20das=20vers?= =?UTF-8?q?=C3=B5es=20dos=20m=C3=B3dulos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index f2ab3c5bdafe..9ed4073499a6 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -25,7 +25,7 @@ 'license': 'AGPL-3', 'author': 'Akretion, OpenERPBrasil.org', 'website': 'http://openerpbrasil.org', - 'version': '0.1', + 'version': '7.0', 'depends': [ 'sale_stock', 'l10n_br_sale', From 04cf6d7090aaf054b1faa06344ba41c693359b98 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 13 Dec 2013 18:22:35 -0200 Subject: [PATCH 016/241] =?UTF-8?q?[REF]=20Refatorado=20objetos=20e=20vis?= =?UTF-8?q?=C3=B5es=20no=20m=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fstock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__init__.py | 1 + l10n_br_sale_stock/__openerp__.py | 5 +- .../l10n_br_sale_stock_data.xml | 10 ++ .../l10n_br_sale_stock_demo.xml | 151 ++++++++++++++++++ l10n_br_sale_stock/sale.py | 137 ++++++++++++++++ .../security/ir.model.access.csv | 8 + l10n_br_sale_stock/stock.py | 10 +- 7 files changed, 316 insertions(+), 6 deletions(-) create mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_data.xml create mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_demo.xml create mode 100644 l10n_br_sale_stock/sale.py create mode 100644 l10n_br_sale_stock/security/ir.model.access.csv diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index a3282952f5d2..5d4cf8483904 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -20,4 +20,5 @@ import sale_stock import stock +import sale import report \ No newline at end of file diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 9ed4073499a6..15cc4f8c015a 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -32,9 +32,12 @@ 'l10n_br_stock', ], 'data': [ + 'l10n_br_sale_stock_data.xml', 'sale_stock_view.xml', ], - 'demo': [], + 'demo': [ + 'l10n_br_sale_stock_demo.xml', + ], 'installable': True, 'auto_install': True, } diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml new file mode 100644 index 000000000000..5db016abf9f1 --- /dev/null +++ b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml new file mode 100644 index 000000000000..a9f2ba11debc --- /dev/null +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py new file mode 100644 index 000000000000..d8f4b353d72b --- /dev/null +++ b/l10n_br_sale_stock/sale.py @@ -0,0 +1,137 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm +from openerp.tools.translate import _ + + +class SaleOrder(orm.Model): + _inherit = 'sale.order' + + def _make_invoice(self, cr, uid, order, lines, context=None): + obj_invoice_line = self.pool.get('account.invoice.line') + lines_service = [] + lines_product = [] + inv_product_ids = [] + inv_service_ids = [] + inv_id_product = False + inv_id_service = False + + if not context: + context = {} + + obj_company = self.pool.get('res.company').browse( + cr, uid, order.shop_id.company_id.id) + + if not obj_company.product_invoice_id: + raise orm.except_orm( + _('No fiscal document serie found !'), + _("No fiscal document serie found for selected company %s") % ( + order.company_id.name)) + + for inv_line in obj_invoice_line.browse(cr, uid, lines, context=context): + if inv_line.product_id.fiscal_type == 'service': + lines_service.append(inv_line.id) + + if inv_line.product_id.fiscal_type == 'product': + lines_product.append(inv_line.id) + + if lines_product: + context['fiscal_type'] = 'product' + inv_id_product = super(SaleOrder, self)._make_invoice( + cr, uid, order, lines_product, context=context) + inv_product_ids.append(inv_id_product) + + if lines_service: + context['fiscal_type'] = 'service' + inv_id_service = super(SaleOrder, self)._make_invoice( + cr, uid, order, lines_service, context=context) + inv_service_ids.append(inv_id_service) + + return inv_id_product or inv_id_service + + def _fiscal_comment(self, cr, uid, order, context=None): + + fp_comment = [] + fc_comment = [] + fp_ids = [] + fc_ids = [] + + for line in order.order_line: + if line.fiscal_position and \ + line.fiscal_position.inv_copy_note and \ + line.fiscal_position.note: + if not line.fiscal_position.id in fp_ids: + fp_comment.append(line.fiscal_position.note) + fp_ids.append(line.fiscal_position.id) + + if line.product_id.ncm_id: + fc = line.product_id.ncm_id + if fc.inv_copy_note and fc.note: + if not fc.id in fc_ids: + fc_comment.append(fc.note) + fc_ids.append(fc.id) + + return fp_comment + fc_comment + + 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 + return result + + 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) + #TODO - Testar se só sobrescrevendo o metodo _fiscal_comment nao precisa fazer isso + + comment = [] + fiscal_comment = self._fiscal_comment(cr, uid, order, context=context) + result['comment'] = " - ".join(comment + fiscal_comment) + return result + + +class SaleOrderLine(orm.Model): + _inherit = 'sale.order.line' + + def _prepare_order_line_invoice_line(self, cr, uid, line, + account_id=False, context=None): + result = super(SaleOrderLine, self)._prepare_order_line_invoice_line( + cr, uid, line, account_id, context) + + if line.product_id.fiscal_type == 'product': + cfop = self.pool.get("account.fiscal.position").read( + cr, uid, [result['fiscal_position']], ['cfop_id'], + context=context) + if cfop[0]['cfop_id']: + result['cfop_id'] = cfop[0]['cfop_id'][0] + return result \ No newline at end of file diff --git a/l10n_br_sale_stock/security/ir.model.access.csv b/l10n_br_sale_stock/security/ir.model.access.csv new file mode 100644 index 000000000000..41372a37f53a --- /dev/null +++ b/l10n_br_sale_stock/security/ir.model.access.csv @@ -0,0 +1,8 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"l10n_br_account_product_cfop","l10n_br_account_product.cfop","l10n_br_account_product.model_l10n_br_account_product_cfop","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_sale_template_salesman","l10n_br_tax.definition.sale.template","l10n_br_account_product.model_l10n_br_tax_definition_sale_template","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_purchase_template_salesman","l10n_br_tax.definition.purchase.template","l10n_br_account_product.model_l10n_br_tax_definition_purchase_template","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_sale_salesman","l10n_br_tax.definition.sale","l10n_br_account_product.model_l10n_br_tax_definition_sale","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_purchase_salesman","l10n_br_tax.definition.purchase","l10n_br_account_product.model_l10n_br_tax_definition_purchase","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_company_product_salesman","l10n_br_tax.definition.company.product","l10n_br_account_product.model_l10n_br_tax_definition_company_product","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_company_service_salesman","l10n_br_tax.definition.company.service","l10n_br_account_service.model_l10n_br_tax_definition_company_service","base.group_sale_salesman",1,0,0,0 \ No newline at end of file diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index 722a6910bcd8..3c278c42a0f0 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -21,12 +21,12 @@ from openerp.osv import orm -class stock_picking(orm.Model): +class StockPicking(orm.Model): _inherit = 'stock.picking' def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): - result = super(stock_picking, self)._prepare_invoice( + result = super(StockPicking, self)._prepare_invoice( cr, uid, picking, partner, inv_type, journal_id, context) fp_comment = [] @@ -49,8 +49,8 @@ def _prepare_invoice(self, cr, uid, picking, partner, fp_comment.append(line.fiscal_position.note) fp_ids.append(line.fiscal_position.id) - if move.product_id.property_fiscal_classification: - fc = move.product_id.property_fiscal_classification + if move.product_id.ncm_id: + fc = move.product_id.ncm_id if fc.inv_copy_note and fc.note: if not fc.id in fc_ids: fc_comment.append(fc.note) @@ -65,7 +65,7 @@ def _prepare_invoice(self, cr, uid, picking, partner, def _prepare_invoice_line(self, cr, uid, group, picking, move_line, invoice_id, invoice_vals, context=None): - result = super(stock_picking, self)._prepare_invoice_line( + result = super(StockPicking, self)._prepare_invoice_line( cr, uid, group, picking, move_line, invoice_id, invoice_vals, context) if move_line.sale_line_id: From 936276f37cd69daca880b129f222c1a90e54c454 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 19 Dec 2013 11:20:23 -0200 Subject: [PATCH 017/241] =?UTF-8?q?[FIX]=20Calculo=20dos=20impostos=20e=20?= =?UTF-8?q?dados=20de=20demostra=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../l10n_br_sale_stock_demo.xml | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml index a9f2ba11debc..9b7ff201db6d 100644 --- a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -4,147 +4,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + From 9e900c3afd88c1415b1287b7d2f39fa557ccbd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 22 Dec 2013 20:12:40 -0200 Subject: [PATCH 018/241] default sale operation should be set in sale, not sale_stock --- l10n_br_sale_stock/l10n_br_sale_stock_data.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml index 5db016abf9f1..556fb4fd2896 100644 --- a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml +++ b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml @@ -2,9 +2,6 @@ - - - - \ No newline at end of file + From 14d0c8eb6c39bbcc4d452e24bee98edb2926d888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Tue, 24 Dec 2013 20:42:31 -0200 Subject: [PATCH 019/241] moved data arround to get sale on_change tests passing but in the l10n_br_sale_stock module --- l10n_br_sale_stock/__openerp__.py | 2 + .../l10n_br_sale_stock_demo.xml | 2 +- l10n_br_sale_stock/test/sale_order_demo.yml | 44 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 l10n_br_sale_stock/test/sale_order_demo.yml diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 15cc4f8c015a..3cbd27709fae 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -30,6 +30,7 @@ 'sale_stock', 'l10n_br_sale', 'l10n_br_stock', + 'l10n_br_account_product', ], 'data': [ 'l10n_br_sale_stock_data.xml', @@ -37,6 +38,7 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', + 'test/sale_order_demo.yml' # put in demo rather than test for easier testing on Travis-CI ], 'installable': True, 'auto_install': True, diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml index 9b7ff201db6d..b8de68209e54 100644 --- a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -148,4 +148,4 @@ - \ No newline at end of file + diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml new file mode 100644 index 000000000000..d271b045e8e0 --- /dev/null +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -0,0 +1,44 @@ +- + I prepare tunneling extra args in the context +- + !python {model: sale.order}: | + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1')}) +- + In order to test fiscal parameters of Sale Order inside the same state, I create sale order +- + !record {model: sale.order, id: sale_order_test1}: + partner_id: l10n_br_base.res_partner_akretion + order_line: + - product_id: product.product_product_7 + product_uom_qty: 8 +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') + - order_line[0].product_id.id == ref('product.product_product_7') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') + - order_line[0].product_uom_qty == 8 + - order_line[0].product_uom.id == ref('product.product_uom_unit') +- + I create another sale order +- + !record {model: sale.order, id: sale_order_test2}: + partner_id: l10n_br_base.res_partner_address_ak2 + order_line: + - product_id: product.product_product_7 + product_uom_qty: 16 + product_uom: product.product_uom_dozen +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + - order_line[0].product_id.id == ref('product.product_product_7') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + - order_line[0].product_uom.id == ref('product.product_uom_dozen') + - order_line[0].product_uom_qty == 16 From 21d79249c21b315bb3f32359b6754a9a07abb081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Wed, 25 Dec 2013 17:05:24 -0200 Subject: [PATCH 020/241] converting l10n_br_sale and l10n_br_sale_stock to web_context_tunnel module, preserving all orginial on_change signatures --- l10n_br_sale_stock/sale_stock_view.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml index 46158635369a..30e95dbeffa2 100644 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -8,10 +8,13 @@ - product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos,name, parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context, parent.fiscal_category_id, parent.shop_id, False, parent.partner_invoice_id) + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + - \ No newline at end of file + From f363c939db20bfcbf05e4ca459985538cbc99cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Wed, 25 Dec 2013 18:34:29 -0200 Subject: [PATCH 021/241] pick a product with taxes and ensure sale order lines get the taxes --- l10n_br_sale_stock/test/sale_order_demo.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index d271b045e8e0..e2e239d28c22 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -9,7 +9,7 @@ !record {model: sale.order, id: sale_order_test1}: partner_id: l10n_br_base.res_partner_akretion order_line: - - product_id: product.product_product_7 + - product_id: product.product_product_8 product_uom_qty: 8 - I verify that the onchange was correctly triggered @@ -17,9 +17,10 @@ !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - order_line[0].product_id.id == ref('product.product_product_7') + - order_line[0].product_id.id == ref('product.product_product_8') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') + - len(order_line[0].tax_id) == 6 - order_line[0].product_uom_qty == 8 - order_line[0].product_uom.id == ref('product.product_uom_unit') - @@ -28,7 +29,7 @@ !record {model: sale.order, id: sale_order_test2}: partner_id: l10n_br_base.res_partner_address_ak2 order_line: - - product_id: product.product_product_7 + - product_id: product.product_product_8 product_uom_qty: 16 product_uom: product.product_uom_dozen - @@ -37,8 +38,9 @@ !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - order_line[0].product_id.id == ref('product.product_product_7') + - order_line[0].product_id.id == ref('product.product_product_8') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + - len(order_line[0].tax_id) == 6 - order_line[0].product_uom.id == ref('product.product_uom_dozen') - order_line[0].product_uom_qty == 16 From 24fae80dc39b99b74bfcecd6d485858962be6387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Wed, 25 Dec 2013 18:39:32 -0200 Subject: [PATCH 022/241] manually complete the context before on_change is played in YAML test to fake web_context_tunnel behavior --- l10n_br_sale_stock/test/sale_order_demo.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index e2e239d28c22..502fe4d04876 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -2,7 +2,7 @@ I prepare tunneling extra args in the context - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1')}) + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) - In order to test fiscal parameters of Sale Order inside the same state, I create sale order - @@ -23,6 +23,11 @@ - len(order_line[0].tax_id) == 6 - order_line[0].product_uom_qty == 8 - order_line[0].product_uom.id == ref('product.product_uom_unit') +- + I prepare tunneling extra args in the context +- + !python {model: sale.order}: | + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) - I create another sale order - From 56c2e3afcabf09e9730f36571a1e1f4b925388e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Wed, 22 Jan 2014 03:41:50 -0200 Subject: [PATCH 023/241] l10n_br_sale_stock: creating delivery from test sale order, and creating test invoice from delivery --- l10n_br_sale_stock/test/sale_order_demo.yml | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 502fe4d04876..6db355170ce8 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -33,6 +33,7 @@ - !record {model: sale.order, id: sale_order_test2}: partner_id: l10n_br_base.res_partner_address_ak2 + order_policy: picking order_line: - product_id: product.product_product_8 product_uom_qty: 16 @@ -49,3 +50,43 @@ - len(order_line[0].tax_id) == 6 - order_line[0].product_uom.id == ref('product.product_uom_dozen') - order_line[0].product_uom_qty == 16 +- + I confirm order_test2 +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_test2} +- + I check the details of delivery order after confirmed quotation. +- + !python {model: sale.order}: | + sale_order = self.browse(cr, uid, ref("sale_order_test2")) + assert sale_order.picking_ids, "Delivery order is not created." + for picking in sale_order.picking_ids: + assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." + assert picking.type == 'out',"Shipment should be Outgoing." + assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') +- + I create Invoice from Delivery Order. +- + !python {model: stock.invoice.onshipping}: | + sale = self.pool.get('sale.order') + sale_order = sale.browse(cr, uid, ref("sale_order_test2")) + ship_ids = [x.id for x in sale_order.picking_ids] + wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, + {'active_ids': ship_ids, 'active_model': 'stock.picking'}) + self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) +- + I check the invoice details after dispatched delivery. +- + !python {model: sale.order}: | + order = self.browse(cr, uid, ref("sale_order_test2")) + assert order.invoice_ids, "Invoice is not created." + journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)]) + for invoice in order.invoice_ids: + assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." + assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') + assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') + assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From 7564c263e49a7dbfc48ab0898cc82fbb3d85af11 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 24 Jan 2014 14:52:13 -0200 Subject: [PATCH 024/241] =?UTF-8?q?[FIX]=20Corrigido=20testes=20do=20m?= =?UTF-8?q?=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fstock=20para=20n=C3=A3o=20tenta?= =?UTF-8?q?r=20faturar=20um=20picking=20que=20j=C3=A1=20foi=20faturado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/test/sale_order_demo.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 6db355170ce8..96e8a17de165 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -71,10 +71,11 @@ !python {model: stock.invoice.onshipping}: | sale = self.pool.get('sale.order') sale_order = sale.browse(cr, uid, ref("sale_order_test2")) - ship_ids = [x.id for x in sale_order.picking_ids] - wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, - {'active_ids': ship_ids, 'active_model': 'stock.picking'}) - self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) + ship_ids = [picking.id for picking in sale_order.picking_ids if picking.invoice_state == '2binvoiced'] + if ship_ids: + wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, + {'active_ids': ship_ids, 'active_model': 'stock.picking'}) + self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) - I check the invoice details after dispatched delivery. - From 8343d0ab286e24d604bfe73da35dcc120b34c660 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 24 Jan 2014 17:08:18 -0200 Subject: [PATCH 025/241] =?UTF-8?q?[FIX]=20Corrigido=20testes=20do=20m?= =?UTF-8?q?=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fstock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/test/sale_order_demo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 96e8a17de165..9f8de7192d0a 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -36,8 +36,8 @@ order_policy: picking order_line: - product_id: product.product_product_8 + product_uom: product.product_uom_unit product_uom_qty: 16 - product_uom: product.product_uom_dozen - I verify that the onchange was correctly triggered - @@ -48,7 +48,7 @@ - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - len(order_line[0].tax_id) == 6 - - order_line[0].product_uom.id == ref('product.product_uom_dozen') + - order_line[0].product_uom.id == ref('product.product_uom_unit') - order_line[0].product_uom_qty == 16 - I confirm order_test2 From 4a57ce7ec221bbc8d5bd4dc5701feb7ccddbd27e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sun, 9 Feb 2014 20:22:54 -0200 Subject: [PATCH 026/241] minor optimization --- l10n_br_sale_stock/sale.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index d8f4b353d72b..c7baab3fa605 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -48,8 +48,7 @@ def _make_invoice(self, cr, uid, order, lines, context=None): for inv_line in obj_invoice_line.browse(cr, uid, lines, context=context): if inv_line.product_id.fiscal_type == 'service': lines_service.append(inv_line.id) - - if inv_line.product_id.fiscal_type == 'product': + elif inv_line.product_id.fiscal_type == 'product': lines_product.append(inv_line.id) if lines_product: @@ -67,7 +66,6 @@ def _make_invoice(self, cr, uid, order, lines, context=None): return inv_id_product or inv_id_service def _fiscal_comment(self, cr, uid, order, context=None): - fp_comment = [] fc_comment = [] fp_ids = [] @@ -134,4 +132,4 @@ def _prepare_order_line_invoice_line(self, cr, uid, line, context=context) if cfop[0]['cfop_id']: result['cfop_id'] = cfop[0]['cfop_id'][0] - return result \ No newline at end of file + return result From 8873614661bb33e8741be6b1d19e56f69081838c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 10 Feb 2014 00:13:16 -0200 Subject: [PATCH 027/241] [REF] moved and refactored _make_invoice so it can now stays in l10n_br_sale and works wether l10n_br_account_service is installed or not --- l10n_br_sale_stock/sale.py | 41 -------------------------------------- 1 file changed, 41 deletions(-) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index c7baab3fa605..abc854fd39a8 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -24,47 +24,6 @@ class SaleOrder(orm.Model): _inherit = 'sale.order' - def _make_invoice(self, cr, uid, order, lines, context=None): - obj_invoice_line = self.pool.get('account.invoice.line') - lines_service = [] - lines_product = [] - inv_product_ids = [] - inv_service_ids = [] - inv_id_product = False - inv_id_service = False - - if not context: - context = {} - - obj_company = self.pool.get('res.company').browse( - cr, uid, order.shop_id.company_id.id) - - if not obj_company.product_invoice_id: - raise orm.except_orm( - _('No fiscal document serie found !'), - _("No fiscal document serie found for selected company %s") % ( - order.company_id.name)) - - for inv_line in obj_invoice_line.browse(cr, uid, lines, context=context): - if inv_line.product_id.fiscal_type == 'service': - lines_service.append(inv_line.id) - elif inv_line.product_id.fiscal_type == 'product': - lines_product.append(inv_line.id) - - if lines_product: - context['fiscal_type'] = 'product' - inv_id_product = super(SaleOrder, self)._make_invoice( - cr, uid, order, lines_product, context=context) - inv_product_ids.append(inv_id_product) - - if lines_service: - context['fiscal_type'] = 'service' - inv_id_service = super(SaleOrder, self)._make_invoice( - cr, uid, order, lines_service, context=context) - inv_service_ids.append(inv_id_service) - - return inv_id_product or inv_id_service - def _fiscal_comment(self, cr, uid, order, context=None): fp_comment = [] fc_comment = [] From e404eb1f851e45ffc9edcc4a660c2385ef7b30a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 10 Feb 2014 01:44:22 -0200 Subject: [PATCH 028/241] [REF] WARNING moved default 'Venda' fiscal category to l10n_br_account so it can be shared bewteen products and services. You need to change the ir_model_data id of this fiscal category by SQL to update your database --- l10n_br_sale_stock/__openerp__.py | 1 - .../l10n_br_sale_stock_data.xml | 7 --- .../l10n_br_sale_stock_demo.xml | 58 +++++++++---------- l10n_br_sale_stock/test/sale_order_demo.yml | 14 ++--- 4 files changed, 36 insertions(+), 44 deletions(-) delete mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_data.xml diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 3cbd27709fae..4d584f761c7e 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -33,7 +33,6 @@ 'l10n_br_account_product', ], 'data': [ - 'l10n_br_sale_stock_data.xml', 'sale_stock_view.xml', ], 'demo': [ diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml deleted file mode 100644 index 556fb4fd2896..000000000000 --- a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml index b8de68209e54..4c917cdae96b 100644 --- a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -3,147 +3,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 9f8de7192d0a..22db1bcd59d0 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -15,10 +15,10 @@ I verify that the onchange was correctly triggered - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - len(order_line[0].tax_id) == 6 - order_line[0].product_uom_qty == 8 @@ -42,10 +42,10 @@ I verify that the onchange was correctly triggered - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - len(order_line[0].tax_id) == 6 - order_line[0].product_uom.id == ref('product.product_uom_unit') @@ -63,7 +63,7 @@ for picking in sale_order.picking_ids: assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." assert picking.type == 'out',"Shipment should be Outgoing." - assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert picking.fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - I create Invoice from Delivery Order. @@ -87,7 +87,7 @@ assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') - assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From da5db61d0832b76a4650dd1e6a8521c925a11eb3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 12 Feb 2014 10:42:18 -0200 Subject: [PATCH 029/241] Revert "[REF] WARNING moved default 'Venda' fiscal category to l10n_br_account so it can be shared bewteen products and services. You need to change the ir_model_data id of this fiscal category by SQL to update your database" This reverts commit 5296355f76a641090cc9ea72112eb6431088413d. --- l10n_br_sale_stock/__openerp__.py | 1 + .../l10n_br_sale_stock_data.xml | 7 +++ .../l10n_br_sale_stock_demo.xml | 58 +++++++++---------- l10n_br_sale_stock/test/sale_order_demo.yml | 14 ++--- 4 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_data.xml diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 4d584f761c7e..3cbd27709fae 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -33,6 +33,7 @@ 'l10n_br_account_product', ], 'data': [ + 'l10n_br_sale_stock_data.xml', 'sale_stock_view.xml', ], 'demo': [ diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml new file mode 100644 index 000000000000..556fb4fd2896 --- /dev/null +++ b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml index 4c917cdae96b..b8de68209e54 100644 --- a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -3,147 +3,147 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 22db1bcd59d0..9f8de7192d0a 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -15,10 +15,10 @@ I verify that the onchange was correctly triggered - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - len(order_line[0].tax_id) == 6 - order_line[0].product_uom_qty == 8 @@ -42,10 +42,10 @@ I verify that the onchange was correctly triggered - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - len(order_line[0].tax_id) == 6 - order_line[0].product_uom.id == ref('product.product_uom_unit') @@ -63,7 +63,7 @@ for picking in sale_order.picking_ids: assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." assert picking.type == 'out',"Shipment should be Outgoing." - assert picking.fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - I create Invoice from Delivery Order. @@ -87,7 +87,7 @@ assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') - assert invoice.fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From 51d3c50045ac1d21547704aa2d50116df6882e98 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 12 Feb 2014 17:36:46 -0200 Subject: [PATCH 030/241] Movido o arquivo de teste do demo para o test no __openerp__.py --- l10n_br_sale_stock/__openerp__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 3cbd27709fae..ab5e6e33515d 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -38,7 +38,9 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', - 'test/sale_order_demo.yml' # put in demo rather than test for easier testing on Travis-CI + ], + 'test': [ + 'test/sale_order_demo.yml' ], 'installable': True, 'auto_install': True, From 9f76e5fa8c707fb0948ceac9cc94db956f23750a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 8 Mar 2014 22:48:09 -0300 Subject: [PATCH 031/241] re-activated tests for Travis-CI --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index ab5e6e33515d..dc968d2f72bd 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -38,9 +38,9 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', + 'test/sale_order_demo.yml' ], 'test': [ - 'test/sale_order_demo.yml' ], 'installable': True, 'auto_install': True, From 027d53adf7e5f0bd45eb636109e30eba18ca279f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 8 Mar 2014 22:59:31 -0300 Subject: [PATCH 032/241] updated tests for new demo data --- l10n_br_sale_stock/test/sale_order_demo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 9f8de7192d0a..28f588809af5 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -20,7 +20,7 @@ - order_line[0].product_id.id == ref('product.product_product_8') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - len(order_line[0].tax_id) == 6 + - len(order_line[0].tax_id) == 3 - order_line[0].product_uom_qty == 8 - order_line[0].product_uom.id == ref('product.product_uom_unit') - @@ -47,7 +47,7 @@ - order_line[0].product_id.id == ref('product.product_product_8') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - len(order_line[0].tax_id) == 6 + - len(order_line[0].tax_id) == 3 - order_line[0].product_uom.id == ref('product.product_uom_unit') - order_line[0].product_uom_qty == 16 - From 667e385455bbfba8d78e78cafd732bf6a997e020 Mon Sep 17 00:00:00 2001 From: Danimar Ribeiro Date: Tue, 11 Mar 2014 22:38:57 -0300 Subject: [PATCH 033/241] =?UTF-8?q?Corrigido=20erros=20de=20digita=C3=A7?= =?UTF-8?q?=C3=A3o=20e=20adicionado=20tradu=C3=A7=C3=B5es=20aos=20m=C3=B3d?= =?UTF-8?q?ulos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/i18n/pt_BR.po | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/l10n_br_sale_stock/i18n/pt_BR.po b/l10n_br_sale_stock/i18n/pt_BR.po index e69de29bb2d1..f8b26be3a564 100644 --- a/l10n_br_sale_stock/i18n/pt_BR.po +++ b/l10n_br_sale_stock/i18n/pt_BR.po @@ -0,0 +1,9 @@ +#. module: base +#: model:ir.module.module,shortdesc:base.module_l10n_br_sale_stock +msgid "Brazilian Localization Sales and Warehouse" +msgstr "Localização Brasileira - Módulo de Vendas e Estoque" + +#. module: base +#: model:ir.module.module,description:base.module_l10n_br_sale_stock +msgid "Brazilian Localization for sale_stock_module" +msgstr "Localização Brasileira - Integra os módulos de venda e estoque" From b72499a0b4fae6d810b5c084b646b40a463cf95f Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 14 Mar 2014 16:21:52 -0300 Subject: [PATCH 034/241] =?UTF-8?q?[FIX]=20formata=C3=A7=C3=A3o=20das=20vi?= =?UTF-8?q?s=C3=B5es=20no=20l10n=5Fbr=5Fsale=5Fstock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale_stock_view.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml index 30e95dbeffa2..aedbf9cb7afb 100644 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -8,11 +8,11 @@ - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - From baf8b69c633e96fcfe42b2ba1c17af262c75dab3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 14 Mar 2014 18:06:56 -0300 Subject: [PATCH 035/241] =?UTF-8?q?Iniciado=20copiar=20m=C3=A9todos=20dos?= =?UTF-8?q?=20m=C3=B3dulos=20l10n=5Fbr=5Fsale=20e=20l10n=5Fbr=5Fsale=5Fsto?= =?UTF-8?q?ck=20para=20o=20l10n=5Fbr=5Fsale=5Fproduct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/__openerp__.py | 3 +-- l10n_br_sale_stock/sale.py | 23 ----------------------- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index dc968d2f72bd..8415f0e39635 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -28,9 +28,8 @@ 'version': '7.0', 'depends': [ 'sale_stock', - 'l10n_br_sale', + 'l10n_br_sale_product', 'l10n_br_stock', - 'l10n_br_account_product', ], 'data': [ 'l10n_br_sale_stock_data.xml', diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index abc854fd39a8..9879eeb87219 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -24,29 +24,6 @@ class SaleOrder(orm.Model): _inherit = 'sale.order' - def _fiscal_comment(self, cr, uid, order, context=None): - fp_comment = [] - fc_comment = [] - fp_ids = [] - fc_ids = [] - - for line in order.order_line: - if line.fiscal_position and \ - line.fiscal_position.inv_copy_note and \ - line.fiscal_position.note: - if not line.fiscal_position.id in fp_ids: - fp_comment.append(line.fiscal_position.note) - fp_ids.append(line.fiscal_position.id) - - if line.product_id.ncm_id: - fc = line.product_id.ncm_id - if fc.inv_copy_note and fc.note: - if not fc.id in fc_ids: - fc_comment.append(fc.note) - fc_ids.append(fc.id) - - return fp_comment + fc_comment - def _prepare_order_picking(self, cr, uid, order, context=None): result = super(SaleOrder, self)._prepare_order_picking(cr, uid, order, context) From c5d023493d7113a117722a53f911a3081dbe8d17 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 15 Mar 2014 01:48:18 -0300 Subject: [PATCH 036/241] =?UTF-8?q?Inicio=20da=20extra=C3=A7=C3=A3o=20dos?= =?UTF-8?q?=20campos=20e=20m=C3=A9todos=20do=20m=C3=B3dulo=20l10n=5Fbr=5Fs?= =?UTF-8?q?ale=20para=20o=20novo=20m=C3=B3dulo=20l10n=5Fbr=5Fsale=5Fproduc?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale.py | 39 +------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index 9879eeb87219..1eac9a6a17d5 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -2,6 +2,7 @@ ############################################################################### # # # 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 # @@ -18,7 +19,6 @@ ############################################################################### from openerp.osv import orm -from openerp.tools.translate import _ class SaleOrder(orm.Model): @@ -32,40 +32,3 @@ def _prepare_order_picking(self, cr, uid, order, context=None): result['fiscal_position'] = order.fiscal_position and \ order.fiscal_position.id return result - - 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) - #TODO - Testar se só sobrescrevendo o metodo _fiscal_comment nao precisa fazer isso - - comment = [] - fiscal_comment = self._fiscal_comment(cr, uid, order, context=context) - result['comment'] = " - ".join(comment + fiscal_comment) - return result - - -class SaleOrderLine(orm.Model): - _inherit = 'sale.order.line' - - def _prepare_order_line_invoice_line(self, cr, uid, line, - account_id=False, context=None): - result = super(SaleOrderLine, self)._prepare_order_line_invoice_line( - cr, uid, line, account_id, context) - - if line.product_id.fiscal_type == 'product': - cfop = self.pool.get("account.fiscal.position").read( - cr, uid, [result['fiscal_position']], ['cfop_id'], - context=context) - if cfop[0]['cfop_id']: - result['cfop_id'] = cfop[0]['cfop_id'][0] - return result From 545dbb6b7933e604934e66c0dd7f1ce79196e6f0 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 15 Mar 2014 02:03:20 -0300 Subject: [PATCH 037/241] =?UTF-8?q?Extraido=20m=C3=A9todos=20do=20m=C3=B3d?= =?UTF-8?q?ulo=20l10n=5Fbr=5Fdelivery=20para=20o=20novo=20m=C3=B3dulo=20l1?= =?UTF-8?q?0n=5Fbr=5Fsale=5Fproduct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index 1eac9a6a17d5..2d71ecc08982 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -24,6 +24,25 @@ 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) From 2cdad174b111331e1e6b92fc6c1180a63fba13c1 Mon Sep 17 00:00:00 2001 From: mileo Date: Wed, 2 Apr 2014 11:03:58 -0300 Subject: [PATCH 038/241] =?UTF-8?q?[NEW][FIX]=20Cria=C3=A7=C3=A3o=20dos=20?= =?UTF-8?q?campos=20fiscal=20position=20e=20fiscal=20category=20na=20class?= =?UTF-8?q?e=20StockMove=20e=20corre=C3=A7=C3=A3o=20do=20=5Fprepare=5Finvo?= =?UTF-8?q?ice=5Fline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/stock.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index 3c278c42a0f0..cef234d9bdf0 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -73,9 +73,11 @@ def _prepare_invoice_line(self, cr, uid, group, picking, move_line, move_line.sale_line_id.order_id.fiscal_position fiscal_category_id = move_line.sale_line_id.fiscal_category_id or \ move_line.sale_line_id.order_id.fiscal_category_id - else: - fiscal_position = move_line.picking_id.fiscal_position - fiscal_category_id = move_line.picking_id.fiscal_category_id + else: + fiscal_position = move_line.fiscal_position or \ + move_line.picking_id.fiscal_position or False + fiscal_category_id = move_line.fiscal_category_id or \ + move_line.picking_id.fiscal_category_id or False result['cfop_id'] = fiscal_position and \ fiscal_position.cfop_id and fiscal_position.cfop_id.id From 8032ad0767759aa3fab492db0a362ee566067f43 Mon Sep 17 00:00:00 2001 From: mileo Date: Sat, 3 May 2014 07:37:15 -0300 Subject: [PATCH 039/241] =?UTF-8?q?[NEW]=20Incluindo=20posi=C3=A7=C3=B5es?= =?UTF-8?q?=20fiscais=20das=20linhas=20das=20vendas=20nas=20linhas=20do=20?= =?UTF-8?q?picking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/sale.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index 2d71ecc08982..19bdb174eb46 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -51,3 +51,13 @@ def _prepare_order_picking(self, cr, uid, order, context=None): result['fiscal_position'] = order.fiscal_position and \ order.fiscal_position.id 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 \ No newline at end of file From d23ab239c6b95c81bc64204f9241036d853d2b17 Mon Sep 17 00:00:00 2001 From: mileo Date: Tue, 13 May 2014 19:37:55 -0300 Subject: [PATCH 040/241] =?UTF-8?q?[REF][NEW][DEL]=20Cria=C3=A7=C3=A3o=20d?= =?UTF-8?q?os=20on=20changes=20no=20stock.move=20dos=20pickings,=20refator?= =?UTF-8?q?a=C3=A7=C3=A3o=20do=20l10n=5Fbr=5Fpurcharse=20para=20correspond?= =?UTF-8?q?er=20aos=20novos=20comportamentos,=20=5Fprepare=5Finvoice=5Flin?= =?UTF-8?q?e=20removido=20do=20l10n=5Fbr=5Fpurshase,l10n=5Fbr=5Fsale=5Fsto?= =?UTF-8?q?ck=20e=20mantido=20apenas=20no=20l10n=5Fbr=5Fstock.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/stock.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index cef234d9bdf0..25f19f01540e 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -62,31 +62,3 @@ def _prepare_invoice(self, cr, uid, picking, partner, result['fiscal_position'] = picking.fiscal_position and \ picking.fiscal_position.id return result - - def _prepare_invoice_line(self, cr, uid, group, picking, move_line, - invoice_id, invoice_vals, context=None): - result = super(StockPicking, self)._prepare_invoice_line( - cr, uid, group, picking, move_line, invoice_id, invoice_vals, - context) - if move_line.sale_line_id: - fiscal_position = move_line.sale_line_id.fiscal_position or \ - move_line.sale_line_id.order_id.fiscal_position - fiscal_category_id = move_line.sale_line_id.fiscal_category_id or \ - move_line.sale_line_id.order_id.fiscal_category_id - else: - fiscal_position = move_line.fiscal_position or \ - move_line.picking_id.fiscal_position or False - fiscal_category_id = move_line.fiscal_category_id or \ - move_line.picking_id.fiscal_category_id or False - - result['cfop_id'] = fiscal_position and \ - fiscal_position.cfop_id and fiscal_position.cfop_id.id - result['fiscal_category_id'] = fiscal_category_id and \ - fiscal_category_id.id - result['fiscal_position'] = fiscal_position and \ - fiscal_position.id - - result['partner_id'] = picking.partner_id.id - result['company_id'] = picking.company_id.id - - return result From a04ce97282bfe269ed9918af02524c06e747c4e6 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 22 Oct 2014 17:37:58 -0200 Subject: [PATCH 041/241] =?UTF-8?q?Adicionados=20arquivos=20README.md=20pa?= =?UTF-8?q?ra=20descri=C3=A7=C3=A3o=20dos=20m=C3=B3dulos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l10n_br_sale_stock/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 l10n_br_sale_stock/README.md diff --git a/l10n_br_sale_stock/README.md b/l10n_br_sale_stock/README.md new file mode 100644 index 000000000000..1c65300877a7 --- /dev/null +++ b/l10n_br_sale_stock/README.md @@ -0,0 +1,2 @@ +Módulo de Vendas e Estoque +========================== From f43c17b34c83a141448b60fcdec70126d71c422c Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 22 Oct 2014 18:38:38 -0200 Subject: [PATCH 042/241] [MIGRATION] initial commit to new branch 8.0 before migration --- l10n_br_sale_stock/README.md | 2 - l10n_br_sale_stock/__init__.py | 24 --- l10n_br_sale_stock/__openerp__.py | 46 ------ l10n_br_sale_stock/i18n/pt_BR.po | 9 -- .../l10n_br_sale_stock_data.xml | 7 - .../l10n_br_sale_stock_demo.xml | 151 ------------------ l10n_br_sale_stock/report/__init__.py | 20 --- l10n_br_sale_stock/report/sale_report.py | 89 ----------- l10n_br_sale_stock/sale.py | 63 -------- l10n_br_sale_stock/sale_stock.py | 34 ---- l10n_br_sale_stock/sale_stock_view.xml | 20 --- .../security/ir.model.access.csv | 8 - l10n_br_sale_stock/stock.py | 64 -------- l10n_br_sale_stock/test/sale_order_demo.yml | 93 ----------- 14 files changed, 630 deletions(-) delete mode 100644 l10n_br_sale_stock/README.md delete mode 100644 l10n_br_sale_stock/__init__.py delete mode 100644 l10n_br_sale_stock/__openerp__.py delete mode 100644 l10n_br_sale_stock/i18n/pt_BR.po delete mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_data.xml delete mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_demo.xml delete mode 100644 l10n_br_sale_stock/report/__init__.py delete mode 100644 l10n_br_sale_stock/report/sale_report.py delete mode 100644 l10n_br_sale_stock/sale.py delete mode 100644 l10n_br_sale_stock/sale_stock.py delete mode 100644 l10n_br_sale_stock/sale_stock_view.xml delete mode 100644 l10n_br_sale_stock/security/ir.model.access.csv delete mode 100644 l10n_br_sale_stock/stock.py delete mode 100644 l10n_br_sale_stock/test/sale_order_demo.yml diff --git a/l10n_br_sale_stock/README.md b/l10n_br_sale_stock/README.md deleted file mode 100644 index 1c65300877a7..000000000000 --- a/l10n_br_sale_stock/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Módulo de Vendas e Estoque -========================== diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py deleted file mode 100644 index 5d4cf8483904..000000000000 --- a/l10n_br_sale_stock/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 Raphaël Valyi - Akretion # -# Copyright (C) 2013 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 . # -############################################################################### - -import sale_stock -import stock -import sale -import report \ No newline at end of file diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py deleted file mode 100644 index 8415f0e39635..000000000000 --- a/l10n_br_sale_stock/__openerp__.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 Raphaël Valyi - Akretion # -# Copyright (C) 2013 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 . # -############################################################################### - -{ - 'name': 'Brazilian Localization Sales and Warehouse', - 'description': 'Brazilian Localization for sale_stock_module', - 'category': 'Localisation', - 'license': 'AGPL-3', - 'author': 'Akretion, OpenERPBrasil.org', - 'website': 'http://openerpbrasil.org', - 'version': '7.0', - 'depends': [ - 'sale_stock', - 'l10n_br_sale_product', - 'l10n_br_stock', - ], - 'data': [ - 'l10n_br_sale_stock_data.xml', - 'sale_stock_view.xml', - ], - 'demo': [ - 'l10n_br_sale_stock_demo.xml', - 'test/sale_order_demo.yml' - ], - 'test': [ - ], - 'installable': True, - 'auto_install': True, -} diff --git a/l10n_br_sale_stock/i18n/pt_BR.po b/l10n_br_sale_stock/i18n/pt_BR.po deleted file mode 100644 index f8b26be3a564..000000000000 --- a/l10n_br_sale_stock/i18n/pt_BR.po +++ /dev/null @@ -1,9 +0,0 @@ -#. module: base -#: model:ir.module.module,shortdesc:base.module_l10n_br_sale_stock -msgid "Brazilian Localization Sales and Warehouse" -msgstr "Localização Brasileira - Módulo de Vendas e Estoque" - -#. module: base -#: model:ir.module.module,description:base.module_l10n_br_sale_stock -msgid "Brazilian Localization for sale_stock_module" -msgstr "Localização Brasileira - Integra os módulos de venda e estoque" diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml deleted file mode 100644 index 556fb4fd2896..000000000000 --- a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml deleted file mode 100644 index b8de68209e54..000000000000 --- a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/l10n_br_sale_stock/report/__init__.py b/l10n_br_sale_stock/report/__init__.py deleted file mode 100644 index 87f260be81b0..000000000000 --- a/l10n_br_sale_stock/report/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 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 . # -############################################################################### - -import sale_report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/sale_report.py b/l10n_br_sale_stock/report/sale_report.py deleted file mode 100644 index 34c818a23476..000000000000 --- a/l10n_br_sale_stock/report/sale_report.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 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 General Public License for more details. # -# # -#You should have received a copy of the GNU General Public License # -#along with this program. If not, see . # -############################################################################### - -from openerp import tools -from openerp.osv import orm, fields - - -class sale_report(orm.Model): - _inherit = "sale.report" - _columns = { - 'fiscal_category_id': fields.many2one( - 'l10n_br_account.fiscal.category', 'Fiscal Category', - readonly=True), - 'fiscal_position': fields.many2one( - 'account.fiscal.position', 'Fiscal Position', readonly=True) - } - - def init(self, cr): - tools.drop_view_if_exists(cr, 'sale_report') - cr.execute(""" - create or replace view sale_report as ( - select - min(l.id) as id, - l.product_id as product_id, - l.fiscal_category_id as fiscal_category_id, - l.fiscal_position as fiscal_position, - t.uom_id as product_uom, - sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty, - sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total, - 1 as nbr, - s.date_order as date, - s.date_confirm as date_confirm, - to_char(s.date_order, 'YYYY') as year, - to_char(s.date_order, 'MM') as month, - to_char(s.date_order, 'YYYY-MM-DD') as day, - s.partner_id as partner_id, - s.user_id as user_id, - s.shop_id as shop_id, - s.company_id as company_id, - extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, - s.state, - t.categ_id as categ_id, - s.shipped, - s.shipped::integer as shipped_qty_1, - s.pricelist_id as pricelist_id, - s.project_id as analytic_account_id - from - sale_order s - join sale_order_line l on (s.id=l.order_id) - left join product_product p on (l.product_id=p.id) - left join product_template t on (p.product_tmpl_id=t.id) - left join product_uom u on (u.id=l.product_uom) - left join product_uom u2 on (u2.id=t.uom_id) - group by - l.product_id, - l.fiscal_category_id, - l.fiscal_position, - l.product_uom_qty, - l.order_id, - t.uom_id, - t.categ_id, - s.date_order, - s.date_confirm, - s.partner_id, - s.user_id, - s.shop_id, - s.company_id, - s.state, - s.shipped, - s.pricelist_id, - s.project_id - ) - """) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py deleted file mode 100644 index 19bdb174eb46..000000000000 --- a/l10n_br_sale_stock/sale.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- 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 . # -############################################################################### - -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 - 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 \ No newline at end of file diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py deleted file mode 100644 index fddd94967f50..000000000000 --- a/l10n_br_sale_stock/sale_stock.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp.osv import orm - - -class sale_order(orm.Model): - _inherit = 'sale.order' - - def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(sale_order, 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 - return result diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml deleted file mode 100644 index aedbf9cb7afb..000000000000 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - l10n_br_sale_stock.order.form - sale.order - - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - - - - diff --git a/l10n_br_sale_stock/security/ir.model.access.csv b/l10n_br_sale_stock/security/ir.model.access.csv deleted file mode 100644 index 41372a37f53a..000000000000 --- a/l10n_br_sale_stock/security/ir.model.access.csv +++ /dev/null @@ -1,8 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"l10n_br_account_product_cfop","l10n_br_account_product.cfop","l10n_br_account_product.model_l10n_br_account_product_cfop","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_sale_template_salesman","l10n_br_tax.definition.sale.template","l10n_br_account_product.model_l10n_br_tax_definition_sale_template","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_purchase_template_salesman","l10n_br_tax.definition.purchase.template","l10n_br_account_product.model_l10n_br_tax_definition_purchase_template","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_sale_salesman","l10n_br_tax.definition.sale","l10n_br_account_product.model_l10n_br_tax_definition_sale","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_purchase_salesman","l10n_br_tax.definition.purchase","l10n_br_account_product.model_l10n_br_tax_definition_purchase","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_company_product_salesman","l10n_br_tax.definition.company.product","l10n_br_account_product.model_l10n_br_tax_definition_company_product","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_company_service_salesman","l10n_br_tax.definition.company.service","l10n_br_account_service.model_l10n_br_tax_definition_company_service","base.group_sale_salesman",1,0,0,0 \ No newline at end of file diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py deleted file mode 100644 index 25f19f01540e..000000000000 --- a/l10n_br_sale_stock/stock.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp.osv import orm - - -class StockPicking(orm.Model): - _inherit = 'stock.picking' - - def _prepare_invoice(self, cr, uid, picking, partner, - inv_type, journal_id, context=None): - result = super(StockPicking, self)._prepare_invoice( - cr, uid, picking, partner, inv_type, journal_id, context) - - fp_comment = [] - fc_comment = [] - fp_ids = [] - fc_ids = [] - - if picking.fiscal_position and \ - picking.fiscal_position.inv_copy_note and \ - picking.fiscal_position.note: - fp_comment.append(picking.fiscal_position.note) - - for move in picking.move_lines: - if move.sale_line_id: - line = move.sale_line_id - if line.fiscal_position and \ - line.fiscal_position.inv_copy_note and \ - line.fiscal_position.note: - if not line.fiscal_position.id in fp_ids: - fp_comment.append(line.fiscal_position.note) - fp_ids.append(line.fiscal_position.id) - - if move.product_id.ncm_id: - fc = move.product_id.ncm_id - if fc.inv_copy_note and fc.note: - if not fc.id in fc_ids: - fc_comment.append(fc.note) - fc_ids.append(fc.id) - - result['comment'] = " - ".join(fp_comment + fc_comment) - result['fiscal_category_id'] = picking.fiscal_category_id and \ - picking.fiscal_category_id.id - result['fiscal_position'] = picking.fiscal_position and \ - picking.fiscal_position.id - return result diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml deleted file mode 100644 index 28f588809af5..000000000000 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ /dev/null @@ -1,93 +0,0 @@ -- - I prepare tunneling extra args in the context -- - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) -- - In order to test fiscal parameters of Sale Order inside the same state, I create sale order -- - !record {model: sale.order, id: sale_order_test1}: - partner_id: l10n_br_base.res_partner_akretion - order_line: - - product_id: product.product_product_8 - product_uom_qty: 8 -- - I verify that the onchange was correctly triggered -- - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - len(order_line[0].tax_id) == 3 - - order_line[0].product_uom_qty == 8 - - order_line[0].product_uom.id == ref('product.product_uom_unit') -- - I prepare tunneling extra args in the context -- - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) -- - I create another sale order -- - !record {model: sale.order, id: sale_order_test2}: - partner_id: l10n_br_base.res_partner_address_ak2 - order_policy: picking - order_line: - - product_id: product.product_product_8 - product_uom: product.product_uom_unit - product_uom_qty: 16 -- - I verify that the onchange was correctly triggered -- - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - order_line[0].product_id.id == ref('product.product_product_8') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - len(order_line[0].tax_id) == 3 - - order_line[0].product_uom.id == ref('product.product_uom_unit') - - order_line[0].product_uom_qty == 16 -- - I confirm order_test2 -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_test2} -- - I check the details of delivery order after confirmed quotation. -- - !python {model: sale.order}: | - sale_order = self.browse(cr, uid, ref("sale_order_test2")) - assert sale_order.picking_ids, "Delivery order is not created." - for picking in sale_order.picking_ids: - assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." - assert picking.type == 'out',"Shipment should be Outgoing." - assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') -- - I create Invoice from Delivery Order. -- - !python {model: stock.invoice.onshipping}: | - sale = self.pool.get('sale.order') - sale_order = sale.browse(cr, uid, ref("sale_order_test2")) - ship_ids = [picking.id for picking in sale_order.picking_ids if picking.invoice_state == '2binvoiced'] - if ship_ids: - wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, - {'active_ids': ship_ids, 'active_model': 'stock.picking'}) - self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) -- - I check the invoice details after dispatched delivery. -- - !python {model: sale.order}: | - order = self.browse(cr, uid, ref("sale_order_test2")) - assert order.invoice_ids, "Invoice is not created." - journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)]) - for invoice in order.invoice_ids: - assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." - assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') - assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') - assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From 956fe2f1cdc32c0e7eb7c6318d2e323a39d99e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 13 Oct 2015 16:58:08 +0200 Subject: [PATCH 043/241] [MOV] move addons out of __unported__ (they remain not installable) --- l10n_br_sale_stock/README.md | 2 + l10n_br_sale_stock/__init__.py | 23 +++ l10n_br_sale_stock/__openerp__.py | 46 ++++++ l10n_br_sale_stock/i18n/pt_BR.po | 9 ++ .../l10n_br_sale_stock_data.xml | 7 + .../l10n_br_sale_stock_demo.xml | 151 ++++++++++++++++++ l10n_br_sale_stock/report/__init__.py | 20 +++ l10n_br_sale_stock/report/sale_report.py | 89 +++++++++++ l10n_br_sale_stock/sale.py | 64 ++++++++ l10n_br_sale_stock/sale_stock_view.xml | 20 +++ .../security/ir.model.access.csv | 8 + l10n_br_sale_stock/stock.py | 64 ++++++++ l10n_br_sale_stock/test/sale_order_demo.yml | 93 +++++++++++ 13 files changed, 596 insertions(+) create mode 100644 l10n_br_sale_stock/README.md create mode 100644 l10n_br_sale_stock/__init__.py create mode 100644 l10n_br_sale_stock/__openerp__.py create mode 100644 l10n_br_sale_stock/i18n/pt_BR.po create mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_data.xml create mode 100644 l10n_br_sale_stock/l10n_br_sale_stock_demo.xml create mode 100644 l10n_br_sale_stock/report/__init__.py create mode 100644 l10n_br_sale_stock/report/sale_report.py create mode 100644 l10n_br_sale_stock/sale.py create mode 100644 l10n_br_sale_stock/sale_stock_view.xml create mode 100644 l10n_br_sale_stock/security/ir.model.access.csv create mode 100644 l10n_br_sale_stock/stock.py create mode 100644 l10n_br_sale_stock/test/sale_order_demo.yml diff --git a/l10n_br_sale_stock/README.md b/l10n_br_sale_stock/README.md new file mode 100644 index 000000000000..1c65300877a7 --- /dev/null +++ b/l10n_br_sale_stock/README.md @@ -0,0 +1,2 @@ +Módulo de Vendas e Estoque +========================== diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py new file mode 100644 index 000000000000..cd35233894f8 --- /dev/null +++ b/l10n_br_sale_stock/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 Raphaël Valyi - Akretion # +# Copyright (C) 2013 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 . # +############################################################################### + +import stock +import sale +import report \ No newline at end of file diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py new file mode 100644 index 000000000000..d4cabe9da526 --- /dev/null +++ b/l10n_br_sale_stock/__openerp__.py @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 Raphaël Valyi - Akretion # +# Copyright (C) 2013 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 . # +############################################################################### + +{ + 'name': 'Brazilian Localization Sales and Warehouse', + 'description': 'Brazilian Localization for sale_stock_module', + 'category': 'Localisation', + 'license': 'AGPL-3', + 'author': 'Akretion, OpenERPBrasil.org', + 'website': 'http://openerpbrasil.org', + 'version': '7.0', + 'depends': [ + 'sale_stock', + 'l10n_br_sale_product', + 'l10n_br_stock', + ], + 'data': [ + 'l10n_br_sale_stock_data.xml', + 'sale_stock_view.xml', + ], + 'demo': [ + 'l10n_br_sale_stock_demo.xml', + 'test/sale_order_demo.yml' + ], + 'test': [ + ], + 'installable': False, + 'auto_install': True, +} diff --git a/l10n_br_sale_stock/i18n/pt_BR.po b/l10n_br_sale_stock/i18n/pt_BR.po new file mode 100644 index 000000000000..f8b26be3a564 --- /dev/null +++ b/l10n_br_sale_stock/i18n/pt_BR.po @@ -0,0 +1,9 @@ +#. module: base +#: model:ir.module.module,shortdesc:base.module_l10n_br_sale_stock +msgid "Brazilian Localization Sales and Warehouse" +msgstr "Localização Brasileira - Módulo de Vendas e Estoque" + +#. module: base +#: model:ir.module.module,description:base.module_l10n_br_sale_stock +msgid "Brazilian Localization for sale_stock_module" +msgstr "Localização Brasileira - Integra os módulos de venda e estoque" diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml new file mode 100644 index 000000000000..556fb4fd2896 --- /dev/null +++ b/l10n_br_sale_stock/l10n_br_sale_stock_data.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml new file mode 100644 index 000000000000..b8de68209e54 --- /dev/null +++ b/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/l10n_br_sale_stock/report/__init__.py b/l10n_br_sale_stock/report/__init__.py new file mode 100644 index 000000000000..87f260be81b0 --- /dev/null +++ b/l10n_br_sale_stock/report/__init__.py @@ -0,0 +1,20 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 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 . # +############################################################################### + +import sale_report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/sale_report.py b/l10n_br_sale_stock/report/sale_report.py new file mode 100644 index 000000000000..34c818a23476 --- /dev/null +++ b/l10n_br_sale_stock/report/sale_report.py @@ -0,0 +1,89 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2013 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 General Public License for more details. # +# # +#You should have received a copy of the GNU General Public License # +#along with this program. If not, see . # +############################################################################### + +from openerp import tools +from openerp.osv import orm, fields + + +class sale_report(orm.Model): + _inherit = "sale.report" + _columns = { + 'fiscal_category_id': fields.many2one( + 'l10n_br_account.fiscal.category', 'Fiscal Category', + readonly=True), + 'fiscal_position': fields.many2one( + 'account.fiscal.position', 'Fiscal Position', readonly=True) + } + + def init(self, cr): + tools.drop_view_if_exists(cr, 'sale_report') + cr.execute(""" + create or replace view sale_report as ( + select + min(l.id) as id, + l.product_id as product_id, + l.fiscal_category_id as fiscal_category_id, + l.fiscal_position as fiscal_position, + t.uom_id as product_uom, + sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty, + sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total, + 1 as nbr, + s.date_order as date, + s.date_confirm as date_confirm, + to_char(s.date_order, 'YYYY') as year, + to_char(s.date_order, 'MM') as month, + to_char(s.date_order, 'YYYY-MM-DD') as day, + s.partner_id as partner_id, + s.user_id as user_id, + s.shop_id as shop_id, + s.company_id as company_id, + extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, + s.state, + t.categ_id as categ_id, + s.shipped, + s.shipped::integer as shipped_qty_1, + s.pricelist_id as pricelist_id, + s.project_id as analytic_account_id + from + sale_order s + join sale_order_line l on (s.id=l.order_id) + left join product_product p on (l.product_id=p.id) + left join product_template t on (p.product_tmpl_id=t.id) + left join product_uom u on (u.id=l.product_uom) + left join product_uom u2 on (u2.id=t.uom_id) + group by + l.product_id, + l.fiscal_category_id, + l.fiscal_position, + l.product_uom_qty, + l.order_id, + t.uom_id, + t.categ_id, + s.date_order, + s.date_confirm, + s.partner_id, + s.user_id, + s.shop_id, + s.company_id, + s.state, + s.shipped, + s.pricelist_id, + s.project_id + ) + """) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py new file mode 100644 index 000000000000..cf1193bcb5a8 --- /dev/null +++ b/l10n_br_sale_stock/sale.py @@ -0,0 +1,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 . # +############################################################################### + +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 \ No newline at end of file diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml new file mode 100644 index 000000000000..aedbf9cb7afb --- /dev/null +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -0,0 +1,20 @@ + + + + + + l10n_br_sale_stock.order.form + sale.order + + + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + + + + + diff --git a/l10n_br_sale_stock/security/ir.model.access.csv b/l10n_br_sale_stock/security/ir.model.access.csv new file mode 100644 index 000000000000..41372a37f53a --- /dev/null +++ b/l10n_br_sale_stock/security/ir.model.access.csv @@ -0,0 +1,8 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"l10n_br_account_product_cfop","l10n_br_account_product.cfop","l10n_br_account_product.model_l10n_br_account_product_cfop","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_sale_template_salesman","l10n_br_tax.definition.sale.template","l10n_br_account_product.model_l10n_br_tax_definition_sale_template","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_purchase_template_salesman","l10n_br_tax.definition.purchase.template","l10n_br_account_product.model_l10n_br_tax_definition_purchase_template","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_sale_salesman","l10n_br_tax.definition.sale","l10n_br_account_product.model_l10n_br_tax_definition_sale","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_purchase_salesman","l10n_br_tax.definition.purchase","l10n_br_account_product.model_l10n_br_tax_definition_purchase","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_company_product_salesman","l10n_br_tax.definition.company.product","l10n_br_account_product.model_l10n_br_tax_definition_company_product","base.group_sale_salesman",1,0,0,0 +"l10n_br_tax_definition_company_service_salesman","l10n_br_tax.definition.company.service","l10n_br_account_service.model_l10n_br_tax_definition_company_service","base.group_sale_salesman",1,0,0,0 \ No newline at end of file diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py new file mode 100644 index 000000000000..25f19f01540e --- /dev/null +++ b/l10n_br_sale_stock/stock.py @@ -0,0 +1,64 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm + + +class StockPicking(orm.Model): + _inherit = 'stock.picking' + + def _prepare_invoice(self, cr, uid, picking, partner, + inv_type, journal_id, context=None): + result = super(StockPicking, self)._prepare_invoice( + cr, uid, picking, partner, inv_type, journal_id, context) + + fp_comment = [] + fc_comment = [] + fp_ids = [] + fc_ids = [] + + if picking.fiscal_position and \ + picking.fiscal_position.inv_copy_note and \ + picking.fiscal_position.note: + fp_comment.append(picking.fiscal_position.note) + + for move in picking.move_lines: + if move.sale_line_id: + line = move.sale_line_id + if line.fiscal_position and \ + line.fiscal_position.inv_copy_note and \ + line.fiscal_position.note: + if not line.fiscal_position.id in fp_ids: + fp_comment.append(line.fiscal_position.note) + fp_ids.append(line.fiscal_position.id) + + if move.product_id.ncm_id: + fc = move.product_id.ncm_id + if fc.inv_copy_note and fc.note: + if not fc.id in fc_ids: + fc_comment.append(fc.note) + fc_ids.append(fc.id) + + result['comment'] = " - ".join(fp_comment + fc_comment) + result['fiscal_category_id'] = picking.fiscal_category_id and \ + picking.fiscal_category_id.id + result['fiscal_position'] = picking.fiscal_position and \ + picking.fiscal_position.id + return result diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml new file mode 100644 index 000000000000..28f588809af5 --- /dev/null +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -0,0 +1,93 @@ +- + I prepare tunneling extra args in the context +- + !python {model: sale.order}: | + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) +- + In order to test fiscal parameters of Sale Order inside the same state, I create sale order +- + !record {model: sale.order, id: sale_order_test1}: + partner_id: l10n_br_base.res_partner_akretion + order_line: + - product_id: product.product_product_8 + product_uom_qty: 8 +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') + - order_line[0].product_id.id == ref('product.product_product_8') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') + - len(order_line[0].tax_id) == 3 + - order_line[0].product_uom_qty == 8 + - order_line[0].product_uom.id == ref('product.product_uom_unit') +- + I prepare tunneling extra args in the context +- + !python {model: sale.order}: | + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) +- + I create another sale order +- + !record {model: sale.order, id: sale_order_test2}: + partner_id: l10n_br_base.res_partner_address_ak2 + order_policy: picking + order_line: + - product_id: product.product_product_8 + product_uom: product.product_uom_unit + product_uom_qty: 16 +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: + - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + - order_line[0].product_id.id == ref('product.product_product_8') + - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + - len(order_line[0].tax_id) == 3 + - order_line[0].product_uom.id == ref('product.product_uom_unit') + - order_line[0].product_uom_qty == 16 +- + I confirm order_test2 +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_test2} +- + I check the details of delivery order after confirmed quotation. +- + !python {model: sale.order}: | + sale_order = self.browse(cr, uid, ref("sale_order_test2")) + assert sale_order.picking_ids, "Delivery order is not created." + for picking in sale_order.picking_ids: + assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." + assert picking.type == 'out',"Shipment should be Outgoing." + assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') +- + I create Invoice from Delivery Order. +- + !python {model: stock.invoice.onshipping}: | + sale = self.pool.get('sale.order') + sale_order = sale.browse(cr, uid, ref("sale_order_test2")) + ship_ids = [picking.id for picking in sale_order.picking_ids if picking.invoice_state == '2binvoiced'] + if ship_ids: + wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, + {'active_ids': ship_ids, 'active_model': 'stock.picking'}) + self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) +- + I check the invoice details after dispatched delivery. +- + !python {model: sale.order}: | + order = self.browse(cr, uid, ref("sale_order_test2")) + assert order.invoice_ids, "Invoice is not created." + journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)]) + for invoice in order.invoice_ids: + assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." + assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') + assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') + assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') + assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') + assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From 1a279a377ed544b8c51964415a8ee1e42be5ef20 Mon Sep 17 00:00:00 2001 From: kram3r Date: Mon, 16 Nov 2015 18:17:54 -0200 Subject: [PATCH 044/241] [FIX] sale_analysis_report --- l10n_br_sale_stock/__init__.py | 1 - l10n_br_sale_stock/report/__init__.py | 20 ------ l10n_br_sale_stock/report/sale_report.py | 89 ------------------------ 3 files changed, 110 deletions(-) delete mode 100644 l10n_br_sale_stock/report/__init__.py delete mode 100644 l10n_br_sale_stock/report/sale_report.py diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index cd35233894f8..4526a8e5a96f 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -20,4 +20,3 @@ import stock import sale -import report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/__init__.py b/l10n_br_sale_stock/report/__init__.py deleted file mode 100644 index 87f260be81b0..000000000000 --- a/l10n_br_sale_stock/report/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 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 . # -############################################################################### - -import sale_report \ No newline at end of file diff --git a/l10n_br_sale_stock/report/sale_report.py b/l10n_br_sale_stock/report/sale_report.py deleted file mode 100644 index 34c818a23476..000000000000 --- a/l10n_br_sale_stock/report/sale_report.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2013 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 General Public License for more details. # -# # -#You should have received a copy of the GNU General Public License # -#along with this program. If not, see . # -############################################################################### - -from openerp import tools -from openerp.osv import orm, fields - - -class sale_report(orm.Model): - _inherit = "sale.report" - _columns = { - 'fiscal_category_id': fields.many2one( - 'l10n_br_account.fiscal.category', 'Fiscal Category', - readonly=True), - 'fiscal_position': fields.many2one( - 'account.fiscal.position', 'Fiscal Position', readonly=True) - } - - def init(self, cr): - tools.drop_view_if_exists(cr, 'sale_report') - cr.execute(""" - create or replace view sale_report as ( - select - min(l.id) as id, - l.product_id as product_id, - l.fiscal_category_id as fiscal_category_id, - l.fiscal_position as fiscal_position, - t.uom_id as product_uom, - sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty, - sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total, - 1 as nbr, - s.date_order as date, - s.date_confirm as date_confirm, - to_char(s.date_order, 'YYYY') as year, - to_char(s.date_order, 'MM') as month, - to_char(s.date_order, 'YYYY-MM-DD') as day, - s.partner_id as partner_id, - s.user_id as user_id, - s.shop_id as shop_id, - s.company_id as company_id, - extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay, - s.state, - t.categ_id as categ_id, - s.shipped, - s.shipped::integer as shipped_qty_1, - s.pricelist_id as pricelist_id, - s.project_id as analytic_account_id - from - sale_order s - join sale_order_line l on (s.id=l.order_id) - left join product_product p on (l.product_id=p.id) - left join product_template t on (p.product_tmpl_id=t.id) - left join product_uom u on (u.id=l.product_uom) - left join product_uom u2 on (u2.id=t.uom_id) - group by - l.product_id, - l.fiscal_category_id, - l.fiscal_position, - l.product_uom_qty, - l.order_id, - t.uom_id, - t.categ_id, - s.date_order, - s.date_confirm, - s.partner_id, - s.user_id, - s.shop_id, - s.company_id, - s.state, - s.shipped, - s.pricelist_id, - s.project_id - ) - """) From 63d73f89d02f6863877386b6b6d7c8546c613939 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:57:43 -0200 Subject: [PATCH 045/241] set l10n_br_sale_stock module as installable --- l10n_br_sale_stock/__openerp__.py | 2 +- l10n_br_sale_stock/sale_stock.py | 34 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index d4cabe9da526..8415f0e39635 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -41,6 +41,6 @@ ], 'test': [ ], - 'installable': False, + 'installable': True, 'auto_install': True, } diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py new file mode 100644 index 000000000000..fddd94967f50 --- /dev/null +++ b/l10n_br_sale_stock/sale_stock.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm + + +class sale_order(orm.Model): + _inherit = 'sale.order' + + def _prepare_order_picking(self, cr, uid, order, context=None): + result = super(sale_order, 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 + return result From 6e7b3b6458e1fcf2d9996dc0ffa5d90c55618df3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:58:44 -0200 Subject: [PATCH 046/241] update metadata --- l10n_br_sale_stock/__openerp__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 8415f0e39635..fde844ddc58e 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -23,9 +23,9 @@ 'description': 'Brazilian Localization for sale_stock_module', 'category': 'Localisation', 'license': 'AGPL-3', - 'author': 'Akretion, OpenERPBrasil.org', - 'website': 'http://openerpbrasil.org', - 'version': '7.0', + 'author': 'Akretion, OdooBrasil', + 'website': 'http://odoo-brasil.org', + 'version': '8.0', 'depends': [ 'sale_stock', 'l10n_br_sale_product', From aa553be56e17f36a69d7db621b7a127f8be13b18 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:59:05 -0200 Subject: [PATCH 047/241] change dependency --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index fde844ddc58e..e918d6470734 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -29,7 +29,7 @@ 'depends': [ 'sale_stock', 'l10n_br_sale_product', - 'l10n_br_stock', + 'l10n_br_stock_account', ], 'data': [ 'l10n_br_sale_stock_data.xml', From 9f0961cb072340c46e01827b3997e8e6325179ad Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:59:30 -0200 Subject: [PATCH 048/241] comment data file --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index e918d6470734..38949e9f7eeb 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -37,7 +37,7 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', - 'test/sale_order_demo.yml' + #'test/sale_order_demo.yml' ], 'test': [ ], From fe57d5abe8dd7df61003332c01b811a936ecbf90 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 27 Oct 2014 09:51:51 -0200 Subject: [PATCH 049/241] migrate sale.order object to new API --- l10n_br_sale_stock/sale.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index cf1193bcb5a8..9f314c4b840a 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -18,10 +18,10 @@ #along with this program. If not, see . # ############################################################################### -from openerp.osv import orm +from openerp import models, api -class SaleOrder(orm.Model): +class SaleOrder(models.Model): _inherit = 'sale.order' def _prepare_invoice(self, cr, uid, order, lines, context=None): @@ -43,6 +43,7 @@ def _prepare_invoice(self, cr, uid, order, lines, context=None): return result + # TODO não existe mais este método pai def _prepare_order_picking(self, cr, uid, order, context=None): result = super(SaleOrder, self)._prepare_order_picking(cr, uid, order, context) @@ -53,7 +54,7 @@ def _prepare_order_picking(self, cr, uid, order, context=None): result['ind_pres'] = order.ind_pres or False return result - + # TODO 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) From 5a01bb7e0cc28df2d905a92719055e1545d41c0f Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 27 Oct 2014 09:54:33 -0200 Subject: [PATCH 050/241] migrate stock objects and view to new API --- l10n_br_sale_stock/sale_stock.py | 13 ++++++------- l10n_br_sale_stock/sale_stock_view.xml | 4 ++-- l10n_br_sale_stock/stock.py | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index fddd94967f50..a3d08dbc1665 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -18,17 +18,16 @@ #along with this program. If not, see . # ############################################################################### -from openerp.osv import orm +from openerp import models -class sale_order(orm.Model): +class SaleOrder(models.Model): _inherit = 'sale.order' + # TODO migrate to new API def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(sale_order, self)._prepare_order_picking( + result = super(SaleOrder, self._model)._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['fiscal_category_id'] = order.fiscal_category_id.id + result['fiscal_position'] = order.fiscal_position.id return result diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/sale_stock_view.xml index aedbf9cb7afb..5cdc0cc36aef 100644 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ b/l10n_br_sale_stock/sale_stock_view.xml @@ -8,10 +8,10 @@ - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - {'parent_fiscal_category_id': parent.fiscal_category_id, 'shop_id': parent.shop_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index 25f19f01540e..fe1f6dfc3494 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -18,12 +18,13 @@ #along with this program. If not, see . # ############################################################################### -from openerp.osv import orm +from openerp import models -class StockPicking(orm.Model): +class StockPicking(models.Model): _inherit = 'stock.picking' + # TODO migrate to new API def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): result = super(StockPicking, self)._prepare_invoice( From 4e436234ab9bae4c3c7805c1fd60b944d76e2788 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 27 Oct 2014 09:56:21 -0200 Subject: [PATCH 051/241] update yml test file --- l10n_br_sale_stock/test/sale_order_demo.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 28f588809af5..2eb815384d17 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -2,7 +2,7 @@ I prepare tunneling extra args in the context - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'company_id': ref('base.main_company'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) - In order to test fiscal parameters of Sale Order inside the same state, I create sale order - @@ -27,7 +27,7 @@ I prepare tunneling extra args in the context - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'shop_id': ref('sale.sale_shop_1'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) + context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'company_id': ref('base.main_company'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) - I create another sale order - @@ -62,7 +62,6 @@ assert sale_order.picking_ids, "Delivery order is not created." for picking in sale_order.picking_ids: assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." - assert picking.type == 'out',"Shipment should be Outgoing." assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - From a1ad7d8e0d167ca08e3fc4220ae31db6da1818a2 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 30 Oct 2014 18:34:56 -0200 Subject: [PATCH 052/241] added new inherit class procurement.order to copy fiscal info in stock.move object --- l10n_br_sale_stock/__init__.py | 1 + l10n_br_sale_stock/procurement.py | 34 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 l10n_br_sale_stock/procurement.py diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index 4526a8e5a96f..dd263139839c 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -20,3 +20,4 @@ import stock import sale +import procurement diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/procurement.py new file mode 100644 index 000000000000..60ae69dfbef7 --- /dev/null +++ b/l10n_br_sale_stock/procurement.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# 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 . # +############################################################################### + +from openerp import models, api + + +class ProcurementOrder(models.Model): + _inherit = "procurement.order" + + @api.model + def _run_move_create(self, procurement): + result = super(ProcurementOrder, self)._run_move_create(procurement) + if procurement.sale_line_id: + result.update({ + 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_position': procurement.sale_line_id.fiscal_position.id, + }) + return result \ No newline at end of file From dcafeaa88c8bcd51aa0cca9bd10f42a3da24718a Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 14 Jan 2015 10:46:15 -0200 Subject: [PATCH 053/241] copy incoterm --- l10n_br_sale_stock/sale_stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index a3d08dbc1665..084e76993bac 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -30,4 +30,5 @@ def _prepare_order_picking(self, cr, uid, order, context=None): cr, uid, order, context) result['fiscal_category_id'] = order.fiscal_category_id.id result['fiscal_position'] = order.fiscal_position.id + result['incoterm'] = order.incoterm return result From 8ede470505b36773ffd6388f4925e84720a24cc8 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 13:20:28 -0300 Subject: [PATCH 054/241] migration to 8.0 --- l10n_br_sale_stock/sale.py | 8 ++++---- l10n_br_sale_stock/sale_stock.py | 34 -------------------------------- l10n_br_sale_stock/stock.py | 3 ++- 3 files changed, 6 insertions(+), 39 deletions(-) delete mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py index 9f314c4b840a..a5063fa1828a 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/sale.py @@ -24,7 +24,8 @@ class SaleOrder(models.Model): _inherit = 'sale.order' - def _prepare_invoice(self, cr, uid, order, lines, context=None): + @api.model + def _prepare_invoice(self, order, lines): """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 @@ -35,8 +36,7 @@ def _prepare_invoice(self, cr, uid, order, lines, context=None): attached to the invoice :return: dict of value to create() the invoice """ - result = super(SaleOrder, self)._prepare_invoice( - cr, uid, order, lines, context) + result = super(SaleOrder, self)._prepare_invoice(order, lines) if order.incoterm: result['incoterm'] = order.incoterm.id @@ -62,4 +62,4 @@ def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planne line.fiscal_category_id.id result['fiscal_position'] = line.fiscal_position and \ line.fiscal_position.id - return result \ No newline at end of file + return result diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py deleted file mode 100644 index 084e76993bac..000000000000 --- a/l10n_br_sale_stock/sale_stock.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp import models - - -class SaleOrder(models.Model): - _inherit = 'sale.order' - - # TODO migrate to new API - def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(SaleOrder, self._model)._prepare_order_picking( - cr, uid, order, context) - result['fiscal_category_id'] = order.fiscal_category_id.id - result['fiscal_position'] = order.fiscal_position.id - result['incoterm'] = order.incoterm - return result diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/stock.py index fe1f6dfc3494..622d77ee039e 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/stock.py @@ -24,7 +24,7 @@ class StockPicking(models.Model): _inherit = 'stock.picking' - # TODO migrate to new API + # TODO migrate to new API - Não existe mais este método def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): result = super(StockPicking, self)._prepare_invoice( @@ -62,4 +62,5 @@ def _prepare_invoice(self, cr, uid, picking, partner, picking.fiscal_category_id.id result['fiscal_position'] = picking.fiscal_position and \ picking.fiscal_position.id + result['ind_final'] = picking.fiscal_position.ind_final return result From df3acf80b40da3c8002e4ba5a42e3ba450bdd4a5 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 17:31:30 -0300 Subject: [PATCH 055/241] moved models and views to a folder as new pattern and replace uncoding to coding in py files --- l10n_br_sale_stock/__init__.py | 6 ++--- l10n_br_sale_stock/__openerp__.py | 6 ++--- .../{ => data}/l10n_br_sale_stock_data.xml | 0 .../{ => demo}/l10n_br_sale_stock_demo.xml | 0 l10n_br_sale_stock/models/__init__.py | 22 +++++++++++++++++++ .../{ => models}/procurement.py | 2 +- l10n_br_sale_stock/{ => models}/sale.py | 2 +- l10n_br_sale_stock/{ => models}/stock.py | 2 +- .../{ => views}/sale_stock_view.xml | 0 9 files changed, 30 insertions(+), 10 deletions(-) rename l10n_br_sale_stock/{ => data}/l10n_br_sale_stock_data.xml (100%) rename l10n_br_sale_stock/{ => demo}/l10n_br_sale_stock_demo.xml (100%) create mode 100644 l10n_br_sale_stock/models/__init__.py rename l10n_br_sale_stock/{ => models}/procurement.py (98%) rename l10n_br_sale_stock/{ => models}/sale.py (99%) rename l10n_br_sale_stock/{ => models}/stock.py (99%) rename l10n_br_sale_stock/{ => views}/sale_stock_view.xml (100%) diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index dd263139839c..c6abaff66b61 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2013 Raphaël Valyi - Akretion # @@ -18,6 +18,4 @@ #along with this program. If not, see . # ############################################################################### -import stock -import sale -import procurement +from . import models diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 38949e9f7eeb..20787e2ca75a 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2013 Raphaël Valyi - Akretion # @@ -32,8 +32,8 @@ 'l10n_br_stock_account', ], 'data': [ - 'l10n_br_sale_stock_data.xml', - 'sale_stock_view.xml', + 'data/l10n_br_sale_stock_data.xml', + 'views/sale_stock_view.xml', ], 'demo': [ 'l10n_br_sale_stock_demo.xml', diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml similarity index 100% rename from l10n_br_sale_stock/l10n_br_sale_stock_data.xml rename to l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml diff --git a/l10n_br_sale_stock/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml similarity index 100% rename from l10n_br_sale_stock/l10n_br_sale_stock_demo.xml rename to l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py new file mode 100644 index 000000000000..826725baf7cb --- /dev/null +++ b/l10n_br_sale_stock/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2015 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 . # +############################################################################### + +from . import procurement +from . import sale +from . import stock diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/models/procurement.py similarity index 98% rename from l10n_br_sale_stock/procurement.py rename to l10n_br_sale_stock/models/procurement.py index 60ae69dfbef7..7cee9e09c536 100644 --- a/l10n_br_sale_stock/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2014 Renato Lima - Akretion # diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/models/sale.py similarity index 99% rename from l10n_br_sale_stock/sale.py rename to l10n_br_sale_stock/models/sale.py index a5063fa1828a..5b4b312373d3 100644 --- a/l10n_br_sale_stock/sale.py +++ b/l10n_br_sale_stock/models/sale.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2013 Raphaël Valyi - Akretion # diff --git a/l10n_br_sale_stock/stock.py b/l10n_br_sale_stock/models/stock.py similarity index 99% rename from l10n_br_sale_stock/stock.py rename to l10n_br_sale_stock/models/stock.py index 622d77ee039e..61580710d0cf 100644 --- a/l10n_br_sale_stock/stock.py +++ b/l10n_br_sale_stock/models/stock.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2009 Renato Lima - Akretion # diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/views/sale_stock_view.xml similarity index 100% rename from l10n_br_sale_stock/sale_stock_view.xml rename to l10n_br_sale_stock/views/sale_stock_view.xml From aa6cf245c95310a08b0ccbda1b0a42779b49deae Mon Sep 17 00:00:00 2001 From: Raphael Valyi Date: Wed, 21 Oct 2015 18:05:28 -0200 Subject: [PATCH 056/241] pep8 hopefully cleared --- l10n_br_sale_stock/__init__.py | 20 ++++++------ l10n_br_sale_stock/__openerp__.py | 20 ++++++------ l10n_br_sale_stock/models/__init__.py | 20 ++++++------ l10n_br_sale_stock/models/procurement.py | 25 ++++++++------- l10n_br_sale_stock/models/sale.py | 41 ++++++------------------ l10n_br_sale_stock/models/stock.py | 40 +++++++++++------------ 6 files changed, 73 insertions(+), 93 deletions(-) diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index c6abaff66b61..93e3762d5940 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -4,18 +4,18 @@ # Copyright (C) 2013 Raphaël Valyi - Akretion # # Copyright (C) 2013 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from . import models diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 20787e2ca75a..d74b58d507cf 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -4,18 +4,18 @@ # Copyright (C) 2013 Raphaël Valyi - Akretion # # Copyright (C) 2013 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### { diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 826725baf7cb..608e11494c26 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -3,18 +3,18 @@ # # # Copyright (C) 2015 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from . import procurement diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 7cee9e09c536..4fc4fa54d8a9 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -3,18 +3,18 @@ # # # 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -28,7 +28,8 @@ def _run_move_create(self, procurement): result = super(ProcurementOrder, self)._run_move_create(procurement) if procurement.sale_line_id: result.update({ - 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_category_id': (procurement + .sale_line_id.fiscal_category_id.id), 'fiscal_position': procurement.sale_line_id.fiscal_position.id, }) - return result \ No newline at end of file + return result diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py index 5b4b312373d3..221506d66253 100644 --- a/l10n_br_sale_stock/models/sale.py +++ b/l10n_br_sale_stock/models/sale.py @@ -4,18 +4,18 @@ # 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -42,24 +42,3 @@ def _prepare_invoice(self, order, lines): result['incoterm'] = order.incoterm.id return result - - # TODO não existe mais este método pai - 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 - - # TODO - 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 diff --git a/l10n_br_sale_stock/models/stock.py b/l10n_br_sale_stock/models/stock.py index 61580710d0cf..27862a7825bd 100644 --- a/l10n_br_sale_stock/models/stock.py +++ b/l10n_br_sale_stock/models/stock.py @@ -4,18 +4,18 @@ # Copyright (C) 2009 Renato Lima - Akretion # # Copyright (C) 2012 Raphaël Valyi - 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from openerp import models @@ -24,9 +24,9 @@ class StockPicking(models.Model): _inherit = 'stock.picking' - # TODO migrate to new API - Não existe mais este método + # TODO migrate to new API - Não existe mais este método def _prepare_invoice(self, cr, uid, picking, partner, - inv_type, journal_id, context=None): + inv_type, journal_id, context=None): result = super(StockPicking, self)._prepare_invoice( cr, uid, picking, partner, inv_type, journal_id, context) @@ -36,31 +36,31 @@ def _prepare_invoice(self, cr, uid, picking, partner, fc_ids = [] if picking.fiscal_position and \ - picking.fiscal_position.inv_copy_note and \ - picking.fiscal_position.note: + picking.fiscal_position.inv_copy_note and \ + picking.fiscal_position.note: fp_comment.append(picking.fiscal_position.note) for move in picking.move_lines: if move.sale_line_id: line = move.sale_line_id if line.fiscal_position and \ - line.fiscal_position.inv_copy_note and \ - line.fiscal_position.note: - if not line.fiscal_position.id in fp_ids: + line.fiscal_position.inv_copy_note and \ + line.fiscal_position.note: + if line.fiscal_position.id not in fp_ids: fp_comment.append(line.fiscal_position.note) fp_ids.append(line.fiscal_position.id) if move.product_id.ncm_id: fc = move.product_id.ncm_id if fc.inv_copy_note and fc.note: - if not fc.id in fc_ids: + if fc.id not in fc_ids: fc_comment.append(fc.note) fc_ids.append(fc.id) result['comment'] = " - ".join(fp_comment + fc_comment) result['fiscal_category_id'] = picking.fiscal_category_id and \ - picking.fiscal_category_id.id + picking.fiscal_category_id.id result['fiscal_position'] = picking.fiscal_position and \ - picking.fiscal_position.id + picking.fiscal_position.id result['ind_final'] = picking.fiscal_position.ind_final return result From 205b2057c74d76646804d00e40685b399c0c852e Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:09:57 -0200 Subject: [PATCH 057/241] changed version, add README.rst and README.md --- l10n_br_sale_stock/README.md | 2 - l10n_br_sale_stock/README.rst | 79 +++++++++++++++++++++++++++++++ l10n_br_sale_stock/__openerp__.py | 5 +- 3 files changed, 81 insertions(+), 5 deletions(-) delete mode 100644 l10n_br_sale_stock/README.md create mode 100644 l10n_br_sale_stock/README.rst diff --git a/l10n_br_sale_stock/README.md b/l10n_br_sale_stock/README.md deleted file mode 100644 index 1c65300877a7..000000000000 --- a/l10n_br_sale_stock/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Módulo de Vendas e Estoque -========================== diff --git a/l10n_br_sale_stock/README.rst b/l10n_br_sale_stock/README.rst new file mode 100644 index 000000000000..e3d27c8abd90 --- /dev/null +++ b/l10n_br_sale_stock/README.rst @@ -0,0 +1,79 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +========================================== +Módulo Informações Contabéis para Produtos +========================================== + +This module was written to extend the functionality of ... to support ... +and allow you to ... + +Installation +============ + +To install this module, you need to: + +* do this ... + +Configuration +============= + +To configure this module, you need to: + +* go to ... + +Usage +===== + +To use this module, you need to: + +* go to ... + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} + + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +Known issues / Roadmap +====================== + +TODO + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. + + +Credits +======= + +Contributors +------------ + +* Renato Lima +* Raphaël Valyi + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index d74b58d507cf..96c43740c15c 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -20,12 +20,11 @@ { 'name': 'Brazilian Localization Sales and Warehouse', - 'description': 'Brazilian Localization for sale_stock_module', 'category': 'Localisation', 'license': 'AGPL-3', - 'author': 'Akretion, OdooBrasil', + 'author': 'Akretion, ,Odoo Community Association (OCA)', 'website': 'http://odoo-brasil.org', - 'version': '8.0', + 'version': '8.0.1.0.0', 'depends': [ 'sale_stock', 'l10n_br_sale_product', From f486ced28e644c61113a7c3c2b34c19171bbb35d Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:27:29 -0200 Subject: [PATCH 058/241] remove empty file --- l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml diff --git a/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml deleted file mode 100644 index 556fb4fd2896..000000000000 --- a/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 005b76ca6bec31663ffcb5f909b0acbfd937137a Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:28:06 -0200 Subject: [PATCH 059/241] remove ir.model.access record to unused model --- l10n_br_sale_stock/security/ir.model.access.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/l10n_br_sale_stock/security/ir.model.access.csv b/l10n_br_sale_stock/security/ir.model.access.csv index 41372a37f53a..c8aab40ac7aa 100644 --- a/l10n_br_sale_stock/security/ir.model.access.csv +++ b/l10n_br_sale_stock/security/ir.model.access.csv @@ -5,4 +5,3 @@ "l10n_br_tax_definition_sale_salesman","l10n_br_tax.definition.sale","l10n_br_account_product.model_l10n_br_tax_definition_sale","base.group_sale_salesman",1,0,0,0 "l10n_br_tax_definition_purchase_salesman","l10n_br_tax.definition.purchase","l10n_br_account_product.model_l10n_br_tax_definition_purchase","base.group_sale_salesman",1,0,0,0 "l10n_br_tax_definition_company_product_salesman","l10n_br_tax.definition.company.product","l10n_br_account_product.model_l10n_br_tax_definition_company_product","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_company_service_salesman","l10n_br_tax.definition.company.service","l10n_br_account_service.model_l10n_br_tax_definition_company_service","base.group_sale_salesman",1,0,0,0 \ No newline at end of file From 5bcd222dedde188220e832d27627c6abf152b874 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:57:43 -0200 Subject: [PATCH 060/241] set l10n_br_sale_stock module as installable --- l10n_br_sale_stock/sale_stock.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py new file mode 100644 index 000000000000..fddd94967f50 --- /dev/null +++ b/l10n_br_sale_stock/sale_stock.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm + + +class sale_order(orm.Model): + _inherit = 'sale.order' + + def _prepare_order_picking(self, cr, uid, order, context=None): + result = super(sale_order, 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 + return result From 297faa06a08a9a4ad80b7c6cb9aea08253111b0c Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:58:44 -0200 Subject: [PATCH 061/241] update metadata --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 96c43740c15c..526d77836855 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -36,9 +36,9 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', - #'test/sale_order_demo.yml' ], 'test': [ + 'test/sale_order_demo.yml' ], 'installable': True, 'auto_install': True, From 7770a3294b9b01ba409e85e7bfef4fd482e9956e Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:59:30 -0200 Subject: [PATCH 062/241] comment data file --- l10n_br_sale_stock/__openerp__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 526d77836855..c47248d4abdc 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -36,6 +36,10 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', +<<<<<<< HEAD +======= + #'test/sale_order_demo.yml' +>>>>>>> comment data file ], 'test': [ 'test/sale_order_demo.yml' From fac2d5cd3c9efc9b9e94ecab2aba6de78e420eb2 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 27 Oct 2014 09:54:33 -0200 Subject: [PATCH 063/241] migrate stock objects and view to new API --- l10n_br_sale_stock/models/stock.py | 66 ------------------------------ l10n_br_sale_stock/sale_stock.py | 13 +++--- 2 files changed, 6 insertions(+), 73 deletions(-) delete mode 100644 l10n_br_sale_stock/models/stock.py diff --git a/l10n_br_sale_stock/models/stock.py b/l10n_br_sale_stock/models/stock.py deleted file mode 100644 index 27862a7825bd..000000000000 --- a/l10n_br_sale_stock/models/stock.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp import models - - -class StockPicking(models.Model): - _inherit = 'stock.picking' - - # TODO migrate to new API - Não existe mais este método - def _prepare_invoice(self, cr, uid, picking, partner, - inv_type, journal_id, context=None): - result = super(StockPicking, self)._prepare_invoice( - cr, uid, picking, partner, inv_type, journal_id, context) - - fp_comment = [] - fc_comment = [] - fp_ids = [] - fc_ids = [] - - if picking.fiscal_position and \ - picking.fiscal_position.inv_copy_note and \ - picking.fiscal_position.note: - fp_comment.append(picking.fiscal_position.note) - - for move in picking.move_lines: - if move.sale_line_id: - line = move.sale_line_id - if line.fiscal_position and \ - line.fiscal_position.inv_copy_note and \ - line.fiscal_position.note: - if line.fiscal_position.id not in fp_ids: - fp_comment.append(line.fiscal_position.note) - fp_ids.append(line.fiscal_position.id) - - if move.product_id.ncm_id: - fc = move.product_id.ncm_id - if fc.inv_copy_note and fc.note: - if fc.id not in fc_ids: - fc_comment.append(fc.note) - fc_ids.append(fc.id) - - result['comment'] = " - ".join(fp_comment + fc_comment) - result['fiscal_category_id'] = picking.fiscal_category_id and \ - picking.fiscal_category_id.id - result['fiscal_position'] = picking.fiscal_position and \ - picking.fiscal_position.id - result['ind_final'] = picking.fiscal_position.ind_final - return result diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index fddd94967f50..a3d08dbc1665 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -18,17 +18,16 @@ #along with this program. If not, see . # ############################################################################### -from openerp.osv import orm +from openerp import models -class sale_order(orm.Model): +class SaleOrder(models.Model): _inherit = 'sale.order' + # TODO migrate to new API def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(sale_order, self)._prepare_order_picking( + result = super(SaleOrder, self._model)._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['fiscal_category_id'] = order.fiscal_category_id.id + result['fiscal_position'] = order.fiscal_position.id return result From 694b8e36ec14e940d44b12ddde629971f7ca5bcd Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 30 Oct 2014 18:34:56 -0200 Subject: [PATCH 064/241] added new inherit class procurement.order to copy fiscal info in stock.move object --- l10n_br_sale_stock/procurement.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 l10n_br_sale_stock/procurement.py diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/procurement.py new file mode 100644 index 000000000000..60ae69dfbef7 --- /dev/null +++ b/l10n_br_sale_stock/procurement.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# 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 . # +############################################################################### + +from openerp import models, api + + +class ProcurementOrder(models.Model): + _inherit = "procurement.order" + + @api.model + def _run_move_create(self, procurement): + result = super(ProcurementOrder, self)._run_move_create(procurement) + if procurement.sale_line_id: + result.update({ + 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_position': procurement.sale_line_id.fiscal_position.id, + }) + return result \ No newline at end of file From ea3c22a49cf537773d05291805c287898f2a5c93 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 14 Jan 2015 10:46:15 -0200 Subject: [PATCH 065/241] copy incoterm --- l10n_br_sale_stock/sale_stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index a3d08dbc1665..084e76993bac 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -30,4 +30,5 @@ def _prepare_order_picking(self, cr, uid, order, context=None): cr, uid, order, context) result['fiscal_category_id'] = order.fiscal_category_id.id result['fiscal_position'] = order.fiscal_position.id + result['incoterm'] = order.incoterm return result From df477d274624f566b6a304aec6cd575b1ea4e2c1 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 13:20:28 -0300 Subject: [PATCH 066/241] migration to 8.0 --- l10n_br_sale_stock/sale_stock.py | 34 -------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py deleted file mode 100644 index 084e76993bac..000000000000 --- a/l10n_br_sale_stock/sale_stock.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp import models - - -class SaleOrder(models.Model): - _inherit = 'sale.order' - - # TODO migrate to new API - def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(SaleOrder, self._model)._prepare_order_picking( - cr, uid, order, context) - result['fiscal_category_id'] = order.fiscal_category_id.id - result['fiscal_position'] = order.fiscal_position.id - result['incoterm'] = order.incoterm - return result From c56f0e8ac87818db1b4f5450f396e02d68a74a9a Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 17:31:30 -0300 Subject: [PATCH 067/241] moved models and views to a folder as new pattern and replace uncoding to coding in py files --- l10n_br_sale_stock/models/__init__.py | 1 - l10n_br_sale_stock/models/procurement.py | 25 +++++++++-------- l10n_br_sale_stock/procurement.py | 34 ------------------------ 3 files changed, 12 insertions(+), 48 deletions(-) delete mode 100644 l10n_br_sale_stock/procurement.py diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 608e11494c26..ef808c891aec 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -19,4 +19,3 @@ from . import procurement from . import sale -from . import stock diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 4fc4fa54d8a9..7cee9e09c536 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -3,18 +3,18 @@ # # # 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 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. # +#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 . # +#You should have received a copy of the GNU Affero General Public License # +#along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -28,8 +28,7 @@ def _run_move_create(self, procurement): result = super(ProcurementOrder, self)._run_move_create(procurement) if procurement.sale_line_id: result.update({ - 'fiscal_category_id': (procurement - .sale_line_id.fiscal_category_id.id), + 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, 'fiscal_position': procurement.sale_line_id.fiscal_position.id, }) - return result + return result \ No newline at end of file diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/procurement.py deleted file mode 100644 index 60ae69dfbef7..000000000000 --- a/l10n_br_sale_stock/procurement.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# 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 . # -############################################################################### - -from openerp import models, api - - -class ProcurementOrder(models.Model): - _inherit = "procurement.order" - - @api.model - def _run_move_create(self, procurement): - result = super(ProcurementOrder, self)._run_move_create(procurement) - if procurement.sale_line_id: - result.update({ - 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, - 'fiscal_position': procurement.sale_line_id.fiscal_position.id, - }) - return result \ No newline at end of file From f3f59b8d6e88f5c1fecb7e985ce57ed8bcfbad33 Mon Sep 17 00:00:00 2001 From: Raphael Valyi Date: Wed, 21 Oct 2015 18:05:28 -0200 Subject: [PATCH 068/241] pep8 hopefully cleared --- l10n_br_sale_stock/models/procurement.py | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 7cee9e09c536..4fc4fa54d8a9 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -3,18 +3,18 @@ # # # 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -28,7 +28,8 @@ def _run_move_create(self, procurement): result = super(ProcurementOrder, self)._run_move_create(procurement) if procurement.sale_line_id: result.update({ - 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_category_id': (procurement + .sale_line_id.fiscal_category_id.id), 'fiscal_position': procurement.sale_line_id.fiscal_position.id, }) - return result \ No newline at end of file + return result From 2c3be39f12d09af5eb72a8656273a76234f33285 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:57:43 -0200 Subject: [PATCH 069/241] set l10n_br_sale_stock module as installable --- l10n_br_sale_stock/sale_stock.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py new file mode 100644 index 000000000000..fddd94967f50 --- /dev/null +++ b/l10n_br_sale_stock/sale_stock.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# Copyright (C) 2012 Raphaël Valyi - 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 . # +############################################################################### + +from openerp.osv import orm + + +class sale_order(orm.Model): + _inherit = 'sale.order' + + def _prepare_order_picking(self, cr, uid, order, context=None): + result = super(sale_order, 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 + return result From 339b36f8ade29a3f92c3264aeeff7d9f1f1c3e03 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sat, 25 Oct 2014 01:58:44 -0200 Subject: [PATCH 070/241] update metadata --- l10n_br_sale_stock/__openerp__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index c47248d4abdc..526d77836855 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -36,10 +36,6 @@ ], 'demo': [ 'l10n_br_sale_stock_demo.xml', -<<<<<<< HEAD -======= - #'test/sale_order_demo.yml' ->>>>>>> comment data file ], 'test': [ 'test/sale_order_demo.yml' From 95cdc73f1e907450202a7f5403a5bb3a311e93c3 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 27 Oct 2014 09:54:33 -0200 Subject: [PATCH 071/241] migrate stock objects and view to new API --- l10n_br_sale_stock/sale_stock.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index fddd94967f50..a3d08dbc1665 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -18,17 +18,16 @@ #along with this program. If not, see . # ############################################################################### -from openerp.osv import orm +from openerp import models -class sale_order(orm.Model): +class SaleOrder(models.Model): _inherit = 'sale.order' + # TODO migrate to new API def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(sale_order, self)._prepare_order_picking( + result = super(SaleOrder, self._model)._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['fiscal_category_id'] = order.fiscal_category_id.id + result['fiscal_position'] = order.fiscal_position.id return result From 378327332122618603b0ba7cc52690ae323066db Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Thu, 30 Oct 2014 18:34:56 -0200 Subject: [PATCH 072/241] added new inherit class procurement.order to copy fiscal info in stock.move object --- l10n_br_sale_stock/procurement.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 l10n_br_sale_stock/procurement.py diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/procurement.py new file mode 100644 index 000000000000..60ae69dfbef7 --- /dev/null +++ b/l10n_br_sale_stock/procurement.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################### +# # +# 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 . # +############################################################################### + +from openerp import models, api + + +class ProcurementOrder(models.Model): + _inherit = "procurement.order" + + @api.model + def _run_move_create(self, procurement): + result = super(ProcurementOrder, self)._run_move_create(procurement) + if procurement.sale_line_id: + result.update({ + 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_position': procurement.sale_line_id.fiscal_position.id, + }) + return result \ No newline at end of file From 518754ed0f9a13ade1f53e28da43a3190433b39b Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 14 Jan 2015 10:46:15 -0200 Subject: [PATCH 073/241] copy incoterm --- l10n_br_sale_stock/sale_stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py index a3d08dbc1665..084e76993bac 100644 --- a/l10n_br_sale_stock/sale_stock.py +++ b/l10n_br_sale_stock/sale_stock.py @@ -30,4 +30,5 @@ def _prepare_order_picking(self, cr, uid, order, context=None): cr, uid, order, context) result['fiscal_category_id'] = order.fiscal_category_id.id result['fiscal_position'] = order.fiscal_position.id + result['incoterm'] = order.incoterm return result From 2465e2300e95e4ab026b93add4666f2c5ce4ae43 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 13:20:28 -0300 Subject: [PATCH 074/241] migration to 8.0 --- l10n_br_sale_stock/sale_stock.py | 34 -------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 l10n_br_sale_stock/sale_stock.py diff --git a/l10n_br_sale_stock/sale_stock.py b/l10n_br_sale_stock/sale_stock.py deleted file mode 100644 index 084e76993bac..000000000000 --- a/l10n_br_sale_stock/sale_stock.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 Renato Lima - Akretion # -# Copyright (C) 2012 Raphaël Valyi - 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 . # -############################################################################### - -from openerp import models - - -class SaleOrder(models.Model): - _inherit = 'sale.order' - - # TODO migrate to new API - def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(SaleOrder, self._model)._prepare_order_picking( - cr, uid, order, context) - result['fiscal_category_id'] = order.fiscal_category_id.id - result['fiscal_position'] = order.fiscal_position.id - result['incoterm'] = order.incoterm - return result From db3e08111d21962e6f07f33b4a72dc9e2f2783fe Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Wed, 11 Mar 2015 17:31:30 -0300 Subject: [PATCH 075/241] moved models and views to a folder as new pattern and replace uncoding to coding in py files --- .../data/l10n_br_sale_stock_data.xml | 7 +++ l10n_br_sale_stock/models/procurement.py | 25 +++++------ l10n_br_sale_stock/models/sale.py | 44 ------------------- l10n_br_sale_stock/procurement.py | 34 -------------- 4 files changed, 19 insertions(+), 91 deletions(-) create mode 100644 l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml delete mode 100644 l10n_br_sale_stock/models/sale.py delete mode 100644 l10n_br_sale_stock/procurement.py diff --git a/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml new file mode 100644 index 000000000000..556fb4fd2896 --- /dev/null +++ b/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 4fc4fa54d8a9..7cee9e09c536 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -3,18 +3,18 @@ # # # 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 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. # +#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 . # +#You should have received a copy of the GNU Affero General Public License # +#along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -28,8 +28,7 @@ def _run_move_create(self, procurement): result = super(ProcurementOrder, self)._run_move_create(procurement) if procurement.sale_line_id: result.update({ - 'fiscal_category_id': (procurement - .sale_line_id.fiscal_category_id.id), + 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, 'fiscal_position': procurement.sale_line_id.fiscal_position.id, }) - return result + return result \ No newline at end of file diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py deleted file mode 100644 index 221506d66253..000000000000 --- a/l10n_br_sale_stock/models/sale.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: 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 . # -############################################################################### - -from openerp import models, api - - -class SaleOrder(models.Model): - _inherit = 'sale.order' - - @api.model - def _prepare_invoice(self, order, lines): - """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(order, lines) - - if order.incoterm: - result['incoterm'] = order.incoterm.id - - return result diff --git a/l10n_br_sale_stock/procurement.py b/l10n_br_sale_stock/procurement.py deleted file mode 100644 index 60ae69dfbef7..000000000000 --- a/l10n_br_sale_stock/procurement.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# 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 . # -############################################################################### - -from openerp import models, api - - -class ProcurementOrder(models.Model): - _inherit = "procurement.order" - - @api.model - def _run_move_create(self, procurement): - result = super(ProcurementOrder, self)._run_move_create(procurement) - if procurement.sale_line_id: - result.update({ - 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, - 'fiscal_position': procurement.sale_line_id.fiscal_position.id, - }) - return result \ No newline at end of file From 79ba34ddcbfea57714ceb2becb4734c33c1fa3f9 Mon Sep 17 00:00:00 2001 From: Raphael Valyi Date: Wed, 21 Oct 2015 18:05:28 -0200 Subject: [PATCH 076/241] pep8 hopefully cleared --- l10n_br_sale_stock/models/procurement.py | 25 +++++++------- l10n_br_sale_stock/models/sale.py | 44 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 l10n_br_sale_stock/models/sale.py diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 7cee9e09c536..4fc4fa54d8a9 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -3,18 +3,18 @@ # # # 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 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. # +# 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 . # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # ############################################################################### from openerp import models, api @@ -28,7 +28,8 @@ def _run_move_create(self, procurement): result = super(ProcurementOrder, self)._run_move_create(procurement) if procurement.sale_line_id: result.update({ - 'fiscal_category_id': procurement.sale_line_id.fiscal_category_id.id, + 'fiscal_category_id': (procurement + .sale_line_id.fiscal_category_id.id), 'fiscal_position': procurement.sale_line_id.fiscal_position.id, }) - return result \ No newline at end of file + return result diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py new file mode 100644 index 000000000000..221506d66253 --- /dev/null +++ b/l10n_br_sale_stock/models/sale.py @@ -0,0 +1,44 @@ +# -*- coding: 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 . # +############################################################################### + +from openerp import models, api + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + @api.model + def _prepare_invoice(self, order, lines): + """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(order, lines) + + if order.incoterm: + result['incoterm'] = order.incoterm.id + + return result From b4dcdcc4bb7cc3fd372a301feff83326dca175f7 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:27:29 -0200 Subject: [PATCH 077/241] remove empty file --- l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml diff --git a/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml b/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml deleted file mode 100644 index 556fb4fd2896..000000000000 --- a/l10n_br_sale_stock/data/l10n_br_sale_stock_data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 72c228d2feb02762174c81b0e0cad85192d7503a Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:28:06 -0200 Subject: [PATCH 078/241] remove ir.model.access record to unused model --- l10n_br_sale_stock/README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/l10n_br_sale_stock/README.rst b/l10n_br_sale_stock/README.rst index e3d27c8abd90..db83a78db0a0 100644 --- a/l10n_br_sale_stock/README.rst +++ b/l10n_br_sale_stock/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -========================================== -Módulo Informações Contabéis para Produtos -========================================== +================= +Módulo Sale Stcok +================= This module was written to extend the functionality of ... to support ... and allow you to ... @@ -50,7 +50,7 @@ Bugs are tracked on `GitHub Issues `_ In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. From e3ad4ae7f94e3470347fb72642b235bba2458d1c Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Tue, 1 Dec 2015 00:23:01 -0200 Subject: [PATCH 079/241] fix tests and refactoring methods in stock.picking --- l10n_br_sale_stock/__openerp__.py | 1 - l10n_br_sale_stock/test/sale_order_demo.yml | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 526d77836855..53007d871642 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -31,7 +31,6 @@ 'l10n_br_stock_account', ], 'data': [ - 'data/l10n_br_sale_stock_data.xml', 'views/sale_stock_view.xml', ], 'demo': [ diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 2eb815384d17..124e2dc98ec2 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -6,10 +6,11 @@ - In order to test fiscal parameters of Sale Order inside the same state, I create sale order - - !record {model: sale.order, id: sale_order_test1}: + !record {model: sale.order, id: sale_order_test1, view: l10n_br_sale.l10n_br_sale_order_form}: partner_id: l10n_br_base.res_partner_akretion + fiscal_category_id: l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12 order_line: - - product_id: product.product_product_8 + - product_id: product.product_product_10 product_uom_qty: 8 - I verify that the onchange was correctly triggered @@ -17,7 +18,7 @@ !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - order_line[0].product_id.id == ref('product.product_product_8') + - order_line[0].product_id.id == ref('product.product_product_10') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - len(order_line[0].tax_id) == 3 @@ -31,11 +32,13 @@ - I create another sale order - - !record {model: sale.order, id: sale_order_test2}: + !record {model: sale.order, id: sale_order_test2, view: l10n_br_sale.l10n_br_sale_order_form}: partner_id: l10n_br_base.res_partner_address_ak2 + fiscal_category_id: l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12 + fiscal_position: l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo order_policy: picking order_line: - - product_id: product.product_product_8 + - product_id: product.product_product_19 product_uom: product.product_uom_unit product_uom_qty: 16 - @@ -44,7 +47,7 @@ !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - order_line[0].product_id.id == ref('product.product_product_8') + - order_line[0].product_id.id == ref('product.product_product_19') - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - len(order_line[0].tax_id) == 3 From 1db50856e2ad97036351f1495078b53f963d7088 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 22 Jan 2016 12:07:13 -0200 Subject: [PATCH 080/241] fix test --- l10n_br_sale_stock/test/sale_order_demo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml index 124e2dc98ec2..d37c4930e4bb 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -65,6 +65,7 @@ assert sale_order.picking_ids, "Delivery order is not created." for picking in sale_order.picking_ids: assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." + assert picking.picking_type_id.code == 'outgoing',"Shipment should be Outgoing." assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - From 67db80f784d5390a397adac5fcdae66c6df2f1d4 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 22 Jan 2016 15:06:31 -0200 Subject: [PATCH 081/241] pep8 --- l10n_br_sale_stock/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 53007d871642..0742c16659db 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -34,10 +34,10 @@ 'views/sale_stock_view.xml', ], 'demo': [ - 'l10n_br_sale_stock_demo.xml', + 'demo/l10n_br_sale_stock_demo.xml' ], 'test': [ - 'test/sale_order_demo.yml' + # 'test/sale_order_demo.yml' ], 'installable': True, 'auto_install': True, From 908e0c7da023205159344efdbecc17185698e974 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 23 Nov 2015 18:09:57 -0200 Subject: [PATCH 082/241] changed version, add README.rst and README.md --- l10n_br_sale_stock/README.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/l10n_br_sale_stock/README.rst b/l10n_br_sale_stock/README.rst index db83a78db0a0..07ab77df6f3d 100644 --- a/l10n_br_sale_stock/README.rst +++ b/l10n_br_sale_stock/README.rst @@ -2,9 +2,9 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -================= -Módulo Sale Stcok -================= +========================================== +Módulo Informações Contabéis para Produtos +========================================== This module was written to extend the functionality of ... to support ... and allow you to ... @@ -49,9 +49,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. +l10n-brazil/issues/new?body=module:%20l10n_br_sale_stock%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. Credits From 64c62edf19eed1f478ad2d481be610ffa184ae2e Mon Sep 17 00:00:00 2001 From: Luis Felipe Mileo Date: Tue, 19 Jul 2016 11:45:03 -0300 Subject: [PATCH 083/241] [REF] Replace tabs with spaces find . -name '*.xml' ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \; --- .../demo/l10n_br_sale_stock_demo.xml | 296 +++++++++--------- l10n_br_sale_stock/views/sale_stock_view.xml | 30 +- 2 files changed, 163 insertions(+), 163 deletions(-) diff --git a/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml index b8de68209e54..7dafa4d2ba39 100644 --- a/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml @@ -1,151 +1,151 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/l10n_br_sale_stock/views/sale_stock_view.xml b/l10n_br_sale_stock/views/sale_stock_view.xml index 5cdc0cc36aef..82e6c6ab92be 100644 --- a/l10n_br_sale_stock/views/sale_stock_view.xml +++ b/l10n_br_sale_stock/views/sale_stock_view.xml @@ -1,20 +1,20 @@ - + - - l10n_br_sale_stock.order.form - sale.order - - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - + + l10n_br_sale_stock.order.form + sale.order + + + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + + {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} + + + - + From b3d511b687703a963ed6463bf66901ee38e4119b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 15 Aug 2016 17:29:15 -0300 Subject: [PATCH 084/241] lighter new style OCA license headers --- l10n_br_sale_stock/__init__.py | 17 +---------------- l10n_br_sale_stock/__openerp__.py | 17 +---------------- l10n_br_sale_stock/models/__init__.py | 17 +---------------- l10n_br_sale_stock/models/procurement.py | 17 +---------------- l10n_br_sale_stock/models/sale.py | 17 +---------------- 5 files changed, 5 insertions(+), 80 deletions(-) diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index 93e3762d5940..e3b369332d03 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -1,21 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################### -# # # Copyright (C) 2013 Raphaël Valyi - Akretion # # Copyright (C) 2013 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 . # -############################################################################### +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index 0742c16659db..cc66a71e17ef 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -1,22 +1,7 @@ # -*- coding: utf-8 -*- -############################################################################### -# # # Copyright (C) 2013 Raphaël Valyi - Akretion # # Copyright (C) 2013 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 . # -############################################################################### +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { 'name': 'Brazilian Localization Sales and Warehouse', diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index ef808c891aec..1aa0aa416947 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -1,21 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################### -# # # Copyright (C) 2015 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 . # -############################################################################### +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import procurement from . import sale diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 4fc4fa54d8a9..c12e821fb34b 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -1,21 +1,6 @@ # -*- coding: utf-8 -*- -############################################################################### -# # # 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 . # -############################################################################### +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py index 221506d66253..92451a2e9ead 100644 --- a/l10n_br_sale_stock/models/sale.py +++ b/l10n_br_sale_stock/models/sale.py @@ -1,22 +1,7 @@ # -*- coding: 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 . # -############################################################################### +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api From fbe8dcec49ae444e41dc882c34f9b6813d2bef4e Mon Sep 17 00:00:00 2001 From: renato Date: Fri, 2 Dec 2016 01:33:20 -0200 Subject: [PATCH 085/241] [MIG] Make modules uninstallable --- l10n_br_sale_stock/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index cc66a71e17ef..77f2499e8ba2 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -24,6 +24,6 @@ 'test': [ # 'test/sale_order_demo.yml' ], - 'installable': True, + 'installable': False, 'auto_install': True, } From db6a599f8f13211d11e66332a4653cf03442b032 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Tue, 6 Dec 2016 04:26:45 -0200 Subject: [PATCH 086/241] [MIG] Rename manifest files --- l10n_br_sale_stock/{__openerp__.py => __manifest__.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename l10n_br_sale_stock/{__openerp__.py => __manifest__.py} (100%) diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__manifest__.py similarity index 100% rename from l10n_br_sale_stock/__openerp__.py rename to l10n_br_sale_stock/__manifest__.py From 5dc97413dd612056f7ae8ee029443b667bf4950c Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 29 May 2020 14:47:49 -0300 Subject: [PATCH 087/241] Update l10n_br_sale_stock --- l10n_br_sale_stock/__init__.py | 5 ++-- l10n_br_sale_stock/__manifest__.py | 15 ++++++------ l10n_br_sale_stock/models/__init__.py | 3 +-- l10n_br_sale_stock/models/procurement.py | 3 +-- l10n_br_sale_stock/models/sale.py | 30 +++++++----------------- 5 files changed, 19 insertions(+), 37 deletions(-) diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index e3b369332d03..ba0004b905d7 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2013 Raphaël Valyi - Akretion # -# Copyright (C) 2013 Renato Lima - Akretion # +# Copyright (C) 2013 Raphaël Valyi - Akretion +# Copyright (C) 2013 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models diff --git a/l10n_br_sale_stock/__manifest__.py b/l10n_br_sale_stock/__manifest__.py index 77f2499e8ba2..e5d75cf29aef 100644 --- a/l10n_br_sale_stock/__manifest__.py +++ b/l10n_br_sale_stock/__manifest__.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2013 Raphaël Valyi - Akretion # -# Copyright (C) 2013 Renato Lima - Akretion # +# Copyright (C) 2013 Raphaël Valyi - Akretion +# Copyright (C) 2013 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { @@ -9,21 +8,21 @@ 'license': 'AGPL-3', 'author': 'Akretion, ,Odoo Community Association (OCA)', 'website': 'http://odoo-brasil.org', - 'version': '8.0.1.0.0', + 'version': '12.0.1.0.0', 'depends': [ 'sale_stock', - 'l10n_br_sale_product', + 'l10n_br_sale', 'l10n_br_stock_account', ], 'data': [ - 'views/sale_stock_view.xml', + # 'views/sale_stock_view.xml', ], 'demo': [ - 'demo/l10n_br_sale_stock_demo.xml' + # 'demo/l10n_br_sale_stock_demo.xml' ], 'test': [ # 'test/sale_order_demo.yml' ], - 'installable': False, + 'installable': True, 'auto_install': True, } diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 1aa0aa416947..f48afe3bc234 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2015 Renato Lima - Akretion # +# Copyright (C) 2015 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import procurement diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index c12e821fb34b..28c00318cf47 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2014 Renato Lima - Akretion # +# Copyright (C) 2014 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import models, api diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py index 92451a2e9ead..c7356fd3c2b4 100644 --- a/l10n_br_sale_stock/models/sale.py +++ b/l10n_br_sale_stock/models/sale.py @@ -1,29 +1,15 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2013 Raphaël Valyi - Akretion # -# Copyright (C) 2014 Renato Lima - Akretion # +# Copyright (C) 2013 Raphaël Valyi - Akretion +# Copyright (C) 2014 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp import models, api +from odoo import api, models class SaleOrder(models.Model): _inherit = 'sale.order' - @api.model - def _prepare_invoice(self, order, lines): - """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(order, lines) - - if order.incoterm: - result['incoterm'] = order.incoterm.id - - return result + @api.multi + def _prepare_procurement_values(self, group_id=False): + values = super()._prepare_procurement_values(group_id) + # TODO copy fiscal operation + return values From 6e61bdabb9e1f9369facfdc8fc0528a5dd1556d9 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 29 May 2020 17:07:29 -0300 Subject: [PATCH 088/241] [ADD] readme files --- l10n_br_sale_stock/readme/CONFIGURE.rst | 0 l10n_br_sale_stock/readme/CONTRIBUTORS.rst | 3 +++ l10n_br_sale_stock/readme/CREDITS.rst | 3 +++ l10n_br_sale_stock/readme/DESCRIPTION.rst | 0 l10n_br_sale_stock/readme/HISTORY.rst | 4 ++++ l10n_br_sale_stock/readme/INSTALL.rst | 0 l10n_br_sale_stock/readme/ROADMAP.rst | 0 l10n_br_sale_stock/readme/USAGE.rst | 0 8 files changed, 10 insertions(+) create mode 100644 l10n_br_sale_stock/readme/CONFIGURE.rst create mode 100644 l10n_br_sale_stock/readme/CONTRIBUTORS.rst create mode 100644 l10n_br_sale_stock/readme/CREDITS.rst create mode 100644 l10n_br_sale_stock/readme/DESCRIPTION.rst create mode 100644 l10n_br_sale_stock/readme/HISTORY.rst create mode 100644 l10n_br_sale_stock/readme/INSTALL.rst create mode 100644 l10n_br_sale_stock/readme/ROADMAP.rst create mode 100644 l10n_br_sale_stock/readme/USAGE.rst diff --git a/l10n_br_sale_stock/readme/CONFIGURE.rst b/l10n_br_sale_stock/readme/CONFIGURE.rst new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/l10n_br_sale_stock/readme/CONTRIBUTORS.rst b/l10n_br_sale_stock/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..a3b1447a1cc6 --- /dev/null +++ b/l10n_br_sale_stock/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Renato Lima +* Raphaël Valyi +* Magno Costa diff --git a/l10n_br_sale_stock/readme/CREDITS.rst b/l10n_br_sale_stock/readme/CREDITS.rst new file mode 100644 index 000000000000..d91cdc201998 --- /dev/null +++ b/l10n_br_sale_stock/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Aketion LTDA diff --git a/l10n_br_sale_stock/readme/DESCRIPTION.rst b/l10n_br_sale_stock/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/l10n_br_sale_stock/readme/HISTORY.rst b/l10n_br_sale_stock/readme/HISTORY.rst new file mode 100644 index 000000000000..783a4a421bd8 --- /dev/null +++ b/l10n_br_sale_stock/readme/HISTORY.rst @@ -0,0 +1,4 @@ +12.0.1.0.0 (2020-05-29) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migration to version 12.0 diff --git a/l10n_br_sale_stock/readme/INSTALL.rst b/l10n_br_sale_stock/readme/INSTALL.rst new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/l10n_br_sale_stock/readme/ROADMAP.rst b/l10n_br_sale_stock/readme/ROADMAP.rst new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/l10n_br_sale_stock/readme/USAGE.rst b/l10n_br_sale_stock/readme/USAGE.rst new file mode 100644 index 000000000000..e69de29bb2d1 From f1d0722872a321b14c409145e35c00a713b331b8 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 29 May 2020 17:09:05 -0300 Subject: [PATCH 089/241] [MIGR] manifest --- l10n_br_sale_stock/__manifest__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/l10n_br_sale_stock/__manifest__.py b/l10n_br_sale_stock/__manifest__.py index e5d75cf29aef..ccb48d44799b 100644 --- a/l10n_br_sale_stock/__manifest__.py +++ b/l10n_br_sale_stock/__manifest__.py @@ -6,8 +6,8 @@ 'name': 'Brazilian Localization Sales and Warehouse', 'category': 'Localisation', 'license': 'AGPL-3', - 'author': 'Akretion, ,Odoo Community Association (OCA)', - 'website': 'http://odoo-brasil.org', + 'author': 'Akretion, Odoo Community Association (OCA)', + 'website': 'http://github.com/OCA/l10n-brazil', 'version': '12.0.1.0.0', 'depends': [ 'sale_stock', @@ -20,9 +20,6 @@ 'demo': [ # 'demo/l10n_br_sale_stock_demo.xml' ], - 'test': [ - # 'test/sale_order_demo.yml' - ], 'installable': True, 'auto_install': True, } From 909d8db6bf90e87462d4e3066b613481cc911975 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 29 May 2020 17:09:31 -0300 Subject: [PATCH 090/241] [MIGR] models --- l10n_br_sale_stock/models/__init__.py | 2 +- l10n_br_sale_stock/models/procurement.py | 32 ++++++++++++------------ l10n_br_sale_stock/models/sale.py | 6 ++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index f48afe3bc234..5b6d4f8e27b3 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -1,5 +1,5 @@ # Copyright (C) 2015 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from . import procurement +# from . import procurement from . import sale diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py index 28c00318cf47..ed239b34256b 100644 --- a/l10n_br_sale_stock/models/procurement.py +++ b/l10n_br_sale_stock/models/procurement.py @@ -1,19 +1,19 @@ # Copyright (C) 2014 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from openerp import models, api - - -class ProcurementOrder(models.Model): - _inherit = "procurement.order" - - @api.model - def _run_move_create(self, procurement): - result = super(ProcurementOrder, self)._run_move_create(procurement) - if procurement.sale_line_id: - result.update({ - 'fiscal_category_id': (procurement - .sale_line_id.fiscal_category_id.id), - 'fiscal_position': procurement.sale_line_id.fiscal_position.id, - }) - return result +# from openerp import models, api +# +# +# class ProcurementOrder(models.Model): +# _inherit = "procurement.order" +# +# @api.model +# def _run_move_create(self, procurement): +# result = super(ProcurementOrder, self)._run_move_create(procurement) +# if procurement.sale_line_id: +# result.update({ +# 'fiscal_category_id': (procurement +# .sale_line_id.fiscal_category_id.id), +# 'fiscal_position': procurement.sale_line_id.fiscal_position.id, +# }) +# return result diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py index c7356fd3c2b4..b2cc6dc2a178 100644 --- a/l10n_br_sale_stock/models/sale.py +++ b/l10n_br_sale_stock/models/sale.py @@ -5,11 +5,11 @@ from odoo import api, models -class SaleOrder(models.Model): - _inherit = 'sale.order' +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' @api.multi def _prepare_procurement_values(self, group_id=False): values = super()._prepare_procurement_values(group_id) - # TODO copy fiscal operation + values.update(self._prepare_br_fiscal_dict()) return values From 0ac93cd9385f2309d5ff768a063f3074f7d2126e Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Fri, 29 May 2020 17:11:08 -0300 Subject: [PATCH 091/241] Rename file --- l10n_br_sale_stock/models/__init__.py | 2 +- l10n_br_sale_stock/models/{sale.py => sale_order_line.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename l10n_br_sale_stock/models/{sale.py => sale_order_line.py} (100%) diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 5b6d4f8e27b3..6df82d19dd84 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -2,4 +2,4 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # from . import procurement -from . import sale +from . import sale_order_line diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale_order_line.py similarity index 100% rename from l10n_br_sale_stock/models/sale.py rename to l10n_br_sale_stock/models/sale_order_line.py From 3f15ed2341c40fdad1c8df964a36e77fb84caea8 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Mon, 1 Jun 2020 16:54:21 -0300 Subject: [PATCH 092/241] [MIGR] l10n_br_stock_account sale order --- l10n_br_sale_stock/models/__init__.py | 2 +- l10n_br_sale_stock/models/sale.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 l10n_br_sale_stock/models/sale.py diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 6df82d19dd84..5b6d4f8e27b3 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -2,4 +2,4 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # from . import procurement -from . import sale_order_line +from . import sale diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py new file mode 100644 index 000000000000..b2cc6dc2a178 --- /dev/null +++ b/l10n_br_sale_stock/models/sale.py @@ -0,0 +1,15 @@ +# Copyright (C) 2013 Raphaël Valyi - Akretion +# Copyright (C) 2014 Renato Lima - Akretion +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, models + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + @api.multi + def _prepare_procurement_values(self, group_id=False): + values = super()._prepare_procurement_values(group_id) + values.update(self._prepare_br_fiscal_dict()) + return values From c9f3840128cf94927841faa2cbdf74167dec6e35 Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sun, 14 Jun 2020 19:22:12 -0300 Subject: [PATCH 093/241] [MIGR] l10n_br_sale_stock cleanup --- l10n_br_sale_stock/__manifest__.py | 8 ++------ l10n_br_sale_stock/models/__init__.py | 3 +-- l10n_br_sale_stock/models/sale.py | 15 -------------- .../security/ir.model.access.csv | 7 ------- l10n_br_sale_stock/views/sale_stock_view.xml | 20 ++----------------- 5 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 l10n_br_sale_stock/models/sale.py delete mode 100644 l10n_br_sale_stock/security/ir.model.access.csv diff --git a/l10n_br_sale_stock/__manifest__.py b/l10n_br_sale_stock/__manifest__.py index ccb48d44799b..b22c7dee092b 100644 --- a/l10n_br_sale_stock/__manifest__.py +++ b/l10n_br_sale_stock/__manifest__.py @@ -14,12 +14,8 @@ 'l10n_br_sale', 'l10n_br_stock_account', ], - 'data': [ - # 'views/sale_stock_view.xml', - ], - 'demo': [ - # 'demo/l10n_br_sale_stock_demo.xml' - ], + 'data': [], + 'demo': [], 'installable': True, 'auto_install': True, } diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 5b6d4f8e27b3..d5b088f1356c 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -1,5 +1,4 @@ # Copyright (C) 2015 Renato Lima - Akretion # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -# from . import procurement -from . import sale +from . import sale_order_line diff --git a/l10n_br_sale_stock/models/sale.py b/l10n_br_sale_stock/models/sale.py deleted file mode 100644 index b2cc6dc2a178..000000000000 --- a/l10n_br_sale_stock/models/sale.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2013 Raphaël Valyi - Akretion -# Copyright (C) 2014 Renato Lima - Akretion -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -from odoo import api, models - - -class SaleOrderLine(models.Model): - _inherit = 'sale.order.line' - - @api.multi - def _prepare_procurement_values(self, group_id=False): - values = super()._prepare_procurement_values(group_id) - values.update(self._prepare_br_fiscal_dict()) - return values diff --git a/l10n_br_sale_stock/security/ir.model.access.csv b/l10n_br_sale_stock/security/ir.model.access.csv deleted file mode 100644 index c8aab40ac7aa..000000000000 --- a/l10n_br_sale_stock/security/ir.model.access.csv +++ /dev/null @@ -1,7 +0,0 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"l10n_br_account_product_cfop","l10n_br_account_product.cfop","l10n_br_account_product.model_l10n_br_account_product_cfop","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_sale_template_salesman","l10n_br_tax.definition.sale.template","l10n_br_account_product.model_l10n_br_tax_definition_sale_template","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_purchase_template_salesman","l10n_br_tax.definition.purchase.template","l10n_br_account_product.model_l10n_br_tax_definition_purchase_template","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_sale_salesman","l10n_br_tax.definition.sale","l10n_br_account_product.model_l10n_br_tax_definition_sale","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_purchase_salesman","l10n_br_tax.definition.purchase","l10n_br_account_product.model_l10n_br_tax_definition_purchase","base.group_sale_salesman",1,0,0,0 -"l10n_br_tax_definition_company_product_salesman","l10n_br_tax.definition.company.product","l10n_br_account_product.model_l10n_br_tax_definition_company_product","base.group_sale_salesman",1,0,0,0 diff --git a/l10n_br_sale_stock/views/sale_stock_view.xml b/l10n_br_sale_stock/views/sale_stock_view.xml index 82e6c6ab92be..1d77a6b31998 100644 --- a/l10n_br_sale_stock/views/sale_stock_view.xml +++ b/l10n_br_sale_stock/views/sale_stock_view.xml @@ -1,20 +1,4 @@ - - + - - l10n_br_sale_stock.order.form - sale.order - - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - {'parent_fiscal_category_id': parent.fiscal_category_id, 'company_id': parent.company_id, 'parent_fiscal_position': False, 'partner_invoice_id': parent.partner_invoice_id} - - - - - - + From ec18bf302f6e6318d25c86bf07354c9fe7f5298d Mon Sep 17 00:00:00 2001 From: Renato Lima Date: Sun, 23 Aug 2020 22:14:33 -0300 Subject: [PATCH 094/241] [MIGR] demo data --- l10n_br_sale_stock/__manifest__.py | 4 +- .../demo/l10n_br_sale_stock_demo.xml | 261 ++++++++---------- 2 files changed, 114 insertions(+), 151 deletions(-) diff --git a/l10n_br_sale_stock/__manifest__.py b/l10n_br_sale_stock/__manifest__.py index b22c7dee092b..d5090d98c9cb 100644 --- a/l10n_br_sale_stock/__manifest__.py +++ b/l10n_br_sale_stock/__manifest__.py @@ -15,7 +15,9 @@ 'l10n_br_stock_account', ], 'data': [], - 'demo': [], + 'demo': [ + 'demo/l10n_br_sale_stock_demo.xml', + ], 'installable': True, 'auto_install': True, } diff --git a/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml b/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml index 7dafa4d2ba39..91cb2d501d57 100644 --- a/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml +++ b/l10n_br_sale_stock/demo/l10n_br_sale_stock_demo.xml @@ -1,151 +1,112 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 311b92c4363c11bdd4b2168379b4cb37ecb93dcb Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Wed, 23 Sep 2020 15:42:04 -0300 Subject: [PATCH 095/241] [FIX] Deprecated yml --- l10n_br_sale_stock/test/sale_order_demo.yml | 96 --------------------- 1 file changed, 96 deletions(-) delete mode 100644 l10n_br_sale_stock/test/sale_order_demo.yml diff --git a/l10n_br_sale_stock/test/sale_order_demo.yml b/l10n_br_sale_stock/test/sale_order_demo.yml deleted file mode 100644 index d37c4930e4bb..000000000000 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ /dev/null @@ -1,96 +0,0 @@ -- - I prepare tunneling extra args in the context -- - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'company_id': ref('base.main_company'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_akretion')}) -- - In order to test fiscal parameters of Sale Order inside the same state, I create sale order -- - !record {model: sale.order, id: sale_order_test1, view: l10n_br_sale.l10n_br_sale_order_form}: - partner_id: l10n_br_base.res_partner_akretion - fiscal_category_id: l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12 - order_line: - - product_id: product.product_product_10 - product_uom_qty: 8 -- - I verify that the onchange was correctly triggered -- - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test1, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - order_line[0].product_id.id == ref('product.product_product_10') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_internal_demo') - - len(order_line[0].tax_id) == 3 - - order_line[0].product_uom_qty == 8 - - order_line[0].product_uom.id == ref('product.product_uom_unit') -- - I prepare tunneling extra args in the context -- - !python {model: sale.order}: | - context.update({'fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'company_id': ref('base.main_company'), 'parent_fiscal_category_id': ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12'), 'partner_invoice_id': ref('l10n_br_base.res_partner_address_ak2')}) -- - I create another sale order -- - !record {model: sale.order, id: sale_order_test2, view: l10n_br_sale.l10n_br_sale_order_form}: - partner_id: l10n_br_base.res_partner_address_ak2 - fiscal_category_id: l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12 - fiscal_position: l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo - order_policy: picking - order_line: - - product_id: product.product_product_19 - product_uom: product.product_uom_unit - product_uom_qty: 16 -- - I verify that the onchange was correctly triggered -- - !assert {model: sale.order, id: l10n_br_sale_stock.sale_order_test2, string: The onchange function of product was not correctly triggered}: - - fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - order_line[0].product_id.id == ref('product.product_product_19') - - order_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - - order_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - - len(order_line[0].tax_id) == 3 - - order_line[0].product_uom.id == ref('product.product_uom_unit') - - order_line[0].product_uom_qty == 16 -- - I confirm order_test2 -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_test2} -- - I check the details of delivery order after confirmed quotation. -- - !python {model: sale.order}: | - sale_order = self.browse(cr, uid, ref("sale_order_test2")) - assert sale_order.picking_ids, "Delivery order is not created." - for picking in sale_order.picking_ids: - assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state." - assert picking.picking_type_id.code == 'outgoing',"Shipment should be Outgoing." - assert picking.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert picking.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') -- - I create Invoice from Delivery Order. -- - !python {model: stock.invoice.onshipping}: | - sale = self.pool.get('sale.order') - sale_order = sale.browse(cr, uid, ref("sale_order_test2")) - ship_ids = [picking.id for picking in sale_order.picking_ids if picking.invoice_state == '2binvoiced'] - if ship_ids: - wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')}, - {'active_ids': ship_ids, 'active_model': 'stock.picking'}) - self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]}) -- - I check the invoice details after dispatched delivery. -- - !python {model: sale.order}: | - order = self.browse(cr, uid, ref("sale_order_test2")) - assert order.invoice_ids, "Invoice is not created." - journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)]) - for invoice in order.invoice_ids: - assert invoice.type == 'out_invoice',"Invoice should be Customer Invoice." - assert invoice.document_serie_id.id == ref('l10n_br_account_product.l10n_br_document_serie_1_product') - assert invoice.fiscal_document_id.id == ref('l10n_br_account_product.fiscal_document_55') - assert invoice.fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert invoice.fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') - assert invoice.invoice_line[0].fiscal_category_id.id == ref('l10n_br_account_product.fc_78df616ab31e95ee46c6a519a2ce9e12') - assert invoice.invoice_line[0].fiscal_position.id == ref('l10n_br_account_product.fp_78df616ab31e95ee46c6a519a2ce9e12_external_icms12_demo') From f27347f3fa908f4b3a9e79b49bff2c7a4f06b21f Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Wed, 23 Sep 2020 15:48:36 -0300 Subject: [PATCH 096/241] [FIX] Typo --- l10n_br_sale_stock/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/__manifest__.py b/l10n_br_sale_stock/__manifest__.py index d5090d98c9cb..1e60117db6e7 100644 --- a/l10n_br_sale_stock/__manifest__.py +++ b/l10n_br_sale_stock/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Brazilian Localization Sales and Warehouse', - 'category': 'Localisation', + 'category': 'Localization', 'license': 'AGPL-3', 'author': 'Akretion, Odoo Community Association (OCA)', 'website': 'http://github.com/OCA/l10n-brazil', From 3d37b15d9ba2f5793e214513d6f8d2d6a727a444 Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Thu, 24 Sep 2020 15:48:42 -0300 Subject: [PATCH 097/241] [ADD] Freight value from sale order line to stock move --- l10n_br_sale_stock/models/__init__.py | 1 + l10n_br_sale_stock/models/stock_rule.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 l10n_br_sale_stock/models/stock_rule.py diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index d5b088f1356c..899b27e89283 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import sale_order_line +from . import stock_rule diff --git a/l10n_br_sale_stock/models/stock_rule.py b/l10n_br_sale_stock/models/stock_rule.py new file mode 100644 index 000000000000..8e4e188db521 --- /dev/null +++ b/l10n_br_sale_stock/models/stock_rule.py @@ -0,0 +1,13 @@ +# Copyright (C) 2020 - KMEE +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, models + + +class StockRule(models.Model): + """ A rule describe what a procurement should do; produce, buy, move, ... """ + _inherit = 'stock.rule' + + def _get_custom_move_fields(self): + res = super(StockRule, self)._get_custom_move_fields() + return res + ['freight_value'] From 9e5a06629fbdb3bd05636cc4b93fa47b0666692b Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Thu, 24 Sep 2020 16:30:50 -0300 Subject: [PATCH 098/241] [ADD] Tax fields, insurance and other_costs from sale order line to stock move --- l10n_br_sale_stock/models/stock_rule.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/models/stock_rule.py b/l10n_br_sale_stock/models/stock_rule.py index 8e4e188db521..dd9b1c9b2121 100644 --- a/l10n_br_sale_stock/models/stock_rule.py +++ b/l10n_br_sale_stock/models/stock_rule.py @@ -5,9 +5,24 @@ class StockRule(models.Model): - """ A rule describe what a procurement should do; produce, buy, move, ... """ + """ A rule describe what a procurement should do; produce, buy, move, + ... """ _inherit = 'stock.rule' def _get_custom_move_fields(self): res = super(StockRule, self)._get_custom_move_fields() - return res + ['freight_value'] + res += [ + 'freight_value', + 'insurance_value', + 'other_costs_value', + 'cofins_tax_id', + 'cofins_cst_id', + 'pis_tax_id', + 'pis_cst_id', + 'ipi_tax_id', + 'ipi_cst_id', + 'icmssn_tax_id', + 'icms_tax_id', + 'icms_cst_id', + ] + return res From 7f1ae731ee0bc63bd0451a05e2f15aea2c327e40 Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Thu, 24 Sep 2020 16:42:58 -0300 Subject: [PATCH 099/241] [ADD] ALL fields from sale order line to stock move --- l10n_br_sale_stock/models/stock_rule.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/l10n_br_sale_stock/models/stock_rule.py b/l10n_br_sale_stock/models/stock_rule.py index dd9b1c9b2121..c6cdf70b6936 100644 --- a/l10n_br_sale_stock/models/stock_rule.py +++ b/l10n_br_sale_stock/models/stock_rule.py @@ -11,18 +11,7 @@ class StockRule(models.Model): def _get_custom_move_fields(self): res = super(StockRule, self)._get_custom_move_fields() - res += [ - 'freight_value', - 'insurance_value', - 'other_costs_value', - 'cofins_tax_id', - 'cofins_cst_id', - 'pis_tax_id', - 'pis_cst_id', - 'ipi_tax_id', - 'ipi_cst_id', - 'icmssn_tax_id', - 'icms_tax_id', - 'icms_cst_id', - ] + fiscal_fields = [key for key in self.env[ + 'l10n_br_fiscal.document.line.mixin']._fields.keys()] + res += fiscal_fields return res From 0de269211fd39b2dadc0ba6792853b43784bcc5d Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Fri, 25 Sep 2020 15:40:05 -0300 Subject: [PATCH 100/241] [ADD] Tests --- l10n_br_sale_stock/tests/__init__.py | 2 + l10n_br_sale_stock/tests/test_sale_stock.py | 72 +++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 l10n_br_sale_stock/tests/__init__.py create mode 100644 l10n_br_sale_stock/tests/test_sale_stock.py diff --git a/l10n_br_sale_stock/tests/__init__.py b/l10n_br_sale_stock/tests/__init__.py new file mode 100644 index 000000000000..4a0417604127 --- /dev/null +++ b/l10n_br_sale_stock/tests/__init__.py @@ -0,0 +1,2 @@ + +from . import test_sale_stock diff --git a/l10n_br_sale_stock/tests/test_sale_stock.py b/l10n_br_sale_stock/tests/test_sale_stock.py new file mode 100644 index 000000000000..dc1c38f22e2f --- /dev/null +++ b/l10n_br_sale_stock/tests/test_sale_stock.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.exceptions import UserError +from odoo.tests import tagged +from odoo.tests.common import TransactionCase + + +@tagged('post_install', '-at_install') +class TestSaleStock(TransactionCase): + def test_02_sale_stock_return(self): + """ + Test a SO with a product invoiced on delivery. Deliver and invoice + the SO, then do a return + of the picking. Check that a refund invoice is well generated. + """ + # intial so + self.partner = self.env.ref('l10n_br_base.res_partner_address_ak2') + self.product = self.env.ref('product.product_delivery_01') + so_vals = { + 'partner_id': self.partner.id, + 'partner_invoice_id': self.partner.id, + 'partner_shipping_id': self.partner.id, + 'order_line': [(0, 0, { + 'name': self.product.name, + 'product_id': self.product.id, + 'product_uom_qty': 3.0, + 'product_uom': self.product.uom_id.id, + 'price_unit': self.product.list_price + })], + 'pricelist_id': self.env.ref('product.list0').id, + } + self.so = self.env['sale.order'].create(so_vals) + + # confirm our standard so, check the picking + self.so.action_confirm() + self.assertTrue(self.so.picking_ids, + 'Sale Stock: no picking created for "invoice on ' + 'delivery" storable products') + + # set stock.picking to be invoiced + self.assertTrue(len(self.so.picking_ids) == 1, + 'More than one stock picking for sale.order') + self.so.picking_ids.set_to_be_invoiced() + + # validate stock.picking + stock_picking = self.so.picking_ids + self.env['stock.immediate.transfer'].create( + {'pick_ids': [(4, stock_picking.id)]}).process() + + # compare sale.order.line with stock.move + stock_move = stock_picking.move_lines + sale_order_line = self.so.order_line + + sm_fields = [key for key in self.env['stock.move']._fields.keys()] + sol_fields = [key for key in self.env[ + 'sale.order.line']._fields.keys()] + + skipped_fields = [ + 'id', + 'display_name', + 'state', + ] + common_fields = list(set(sm_fields) & set(sol_fields) - set( + skipped_fields)) + + for field in common_fields: + self.assertEqual(stock_move[field], + sale_order_line[field], + 'Field %s failed to transfer from ' + 'sale.order.line to stock.move' % field) + From 817fb0b699923fc2cc12c15b27bb99a8560f983c Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Tue, 29 Sep 2020 16:00:41 -0300 Subject: [PATCH 101/241] [ADD] Author + remove coding utf-8 --- l10n_br_sale_stock/tests/test_sale_stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10n_br_sale_stock/tests/test_sale_stock.py b/l10n_br_sale_stock/tests/test_sale_stock.py index dc1c38f22e2f..289942f43573 100644 --- a/l10n_br_sale_stock/tests/test_sale_stock.py +++ b/l10n_br_sale_stock/tests/test_sale_stock.py @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. +# Copyright 2020 KMEE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.exceptions import UserError from odoo.tests import tagged From 11f93aa6c52fb04f582ad9394de67c54116ad454 Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Tue, 29 Sep 2020 16:01:31 -0300 Subject: [PATCH 102/241] [RMV] Unused view --- l10n_br_sale_stock/views/sale_stock_view.xml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 l10n_br_sale_stock/views/sale_stock_view.xml diff --git a/l10n_br_sale_stock/views/sale_stock_view.xml b/l10n_br_sale_stock/views/sale_stock_view.xml deleted file mode 100644 index 1d77a6b31998..000000000000 --- a/l10n_br_sale_stock/views/sale_stock_view.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - From 6376dd5b4e6b3fe0c8440eecd2a00bf8fd436434 Mon Sep 17 00:00:00 2001 From: Diego Paradeda Date: Tue, 29 Sep 2020 16:04:19 -0300 Subject: [PATCH 103/241] [FIX] Flake 8 --- l10n_br_sale_stock/models/stock_rule.py | 2 +- l10n_br_sale_stock/tests/test_sale_stock.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/l10n_br_sale_stock/models/stock_rule.py b/l10n_br_sale_stock/models/stock_rule.py index c6cdf70b6936..8b3c06ceae89 100644 --- a/l10n_br_sale_stock/models/stock_rule.py +++ b/l10n_br_sale_stock/models/stock_rule.py @@ -1,7 +1,7 @@ # Copyright (C) 2020 - KMEE # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import api, models +from odoo import models class StockRule(models.Model): diff --git a/l10n_br_sale_stock/tests/test_sale_stock.py b/l10n_br_sale_stock/tests/test_sale_stock.py index 289942f43573..7e3c327a85f4 100644 --- a/l10n_br_sale_stock/tests/test_sale_stock.py +++ b/l10n_br_sale_stock/tests/test_sale_stock.py @@ -1,7 +1,6 @@ # Copyright 2020 KMEE # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.exceptions import UserError from odoo.tests import tagged from odoo.tests.common import TransactionCase @@ -39,8 +38,8 @@ def test_02_sale_stock_return(self): 'delivery" storable products') # set stock.picking to be invoiced - self.assertTrue(len(self.so.picking_ids) == 1, - 'More than one stock picking for sale.order') + self.assertTrue(len(self.so.picking_ids) == 1, 'More than one stock ' + 'picking for sale.order') self.so.picking_ids.set_to_be_invoiced() # validate stock.picking @@ -69,4 +68,3 @@ def test_02_sale_stock_return(self): sale_order_line[field], 'Field %s failed to transfer from ' 'sale.order.line to stock.move' % field) - From e8693dc98d28371925ec91ac281491bc99c8d3e8 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Wed, 4 Nov 2020 15:34:22 -0300 Subject: [PATCH 104/241] [ADD] Creation of stock_picking with correct fiscal settings --- l10n_br_sale_stock/models/__init__.py | 1 + l10n_br_sale_stock/models/sale_order_line.py | 6 ++++-- l10n_br_sale_stock/models/stock_move.py | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 l10n_br_sale_stock/models/stock_move.py diff --git a/l10n_br_sale_stock/models/__init__.py b/l10n_br_sale_stock/models/__init__.py index 899b27e89283..d2ca70b4a44a 100644 --- a/l10n_br_sale_stock/models/__init__.py +++ b/l10n_br_sale_stock/models/__init__.py @@ -3,3 +3,4 @@ from . import sale_order_line from . import stock_rule +from . import stock_move diff --git a/l10n_br_sale_stock/models/sale_order_line.py b/l10n_br_sale_stock/models/sale_order_line.py index b2cc6dc2a178..46923226fbaa 100644 --- a/l10n_br_sale_stock/models/sale_order_line.py +++ b/l10n_br_sale_stock/models/sale_order_line.py @@ -10,6 +10,8 @@ class SaleOrderLine(models.Model): @api.multi def _prepare_procurement_values(self, group_id=False): - values = super()._prepare_procurement_values(group_id) - values.update(self._prepare_br_fiscal_dict()) + values = self._prepare_br_fiscal_dict() + values.update(super()._prepare_procurement_values(group_id)) + values.update({ + 'invoice_state': self.order_id.fiscal_operation_id.invoice_state}) return values diff --git a/l10n_br_sale_stock/models/stock_move.py b/l10n_br_sale_stock/models/stock_move.py new file mode 100644 index 000000000000..e418f65ece0b --- /dev/null +++ b/l10n_br_sale_stock/models/stock_move.py @@ -0,0 +1,13 @@ +# Copyright (C) 2020 Gabriel Cardoso de Faria +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, models + + +class StockMove(models.Model): + _inherit = 'stock.move' + + def _get_new_picking_values(self): + values = super()._get_new_picking_values() + values.update(self.sale_line_id.order_id._prepare_br_fiscal_dict()) + return values From 1bc0903dc8486306549667901da58839eadd3225 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Thu, 5 Nov 2020 15:57:11 -0300 Subject: [PATCH 105/241] [ADD] Link invoices from stock.picking to sale.order --- l10n_br_sale_stock/__init__.py | 1 + l10n_br_sale_stock/models/sale_order_line.py | 1 + l10n_br_sale_stock/wizards/__init__.py | 1 + .../wizards/stock_invoice_onshipping.py | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 l10n_br_sale_stock/wizards/__init__.py create mode 100644 l10n_br_sale_stock/wizards/stock_invoice_onshipping.py diff --git a/l10n_br_sale_stock/__init__.py b/l10n_br_sale_stock/__init__.py index ba0004b905d7..371b71bcf51a 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -3,3 +3,4 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from . import models +from . import wizards diff --git a/l10n_br_sale_stock/models/sale_order_line.py b/l10n_br_sale_stock/models/sale_order_line.py index 46923226fbaa..2e9695c4a37d 100644 --- a/l10n_br_sale_stock/models/sale_order_line.py +++ b/l10n_br_sale_stock/models/sale_order_line.py @@ -1,5 +1,6 @@ # Copyright (C) 2013 Raphaël Valyi - Akretion # Copyright (C) 2014 Renato Lima - Akretion +# Copyright (C) 2020 Gabriel Cardoso de Faria - KMEE # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import api, models diff --git a/l10n_br_sale_stock/wizards/__init__.py b/l10n_br_sale_stock/wizards/__init__.py new file mode 100644 index 000000000000..87b9317d657c --- /dev/null +++ b/l10n_br_sale_stock/wizards/__init__.py @@ -0,0 +1 @@ +from . import stock_invoice_onshipping diff --git a/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py new file mode 100644 index 000000000000..9981e69e477e --- /dev/null +++ b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py @@ -0,0 +1,18 @@ +# Copyright 2020 KMEE +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models, _ + + +class StockInvoiceOnshipping(models.TransientModel): + + _inherit = 'stock.invoice.onshipping' + + @api.multi + def _get_invoice_line_values(self, moves, invoice_values, invoice): + move = fields.first(moves) + values = super()._get_invoice_line_values( + moves, invoice_values, invoice + ) + values['sale_line_ids'] = [(6, 0, move.sale_line_id.ids)] + return values From fa34db5fcd2951b2e4a06b52d5f0d7ca24348dc9 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Wed, 11 Nov 2020 10:23:23 -0300 Subject: [PATCH 106/241] [ADD] Get price from sale_order_line --- l10n_br_sale_stock/models/stock_move.py | 7 +++++++ .../wizards/stock_invoice_onshipping.py | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/l10n_br_sale_stock/models/stock_move.py b/l10n_br_sale_stock/models/stock_move.py index e418f65ece0b..299167e19f00 100644 --- a/l10n_br_sale_stock/models/stock_move.py +++ b/l10n_br_sale_stock/models/stock_move.py @@ -7,6 +7,13 @@ class StockMove(models.Model): _inherit = 'stock.move' + @api.multi + def _get_price_unit_invoice(self, inv_type, partner, qty=1): + result = super()._get_price_unit_invoice(inv_type, partner, qty) + if self.sale_line_id.price_unit != result: + return self.sale_line_id.price_unit + return result + def _get_new_picking_values(self): values = super()._get_new_picking_values() values.update(self.sale_line_id.order_id._prepare_br_fiscal_dict()) diff --git a/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py index 9981e69e477e..da44a17fc61f 100644 --- a/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py +++ b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py @@ -8,6 +8,22 @@ class StockInvoiceOnshipping(models.TransientModel): _inherit = 'stock.invoice.onshipping' + @api.multi + def _simulate_invoice_line_onchange(self, values): + """ + Simulate onchange for invoice line + :param values: dict + :return: dict + """ + price_unit = values.pop('price_unit') + new_values = super()._simulate_invoice_line_onchange(values.copy()) + line = self.env['account.invoice.line'].new(new_values.copy()) + line.price_unit = price_unit + line._compute_price() + new_values.update(line._convert_to_write(line._cache)) + values.update(new_values) + return values + @api.multi def _get_invoice_line_values(self, moves, invoice_values, invoice): move = fields.first(moves) From f114832e9a74cf5775776e590db13ebc45f4c783 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Fri, 13 Nov 2020 10:04:03 -0300 Subject: [PATCH 107/241] [FIX] Flake8 --- l10n_br_sale_stock/wizards/stock_invoice_onshipping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py index da44a17fc61f..b6750d7207ce 100644 --- a/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py +++ b/l10n_br_sale_stock/wizards/stock_invoice_onshipping.py @@ -1,7 +1,7 @@ # Copyright 2020 KMEE # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ +from odoo import api, fields, models class StockInvoiceOnshipping(models.TransientModel): From e6f418e919136d76f644d46dfab5dc9c3fc17ad3 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Fri, 13 Nov 2020 10:18:46 -0300 Subject: [PATCH 108/241] [FIX] Test --- l10n_br_sale_stock/tests/test_sale_stock.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/l10n_br_sale_stock/tests/test_sale_stock.py b/l10n_br_sale_stock/tests/test_sale_stock.py index 7e3c327a85f4..c0a8bf1370c7 100644 --- a/l10n_br_sale_stock/tests/test_sale_stock.py +++ b/l10n_br_sale_stock/tests/test_sale_stock.py @@ -31,6 +31,9 @@ def test_02_sale_stock_return(self): } self.so = self.env['sale.order'].create(so_vals) + for line in self.so.order_line: + line._onchange_product_id_fiscal() + # confirm our standard so, check the picking self.so.action_confirm() self.assertTrue(self.so.picking_ids, From 6af49d1546f966886affbc5b53a8226bc89028ab Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Mon, 16 Nov 2020 09:15:42 -0300 Subject: [PATCH 109/241] [REM] File procurement.py --- l10n_br_sale_stock/models/procurement.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 l10n_br_sale_stock/models/procurement.py diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py deleted file mode 100644 index ed239b34256b..000000000000 --- a/l10n_br_sale_stock/models/procurement.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (C) 2014 Renato Lima - Akretion -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - -# from openerp import models, api -# -# -# class ProcurementOrder(models.Model): -# _inherit = "procurement.order" -# -# @api.model -# def _run_move_create(self, procurement): -# result = super(ProcurementOrder, self)._run_move_create(procurement) -# if procurement.sale_line_id: -# result.update({ -# 'fiscal_category_id': (procurement -# .sale_line_id.fiscal_category_id.id), -# 'fiscal_position': procurement.sale_line_id.fiscal_position.id, -# }) -# return result From f48b779885d1ecb319342452937f19c27b85fa61 Mon Sep 17 00:00:00 2001 From: Gabriel Cardoso de Faria Date: Mon, 16 Nov 2020 10:14:52 -0300 Subject: [PATCH 110/241] [ADD] Contributor --- l10n_br_sale_stock/README.rst | 97 ++-- l10n_br_sale_stock/readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 442 ++++++++++++++++++ 3 files changed, 498 insertions(+), 42 deletions(-) create mode 100644 l10n_br_sale_stock/static/description/index.html diff --git a/l10n_br_sale_stock/README.rst b/l10n_br_sale_stock/README.rst index 07ab77df6f3d..2a9987b139ee 100644 --- a/l10n_br_sale_stock/README.rst +++ b/l10n_br_sale_stock/README.rst @@ -1,77 +1,90 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ========================================== -Módulo Informações Contabéis para Produtos +Brazilian Localization Sales and Warehouse ========================================== -This module was written to extend the functionality of ... to support ... -and allow you to ... - -Installation -============ - -To install this module, you need to: - -* do this ... - -Configuration -============= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -To configure this module, you need to: +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-brazil/tree/12.0/l10n_br_sale_stock + :alt: OCA/l10n-brazil +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-brazil-12-0/l10n-brazil-12-0-l10n_br_sale_stock + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/124/12.0 + :alt: Try me on Runbot -* go to ... +|badge1| |badge2| |badge3| |badge4| |badge5| -Usage -===== -To use this module, you need to: +**Table of contents** -* go to ... +.. contents:: + :local: -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} +Changelog +========= +12.0.1.0.0 (2020-05-29) +~~~~~~~~~~~~~~~~~~~~~~~ -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example - -Known issues / Roadmap -====================== - -TODO +* [MIG] Migration to version 12.0 Bug Tracker =========== Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Akretion + Contributors ------------- +~~~~~~~~~~~~ * Renato Lima -* Raphaël Valyi +* Raphaël Valyi +* Magno Costa +* Gabriel Cardoso de Faria -Maintainer ----------- +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Aketion LTDA + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. +This module is part of the `OCA/l10n-brazil `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_br_sale_stock/readme/CONTRIBUTORS.rst b/l10n_br_sale_stock/readme/CONTRIBUTORS.rst index a3b1447a1cc6..991d50b77a8c 100644 --- a/l10n_br_sale_stock/readme/CONTRIBUTORS.rst +++ b/l10n_br_sale_stock/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Renato Lima * Raphaël Valyi * Magno Costa +* Gabriel Cardoso de Faria diff --git a/l10n_br_sale_stock/static/description/index.html b/l10n_br_sale_stock/static/description/index.html new file mode 100644 index 000000000000..375556b0e7ad --- /dev/null +++ b/l10n_br_sale_stock/static/description/index.html @@ -0,0 +1,442 @@ + + + + + + +Brazilian Localization Sales and Warehouse + + + +
+

Brazilian Localization Sales and Warehouse

+ + +

Beta License: AGPL-3 OCA/l10n-brazil Translate me on Weblate Try me on Runbot

+

Table of contents

+ +
+

Changelog

+
+

12.0.1.0.0 (2020-05-29)

+
    +
  • [MIG] Migration to version 12.0
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Aketion LTDA
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-brazil project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From c63ba6dc912180741de03013334d235cf04af855 Mon Sep 17 00:00:00 2001 From: Marcel Savegnago Date: Mon, 16 Nov 2020 14:34:29 -0300 Subject: [PATCH 111/241] [FIX] Readme --- l10n_br_sale_stock/README.rst | 23 ++++++++ l10n_br_sale_stock/readme/CONFIGURE.rst | 1 + l10n_br_sale_stock/readme/DESCRIPTION.rst | 4 ++ l10n_br_sale_stock/readme/HISTORY.rst | 5 ++ l10n_br_sale_stock/readme/INSTALL.rst | 5 ++ .../static/description/index.html | 59 +++++++++++++------ 6 files changed, 80 insertions(+), 17 deletions(-) diff --git a/l10n_br_sale_stock/README.rst b/l10n_br_sale_stock/README.rst index 2a9987b139ee..c5526e241235 100644 --- a/l10n_br_sale_stock/README.rst +++ b/l10n_br_sale_stock/README.rst @@ -25,12 +25,30 @@ Brazilian Localization Sales and Warehouse |badge1| |badge2| |badge3| |badge4| |badge5| +This module extends the standard Odoo sale stock module for Brazil, specially when selling products with NFe's. + +It deals with the propagation of the fiscal operation, fiscal comment and incoterms to invoice created direct from sale +order or picking. **Table of contents** .. contents:: :local: +Installation +============ + +This module depends on: + +* sale_stock +* l10n_br_sale +* l10n_br_stock_account + +Configuration +============= + +No configuration required. + Changelog ========= @@ -39,6 +57,11 @@ Changelog * [MIG] Migration to version 12.0 +10.0.1.0.0 (2019-09-13) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migration to version 10.0 + Bug Tracker =========== diff --git a/l10n_br_sale_stock/readme/CONFIGURE.rst b/l10n_br_sale_stock/readme/CONFIGURE.rst index e69de29bb2d1..e7dc235973ab 100644 --- a/l10n_br_sale_stock/readme/CONFIGURE.rst +++ b/l10n_br_sale_stock/readme/CONFIGURE.rst @@ -0,0 +1 @@ +No configuration required. diff --git a/l10n_br_sale_stock/readme/DESCRIPTION.rst b/l10n_br_sale_stock/readme/DESCRIPTION.rst index e69de29bb2d1..848829430b9b 100644 --- a/l10n_br_sale_stock/readme/DESCRIPTION.rst +++ b/l10n_br_sale_stock/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module extends the standard Odoo sale stock module for Brazil, specially when selling products with NFe's. + +It deals with the propagation of the fiscal operation, fiscal comment and incoterms to invoice created direct from sale +order or picking. diff --git a/l10n_br_sale_stock/readme/HISTORY.rst b/l10n_br_sale_stock/readme/HISTORY.rst index 783a4a421bd8..7423e2969d8e 100644 --- a/l10n_br_sale_stock/readme/HISTORY.rst +++ b/l10n_br_sale_stock/readme/HISTORY.rst @@ -2,3 +2,8 @@ ~~~~~~~~~~~~~~~~~~~~~~~ * [MIG] Migration to version 12.0 + +10.0.1.0.0 (2019-09-13) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migration to version 10.0 diff --git a/l10n_br_sale_stock/readme/INSTALL.rst b/l10n_br_sale_stock/readme/INSTALL.rst index e69de29bb2d1..0ce3db863a91 100644 --- a/l10n_br_sale_stock/readme/INSTALL.rst +++ b/l10n_br_sale_stock/readme/INSTALL.rst @@ -0,0 +1,5 @@ +This module depends on: + +* sale_stock +* l10n_br_sale +* l10n_br_stock_account diff --git a/l10n_br_sale_stock/static/description/index.html b/l10n_br_sale_stock/static/description/index.html index 375556b0e7ad..226199c7a8fb 100644 --- a/l10n_br_sale_stock/static/description/index.html +++ b/l10n_br_sale_stock/static/description/index.html @@ -3,7 +3,7 @@ - + Brazilian Localization Sales and Warehouse