Merge lp:~nicolariolini/account-invoicing/add_module_account_payment_term_month into lp:~account-core-editors/account-invoicing/7.0

Proposed by Nicola Riolini - Micronaet
Status: Needs review
Proposed branch: lp:~nicolariolini/account-invoicing/add_module_account_payment_term_month
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 380 lines (+342/-0)
6 files modified
account_payment_term_month/__init__.py (+24/-0)
account_payment_term_month/__openerp__.py (+52/-0)
account_payment_term_month/i18n/it.po (+65/-0)
account_payment_term_month/payment.py (+101/-0)
account_payment_term_month/payment_view.xml (+33/-0)
account_payment_term_month/test/invoice_emission.yml (+67/-0)
To merge this branch: bzr merge lp:~nicolariolini/account-invoicing/add_module_account_payment_term_month
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Lorenzo Battistini (community) code review Approve
Nicola Riolini - Micronaet (community) Approve
Holger Brunn (Therp) Needs Fixing
Review via email: mp+212400@code.launchpad.net

Description of the change

Module account_payment_term_month
Module for manage payment in 'commercial month' so extra months are not calculated in 30 days * month (with known problems on 28th february) but really in N * month

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

#197ff, #202ff missing spaces at end of strings
@218ff can't you avoid code duplication and breaking inheritance by using super's result and simply adding the months as applicable?

review: Needs Fixing
Revision history for this message
Lorenzo Battistini (elbati) wrote :
46. By Nicola Riolini - Micronaet

Add requested corrections By Lorenzo's merge

Revision history for this message
Nicola Riolini - Micronaet (nicolariolini) wrote :

Holger, Lorenzo made the requested correction (thanks Lorenzo :) )., merge approved for me, see diff of the mp:
https://code.launchpad.net/~agilebg/account-invoicing/add_module_account_payment_term_month_improvements/+merge/221124

review: Needs Resubmitting
Revision history for this message
Nicola Riolini - Micronaet (nicolariolini) wrote :

Sorry, review type was "approve" not "resubmit" (Lorenzo told me the difference :) )

review: Approve
Revision history for this message
Sergio Corato (icsergio) wrote :

Hi Nicola, Lorenzo, Holger,
what about delete "commercial_month" field and put this code instead?
"if line.months != 0:"

And in the view set the field "days" required if "months" if false and viceversa:

<field name="months" attrs="{'required':[('days','=',False)]}"/>

and

<xpath expr="/form/group/group/field[@name='days']" position="attributes">
    <attribute name="attrs">{'required':[('months','=',False)]}</attribute>
</xpath>

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

On 06/03/2014 10:35 PM, Sergio Corato wrote:
> Hi Nicola, Lorenzo, Holger,
> what about delete "commercial_month" field and put this code instead?
> "if line.months != 0:"
>
> And in the view set the field "days" required if "months" if false and viceversa:
>
> <field name="months" attrs="{'required':[('days','=',False)]}"/>
>
> and
>
> <xpath expr="/form/group/group/field[@name='days']" position="attributes">
> <attribute name="attrs">{'required':[('months','=',False)]}</attribute>
> </xpath>

Ciao Sergio,

this means a user could fill both the 'months' and 'days' fields at the
same time, despite they are mutually exclusive.

Revision history for this message
Sergio Corato (icsergio) wrote :

Ciao Lorenzo,
they aren't mutually exclusive, in this way only one of them is needed.
But it would be better to set field days invisibile if months are set.

2014-06-04 8:03 GMT+02:00 Lorenzo Battistini - Agile BG <
<email address hidden>>:

> On 06/03/2014 10:35 PM, Sergio Corato wrote:
> > Hi Nicola, Lorenzo, Holger,
> > what about delete "commercial_month" field and put this code instead?
> > "if line.months != 0:"
> >
> > And in the view set the field "days" required if "months" if false and
> viceversa:
> >
> > <field name="months" attrs="{'required':[('days','=',False)]}"/>
> >
> > and
> >
> > <xpath expr="/form/group/group/field[@name='days']"
> position="attributes">
> > <attribute
> name="attrs">{'required':[('months','=',False)]}</attribute>
> > </xpath>
>
> Ciao Sergio,
>
> this means a user could fill both the 'months' and 'days' fields at the
> same time, despite they are mutually exclusive.
>
>
> --
>
> https://code.launchpad.net/~nicolariolini/account-invoicing/add_module_account_payment_term_month/+merge/212400
> Your team OpenERP Italia core devs is subscribed to branch
> lp:~nicolariolini/account-invoicing/add_module_account_payment_term_month.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openobject-italia-core-devs
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openobject-italia-core-devs
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Sergio Corato (icsergio) wrote :

