diff --git a/README.md b/README.md index 8d79095ebc77..e33b5dc67033 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ addon | version | summary [l10n_br_purchase](l10n_br_purchase/) | 8.0.1.0.0 | Brazilian Localization Purchase [l10n_br_sale](l10n_br_sale/) | 8.0.1.0.0 | Brazilian Localization Sale [l10n_br_sale_product](l10n_br_sale_product/) | 8.0.1.0.0 | Brazilian Localization Sale Product +[l10n_br_sale_stock](l10n_br_sale_stock/) | 8.0.1.0.0 | Brazilian Localization Sales and Warehouse [l10n_br_stock](l10n_br_stock/) | 8.0.1.0.0 | Brazilian Localization Warehouse [l10n_br_stock_account](l10n_br_stock_account/) | 8.0.1.0.0 | Brazilian Localization WMS Accounting [l10n_br_zip](l10n_br_zip/) | 8.0.1.0.0 | Brazilian Localisation ZIP Codes @@ -103,6 +104,5 @@ addon | version | summary [l10n_br_delivery](l10n_br_delivery/) | 7.0 (unported) | Brazilian Localization Delivery [l10n_br_hr_timesheet_invoice](l10n_br_hr_timesheet_invoice/) | 1.0 (unported) | Brazilian Invoice on Timesheets [l10n_br_sale_service](l10n_br_sale_service/) | 7.0 (unported) | Brazilian Localization Sale Service -[l10n_br_sale_stock](l10n_br_sale_stock/) | 7.0 (unported) | Brazilian Localization Sales and Warehouse [//]: # (end addons) diff --git a/l10n_br_account_payment/security/l10n_br_account_payment_security.xml b/l10n_br_account_payment/security/l10n_br_account_payment_security.xml deleted file mode 100644 index f19265aee9d8..000000000000 --- a/l10n_br_account_payment/security/l10n_br_account_payment_security.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/l10n_br_base/README.rst b/l10n_br_base/README.rst new file mode 100644 index 000000000000..8653ddc2dbd9 --- /dev/null +++ b/l10n_br_base/README.rst @@ -0,0 +1,81 @@ +.. 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 Base da localização Brasileira +===================================== + +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 +* Luis Felipe Mileo +* Michell Stuttgart + +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_base/__openerp__.py b/l10n_br_base/__openerp__.py index eba305ebfd03..787db1bfc13c 100644 --- a/l10n_br_base/__openerp__.py +++ b/l10n_br_base/__openerp__.py @@ -37,7 +37,6 @@ 'views/res_partner_view.xml', 'views/res_company_view.xml', 'security/ir.model.access.csv', - 'security/l10n_br_base_security.xml', ], 'demo': [ 'demo/base_demo.xml', diff --git a/l10n_br_base/models/l10n_br_base.py b/l10n_br_base/models/l10n_br_base.py index 4a442f67a2e1..5f648396933f 100644 --- a/l10n_br_base/models/l10n_br_base.py +++ b/l10n_br_base/models/l10n_br_base.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2009 Renato Lima - Akretion # diff --git a/l10n_br_base/models/res_country.py b/l10n_br_base/models/res_country.py index dec96f1dd747..d7b19522c0e6 100644 --- a/l10n_br_base/models/res_country.py +++ b/l10n_br_base/models/res_country.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2009 Renato Lima - Akretion # diff --git a/l10n_br_base/models/res_partner.py b/l10n_br_base/models/res_partner.py index 3447bcc22b7e..a56507fd8722 100644 --- a/l10n_br_base/models/res_partner.py +++ b/l10n_br_base/models/res_partner.py @@ -38,8 +38,8 @@ def _display_address(self, address, without_company=False): address, without_company=False) else: address_format = ( - address.country_id and address.country_id.address_format - or "%(street)s\n%(street2)s\n%(city)s" + address.country_id and address.country_id.address_format or + "%(street)s\n%(street2)s\n%(city)s" " %(state_code)s%(zip)s\n%(country_name)s") args = { 'state_code': address.state_id and diff --git a/l10n_br_base/security/l10n_br_base_security.xml b/l10n_br_base/security/l10n_br_base_security.xml deleted file mode 100644 index 803990c56c7d..000000000000 --- a/l10n_br_base/security/l10n_br_base_security.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/l10n_br_base/tools/fiscal.py b/l10n_br_base/tools/fiscal.py index c959f77f73e7..2f3752e1a3ef 100644 --- a/l10n_br_base/tools/fiscal.py +++ b/l10n_br_base/tools/fiscal.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2013 Renato Lima - Akretion # diff --git a/l10n_br_base/tools/misc.py b/l10n_br_base/tools/misc.py index ad9cf0db79ad..640b33b92c39 100644 --- a/l10n_br_base/tools/misc.py +++ b/l10n_br_base/tools/misc.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################### # # # Copyright (C) 2014 Renato Lima - Akretion # diff --git a/l10n_br_delivery/sale.py b/l10n_br_delivery/sale.py deleted file mode 100644 index f63b673ed370..000000000000 --- a/l10n_br_delivery/sale.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################### -# # -# Copyright (C) 2009 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 time -from openerp.osv import orm, osv -from openerp.tools.translate import _ - - -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.carrier_id: - result['carrier_id'] = order.carrier_id.id - - return result - - def _prepare_order_picking(self, cr, uid, order, context=None): - result = super(SaleOrder, self)._prepare_order_picking( - cr, uid, order, context) - - # FIXME - Confirmado bug do OpenERP - # https://bugs.launchpad.net/bugs/1161138 - # Esse campo já deveria ser copiado pelo módulo nativo delivery - result['incoterm'] = order.incoterm and order.incoterm.id or False - return result - - def delivery_set(self, cr, uid, ids, context=None): - #Copia do modulo delivery - #Exceto pelo final que adiciona ao campo total do frete. - grid_obj = self.pool.get('delivery.grid') - carrier_obj = self.pool.get('delivery.carrier') - - for order in self.browse(cr, uid, ids, context=context): - grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], - order.partner_shipping_id.id) - - if not grid_id: - raise osv.except_osv(_('No Grid Available!'), - _('No grid matching for this carrier!')) - - if not order.state in ('draft'): - raise osv.except_osv(_('Order not in Draft State!'), - _('The order state have to be draft to add delivery lines.')) - - grid = grid_obj.browse(cr, uid, grid_id, context=context) - - amount_freight = grid_obj.get_price(cr, uid, grid.id, order, - time.strftime('%Y-%m-%d'), context) - self.onchange_amount_freight(cr, uid, ids, amount_freight) - return self.write(cr, uid, ids, {'amount_freight': amount_freight}) diff --git a/l10n_br_sale/models/sale.py b/l10n_br_sale/models/sale.py index 68a1db760d1d..e1eb4f1b9f75 100644 --- a/l10n_br_sale/models/sale.py +++ b/l10n_br_sale/models/sale.py @@ -325,7 +325,6 @@ def product_id_change(self, pricelist, product, qty=0, partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): - context = dict(self.env.context) self = self.with_context(context) parent_fiscal_category_id = context.get('parent_fiscal_category_id') 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..db83a78db0a0 --- /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 Sale Stcok +================= + +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/__init__.py b/l10n_br_sale_stock/__init__.py index 4526a8e5a96f..93e3762d5940 100644 --- a/l10n_br_sale_stock/__init__.py +++ b/l10n_br_sale_stock/__init__.py @@ -1,22 +1,21 @@ -# -*- encoding: utf-8 -*- +# -*- 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 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 . # ############################################################################### -import stock -import sale +from . import models diff --git a/l10n_br_sale_stock/__openerp__.py b/l10n_br_sale_stock/__openerp__.py index d4cabe9da526..0742c16659db 100644 --- a/l10n_br_sale_stock/__openerp__.py +++ b/l10n_br_sale_stock/__openerp__.py @@ -1,46 +1,44 @@ -# -*- encoding: utf-8 -*- +# -*- 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 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 . # ############################################################################### { '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', + 'author': 'Akretion, ,Odoo Community Association (OCA)', + 'website': 'http://odoo-brasil.org', + 'version': '8.0.1.0.0', 'depends': [ 'sale_stock', 'l10n_br_sale_product', - 'l10n_br_stock', + 'l10n_br_stock_account', ], 'data': [ - 'l10n_br_sale_stock_data.xml', - 'sale_stock_view.xml', + 'views/sale_stock_view.xml', ], 'demo': [ - 'l10n_br_sale_stock_demo.xml', - 'test/sale_order_demo.yml' + '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/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/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/models/__init__.py b/l10n_br_sale_stock/models/__init__.py new file mode 100644 index 000000000000..ef808c891aec --- /dev/null +++ b/l10n_br_sale_stock/models/__init__.py @@ -0,0 +1,21 @@ +# -*- 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 diff --git a/l10n_br_sale_stock/models/procurement.py b/l10n_br_sale_stock/models/procurement.py new file mode 100644 index 000000000000..4fc4fa54d8a9 --- /dev/null +++ b/l10n_br_sale_stock/models/procurement.py @@ -0,0 +1,35 @@ +# -*- 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 . # +############################################################################### + +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 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 diff --git a/l10n_br_sale_stock/sale.py b/l10n_br_sale_stock/sale.py deleted file mode 100644 index cf1193bcb5a8..000000000000 --- a/l10n_br_sale_stock/sale.py +++ /dev/null @@ -1,64 +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 - 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/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 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 index 28f588809af5..d37c4930e4bb 100644 --- a/l10n_br_sale_stock/test/sale_order_demo.yml +++ b/l10n_br_sale_stock/test/sale_order_demo.yml @@ -2,14 +2,15 @@ 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 - - !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 @@ -27,15 +28,17 @@ 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 - - !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 @@ -62,7 +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.type == 'out',"Shipment should be Outgoing." + 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') - diff --git a/l10n_br_sale_stock/sale_stock_view.xml b/l10n_br_sale_stock/views/sale_stock_view.xml similarity index 68% rename from l10n_br_sale_stock/sale_stock_view.xml rename to l10n_br_sale_stock/views/sale_stock_view.xml index aedbf9cb7afb..5cdc0cc36aef 100644 --- a/l10n_br_sale_stock/sale_stock_view.xml +++ b/l10n_br_sale_stock/views/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}