Merge lp:~agilebg/account-invoicing/adding_account_fiscal_position_country_7 into lp:~account-core-editors/account-invoicing/7.0

Proposed by Alex Comba - Agile BG
Status: Rejected
Rejected by: Pedro Manuel Baeza
Proposed branch: lp:~agilebg/account-invoicing/adding_account_fiscal_position_country_7
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 203 lines (+178/-0)
5 files modified
account_fiscal_position_country/__init__.py (+25/-0)
account_fiscal_position_country/__openerp__.py (+47/-0)
account_fiscal_position_country/country.py (+39/-0)
account_fiscal_position_country/country_view.xml (+17/-0)
account_fiscal_position_country/invoice.py (+50/-0)
To merge this branch: bzr merge lp:~agilebg/account-invoicing/adding_account_fiscal_position_country_7
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) Disapprove
Guewen Baconnier @ Camptocamp Needs Information
Review via email: mp+182636@code.launchpad.net

Description of the change

This branch adds the account_fiscal_position_country porting to 7.0

Module description:

A rule to select automatically the fiscal position based on the country.
In the configuration of the country, choose a default fiscal position for it.
When selecting a partner in an invoice, if the fiscal position for the partner is not set, the one from the country will be used.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

line 189: too long

review: Needs Fixing
23. By Alex Comba - Agile BG

[FIX] PEP8 style

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Lorenzo, now it should be ok.

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Seems redundant with account_fiscal_position_rule in the https://code.launchpad.net/openerp-fiscal-rules project.
Do you have a reason for not reusing it?

review: Needs Information
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Guewen, you are right. The functionality seems to be already covered by account_fiscal_position_rule*
I'm closing this MP

review: Disapprove
Revision history for this message
Lorenzo Battistini (elbati) wrote :

"I'm closing this MP"

I can't :-)

You can reject this MP.

Thanks

Unmerged revisions

23. By Alex Comba - Agile BG

[FIX] PEP8 style

22. By Alex Comba - Agile BG

[FIX] avoid country_ids and adjust onchange_partner_id

21. By Alex Comba - Agile BG

[IMP] class name

20. By Alex Comba - Agile BG

[REF] ported module account_fiscal_position_country to ver. 7.0

19. By Alex Comba - Agile BG

[ADD] module account_fiscal_position_country ver. 6.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_fiscal_position_country'
=== added file 'account_fiscal_position_country/__init__.py'
--- account_fiscal_position_country/__init__.py 1970-01-01 00:00:00 +0000
+++ account_fiscal_position_country/__init__.py 2013-08-28 16:12:06 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
5# Copyright (C) 2011-2013 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import country
24import account
25import invoice
026
=== added file 'account_fiscal_position_country/__openerp__.py'
--- account_fiscal_position_country/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_fiscal_position_country/__openerp__.py 2013-08-28 16:12:06 +0000
@@ -0,0 +1,47 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
5# Copyright (C) 2011-2013 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7# @author Leonardo Pistone <leonardo.pistone@agilebg.com>
8# Ported to OpenERP 7.0 by Alex Comba <alex.comba@agilebg.com>
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU Affero General Public License as published
12# by the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Affero General Public License for more details.
19#
20# You should have received a copy of the GNU Affero General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
22#
23##############################################################################
24
25{
26 'name': 'Fiscal Position by country',
27 'version': '0.3',
28 'category': 'Generic Modules/Accounting',
29 'description': """
30A rule to select automatically the fiscal position based on the country
31In the configuration of the country, choose a default fiscal position for it.
32When selecting a partner in an invoice, if the fiscal position for the partner
33is not set, the one from the country will be used.
34 """,
35 'author': 'Agile Business Group',
36 'website': 'http://www.agilebg.com',
37 'license': 'AGPL-3',
38 'depends': [
39 'base',
40 'account',
41 ],
42 'data': [
43 'country_view.xml',
44 ],
45 "active": False,
46 'installable': True,
47}
048
=== added file 'account_fiscal_position_country/country.py'
--- account_fiscal_position_country/country.py 1970-01-01 00:00:00 +0000
+++ account_fiscal_position_country/country.py 2013-08-28 16:12:06 +0000
@@ -0,0 +1,39 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
5# Copyright (C) 2011-2013 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import fields, orm
24
25
26class res_country(orm.Model):
27 _inherit = 'res.country'
28 _columns = {
29 'property_account_position': fields.property(
30 'account.fiscal.position',
31 type='many2one',
32 relation='account.fiscal.position',
33 string="Default Fiscal Position",
34 method=True,
35 view_load=True,
36 help="""The fiscal position will determine taxes and the accounts
37 used for the country, if not set specifically elsewere.""",
38 ),
39 }
040
=== added file 'account_fiscal_position_country/country_view.xml'
--- account_fiscal_position_country/country_view.xml 1970-01-01 00:00:00 +0000
+++ account_fiscal_position_country/country_view.xml 2013-08-28 16:12:06 +0000
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>
3 <data>
4
5 <record model="ir.ui.view" id="view_country_fiscal_position_form">
6 <field name="name">country.fiscal.position.form</field>
7 <field name="model">res.country</field>
8 <field name="inherit_id" ref="base.view_country_form"/>
9 <field name="arch" type="xml">
10 <field name="code" position="after">
11 <field name="property_account_position" widget="selection"/>
12 </field>
13 </field>
14 </record>
15
16 </data>
17</openerp>
018
=== added file 'account_fiscal_position_country/invoice.py'
--- account_fiscal_position_country/invoice.py 1970-01-01 00:00:00 +0000
+++ account_fiscal_position_country/invoice.py 2013-08-28 16:12:06 +0000
@@ -0,0 +1,50 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Domsense srl (<http://www.domsense.com>)
5# Copyright (C) 2011-2013 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import fields, orm
24
25
26class account_invoice(orm.Model):
27 _inherit = "account.invoice"
28
29 def onchange_partner_id(
30 self, cr, uid, ids, type, partner_id,
31 date_invoice=False, payment_term=False,
32 partner_bank_id=False, company_id=False
33 ):
34
35 result = super(account_invoice, self).onchange_partner_id(
36 cr, uid, ids, type, partner_id,
37 date_invoice, payment_term, partner_bank_id, company_id)
38
39 if not result['value']['fiscal_position']:
40 if partner_id:
41 partner = self.pool.get('res.partner').browse(
42 cr, uid, partner_id)
43 result['value']['fiscal_position'] = (
44 partner.country_id
45 and partner.country_id.property_account_position
46 and partner.country_id.property_account_position.id
47 or False
48 )
49
50 return result

Subscribers

People subscribed via source and target branches