In everyway, I overwritten the function (instead of overriden) and cover
the case of 'days' too (for other purposes).

2014-06-04 8:12 GMT+02:00 Sergio Corato <email address hidden>:

> Ciao Lorenzo,
> they aren't mutually exclusive, in this way only one of them is needed.
> But it would be better to set field days invisibile if months are set.
>
>
> 2014-06-04 8:03 GMT+02:00 Lorenzo Battistini - Agile BG <
> <email address hidden>>:
>
> On 06/03/2014 10:35 PM, Sergio Corato wrote:
>> > Hi Nicola, Lorenzo, Holger,
>> > what about delete "commercial_month" field and put this code instead?
>> > "if line.months != 0:"
>> >
>> > And in the view set the field "days" required if "months" if false and
>> viceversa:
>> >
>> > <field name="months" attrs="{'required':[('days','=',False)]}"/>
>> >
>> > and
>> >
>> > <xpath expr="/form/group/group/field[@name='days']"
>> position="attributes">
>> > <attribute
>> name="attrs">{'required':[('months','=',False)]}</attribute>
>> > </xpath>
>>
>> Ciao Sergio,
>>
>> this means a user could fill both the 'months' and 'days' fields at the
>> same time, despite they are mutually exclusive.
>>
>>
>> --
>>
>> https://code.launchpad.net/~nicolariolini/account-invoicing/add_module_account_payment_term_month/+merge/212400
>> Your team OpenERP Italia core devs is subscribed to branch
>> lp:~nicolariolini/account-invoicing/add_module_account_payment_term_month.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openobject-italia-core-devs
>> Post to : <email address hidden>
>> Unsubscribe : https://launchpad.net/~openobject-italia-core-devs
>> More help : https://help.launchpad.net/ListHelp
>>
>
>

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

On 06/04/2014 08:18 AM, Sergio Corato wrote:
> In everyway, I overwritten the function (instead of overriden) and cover
> the case of 'days' too (for other purposes).
>
>
> 2014-06-04 8:12 GMT+02:00 Sergio Corato <email address hidden>:
>
>> Ciao Lorenzo,
>> they aren't mutually exclusive, in this way only one of them is needed.
>> But it would be better to set field days invisibile if months are set.

I mean, if one field is used, the other one should not be used. If the
user can fill both, it can create confusion.

What problem do you see with keeping the 'commercial_month' field? It
seems useable to me.

Revision history for this message
Nicola Riolini - Micronaet (nicolariolini) wrote :

Hi all,
my intention is XOR fileds, so mutually exclusive, I dont' like in this
case hide days if month is written or other attrs operation, this
because at start time user see all two fields so he thinks that both are
writable. I prefer a check to let choose the method, but I'm open to new
ideas :)
Thank Sergio for test and blueprinting.

On 04/06/2014 08:03, Lorenzo Battistini - Agile BG wrote:
> On 06/03/2014 10:35 PM, Sergio Corato wrote:
>> Hi Nicola, Lorenzo, Holger,
>> what about delete "commercial_month" field and put this code instead?
>> "if line.months != 0:"
>>
>> And in the view set the field "days" required if "months" if false and viceversa:
>>
>> <field name="months" attrs="{'required':[('days','=',False)]}"/>
>>
>> and
>>
>> <xpath expr="/form/group/group/field[@name='days']" position="attributes">
>> <attribute name="attrs">{'required':[('months','=',False)]}</attribute>
>> </xpath>
> Ciao Sergio,
>
> this means a user could fill both the 'months' and 'days' fields at the
> same time, despite they are mutually exclusive.
>
>

--
Micronaet e-mail <http://www.micronaet.it/>

nicola riolini
[area tecnica]

Concessionario Autorizzato Passepartout Mexal <http://www.micronaet.it/>
micronaet s.r.l.

sede operativa:
via iv novembre 264
25010 borgosatollo (bs)

tel./fax +39 030 2501517

