Skip to content

Commit

Permalink
Change field Fiscal Position to be required. (#53)
Browse files Browse the repository at this point in the history
[IMP] account_fiscal_position_rule: Change field Fiscal Position to be required
  • Loading branch information
mbcosta authored and pedrobaeza committed Oct 6, 2016
1 parent f009087 commit 2274e8c
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 320 deletions.
43 changes: 43 additions & 0 deletions account_fiscal_position_rule/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.. 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

============================
Account Fiscal Position Rule
============================

This module was written to allow you to include a rule to decide the correct
fiscal position.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-fiscal-rule/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 <https://github.com/OCA/account-fiscal-rule/issues/new?body=module:%20account_fiscal_position_rule%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Contributors
------------

* Sébastien BEAU <sebastien.beau@akretion.com>
* Renato Lima <renato.lima@akretion.com>
* Guewen Baconnier

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.
24 changes: 4 additions & 20 deletions account_fiscal_position_rule/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# account_fiscal_position_rule for OpenERP
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models
30 changes: 7 additions & 23 deletions account_fiscal_position_rule/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# account_fiscal_position_rule for OpenERP
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# Copyright 2012 Camptocamp SA
# @author: Guewen Baconnier
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# Copyright 2012-TODAY Camptocamp SA
# @author: Guewen Baconnier
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
'name': 'Account Fiscal Position Rule',
Expand Down
24 changes: 4 additions & 20 deletions account_fiscal_position_rule/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# account_fiscal_position_rule for OpenERP
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion - <http://www.akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import account_fiscal_position_rule
from . import account_invoice
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# account_fiscal_position_rule for OpenERP
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# Copyright 2012 Camptocamp SA
# @author: Guewen Baconnier
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# Copyright 2012-TODAY Camptocamp SA
# @author: Guewen Baconnier
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

import time

Expand Down Expand Up @@ -49,7 +33,7 @@ class AccountFiscalPositionRule(models.Model):
company_id = fields.Many2one(
'res.company', 'Company', required=True, select=True)
fiscal_position_id = fields.Many2one(
'account.fiscal.position', 'Fiscal Position',
'account.fiscal.position', 'Fiscal Position', required=True,
domain="[('company_id','=',company_id)]", select=True)
use_sale = fields.Boolean('Use in sales order')
use_invoice = fields.Boolean('Use in Invoices')
Expand Down Expand Up @@ -186,7 +170,7 @@ class AccountFiscalPositionRuleTemplate(models.Model):
'res.country.state', 'Destination State',
domain="[('country_id','=',to_shipping_country)]")
fiscal_position_id = fields.Many2one(
'account.fiscal.position.template', 'Fiscal Position')
'account.fiscal.position.template', 'Fiscal Position', required=True)
use_sale = fields.Boolean('Use in sales order')
use_invoice = fields.Boolean('Use in Invoices')
use_purchase = fields.Boolean('Use in Purchases')
Expand Down
26 changes: 5 additions & 21 deletions account_fiscal_position_rule/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# account_fiscal_position_rule for OpenERP
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# -*- coding: utf-8 -*-
# Copyright (C) 2009-TODAY Akretion <http://www.akretion.com>
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @author Renato Lima <renato.lima@akretion.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import models, api

Expand Down
1 change: 1 addition & 0 deletions account_fiscal_position_rule/test/test_rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
!record {model: account.fiscal.position.rule, id: fake_rule}:
name: rule_fake
company_id: base.main_company
fiscal_position_id: p1
-
I check that the mapping works for invoice address
-
Expand Down
Loading

0 comments on commit 2274e8c

Please sign in to comment.