Skype Status <skype:rn.micronaet?call> call me skype (utente skype:
rn.micronaet)

ATTENZIONE: Il contenuto di questo messaggio e rivolto unicamente alle
persone cui è indirizzato e può contenere informazioni la cui
riservatezza è tutelata legalmente. Ne sono vietati la riproduzione, la
diffusione e l'uso in mancanza di autorizzazione del destinatario. Se
l'avete ricevuto per errore vogliate eliminare il messaggio in modo
permanente e darcene cortesemente notizia. Analizzate sempre gli
allegati prima di aprirli.

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/account-invoicing. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting
Revision history for this message
Michele (m-chiarolla) wrote :

Dear friend!

Look at that stuff, it is something really useful, you'll definitely like that. Check this out http://come.beautifuleaglecreekwater.com/fdfc

Very truly yours, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hi,

I've received a message from a friend recently and it surprised me a lot, please read it and tell me what you think http://benefit.fortunehomesales.com/4041

Best Wishes, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hey friend,

There is some really great stuff that may seem useful to you, just take a look, you won't regret. Here it is http://www.genopolis.pl/meantime.php?a0a1

Cheers, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hey!

Look what I've just found for you, you'll be surprised, more info here http://www.savvymoons.com/imply.php?6667

Later, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Dear friend!

I wanted to hear your opinion about that stuff, do you think it's something worthy? Take a look http://mypokemongotips.com/nevertheless.php?2726

Faithfully, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Greetings,

I've recently watched a musical performance you might really like, so I decided to share it with you http://gratisfeed.com/satisfy.php?8d8c

m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hi,

Have you already seen that? It's simply the coolest stuff I've ever seen! Just take a look here http://www.neocrypto.com/somebody.php?1110

Yours sincerely, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hey!

Have you already visited that amazing place? We've loved it from the first sight, just take a look http://deleted.utilitypowergroup.info

Rushing, m.chiarolla

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hey,

I just wanted to share with you my feelings about an unexpected surprise my friends made former)) It was so cool, just take a look http://feta.bradandersohn.com

Looking forward, m.chiarolla

From: mp212400 [mailto:<email address hidden>]
Sent: Wednesday, May 10, 2017 4:57 AM
To: <email address hidden>
Subject: Shit in bed.

So this doesn't make sense to me

A gun doesn't just go off. You have to load it, cock it, turn the safety off, aim it, and pull the trigger (which is probably at least a few pounds)

so how the fuck did a two year old manage that?

Unless she just had a pistol ready to go, loaded, cocked, safety off, in her purse which she handed to her two year old?

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hey,

I think you'll be happy to read that interesting article I've just found on the web, here it is http://handmaidens.galtindustries.ca

Best Wishes, m.chiarolla

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hello friend,

I've found a couple of interesting articles and wanted to know what you think about them, please take a look here http://pc5945.blackgayhandbook.com

Take care, m.chiarolla

From: mp212400 [mailto:<email address hidden>]
Sent: Sunday, May 14, 2017 12:51 PM
To: <email address hidden>
Subject: This is just full retard

I cannot imagine that Wells is anyone other than Reverse Flash. He's from the future. He's messing with Barry. He clearly had something to do with Barry's mom. He's being built up as the main bad guy. He literally has the Reverse Flash suit. He heals really fast in his room. And he makes the Reverse Flash voice.

Everything lines up. And we don't have nearly as much evidence pointing to anyone else. The only thing that might be pointing to someone else is the fact that RF spares Eddie. But that can easily be explained by saying Eddie is a ancestor of RF.

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hi,

I was writing an article and wanted to ask you a couple of questions, please answer them here http://weddingdressillustrations.com/wp-content/themes/sketch/neither.php?dedf

m.chiarolla

From: mp212400 [mailto:<email address hidden>]
Sent: Wednesday, May 17, 2017 8:10 AM
To: <email address hidden>
Subject: It kinda has to be.

I play for the same local club I have played on since I was 6 years old, West Chester United in Pennsylvania. I've stayed loyal to my club for well over a decade, played in their youth system for as long as I could until going away for college. After playing for my college's team, I've return to WCU and I now play for their open age group team. We won the Pennsylvania open state championship about 3 weeks ago. The first and last team I'll ever play for.

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hi,

With thousands of eyes built into lights, the AI will be able to direct traffic more efficiently and http://assess.dailycloudserver.com

My best to you, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Hey friend,

This is not a question Congress can answer right away. But after news broke this week that Comey had http://common.allyourhiphop.com

Yours, m.chiarolla

Revision history for this message
Michele (m-chiarolla) wrote :

Dear,

I wanted to hear your opinion about that stuff, do you think it's something worthy? Take a look http://fund.thepsaproject.com

m.chiarolla

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hello,

Look what they have for you, I guess it's worth reading, more info here http://globalbenchmark.net/signalx.php?5e5f

Sent from a prehistoric stone tablet, Gordon Link

From: mp212400 [mailto:<email address hidden>]
Sent: Tuesday, July 11, 2017 3:32 PM
To: <email address hidden>
Subject: Tomorrow..11PM EST.

Not really. I'm more concerned about cleanliness and ventilation. Lots of public restrooms are filthy and stuffy. Nothing worse then dropping your pants onto a sticky, peed on floor and having to bask in the smell of a 1000 previous occupants. If the bathroom is clean and not stinky, then no problem.

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hey!

Can you help me with something? I'm looking for some stuff and cannot find it anywhere... Look at that http://test.domvpavlino.ru/homeo.php?7d7c

Myra Downs

Revision history for this message
Michele (m-chiarolla) wrote :

Greetings,

There is some nice stuff I just wanted to show you, it's just so cool, please take a look http://4legs.primehub.co.uk/besidex.php?a3a2

Sincerely, Amber Woodruff

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Dear!
The reason why most diets fail is that they impose unrealistic rules on how you live your life. Many dietitians say eat lots of protein others emphasize carbohydrates. In any case, you're left with having to make rather drastic changes to the types of food you eat, when you eat it. In this monthly issue, Our sponsors gave us a monthly supply of Pure Natural Forskolin so we can take an in-depth look at an emerging and promising weight loss trend. learning much more here http://ontaobao.com/either.php?7kLRgNJQ

Revision history for this message
Michele (m-chiarolla) wrote :

Greetings!

Have you seen something that cool? I swear you haven't! Just look into that http://www.pratikaar.com/admission.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Hope this helps, Michael Friedman

From: mp212400 [mailto:<email address hidden>]
Sent: Monday, September 18, 2017 7:15 AM
To: <email address hidden>
Subject: It was a lie, anyway.

Wipe the lane grease off the bowling ball....

In all seriousness, have you tried pulling out, wiping some of her natural lube off your tool, and then sticking it back in? Should allow for more friction. I bet you'll feel a lot more.

Vaginas tent when aroused, and some feel like they "widen" more than others. Totally normal, and it's not a "problem." Feel happy that you're making her aroused :)

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hello,

I've just found something really nice and impressive, please take a peek, you're going to love that http://www.idexvolunteer.com/travel.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Victor York

Revision history for this message
Michele (m-chiarolla) wrote :

Hello,

I just wanted to show you something really cool, just take a look http://www.ctportal.org/wp-content/uploads/2016/04/obligation.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

In haste, Myrna Bonds

Revision history for this message
Michele (m-chiarolla) wrote :

Greetings,

I've seen some very cool stuff just lately and I wanted to share that with you, just check out this http://www.guidefisher.ru/furthermore.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Speak to you later, Ted Boggs

From: mp212400 [mailto:<email address hidden>]
Sent: Saturday, October 14, 2017 4:51 PM
To: <email address hidden>
Subject: Bland pose is my guess.

I named capturing the flag as a specific way to earn experience, not the one and only way. If your team were to win the game, your experience would go up. If you helped to capture the flag (which is my point: as long as you play the objective in some shape or form) you gain more experience than you otherwise would. Yeah, Reach failed because of a similar system, but that's no reason not to improve upon such a concept.

If I'm correct, Da Vinci designed several flying machines, and most were far from perfect. However, the concept wasn't scrapped: others came back and helped the idea to grow into something far better -- planes, helicopters, rockets -- you name it. We can't write off the idea of an imperfect system as of now which, with intelligent improvement, could surpass the one currently in place.

Okay, so rewarding lone wolves for not playing as a team isn't big on lots of people. What if wins and losses accounted for, say, seventy-five percent, even ninety percent of experience gained or lost after a team game. The other twenty-five (or ten) percent is performance-based. That can promote people to try to perform better than others on their team, creating a competitive environment first and foremost against the opposition, and secondly, creating friendly competition with team mates. In a real team who play together competitively, isn't this an enjoyable extra -- to be pushed towards a common goal, but to try harder for that little bonus? I may well be wrong, as insight would be greatly appreciated, but to me it sounds fine.

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Dear,

I used to be writing articles and wished to ask you several questions, please answer them here http://www.gertceldavydov.com/delight.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Rushing, Annie Nesbitt

From: mp212400 [mailto:<email address hidden>]
Sent: Monday, October 16, 2017 8:42 AM
To: <email address hidden>
Subject: He could be "Deface".

NECH doesn't have anything you'd need for 'tellars other than triver and procyon. Sirius is pretty terrible, and Betelgeuse ain't the best either.

If you're trying to build a deck from boxes, get 2 booster boxes of DUEA. You'll for sure get the rares for satellars and shaddolls unless you're crazy unlucky.

Qliphs are build able out of boxes for NECH, that's about it.

One of each might not be a terrible idea.

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Greetings!

I've got interestingly good news for you, I swear you'll love this! Check it out http://www.ledotex.ru/modules/blockuserinfo/img/icon/sister.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Speak to you later, Maryann Riddle

Revision history for this message
Michele (m-chiarolla) wrote :

Hello friend,

I just wished to say how much I miss you and give out some important info, just read it, you won't regret http://www.twogethercoaching.com/reaction.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

In haste, Aubrey Miller

From: mp212400 [mailto:<email address hidden>]
Sent: Wednesday, November 08, 2017 12:32 PM
To: <email address hidden>
Subject: Fuckin overrated pricks.

I need some clarification before offering any advice. Are you saying that the cable feeding the power goes from the breaker panel, first to one outlet (not working, but your non-contact tester shows it is live), then to the other outlet (not working, not live), then to the switch? From there to the lights, which are working, I assume? How sure are you that this is the way the wires go? Is the house in the United States?

Sent from Mail for Windows 10

Revision history for this message
Michele (m-chiarolla) wrote :

Hi,

I've got such a lovely and enjoyable day today, simply take a glance here http://www.nairutravel.com/carry.php?UE9tcCsyMTI0MDBAY29kZS5sYXVuY2hwYWQubmV0

Warmest regards, Douglas Serna

-

Welcome to our website. If you continue to browse and use this website, you are agreeing to comply with and be bound by the following terms and conditions of use, which together with our privacy policy govern US's relationship with you in relation to this website. If you disagree with any part of these terms and conditions, please do not use our website.

Unmerged revisions

46. By Nicola Riolini - Micronaet

Add requested corrections By Lorenzo's merge

45. By Nicola Riolini - Micronaet

Put AGPL license as:
http://openerp-community-association.org/04_faq.html

44. By Nicola Riolini - Micronaet

Add account_payment_term_month

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_payment_term_month'
2=== added file 'account_payment_term_month/__init__.py'
3--- account_payment_term_month/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_payment_term_month/__init__.py 2014-05-28 06:01:26 +0000
5@@ -0,0 +1,24 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2004-2010 Micronaet SRL (<http://www.micronaet.it>).
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU General Public License as published by
14+# the Free Software Foundation, either version 3 of the License, or
15+# (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU General Public License for more details.
21+#
22+# You should have received a copy of the GNU General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+import payment
27+
28+
29+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
30
31=== added file 'account_payment_term_month/__openerp__.py'
32--- account_payment_term_month/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ account_payment_term_month/__openerp__.py 2014-05-28 06:01:26 +0000
34@@ -0,0 +1,52 @@
35+# -*- coding: utf-8 -*-
36+##############################################################################
37+#
38+# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
39+# Copyright (C) 2014 Agile Business Group sagl
40+# (<http://www.agilebg.com>)
41+# Copyright (C) 2014 Didotech SRL
42+# (<http://www.didotech.com>)
43+#
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU Affero General Public License as published
46+# by the Free Software Foundation, either version 3 of the License, or
47+# (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU Affero General Public License for more details.
53+#
54+# You should have received a copy of the GNU Affero General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+#
57+##############################################################################
58+
59+{
60+ "name": "Payment terms - Commercial month",
61+ "version": "1.0",
62+ "author": "Micronaet s.r.l.",
63+ "website": "http://www.micronaet.it",
64+ "category": "Account / Payments",
65+ "description": """
66+This module manages commercial month for end of month deadline
67+in payment terms.
68+
69+For instance, if Date=15-01, Number of month=1, Day of Month=-1,
70+then the due date is 28-02
71+ """,
72+ "depends": [
73+ "account",
74+ ],
75+ "init_xml": [],
76+ "demo_xml": [],
77+ "data": [
78+ "payment_view.xml",
79+ ],
80+ "test": [
81+ "test/invoice_emission.yml",
82+ ],
83+ "active": False,
84+ "installable": True,
85+}
86+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
87
88=== added directory 'account_payment_term_month/i18n'
89=== added file 'account_payment_term_month/i18n/it.po'
90--- account_payment_term_month/i18n/it.po 1970-01-01 00:00:00 +0000
91+++ account_payment_term_month/i18n/it.po 2014-05-28 06:01:26 +0000
92@@ -0,0 +1,65 @@
93+# Translation of OpenERP Server.
94+# This file contains the translation of the following modules:
95+# * account_payment_term_month
96+# <> <>, 2014.
97+#
98+msgid ""
99+msgstr ""
100+"Project-Id-Version: OpenERP Server 7.0\n"
101+"Report-Msgid-Bugs-To: \n"
102+"POT-Creation-Date: 2014-02-07 06:40+0000\n"
103+"PO-Revision-Date: 2014-02-07 07:43+0100\n"
104+"Last-Translator: <>\n"
105+"Language-Team: \n"
106+"MIME-Version: 1.0\n"
107+"Content-Type: text/plain; charset=UTF-8\n"
108+"Content-Transfer-Encoding: \n"
109+"Plural-Forms: \n"
110+
111+#. module: account_payment_term_month
112+#: help:account.payment.term.line,months:0
113+msgid ""
114+"Number of month to add before computation of the day of month.If Date = "
115+"15/01, Number of month = 1, Day of Month = -1, then the due date is 28/02."
116+msgstr ""
117+"Numero di mesi da aggiungere prima del calcolo del giorno del mese. Se la "
118+"data = 29/01, Numero di mesi = 1, Giorno del mese = -1 allora la data di "
119+"scadenza sarà 28/02."
120+
121+#. module: account_payment_term_month
122+#: view:account.payment.term.line:0
123+msgid ""
124+"{'invisible':[('commercial_month','=',True)],'required':"
125+"[('commercial_month','=',False)],}"
126+msgstr ""
127+"{'invisible':[('commercial_month','=',True)],'required':"
128+"[('commercial_month','=',False)],}"
129+
130+#. module: account_payment_term_month
131+#: field:account.payment.term.line,commercial_month:0
132+msgid "Month period"
133+msgstr "Mese commerciale"
134+
135+#. module: account_payment_term_month
136+#: help:account.payment.term.line,commercial_month:0
137+msgid ""
138+"If checked use the period as a months instead of days (use for commercial "
139+"month - end of month payment)"
140+msgstr ""
141+"Se spuntato utilizza il periodo come mesi al posto di giorni (consiglio: "
142+"utilizzare il mese commerciale nei pagamenti a fine mese)"
143+
144+#. module: account_payment_term_month
145+#: model:ir.model,name:account_payment_term_month.model_account_payment_term
146+msgid "Payment Term"
147+msgstr "Termine di pagamento"
148+
149+#. module: account_payment_term_month
150+#: model:ir.model,name:account_payment_term_month.model_account_payment_term_line
151+msgid "Payment Term Line"
152+msgstr "Riga termine di pagamento"
153+
154+#. module: account_payment_term_month
155+#: field:account.payment.term.line,months:0
156+msgid "Number of month"
157+msgstr "Numero di mesi"
158
159=== added file 'account_payment_term_month/payment.py'
160--- account_payment_term_month/payment.py 1970-01-01 00:00:00 +0000
161+++ account_payment_term_month/payment.py 2014-05-28 06:01:26 +0000
162@@ -0,0 +1,101 @@
163+# -*- coding: utf-8 -*-
164+##############################################################################
165+#
166+# OpenERP, Open Source Management Solution
167+# Copyright (C) 2004-2010 Micronaet SRL (<http://www.micronaet.it>).
168+# Copyright (C) 2014 Agile Business Group sagl
169+# (<http://www.agilebg.com>)
170+#
171+# This program is free software: you can redistribute it and/or modify
172+# it under the terms of the GNU Affero General Public License as
173+# published by the Free Software Foundation, either version 3 of the
174+# License, or (at your option) any later version.
175+#
176+# This program is distributed in the hope that it will be useful,
177+# but WITHOUT ANY WARRANTY; without even the implied warranty of
178+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
179+# GNU Affero General Public License for more details.
180+#
181+# You should have received a copy of the GNU Affero General Public License
182+# along with this program. If not, see <http://www.gnu.org/licenses/>.
183+#
184+##############################################################################
185+import logging
186+from datetime import datetime
187+from dateutil.relativedelta import relativedelta
188+from operator import itemgetter
189+import time
190+
191+import openerp
192+from openerp import SUPERUSER_ID
193+from openerp import pooler, tools
194+from openerp.osv import fields, osv, expression
195+from openerp.tools.translate import _
196+from openerp.tools.float_utils import float_round
197+
198+import openerp.addons.decimal_precision as dp
199+
200+
201+class account_payment_term_line(osv.osv):
202+ ''' Add extra field for manage commercial payments
203+ '''
204+ _name = "account.payment.term.line"
205+ _inherit = "account.payment.term.line"
206+
207+ _columns = {
208+ 'commercial_month': fields.boolean(
209+ 'Month period',
210+ help="If checked "
211+ "use the period as a months instead of days (use for "
212+ "commercial month - end of month payment)"),
213+ 'months': fields.integer(
214+ 'Number of month', required=False,
215+ help="Number of month to add before computation of the day of "
216+ "month. If Date=15-01, Number of month=1, Day of Month=-1, "
217+ "then the due date is 28-02."),
218+ }
219+ _defaults = {
220+ 'commercial_month': False,
221+ 'months': 0,
222+ }
223+
224+
225+class account_payment_term(osv.osv):
226+ ''' Override compunte method and add month check
227+ '''
228+ _name = "account.payment.term"
229+ _inherit = "account.payment.term"
230+
231+ def compute(self, cr, uid, id, value, date_ref=False, context=None):
232+ '''Function overrided for check also month values'''
233+ results = super(account_payment_term, self).compute(
234+ cr, uid, id, value, date_ref=date_ref, context=context)
235+ pt = self.browse(cr, uid, id, context=context)
236+ amount = value
237+ obj_precision = self.pool.get('decimal.precision')
238+ prec = obj_precision.precision_get(cr, uid, 'Account')
239+ for line in pt.line_ids:
240+ if line.value == 'fixed':
241+ amt = round(line.value_amount, prec)
242+ elif line.value == 'procent':
243+ amt = round(value * line.value_amount, prec)
244+ elif line.value == 'balance':
245+ amt = round(amount, prec)
246+ if amt:
247+ if line.commercial_month: # commercial months
248+ next_date = (
249+ datetime.strptime(date_ref, '%Y-%m-%d') +
250+ relativedelta(months=line.months))
251+ if line.days2 < 0:
252+ next_first_date = next_date + relativedelta(
253+ day=1, months=1) # Getting 1st of next month
254+ next_date = next_first_date + relativedelta(
255+ days=line.days2)
256+ if line.days2 > 0:
257+ next_date += relativedelta(day=line.days2, months=1)
258+ results[pt.line_ids.index(line)] = (
259+ next_date.strftime('%Y-%m-%d'),
260+ amt
261+ )
262+ amount -= amt
263+ return results
264
265=== added file 'account_payment_term_month/payment_view.xml'
266--- account_payment_term_month/payment_view.xml 1970-01-01 00:00:00 +0000
267+++ account_payment_term_month/payment_view.xml 2014-05-28 06:01:26 +0000
268@@ -0,0 +1,33 @@
269+<?xml version="1.0" encoding="utf-8"?>
270+<openerp>
271+ <data>
272+ <!-- Payment Terms Line -->
273+ <record id="view_payment_term_line_tree_month" model="ir.ui.view">
274+ <field name="name">account.payment.term.line.tree.month</field>
275+ <field name="model">account.payment.term.line</field>
276+ <field name="inherit_id" ref="account.view_payment_term_line_tree"/>
277+ <field name="arch" type="xml">
278+ <field name="days" position="after">
279+ <field name="commercial_month"/>
280+ <field name="months"/>
281+ </field>
282+ </field>
283+ </record>
284+
285+ <record id="view_payment_term_line_form_month" model="ir.ui.view">
286+ <field name="name">account.payment.term.line.form.month</field>
287+ <field name="model">account.payment.term.line</field>
288+ <field name="inherit_id" ref="account.view_payment_term_line_form"/>
289+ <field name="arch" type="xml">
290+ <field name="days" position="before">
291+ <field name="commercial_month" />
292+ <field name="months" attrs="{'invisible':[('commercial_month','=',False)],'required':[('commercial_month','=',True)],}"/>
293+ </field>
294+ <xpath expr="/form/group/group/field[@name='days']" position="attributes">
295+ <attribute name="attrs">{'invisible':[('commercial_month','=',True)],'required':[('commercial_month','=',False)],}</attribute>
296+ </xpath>
297+ </field>
298+ </record>
299+
300+ </data>
301+</openerp>
302
303=== added directory 'account_payment_term_month/security'
304=== added directory 'account_payment_term_month/static'
305=== added directory 'account_payment_term_month/static/src'
306=== added directory 'account_payment_term_month/static/src/img'
307=== added file 'account_payment_term_month/static/src/img/icon.png'
308Binary files account_payment_term_month/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_payment_term_month/static/src/img/icon.png 2014-05-28 06:01:26 +0000 differ
309=== added directory 'account_payment_term_month/test'
310=== added file 'account_payment_term_month/test/invoice_emission.yml'
311--- account_payment_term_month/test/invoice_emission.yml 1970-01-01 00:00:00 +0000
312+++ account_payment_term_month/test/invoice_emission.yml 2014-05-28 06:01:26 +0000
313@@ -0,0 +1,67 @@
314+-
315+ I create a account payment term record.
316+-
317+ !record {model: account.payment.term, id: account_payment_term_daysendofmonth0}:
318+ line_ids:
319+ - days: 30
320+ days2: -1
321+ value: balance
322+ name: 30 days end of month
323+-
324+ I create a supplier invoice
325+-
326+ !record {model: account.invoice, id: account_invoice_supplier0, view: account.invoice_supplier_form}:
327+ check_total: 3000.0
328+ date_invoice: !eval "'%s-01-30' %(datetime.now().year)"
329+ invoice_line:
330+ - price_unit: 300.0
331+ product_id: product.product_product_5
332+ quantity: 10.0
333+ journal_id: account.expenses_journal
334+ partner_id: base.res_partner_3
335+ payment_term: account_payment_term_daysendofmonth0
336+ reference_type: none
337+ type: in_invoice
338+-
339+ I change the state of invoice to open by clicking Validate button
340+-
341+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0}
342+-
343+ I check that payment expiration is wrong at year-03-31
344+-
345+ !assert {model: account.invoice, id: account_invoice_supplier0}:
346+ - date_due == '%s-03-31' %(datetime.now().year)
347+-
348+ I create another end of month payment term with commercial_month
349+-
350+ !record {model: account.payment.term, id: account_payment_term_daysendofmonth1}:
351+ line_ids:
352+ - commercial_month: True
353+ months: 1
354+ days2: -1
355+ value: balance
356+ name: 30 days end of month
357+-
358+ I create an invoice with the commercial_month payment term
359+-
360+ !record {model: account.invoice, id: account_invoice_supplier1, view: account.invoice_supplier_form}:
361+ check_total: 3000.0
362+ date_invoice: !eval "'%s-01-30' %(datetime.now().year)"
363+ invoice_line:
364+ - price_unit: 300.0
365+ product_id: product.product_product_5
366+ quantity: 10.0
367+ journal_id: account.expenses_journal
368+ partner_id: base.res_partner_3
369+ payment_term: account_payment_term_daysendofmonth1
370+ reference_type: none
371+ type: in_invoice
372+-
373+ I change the state of invoice to open by clicking Validate button
374+-
375+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier1}
376+-
377+ I check that payment expiration is correct at year-02-28
378+-
379+ !assert {model: account.invoice, id: account_invoice_supplier1}:
380+ - date_due == '%s-02-28' %(datetime.now().year)