Merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto into lp:openerp-venezuela-localization

Proposed by hbto [Vauxoo] http://www.vauxoo.com on 2012-12-10
Status: Merged
Merged at revision: 765
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto
Merge into: lp:openerp-venezuela-localization
Diff against target: 1394 lines (+798/-267)
17 files modified
l10n_ve_fiscal_requirements/__openerp__.py (+1/-1)
l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi (+234/-0)
l10n_ve_fiscal_requirements/model/__init__.py (+1/-0)
l10n_ve_fiscal_requirements/model/account.py (+49/-0)
l10n_ve_fiscal_requirements/model/invoice.py (+16/-0)
l10n_ve_fiscal_requirements/model/l10n_ut.py (+4/-2)
l10n_ve_fiscal_requirements/model/partner.py (+153/-19)
l10n_ve_fiscal_requirements/model/res_company.py (+13/-0)
l10n_ve_fiscal_requirements/model/seniat_url.py (+44/-52)
l10n_ve_fiscal_requirements/view/account_invoice_view.xml (+85/-5)
l10n_ve_fiscal_requirements/view/partner_view.xml (+30/-24)
l10n_ve_fiscal_requirements/view/res_company_view.xml (+6/-6)
l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py (+135/-121)
l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py (+22/-19)
l10n_ve_fiscal_requirements/wizard/update_info_partner.py (+4/-8)
l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py (+0/-7)
l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py (+1/-3)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Pending
Review via email: mp+138900@code.launchpad.net

Description of the change

Version revisada del modulo de fiscal requirements

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_requirements/__openerp__.py'
2--- l10n_ve_fiscal_requirements/__openerp__.py 2012-09-26 20:05:11 +0000
3+++ l10n_ve_fiscal_requirements/__openerp__.py 2012-12-10 03:34:20 +0000
4@@ -23,7 +23,7 @@
5 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6 ################################################################################
7 {
8- "name" : "Requirements for Venezuela",
9+ "name" : "Venezuelan Fiscal Requirements",
10 "version" : "0.2",
11 "author" : "Vauxoo",
12 "website" : "http://vauxoo.com",
13
14=== added file 'l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi'
15--- l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi 1970-01-01 00:00:00 +0000
16+++ l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi 2012-12-10 03:34:20 +0000
17@@ -0,0 +1,234 @@
18+<?xml version="1.0" encoding="UTF-8"?>
19+<XMI verified="false" xmi.version="1.2" timestamp="2012-12-01T15:25:02" xmlns:UML="http://schema.omg.org/spec/UML/1.3">
20+ <XMI.header>
21+ <XMI.documentation>
22+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
23+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
24+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
25+ </XMI.documentation>
26+ <XMI.metamodel xmi.version="1.3" href="UML.xml" xmi.name="UML"/>
27+ </XMI.header>
28+ <XMI.content>
29+ <UML:Model isSpecification="false" isAbstract="false" isLeaf="false" xmi.id="m1" isRoot="false" name="UML Model">
30+ <UML:Namespace.ownedElement>
31+ <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="folder" name="folder"/>
32+ <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="datatype" name="datatype"/>
33+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Logical View" name="Logical View">
34+ <UML:Namespace.ownedElement>
35+ <UML:Package stereotype="folder" visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Datatypes" name="Datatypes">
36+ <UML:Namespace.ownedElement>
37+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Hhr1p6xuKJbV" name="int"/>
38+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="se8bAs3OdVm5" name="char"/>
39+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="LoKxVQWk5Mjs" name="bool"/>
40+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="QgnlyMEo0MP9" name="float"/>
41+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="CSVpvHsE4AAX" name="double"/>
42+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="bgHg00XReKAc" name="short"/>
43+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="eOPdjomtFFhA" name="long"/>
44+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="UZPYkZ3JDKxE" name="unsigned int"/>
45+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="IUdxmlXR9w4q" name="unsigned short"/>
46+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="joky3R6XyV4g" name="unsigned long"/>
47+ <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="27xGSvSiN3f8" name="string"/>
48+ </UML:Namespace.ownedElement>
49+ </UML:Package>
50+ </UML:Namespace.ownedElement>
51+ <XMI.extension xmi.extender="umbrello">
52+ <diagrams>
53+ <diagram showopsig="1" linecolor="#ff0000" snapx="10" showattribassocs="1" snapy="10" linewidth="0" showattsig="1" isopen="0" showpackage="1" showpubliconly="1" showstereotype="1" name="class diagram" font="Sans Serif,9,-1,0,50,0,0,0,0,0" canvasheight="537" canvaswidth="811" localid="-1" snapcsgrid="0" showgrid="0" showops="1" griddotcolor="#000000" backgroundcolor="#ffffff" usefillcolor="1" fillcolor="#ffff00" zoom="100" xmi.id="DnSQSq2Hcg6b" documentation="" showscope="1" snapgrid="0" showatts="1" type="1">
54+ <widgets/>
55+ <messages/>
56+ <associations/>
57+ </diagram>
58+ <diagram showopsig="1" linecolor="#ff0000" snapx="10" showattribassocs="1" snapy="10" linewidth="0" showattsig="1" isopen="0" showpackage="1" showpubliconly="1" showstereotype="1" name="base_vat" font="Sans Serif,9,-1,0,50,0,0,0,0,0" canvasheight="537" canvaswidth="811" localid="-1" snapcsgrid="0" showgrid="0" showops="1" griddotcolor="#000000" backgroundcolor="#ffffff" usefillcolor="1" fillcolor="#ffff00" zoom="100" xmi.id="oBZv5bkoPSkS" documentation="" showscope="1" snapgrid="0" showatts="1" type="1">
59+ <widgets/>
60+ <messages/>
61+ <associations/>
62+ </diagram>
63+ <diagram showopsig="1" linecolor="#ff0000" snapx="10" showattribassocs="1" snapy="10" linewidth="0" showattsig="1" isopen="1" showpackage="1" showpubliconly="1" showstereotype="1" name="activity diagram" font="Sans Serif,9,-1,0,50,0,0,0,0,0" canvasheight="709" canvaswidth="794" localid="-1" snapcsgrid="0" showgrid="1" showops="1" griddotcolor="#808080" backgroundcolor="#ffffff" usefillcolor="1" fillcolor="#ffff00" zoom="100" xmi.id="trxpM1WN9Tbb" documentation="" showscope="1" snapgrid="0" showatts="1" type="6">
64+ <widgets>
65+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="324" showstereotype="1" y="0" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="28" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="M3Ji4xqq6NjB" postcondition="" documentation="" activitytype="0" height="28" precondition=""/>
66+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="295" showstereotype="1" y="53" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="126" isinstance="0" usefillcolor="1" fillcolor="none" activityname="button_check_vat" xmi.id="yTyNvinmZkau" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
67+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="283" showstereotype="1" y="460" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="20" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="m4HvVsUqtlYv" postcondition="" documentation="" activitytype="4" height="20" precondition=""/>
68+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="110" showstereotype="1" y="675" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="30" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="gMlmjSwhwu2p" postcondition="" documentation="" activitytype="2" height="30" precondition=""/>
69+ <notewidget width="60" showstereotype="1" x="542" noteType="0" usesdiagramusefillcolor="1" y="501" usesdiagramfillcolor="1" isinstance="0" fillcolor="none" height="30" linecolor="none" xmi.id="cpaCXA4JCJCh" usefillcolor="1" linewidth="none" font="Sans Serif,9,-1,0,50,0,0,0,0,0" text=""/>
70+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="228" showstereotype="1" y="551" text="Failed vat validity" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="113" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="9eX2O5v4Rgp8" height="18"/>
71+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="70" showstereotype="1" y="573" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="120" isinstance="0" usefillcolor="1" fillcolor="none" activityname="Message Error!!!" xmi.id="8lp2frqHeORC" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
72+ <regionwidget width="339" showstereotype="1" x="42" usesdiagramusefillcolor="1" y="157" usesdiagramfillcolor="1" isinstance="0" fillcolor="none" height="362" linecolor="none" regionname="" xmi.id="BR7opZyL2R3p" usefillcolor="1" documentation="" linewidth="none" font="Sans Serif,9,-1,0,50,0,0,0,0,0"/>
73+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="156" showstereotype="1" y="131" text="check_vat" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="68" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="3RkKMgyKWfi3" height="18"/>
74+ <notewidget width="60" showstereotype="1" x="173" noteType="0" usesdiagramusefillcolor="1" y="161" usesdiagramfillcolor="1" isinstance="0" fillcolor="none" height="30" linecolor="none" xmi.id="9FeMZFEkhMWW" usefillcolor="1" linewidth="none" font="Sans Serif,9,-1,0,50,0,0,0,0,0" text=""/>
75+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="134" showstereotype="1" y="176" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="110" isinstance="0" usefillcolor="1" fillcolor="none" activityname="vat_check_vies" xmi.id="tUstutixKRHe" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
76+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="118" showstereotype="1" y="261" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="20" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="7Gzdtfe1uGNT" postcondition="" documentation="" activitytype="4" height="20" precondition=""/>
77+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="252" showstereotype="1" y="270" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="110" isinstance="0" usefillcolor="1" fillcolor="none" activityname="vies_vat_check" xmi.id="WaCBughnBXe5" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
78+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="80" showstereotype="1" y="364" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="126" isinstance="0" usefillcolor="1" fillcolor="none" activityname="simple_vat_check" xmi.id="RL2jmKOtYLUP" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
79+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="91" showstereotype="1" y="460" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="101" isinstance="0" usefillcolor="1" fillcolor="none" activityname="check_vat_ve" xmi.id="09QvNmMtMW2G" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
80+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="156" showstereotype="1" y="258" text="rc.check_vies = True" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="131" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="Dk1MFdReyROk" height="18"/>
81+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="283" showstereotype="1" y="365" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="20" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="lkbH56h3D7ya" postcondition="" documentation="" activitytype="4" height="20" precondition=""/>
82+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="237" showstereotype="1" y="355" text="failed" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="41" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="tJSDnUR0CSMS" height="18"/>
83+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="332" showstereotype="1" y="452" text="successed" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="70" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="4l42DQnyAMED" height="18"/>
84+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="57" showstereotype="1" y="304" text="rc.check_vies = False" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="136" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="6XIJxdj1On2b" height="18"/>
85+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="427" showstereotype="1" y="462" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="20" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="EnYM9maafrBf" postcondition="" documentation="" activitytype="4" height="20" precondition=""/>
86+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="416" showstereotype="1" y="346" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="81" isinstance="0" usefillcolor="1" fillcolor="none" activityname="update_rif" xmi.id="2NXZzbr667N1" postcondition="" documentation="" activitytype="1" height="24" precondition=""/>
87+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="422" showstereotype="1" y="413" text="VE vat" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="47" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="k619r3i5qGSx" height="18"/>
88+ <floatingtext linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="513" showstereotype="1" y="451" text="NOn VE vat" font="Sans Serif,9,-1,0,50,0,0,0,0,0" pretext="" role="700" width="77" isinstance="0" posttext="" usefillcolor="1" fillcolor="none" xmi.id="00XfrjJt4oQ4" height="18"/>
89+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="647" showstereotype="1" y="640" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="15" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="NF8TNVT7ZUEQ" postcondition="" documentation="" activitytype="2" height="15" precondition=""/>
90+ <activitywidget linecolor="none" usesdiagramfillcolor="1" linewidth="none" usesdiagramusefillcolor="1" x="642" showstereotype="1" y="465" font="Sans Serif,9,-1,0,50,0,0,0,0,0" width="20" isinstance="0" usefillcolor="1" fillcolor="none" activityname="" xmi.id="XxWLBwICwopl" postcondition="" documentation="" activitytype="4" height="20" precondition=""/>
91+ </widgets>
92+ <messages/>
93+ <associations>
94+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="yTyNvinmZkau" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="M3Ji4xqq6NjB" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="2" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
95+ <linepath>
96+ <startpoint startx="336" starty="28"/>
97+ <endpoint endx="336" endy="53"/>
98+ </linepath>
99+ </assocwidget>
100+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="8lp2frqHeORC" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="m4HvVsUqtlYv" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="0" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
101+ <linepath>
102+ <startpoint startx="295" starty="480"/>
103+ <endpoint endx="190" endy="575"/>
104+ <point x="295" y="575"/>
105+ </linepath>
106+ </assocwidget>
107+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="gMlmjSwhwu2p" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="8lp2frqHeORC" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="0" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
108+ <linepath>
109+ <startpoint startx="128" starty="597"/>
110+ <endpoint endx="128" endy="675"/>
111+ </linepath>
112+ </assocwidget>
113+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="BR7opZyL2R3p" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="yTyNvinmZkau" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="99" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
114+ <linepath>
115+ <startpoint startx="297" starty="77"/>
116+ <endpoint endx="297" endy="157"/>
117+ </linepath>
118+ </assocwidget>
119+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="7Gzdtfe1uGNT" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="tUstutixKRHe" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="185" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
120+ <linepath>
121+ <startpoint startx="138" starty="200"/>
122+ <endpoint endx="138" endy="261"/>
123+ </linepath>
124+ </assocwidget>
125+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="WaCBughnBXe5" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="7Gzdtfe1uGNT" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="0" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
126+ <linepath>
127+ <startpoint startx="138" starty="276"/>
128+ <endpoint endx="252" endy="276"/>
129+ </linepath>
130+ </assocwidget>
131+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="138" widgetbid="09QvNmMtMW2G" indexb="1" linewidth="none" usesdiagramusefillcolor="10" totalcounta="2" totalcountb="2" widgetaid="RL2jmKOtYLUP" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="72" fillcolor="none" changeabilityA="900" changeabilityB="900" documentation="" type="515">
132+ <linepath>
133+ <startpoint startx="132" starty="388"/>
134+ <endpoint endx="132" endy="460"/>
135+ </linepath>
136+ </assocwidget>
137+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="32" widgetbid="lkbH56h3D7ya" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="WaCBughnBXe5" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="10" fillcolor="none" changeabilityA="900" changeabilityB="900" documentation="" type="515">
138+ <linepath>
139+ <startpoint startx="292" starty="294"/>
140+ <endpoint endx="292" endy="365"/>
141+ </linepath>
142+ </assocwidget>
143+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="RL2jmKOtYLUP" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="lkbH56h3D7ya" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="0" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
144+ <linepath>
145+ <startpoint startx="283" starty="375"/>
146+ <endpoint endx="206" endy="375"/>
147+ </linepath>
148+ </assocwidget>
149+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="m4HvVsUqtlYv" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="lkbH56h3D7ya" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="51" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
150+ <linepath>
151+ <startpoint startx="292" starty="385"/>
152+ <endpoint endx="292" endy="460"/>
153+ </linepath>
154+ </assocwidget>
155+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="m4HvVsUqtlYv" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="09QvNmMtMW2G" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="137" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
156+ <linepath>
157+ <startpoint startx="192" starty="470"/>
158+ <endpoint endx="283" endy="470"/>
159+ </linepath>
160+ </assocwidget>
161+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="RL2jmKOtYLUP" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="7Gzdtfe1uGNT" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="141" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
162+ <linepath>
163+ <startpoint startx="118" starty="281"/>
164+ <endpoint endx="118" endy="364"/>
165+ </linepath>
166+ </assocwidget>
167+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="EnYM9maafrBf" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="m4HvVsUqtlYv" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="21" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
168+ <linepath>
169+ <startpoint startx="303" starty="471"/>
170+ <endpoint endx="427" endy="471"/>
171+ </linepath>
172+ </assocwidget>
173+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="161" widgetbid="2NXZzbr667N1" indexb="1" linewidth="none" usesdiagramusefillcolor="10" totalcounta="2" totalcountb="2" widgetaid="EnYM9maafrBf" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="168" fillcolor="none" changeabilityA="900" changeabilityB="900" documentation="" type="515">
174+ <linepath>
175+ <startpoint startx="437" starty="462"/>
176+ <endpoint endx="437" endy="370"/>
177+ </linepath>
178+ </assocwidget>
179+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="XxWLBwICwopl" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="2NXZzbr667N1" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="198" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
180+ <linepath>
181+ <startpoint startx="497" starty="364"/>
182+ <endpoint endx="652" endy="465"/>
183+ <point x="653" y="364"/>
184+ <point x="652" y="435"/>
185+ </linepath>
186+ </assocwidget>
187+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="82" widgetbid="NF8TNVT7ZUEQ" indexb="1" linewidth="none" usesdiagramusefillcolor="8" totalcounta="2" totalcountb="2" widgetaid="XxWLBwICwopl" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="16" fillcolor="none" changeabilityA="900" changeabilityB="900" documentation="" type="515">
188+ <linepath>
189+ <startpoint startx="653" starty="485"/>
190+ <endpoint endx="653" endy="640"/>
191+ </linepath>
192+ </assocwidget>
193+ <assocwidget indexa="1" roleBdoc="" linecolor="none" usesdiagramfillcolor="0" widgetbid="XxWLBwICwopl" indexb="1" linewidth="none" usesdiagramusefillcolor="0" totalcounta="2" totalcountb="2" widgetaid="EnYM9maafrBf" roleAdoc="" visibilityA="0" visibilityB="0" usefillcolor="198" fillcolor="#000000" changeabilityA="900" changeabilityB="900" documentation="" type="515">
194+ <linepath>
195+ <startpoint startx="447" starty="476"/>
196+ <endpoint endx="642" endy="476"/>
197+ </linepath>
198+ </assocwidget>
199+ </associations>
200+ </diagram>
201+ </diagrams>
202+ </XMI.extension>
203+ </UML:Model>
204+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Use Case View" name="Use Case View">
205+ <UML:Namespace.ownedElement/>
206+ </UML:Model>
207+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Component View" name="Component View">
208+ <UML:Namespace.ownedElement/>
209+ </UML:Model>
210+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Deployment View" name="Deployment View">
211+ <UML:Namespace.ownedElement/>
212+ </UML:Model>
213+ <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Entity Relationship Model" name="Entity Relationship Model">
214+ <UML:Namespace.ownedElement/>
215+ </UML:Model>
216+ </UML:Namespace.ownedElement>
217+ </UML:Model>
218+ </XMI.content>
219+ <XMI.extensions xmi.extender="umbrello">
220+ <docsettings viewid="trxpM1WN9Tbb" uniqueid="XxWLBwICwopl" documentation=""/>
221+ <listview>
222+ <listitem open="1" type="800" id="Views">
223+ <listitem open="1" type="821" id="Component View"/>
224+ <listitem open="1" type="827" id="Deployment View"/>
225+ <listitem open="1" type="836" id="Entity Relationship Model"/>
226+ <listitem open="1" type="801" id="Logical View">
227+ <listitem open="0" type="809" id="trxpM1WN9Tbb" label="activity diagram"/>
228+ <listitem open="0" type="807" id="oBZv5bkoPSkS" label="base_vat"/>
229+ <listitem open="0" type="807" id="DnSQSq2Hcg6b" label="class diagram"/>
230+ <listitem open="0" type="830" id="Datatypes">
231+ <listitem open="1" type="829" id="LoKxVQWk5Mjs"/>
232+ <listitem open="1" type="829" id="se8bAs3OdVm5"/>
233+ <listitem open="1" type="829" id="CSVpvHsE4AAX"/>
234+ <listitem open="1" type="829" id="QgnlyMEo0MP9"/>
235+ <listitem open="1" type="829" id="Hhr1p6xuKJbV"/>
236+ <listitem open="1" type="829" id="eOPdjomtFFhA"/>
237+ <listitem open="1" type="829" id="bgHg00XReKAc"/>
238+ <listitem open="1" type="829" id="27xGSvSiN3f8"/>
239+ <listitem open="1" type="829" id="UZPYkZ3JDKxE"/>
240+ <listitem open="1" type="829" id="joky3R6XyV4g"/>
241+ <listitem open="1" type="829" id="IUdxmlXR9w4q"/>
242+ </listitem>
243+ </listitem>
244+ <listitem open="1" type="802" id="Use Case View"/>
245+ </listitem>
246+ </listview>
247+ <codegeneration>
248+ <codegenerator language="C++"/>
249+ </codegeneration>
250+ </XMI.extensions>
251+</XMI>
252
253=== modified file 'l10n_ve_fiscal_requirements/model/__init__.py'
254--- l10n_ve_fiscal_requirements/model/__init__.py 2012-11-29 19:13:14 +0000
255+++ l10n_ve_fiscal_requirements/model/__init__.py 2012-12-10 03:34:20 +0000
256@@ -22,6 +22,7 @@
257 # You should have received a copy of the GNU Affero General Public License
258 # along with this program. If not, see <http://www.gnu.org/licenses/>.
259 ################################################################################
260+import account
261 import invoice
262 import partner
263 import res_company
264
265=== added file 'l10n_ve_fiscal_requirements/model/account.py'
266--- l10n_ve_fiscal_requirements/model/account.py 1970-01-01 00:00:00 +0000
267+++ l10n_ve_fiscal_requirements/model/account.py 2012-12-10 03:34:20 +0000
268@@ -0,0 +1,49 @@
269+#!/usr/bin/python
270+# -*- encoding: utf-8 -*-
271+###########################################################################
272+# Module Writen to OpenERP, Open Source Management Solution
273+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
274+# All Rights Reserved
275+###############Credits######################################################
276+# Coded by: Vauxoo C.A.
277+# Planified by: Nhomar Hernandez
278+# Audited by: Vauxoo C.A.
279+#############################################################################
280+# This program is free software: you can redistribute it and/or modify
281+# it under the terms of the GNU Affero General Public License as published by
282+# the Free Software Foundation, either version 3 of the License, or
283+# (at your option) any later version.
284+#
285+# This program is distributed in the hope that it will be useful,
286+# but WITHOUT ANY WARRANTY; without even the implied warranty of
287+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
288+# GNU Affero General Public License for more details.
289+#
290+# You should have received a copy of the GNU Affero General Public License
291+# along with this program. If not, see <http://www.gnu.org/licenses/>.
292+################################################################################
293+
294+from osv import fields, osv
295+__TYPES__ = [('sale_debit', 'Sale Debit'),('purchase_debit', 'Purchase Debit')]
296+
297+__HELP__= " Select 'Sale Debit' for customer debit note journals. Select 'Purchase Debit' for supplier debit note journals."
298+
299+class account_journal(osv.osv):
300+ _inherit = 'account.journal'
301+
302+ _columns = {
303+'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'),
304+ ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'),
305+ ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'),
306+ ('situation', 'Opening/Closing Situation'),('sale_debit', 'Sale Debit'),
307+ ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True,
308+ help = "Select 'Sale' for customer invoices journals."\
309+ " Select 'Purchase' for supplier invoices journals."\
310+ " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\
311+ " Select 'General' for miscellaneous operations journals."\
312+ " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\
313+ " Select 'Sale Debit' for customer debit note journals."\
314+ " Select 'Purchase Debit' for supplier debit note journals.")
315+ }
316+
317+account_journal()
318
319=== modified file 'l10n_ve_fiscal_requirements/model/invoice.py'
320--- l10n_ve_fiscal_requirements/model/invoice.py 2012-11-29 19:13:14 +0000
321+++ l10n_ve_fiscal_requirements/model/invoice.py 2012-12-10 03:34:20 +0000
322@@ -27,6 +27,22 @@
323 from tools.translate import _
324 class account_invoice(osv.osv):
325
326+ def _get_journal(self, cr, uid, context=None):
327+ if context is None:
328+ context = {}
329+ journal_type_inv = context.get('journal_type', 'sale')
330+ if journal_type_inv in ('sale_debit', 'purchase_debit'):
331+ user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
332+ company_id = context.get('company_id', user.company_id.id)
333+ journal_obj = self.pool.get('account.journal')
334+ res = journal_obj.search(cr, uid, [('type', '=',journal_type_inv),
335+ ('company_id', '=', company_id)],
336+ limit=1)
337+ return res and res[0] or False
338+ else:
339+ return super(account_invoice, self)._get_journal(cr, uid, context=context)
340+
341+
342
343 def _unique_invoice_per_partner(self, cr, uid, ids, context=None):
344 if context is None: context={}
345
346=== modified file 'l10n_ve_fiscal_requirements/model/l10n_ut.py'
347--- l10n_ve_fiscal_requirements/model/l10n_ut.py 2012-11-29 19:13:14 +0000
348+++ l10n_ve_fiscal_requirements/model/l10n_ut.py 2012-12-10 03:34:20 +0000
349@@ -56,7 +56,8 @@
350 rate=cr.fetchall()[0][0]
351 return rate
352
353- def compute(self, cr, uid, from_amount, date=False, context={}):
354+ def compute(self, cr, uid, from_amount, date=False, context=None):
355+ if context is None: context ={}
356 result = 0.0
357 ut = self.get_amount_ut(cr, uid, date=False)
358 if ut:
359@@ -64,7 +65,8 @@
360
361 return result
362
363- def compute_ut_to_money(self, cr, uid, amount_ut, date=False, context={}):
364+ def compute_ut_to_money(self, cr, uid, amount_ut, date=False, context=None):
365+ if context is None: context ={}
366 money = 0.0
367 ut = self.get_amount_ut(cr, uid, date)
368 if ut:
369
370=== modified file 'l10n_ve_fiscal_requirements/model/partner.py'
371--- l10n_ve_fiscal_requirements/model/partner.py 2012-11-29 19:13:14 +0000
372+++ l10n_ve_fiscal_requirements/model/partner.py 2012-12-10 03:34:20 +0000
373@@ -14,6 +14,8 @@
374 # Miguel Delgado <miguel@openerp.com.ve>
375 # Israel Fermín Montilla <israel@openerp.com.ve>
376 # Juan Márquez <jmarquez@tecvemar.com.ve>
377+# Humberto Arocha <hbto@vauxoo.com>
378+# Yanina Aular <yanina.aular@vauxoo.com>
379 #
380 # This program is free software: you can redistribute it and/or modify
381 # it under the terms of the GNU Affero General Public License as
382@@ -30,17 +32,36 @@
383 #
384 ##############################################################################
385
386+from openerp.osv.orm import except_orm
387 from osv import fields, osv
388 from tools.translate import _
389 import re
390
391 class res_partner(osv.osv):
392 _inherit = 'res.partner'
393-
394+
395+ def _get_country_code(self, cr, uid, context=None):
396+ context = context or {}
397+ user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
398+ return user_company.partner_id and user_company.partner_id.country_id \
399+ and user_company.partner_id.country_id.code or 'XX'
400+
401+ def default_get(self, cr, uid, fields, context=None):
402+ context = context or {}
403+ res = super(res_partner, self).default_get(cr, uid, fields, context=context)
404+ res.update({'uid_country': self._get_country_code(cr,uid,context=context)})
405+ return res
406+
407+ def _get_uid_country(self, cr, uid, ids, field_name, args, context=None):
408+ context = context or {}
409+ res= {}.fromkeys(ids,self._get_country_code(cr,uid,context=context))
410+ return res
411+
412 _columns = {
413 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),
414+ 'uid_country': fields.function(_get_uid_country, type='char', string="uid_country", size=20),
415 }
416-
417+
418 _default = {
419 'seniat_updated': False,
420 }
421@@ -60,7 +81,7 @@
422 '''
423 def _check_partner_invoice_addr(self,cr,uid,ids,context={}):
424 partner_obj = self.browse(cr,uid,ids[0])
425- if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE':
426+ if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id:
427 res = partner_obj.type == 'invoice'
428 if res:
429 return True
430@@ -70,26 +91,132 @@
431 return True
432 return True
433
434- def _check_vat_uniqueness(self, cr, uid, ids, context={}):
435- #Check if its possible to use 'browse' in this 'read'
436+ def _check_vat_uniqueness_def(self, cr, uid, ids, current_vat,list_node_tree, context=None):
437+ if context is None: context = {}
438+ nodes = self.search(cr, uid, [] )
439+ nodes = list( set(nodes) - set(list_node_tree) )
440+ nodes = self.search(cr, uid, [('vat','=',current_vat),('id','in',nodes)] )
441+ return not nodes
442+
443+ def _check_vat_uniqueness(self, cr, uid, ids, context=None):
444+ if context is None: context = {}
445+
446+ user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
447+
448+ #User must be of VE
449+ if not (user_company.partner_id and user_company.partner_id.country_id and user_company.partner_id.country_id.code == 'VE'):
450+ return True
451+
452 partner_brw = self.browse(cr, uid,ids)
453- if not 'VE' in [a.country_id.code for a in partner_brw ]:
454- return True
455-
456 current_vat = partner_brw[0].vat
457-
458- if not current_vat or current_vat.strip()=='':
459+ current_parent_id = partner_brw[0].parent_id
460+
461+ if not current_vat:
462 return True # Accept empty VAT's
463-
464- duplicates = self.read(cr, uid, self.search(cr, uid, [('vat', '=', current_vat)]), ['vat'])
465-
466- return not current_vat in [p['vat'] for p in duplicates if p['id'] != partner_brw[0].id]
467+
468+ #Partners without parent, must have RIF uniqueness
469+ if not current_parent_id:
470+ duplicates = self.browse(cr, uid, self.search(cr, uid, [('vat', '=', current_vat),('parent_id','=',None),('id','!=',partner_brw[0].id)]))
471+ return not duplicates
472+
473+ currrent_is_company =partner_brw[0].is_company
474+
475+ #Partners that are not company and have parent_id, can't have partners' RIF that are not part of its siblings or parent
476+ if(current_parent_id and not currrent_is_company):
477+ list_nodes = current_parent_id.child_ids
478+ list_nodes = map(lambda x: x.id, list_nodes)
479+ list_nodes.append(current_parent_id.id)
480+ return self._check_vat_uniqueness_def(cr, uid, ids, current_vat, list_nodes , context=context)
481+
482+ return True
483+
484+ def _check_vat_mandatory(self, cr, uid, ids, context=None):
485+ '''This method will check the vat mandatoriness in partners
486+ for those user logged on with a Venezuelan Company
487+
488+ The method will return True when:
489+ *) The user's company is not from Venezuela
490+ *) The partner being created is the one for the a company being created [TODO]
491+
492+ The method will return False when:
493+ *) The user's company is from Venezuela AND the vat field is empty AND:
494+ +) partner is_company=True AND parent_id is not NULL
495+ +) partner with parent_id is NULL
496+ +) partner with parent_id is NOT NULL AND type of address is invoice
497+ '''
498+ if context is None: context = {}
499+ # Avoiding Egg-Chicken Syndrome
500+ # TODO: Refine this approach this is big exception
501+ # One that can be handle be end user, I hope so!!!
502+ if context.get('create_company',False):
503+ return True
504+
505+ user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
506+ #Check if the user is not from a VE Company
507+ if not (user_company.partner_id and user_company.partner_id.country_id and user_company.partner_id.country_id.code == 'VE'):
508+ return True
509+
510+ partner_brw = self.browse(cr, uid,ids)
511+ current_vat = partner_brw[0].vat
512+ current_parent_id = partner_brw[0].parent_id
513+ current_is_company =partner_brw[0].is_company
514+ current_type = partner_brw[0].type
515+
516+ #Partners company type and with parent, not exists
517+ if (current_is_company and current_parent_id):
518+ return False
519+
520+ #Partners without parent must have vat
521+ if not current_vat and not current_parent_id:
522+ return False
523+
524+ #Partners invoice type that not be company and have parent, must have vat
525+ if (current_type == 'invoice' and not current_vat and not current_is_company and current_parent_id):
526+ return False
527+
528+ return True
529+
530+ def _validate(self, cr, uid, ids, context=None):
531+ #In the original orm.py openerp does not allow using
532+ #context within the constraint because we have to yield
533+ # the same result always,
534+ # we have overridden this behaviour
535+ # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER
536+ context = context or {}
537+ lng = context.get('lang')
538+ trans = self.pool.get('ir.translation')
539+ error_msgs = []
540+ for constraint in self._constraints:
541+ fun, msg, fields = constraint
542+ # We don't pass around the context here: validation code
543+ # must always yield the same results.
544+ if not fun(self, cr, uid, ids, context=context):
545+ # Check presence of __call__ directly instead of using
546+ # callable() because it will be deprecated as of Python 3.0
547+ if hasattr(msg, '__call__'):
548+ tmp_msg = msg(self, cr, uid, ids, context=context)
549+ if isinstance(tmp_msg, tuple):
550+ tmp_msg, params = tmp_msg
551+ translated_msg = tmp_msg % params
552+ else:
553+ translated_msg = tmp_msg
554+ else:
555+ translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)
556+ error_msgs.append(
557+ _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
558+ )
559+ self._invalids.update(fields)
560+ if error_msgs:
561+ raise except_orm('ValidateError', '\n'.join(error_msgs))
562+ else:
563+ self._invalids.clear()
564
565 _constraints = [
566+ (_check_vat_mandatory, _("Error ! VAT is mandatory"), []),
567 (_check_vat_uniqueness, _("Error ! Partner's VAT must be a unique value or empty"), []),
568- (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),
569+ #~ (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),
570 ]
571-
572+
573 def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None):
574 if context is None:
575 context={}
576@@ -117,10 +244,8 @@
577 if context is None:
578 context={}
579 if re.search(r'^[VJEG][0-9]{9}$', vat):
580- context.update({'ci_pas':False})
581 return True
582- if re.search(r'^([0-9]{1,8}|[D][0-9]{9})$', vat):
583- context.update({'ci_pas':True})
584+ if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):
585 return True
586 return False
587
588@@ -130,5 +255,14 @@
589 su_obj = self.pool.get('seniat.url')
590 return su_obj.update_rif(cr, uid, ids, context=context)
591
592+ def button_check_vat(self, cr, uid, ids, context=None):
593+ if context is None: context = {}
594+ context.update({'update_fiscal_information':True})
595+ super(res_partner, self).button_check_vat(cr, uid, ids, context=context)
596+ user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
597+ if user_company.vat_check_vies:
598+ # force full VIES online check
599+ self.update_rif(cr, uid, ids, context=context)
600+ return True
601 res_partner()
602 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
603
604=== modified file 'l10n_ve_fiscal_requirements/model/res_company.py'
605--- l10n_ve_fiscal_requirements/model/res_company.py 2012-11-29 19:13:14 +0000
606+++ l10n_ve_fiscal_requirements/model/res_company.py 2012-12-10 03:34:20 +0000
607@@ -37,5 +37,18 @@
608 'jour_id': fields.many2one('account.journal', 'Journal',required=False,help="Default journal for damaged invoices"),
609 'acc_id': fields.many2one('account.account', 'Account',required=False,help="Default account used for invoices and lines from damaged invoices"),
610 }
611+
612+ def create(self, cr, uid, vals, context=None):
613+ if context is None: context = {}
614+ context.update({'create_company':True})
615+ return super(res_company, self).create(cr, uid, vals, context=context)
616+
617+ def write(self, cr, uid, ids, values, context=None):
618+ context = context or {}
619+ self.cache_restart(cr)
620+ context.update({'create_company':True})
621+ return super(res_company, self).write(cr, uid, ids, values, context=context)
622+
623+
624 res_company()
625
626
627=== modified file 'l10n_ve_fiscal_requirements/model/seniat_url.py'
628--- l10n_ve_fiscal_requirements/model/seniat_url.py 2012-11-29 19:13:14 +0000
629+++ l10n_ve_fiscal_requirements/model/seniat_url.py 2012-12-10 03:34:20 +0000
630@@ -63,7 +63,9 @@
631 retries -= 1
632 return str_error
633
634- def _buscar_porcentaje(self,rif,url):
635+ def _buscar_porcentaje(self, cr, uid, rif):
636+ url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
637+ url = url_obj.url_seniat + '%s'
638 context={}
639 html_data = self.pool.get('seniat.url')._load_url(3,url %rif)
640 html_data = unicode(html_data, 'ISO-8859-1').encode('utf-8')
641@@ -84,11 +86,7 @@
642 self.logger.info("RIF: %s Found" % rif)
643 if name.count('(') > 0:
644 name = name[:name.index('(')].rstrip()
645- if context.get('spf_info'):
646- res= {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux,'wh_iva_agent':wh_agent}
647- else:
648- res= {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux}
649- return res
650+ return {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux,'wh_iva_agent':wh_agent}
651
652 def _print_error(self, error, msg):
653 raise osv.except_osv(error,msg)
654@@ -110,25 +108,41 @@
655 return True
656 else:
657 return False
658+ def _get_rif(self, vat, url1, url2, context=None):
659+ if context is None: context={}
660
661- def _dom_giver(self, url1, url2, url3, vat, context):
662- if context.get('ci_pas'):
663- xml_data = self._load_url(3,url3 % vat)
664- match = re.search(r'No existe el contribuyente solicitado', xml_data)
665- vat = '0'*(8-len(vat))+vat
666- match2 = re.search(r'[VJEG]'+vat+'[0-9]{1}', xml_data)
667- if match:
668- return False
669- elif match2:
670- vat = match2.group(0)
671 xml_data = self._load_url(3,url1 % vat)
672-
673- if not self._eval_seniat_data(xml_data,vat,context):
674+ if not self._eval_seniat_data(xml_data,vat,context=context):
675 dom = parseString(xml_data)
676 return self._parse_dom(dom, vat, url2,context=context)
677- else:
678+
679+ def _dom_giver(self, cr, uid, vat, context=None):
680+ if context is None: context={}
681+
682+ url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
683+ url1 = url_obj.name + '%s'
684+ url2 = url_obj.url_seniat + '%s'
685+ url3 = url_obj.url_seniat2 + '%s'
686+ if re.search(r'^[VJEG][0-9]{9}$', vat):
687+ '''Checked vat is a RIF'''
688+ return self._get_rif(vat, url1, url2, context=context)
689+
690+ elif re.search(r'^([D][0-9]{9})$', vat):
691+ '''Checked vat is a Passport'''
692+ #TODO: NEEDS VALID NUMBERS TO CHECK THE VALIDITY AND COMPLETE THIS CODE
693 return False
694
695+ elif re.search(r'^([VE][0-9]{1,8})$', vat):
696+ '''Checked vat is an ID'''
697+ xml_data = self._load_url(3,url3 % str(int(vat[1:])))
698+ vat = vat[1:].rjust(8,'0')
699+ match2 = re.search(r'[VE]'+vat+'[0-9]{1}', xml_data)
700+ if re.search(r'No existe el contribuyente solicitado', xml_data):
701+ return False
702+ elif match2:
703+ vat = match2.group(0)
704+ return self._get_rif(vat, url1, url2, context=context)
705+
706 def _update_partner(self, cr, uid, id, context=None):
707 rp_obj = self.pool.get('res.partner')
708 rp_obj.write(cr, uid, id, {'seniat_updated': True})
709@@ -136,47 +150,25 @@
710 def update_rif(self, cr, uid, ids, context={}):
711 aux=[]
712 rp_obj = self.pool.get('res.partner')
713- url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
714- url1 = url_obj.name + '%s'
715- url2 = url_obj.url_seniat + '%s'
716- url3 = url_obj.url_seniat2 + '%s'
717 if context.get('exec_wizard'):
718- res = self._dom_giver(url1, url2, url3, context['vat'],context)
719+ res = self._dom_giver(cr, uid, context['vat'],context=context)
720 if res:
721- self._update_partner(cr, uid, ids, context)
722+ self._update_partner(cr, uid, ids, context=context)
723 return res
724 else:
725 return False
726 for partner in rp_obj.browse(cr,uid,ids):
727+ if not partner.vat or partner.vat[:2]!='VE':
728+ continue
729 rp_obj.write(cr, uid, partner.id, {'seniat_updated': False})
730- if partner.vat and partner.type == 'invoice':
731- partner_id =partner.id
732- code = partner.country_id and partner.country_id.code
733- if code == 'VE':
734- if rp_obj.check_vat_ve(partner.vat[2:],context):
735- res = self._dom_giver(url1, url2, url3,partner.vat[2:],context)
736- if res:
737- rp_obj.write(cr,uid,partner.id,res)
738- self._update_partner(cr, uid, partner.id, context)
739- else:
740- if not context.get('all_rif'):
741- return False
742- #~ self._print_error(_('Error'),_("Does not exist the contributor requested"))
743- else:
744- if not context.get('all_rif'):
745- return False
746- #~ self._print_error(_('Error'),_("The RIF, CI or passport are not well constructed, please check \n The format of the RIF should be for example J1234567890,CI should be 12345678, and passports must be D123456789"))
747- else:
748- if not context.get('all_rif'):
749- return False
750- #~ self._print_error(_('Error'),_("The country in invoice address is not Venezuela, can not establish connection with sSENIAT"))
751+ res = self._dom_giver(cr, uid, partner.vat[2:],context=context)
752+ if res:
753+ rp_obj.write(cr,uid,partner.id,res)
754+ self._update_partner(cr, uid, partner.id, context)
755 else:
756- if partneri and partner.type == 'invoice':
757- invoices_addr_country = partner.country_id and [partner.country_id.code]
758- if invoices_addr_country:
759- country = [j for j in invoices_addr_country if j]
760- if country and 'VE' in country and not context.get('all_rif',False):
761- self._print_error(_('Vat Error !'),_('The field vat is empty'))
762+ if not context.get('all_rif'):
763+ return False
764+ #~ self._print_error(_('Error'),_("The RIF, CI or passport are not well constructed, please check \n The format of the RIF should be for example J1234567890,CI should be 12345678, and passports must be D123456789"))
765 return True
766
767 def connect_seniat(self, cr, uid, ids, context={}, all_rif=False):
768
769=== modified file 'l10n_ve_fiscal_requirements/view/account_invoice_view.xml'
770--- l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2012-11-07 21:33:58 +0000
771+++ l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2012-12-10 03:34:20 +0000
772@@ -68,7 +68,7 @@
773 type='action'
774 string='Debit Note'
775 icon="gtk-execute"
776- attrs="{'invisible':['|',('state','in',['proforma2','proforma','cancel', 'draft']),('type','in',['out_refund', 'in_refund'])]}"/>
777+ attrs="{'invisible':['|','|',('state','in',['proforma2','proforma','cancel', 'draft']),('type','in',['out_refund', 'in_refund']),('parent_id','!=',False)]}"/>
778 </xpath>
779 <xpath expr="//button[@string='Refund Invoice']" position="after">
780 <button name="%(action_account_invoice_parent)d"
781@@ -181,9 +181,89 @@
782 </field>
783 </record>
784
785-
786-
787-
788-
789+ <record id="action_sale_debit_tree" model="ir.actions.act_window">
790+ <field name="name">Customer Debit Notes</field>
791+ <field name="res_model">account.invoice</field>
792+ <field name="view_type">form</field>
793+ <field name="view_mode">tree,form,calendar,graph</field>
794+ <field eval="False" name="view_id"/>
795+ <field name="domain">[('type','=','out_invoice'),('parent_id','!=',False)]</field>
796+ <field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale_debit'}</field>
797+ <field name="search_view_id" ref="account.view_account_invoice_filter"/>
798+ <field name="help" type="html">
799+ <p class="oe_view_nocontent_create">
800+ Click to create a customer debit note.
801+ </p><p>
802+ OpenERP's electronic invoicing allows to ease and fasten the
803+ collection of customer payments. Your customer receives the
804+ invoice by email and he can pay online and/or import it
805+ in his own system.
806+ </p><p>
807+ The discussions with your customer are automatically displayed at
808+ the bottom of each invoice.
809+ </p>
810+ </field>
811+ </record>
812+
813+ <record id="action_sale_debit_tree_view" model="ir.actions.act_window.view">
814+ <field eval="1" name="sequence"/>
815+ <field name="view_mode">tree</field>
816+ <field name="act_window_id" ref="action_sale_debit_tree"/>
817+ </record>
818+
819+ <record id="action_sale_debit_form_view" model="ir.actions.act_window.view">
820+ <field eval="2" name="sequence"/>
821+ <field name="view_mode">form</field>
822+ <field name="view_id" ref="account.invoice_form"/>
823+ <field name="act_window_id" ref="action_sale_debit_tree"/>
824+ </record>
825+
826+
827+
828+ <menuitem action="action_sale_debit_tree" id="menu_action_sale_debit_tree" parent="account.menu_finance_receivables"/>
829+
830+ <record id="action_purchase_debit_tree" model="ir.actions.act_window">
831+ <field name="name">Supplier Debit Notes</field>
832+ <field name="res_model">account.invoice</field>
833+ <field name="view_type">form</field>
834+ <field name="view_mode">tree,form,calendar,graph</field>
835+ <field eval="False" name="view_id"/>
836+ <field name="domain">[('type','=','in_invoice'),('parent_id','!=',False)]</field>
837+ <field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase_debit'}</field>
838+ <field name="search_view_id" ref="account.view_account_invoice_filter"/>
839+ <field name="help" type="html">
840+ <p class="oe_view_nocontent_create">
841+ Click to record a new supplier debit note.
842+ </p><p>
843+ You can control the invoice from your supplier according to
844+ what you purchased or received. OpenERP can also generate
845+ draft invoices automatically from purchase orders or receipts.
846+ </p>
847+ </field>
848+ </record>
849+
850+ <record id="action_purchase_debit_tree_view" model="ir.actions.act_window.view">
851+ <field eval="1" name="sequence"/>
852+ <field name="view_mode">tree</field>
853+ <field name="act_window_id" ref="action_purchase_debit_tree"/>
854+ </record>
855+
856+ <record id="action_purchase_debit_form_view" model="ir.actions.act_window.view">
857+ <field eval="2" name="sequence"/>
858+ <field name="view_mode">form</field>
859+ <field name="view_id" ref="account.invoice_supplier_form"/>
860+ <field name="act_window_id" ref="action_purchase_debit_tree"/>
861+ </record>
862+
863+ <menuitem action="action_purchase_debit_tree" id="menu_action_purchase_debit_tree" parent="account.menu_finance_payables"/>
864+
865+ <record id="account.action_invoice_tree2" model="ir.actions.act_window">
866+ <field name="domain">[('type','=','in_invoice'),('parent_id','=',False)]</field>
867+ </record>
868+
869+ <record id="account.action_invoice_tree1" model="ir.actions.act_window">
870+ <field name="domain">[('type','=','out_invoice'),('parent_id','=',False)]</field>
871+ </record>
872+
873 </data>
874 </openerp>
875
876=== modified file 'l10n_ve_fiscal_requirements/view/partner_view.xml'
877--- l10n_ve_fiscal_requirements/view/partner_view.xml 2012-11-06 22:01:07 +0000
878+++ l10n_ve_fiscal_requirements/view/partner_view.xml 2012-12-10 03:34:20 +0000
879@@ -3,38 +3,44 @@
880 <data>
881
882 <record id="view_partner_form2" model="ir.ui.view">
883- <field name="name">res.partner.vat.inherit2</field>
884- <field name="model">res.partner</field>
885- <field name="inherit_id" ref="base_vat.view_partner_form"/>
886- <field name="arch" type="xml">
887- <field name="vat" position="replace">
888- </field>
889- </field>
890- </record>
891-
892- <record id="view_partner_form3" model="ir.ui.view">
893- <field name="name">res.partner.vat.inherit3</field>
894+ <field name="name">res.partner.vat.inherit2</field>
895 <field name="model">res.partner</field>
896 <field name="type">form</field>
897 <field name="inherit_id" ref="base.view_partner_form"/>
898 <field name="arch" type="xml">
899- <xpath expr='//field[@name="lang"]' position='after'>
900- <field name="vat" on_change="vat_change_fiscal_requirements(vat)" colspan="2"/>
901- <button name="update_rif" string="Update Fiscal Information" type="object" icon="gtk-execute" colspan="2"/>
902- </xpath>
903- </field>
904- </record>
905-
906- <record id="view_partner_form4" model="ir.ui.view">
907- <field name="name">res.partner.vat.inherit4</field>
908- <field name="model">res.partner</field>
909- <field name="inherit_id" ref="base.view_partner_form"/>
910- <field name="arch" type="xml">
911+
912+ <xpath expr='//button[@name="button_check_vat"]' position='replace'></xpath>
913+ <xpath expr='//field[@name="vat"]' position='replace'></xpath>
914+
915 <xpath expr="//field[@name='name']" position="replace">
916 <field name="seniat_updated" invisible="1" />
917 <field name="name" attrs="{'readonly': [('seniat_updated', '!=', False)]}" />
918 </xpath>
919- </field>
920+
921+ <xpath expr='//field[@name="parent_id"]' position='before'>
922+ <label for="vat"/>
923+ <field name="vat" colspan="2" placeholder="e.g. VE123456789" class="oe_inline" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
924+ <button name="button_check_vat" string="Check Validity" type="object" icon="gtk-execute" class="oe_inline"/>
925+ <field name="uid_country" colspan="2" invisible="1"/>
926+ </xpath>
927+
928+ <xpath expr='//field[@name="street"]' position='replace'>
929+ <field name="street" placeholder="Av. Siempre Viva" colspan="2" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
930+ </xpath>
931+
932+ <xpath expr='//field[@name="city"]' position='replace'>
933+ <field name="city" placeholder="Caracas" colspan="2" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
934+ </xpath>
935+
936+ <xpath expr='//field[@name="country_id"]' position='replace'>
937+ <field name="country_id" placeholder="Venezuela" class="oe_no_button" options='{"no_open": True}' colspan="2" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
938+ </xpath>
939+
940+ <xpath expr='//field[@name="phone"]' position='replace'>
941+ <field name="phone" placeholder="+58 414 432 27 20" class="oe_no_button" options='{"no_open": True}' colspan="2" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
942+ </xpath>
943+ </field>
944 </record>
945+
946 </data>
947 </openerp>
948
949=== modified file 'l10n_ve_fiscal_requirements/view/res_company_view.xml'
950--- l10n_ve_fiscal_requirements/view/res_company_view.xml 2011-10-25 20:33:16 +0000
951+++ l10n_ve_fiscal_requirements/view/res_company_view.xml 2012-12-10 03:34:20 +0000
952@@ -5,15 +5,15 @@
953 <record id="il_company_invoice_damaged" model="ir.ui.view">
954 <field name="name">il_company_invoice_damaged</field>
955 <field name="model">res.company</field>
956- <field name="type">form</field>
957+ <field name="priority">24</field>
958 <field name="inherit_id" ref="base.view_company_form"/>
959 <field name="arch" type="xml">
960- <page string="Configuration" position="inside">
961- <separator string="Data used by default for invoices damaged" colspan="4"/>
962+ <xpath expr="//group[@name='account_grp']" position="after">
963+ <group name='fr1_grp' string='Damaged Invoices Info'>
964 <field name="jour_id"/>
965- <field name="acc_id"/>
966- <newline/>
967- </page>
968+ <field name="acc_id" domain="[('type','in',('other','receivable','payable'))]"/>
969+ </group>
970+ </xpath>
971 </field>
972 </record>
973 </data>
974
975=== modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py'
976--- l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2012-11-07 15:19:17 +0000
977+++ l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2012-12-10 03:34:20 +0000
978@@ -43,11 +43,16 @@
979 obj_journal = self.pool.get('account.journal')
980 if context is None:
981 context = {}
982- journal = obj_journal.search(cr, uid, [('type', '=', 'sale')])
983- if context.get('type', False):
984- if context['type'] in ('in_invoice', 'in_refund'):
985- journal = obj_journal.search(cr, uid, [('type', '=', 'purchase')])
986- return journal and journal[0] or False
987+ journal = []
988+ company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
989+ company_id = context.get('company_id', company_id)
990+ if context.get('type', False) in ('out_invoice', 'out_refund'):
991+ journal = obj_journal.search(cr, uid, [('type', '=', 'sale_debit'),('company_id','=',company_id)])
992+ elif context.get('type', False) in ('in_invoice', 'in_refund'):
993+ journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_debit'),('company_id','=',company_id)])
994+ if not journal:
995+ raise osv.except_osv(_('No Debit Journal !'),_("You must define a debit journal"))
996+ return journal[0]
997
998 _defaults = {
999 'date': lambda *a: time.strftime('%Y-%m-%d'),
1000@@ -65,19 +70,23 @@
1001 #type = context.get('journal_type', 'sale_refund')
1002 type = context.get('journal_type', 'sale')
1003 if type in ('sale', 'sale_refund'):
1004- type = 'sale'
1005+ type = 'sale_debit'
1006 else:
1007- type = 'purchase'
1008+ type = 'purchase_debit'
1009+ company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
1010+ company_id = context.get('company_id', company_id)
1011 for field in res['fields']:
1012 if field == 'journal_id':
1013- journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
1014+ journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type),('company_id','=',company_id)], context=context, limit=None, name_get_uid=1)
1015 res['fields'][field]['selection'] = journal_select
1016 return res
1017
1018- def _get_period(self, cr, uid, context={}):
1019+ def _get_period(self, cr, uid, context=None):
1020 """
1021 Return default account period value
1022 """
1023+ if context is None:
1024+ context = {}
1025 account_period_obj = self.pool.get('account.period')
1026 ids = account_period_obj.find(cr, uid, context=context)
1027 period_id = False
1028@@ -85,10 +94,12 @@
1029 period_id = ids[0]
1030 return period_id
1031
1032- def _get_orig(self, cr, uid, inv, ref, context={}):
1033+ def _get_orig(self, cr, uid, inv, ref, context=None):
1034 """
1035 Return default origin value
1036 """
1037+ if context is None:
1038+ context = {}
1039 nro_ref = ref
1040 if inv.type == 'out_invoice':
1041 nro_ref = inv.number
1042@@ -114,119 +125,122 @@
1043 if context is None:
1044 context = {}
1045
1046- for form in self.read(cr, uid, ids, context=context):
1047- created_inv = []
1048- date = False
1049- period = False
1050- description = False
1051- company = res_users_obj.browse(cr, uid, uid, context=context).company_id
1052- journal_id = form.get('journal_id', False)
1053- for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
1054- if inv.state in ['draft', 'proforma2', 'cancel']:
1055- raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))
1056- if inv.reconciled in ('cancel', 'modify'):
1057- raise osv.except_osv(_('Error !'), _('Can not create a debit note from invoice which is already reconciled, invoice should be unreconciled first. You can only Refund or Debit this invoice'))
1058- if inv.type not in ['in_invoice', 'out_invoice']:
1059- raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))
1060- if form['period']:
1061- period = form['period']
1062- else:
1063- #Take period from the current date
1064- #period = inv.period_id and inv.period_id.id or False
1065- period = self._get_period(cr, uid, context)
1066-
1067- if not journal_id:
1068- journal_id = inv.journal_id.id
1069-
1070- if form['date']:
1071- date = form['date']
1072- if not form['period']:
1073- cr.execute("select name from ir_model_fields \
1074- where model = 'account.period' \
1075- and name = 'company_id'")
1076- result_query = cr.fetchone()
1077- if result_query:
1078- #in multi company mode
1079- cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \
1080- and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))
1081- else:
1082- #in mono company mode
1083- cr.execute("""SELECT id
1084- from account_period where date(%s)
1085- between date_start AND date_stop \
1086- limit 1 """, (date,))
1087- res = cr.fetchone()
1088- if res:
1089- period = res[0]
1090- else:
1091- #Take current date
1092- #date = inv.date_invoice
1093- date = time.strftime('%Y-%m-%d')
1094- if form['description']:
1095- description = form['description']
1096- else:
1097- description = inv.name
1098-
1099- if not period:
1100- raise osv.except_osv(_('Data Insufficient !'), \
1101- _('No Period found on Invoice!'))
1102-
1103- #we get original data of invoice to create a new invoice that is the copy of the original
1104- invoice = inv_obj.read(cr, uid, [inv.id],
1105- ['name', 'type', 'number', 'reference',
1106- 'comment', 'date_due', 'partner_id',
1107- 'partner_insite', 'partner_contact',
1108- 'partner_ref', 'payment_term', 'account_id',
1109- 'currency_id', 'invoice_line', 'tax_line',
1110- 'journal_id', 'period_id'], context=context)
1111- invoice = invoice[0]
1112- del invoice['id']
1113- invoice_lines = []
1114- tax_lines = []
1115- #Add origin, parent and comment values
1116- orig = self._get_orig(cr, uid, inv, invoice['reference'], context)
1117- invoice.update({
1118- 'type': inv.type,
1119- 'date_invoice': date,
1120- 'state': 'draft',
1121- 'number': False,
1122- 'invoice_line': invoice_lines,
1123- 'tax_line': tax_lines,
1124- 'period_id': period,
1125- 'parent_id':inv.id,
1126- 'name': description,
1127- 'origin': orig,
1128- 'comment':form['comment']
1129- })
1130- #take the id part of the tuple returned for many2one fields
1131- for field in ('partner_id',
1132- 'account_id', 'currency_id', 'payment_term', 'journal_id'):
1133- invoice[field] = invoice[field] and invoice[field][0]
1134- # create the new invoice
1135- inv_id = inv_obj.create(cr, uid, invoice, {})
1136- # we compute due date
1137- if inv.payment_term.id:
1138- data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
1139- if 'value' in data and data['value']:
1140- inv_obj.write(cr, uid, [inv_id], data['value'])
1141- created_inv.append(inv_id)
1142- #we get the view id
1143- if inv.type in ('out_invoice', 'out_refund'):
1144- xml_id = 'action_invoice_tree1'
1145- else:
1146- xml_id = 'action_invoice_tree2'
1147- #we get the model
1148- result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
1149- id = result and result[1] or False
1150- # we read the act window
1151- result = act_obj.read(cr, uid, id, context=context)
1152- # we add the new invoices into domain list
1153- invoice_domain = eval(result['domain'])
1154- invoice_domain.append(('id', 'in', created_inv))
1155- result['domain'] = invoice_domain
1156- return result
1157+ form = self.browse(cr, uid, ids[0], context = context)
1158+ created_inv = []
1159+ date = False
1160+ period = False
1161+ description = False
1162+ company = res_users_obj.browse(cr, uid, uid, context=context).company_id
1163+ journal_id = form.journal_id and form.journal_id.id or False
1164+ inv = inv_obj.browse(cr, uid, context.get('active_ids')[0], context=context)
1165+ if inv.state in ['draft', 'proforma2', 'cancel']:
1166+ raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))
1167+ if inv.reconciled in ('cancel', 'modify'):
1168+ raise osv.except_osv(_('Error !'), _('Can not create a debit note from invoice which is already reconciled, invoice should be unreconciled first. You can only Refund or Debit this invoice'))
1169+ if inv.type not in ['in_invoice', 'out_invoice']:
1170+ raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))
1171+ if form.period:
1172+ period = form.period.id
1173+ else:
1174+ #Take period from the current date
1175+ #period = inv.period_id and inv.period_id.id or False
1176+ period = self._get_period(cr, uid, context)
1177+
1178+ if not journal_id:
1179+ journal_id = inv.journal_id.id
1180+
1181+ if form.date:
1182+ date = form.date
1183+ if not form.period.id:
1184+ cr.execute("select name from ir_model_fields \
1185+ where model = 'account.period' \
1186+ and name = 'company_id'")
1187+ result_query = cr.fetchone()
1188+ if result_query:
1189+ #in multi company mode
1190+ cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \
1191+ and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))
1192+ else:
1193+ #in mono company mode
1194+ cr.execute("""SELECT id
1195+ from account_period where date(%s)
1196+ between date_start AND date_stop \
1197+ limit 1 """, (date,))
1198+ res = cr.fetchone()
1199+ if res:
1200+ period = res[0]
1201+ else:
1202+ #Take current date
1203+ #date = inv.date_invoice
1204+ date = time.strftime('%Y-%m-%d')
1205+ if form.description:
1206+ description = form.description
1207+ else:
1208+ description = inv.name
1209+
1210+ if not period:
1211+ raise osv.except_osv(_('Data Insufficient !'), \
1212+ _('No Period found on Invoice!'))
1213+
1214+ #we get original data of invoice to create a new invoice that is the copy of the original
1215+ invoice = inv_obj.read(cr, uid, [inv.id],
1216+ ['name', 'type', 'number', 'reference',
1217+ 'comment', 'date_due', 'partner_id',
1218+ 'partner_insite', 'partner_contact',
1219+ 'partner_ref', 'payment_term', 'account_id',
1220+ 'currency_id', 'invoice_line', 'tax_line',
1221+ 'journal_id', 'period_id'], context=context)
1222+ invoice = invoice[0]
1223+ del invoice['id']
1224+ invoice_lines = []
1225+ tax_lines = []
1226+ #Add origin, parent and comment values
1227+ orig = self._get_orig(cr, uid, inv, invoice['reference'], context)
1228+ invoice.update({
1229+ 'type': inv.type,
1230+ 'date_invoice': date,
1231+ 'state': 'draft',
1232+ 'number': False,
1233+ 'invoice_line': invoice_lines,
1234+ 'tax_line': tax_lines,
1235+ 'period_id': period,
1236+ 'parent_id':inv.id,
1237+ 'name': description,
1238+ 'origin': orig,
1239+ 'comment':form.comment,
1240+ 'journal_id':journal_id
1241+ })
1242+ #take the id part of the tuple returned for many2one fields
1243+ for field in ('partner_id',
1244+ 'account_id', 'currency_id', 'payment_term'):
1245+ invoice[field] = invoice[field] and invoice[field][0]
1246+ # create the new invoice
1247+ inv_id = inv_obj.create(cr, uid, invoice, {})
1248+ # we compute due date
1249+ if inv.payment_term.id:
1250+ data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
1251+ if 'value' in data and data['value']:
1252+ inv_obj.write(cr, uid, [inv_id], data['value'])
1253+ created_inv.append(inv_id)
1254+ #we get the view id
1255+ if inv.type in ('out_invoice', 'out_refund'):
1256+ xml_id = 'action_sale_debit_tree'
1257+ else:
1258+ xml_id = 'action_purchase_debit_tree'
1259+ #we get the model
1260+ result = mod_obj.get_object_reference(cr, uid, 'l10n_ve_fiscal_requirements', xml_id)
1261+ id = result and result[1] or False
1262+ # we read the act window
1263+ result = act_obj.read(cr, uid, id, context=context)
1264+ # we add the new invoices into domain list
1265+ invoice_domain = eval(result['domain'])
1266+ invoice_domain.append(('id', 'in', created_inv))
1267+ result['domain'] = invoice_domain
1268+ return result
1269
1270 def invoice_debit(self, cr, uid, ids, context=None):
1271+ if context is None:
1272+ context = {}
1273 return self.compute_debit(cr, uid, ids, context=context)
1274
1275
1276
1277=== modified file 'l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py'
1278--- l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2012-09-26 20:44:41 +0000
1279+++ l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2012-12-10 03:34:20 +0000
1280@@ -35,28 +35,31 @@
1281 'vat_subjected':fields.boolean('Pay VAY', help='Pay VAT, in spanish known as : Contribuyente formal'),
1282 }
1283
1284- def search_partner_seniat(self, cr, uid, vat, context=None):
1285+ def search_partner_seniat(self, cr, uid, ids, context=None):
1286 if context is None:
1287 context={}
1288- aux = ''
1289+ this = self.browse(cr, uid, ids)[0]
1290 su_obj = self.pool.get('seniat.url')
1291 rp_obj = self.pool.get('res.partner')
1292- url_obj = su_obj.browse(cr, uid, su_obj.search(cr, uid, []))[0]
1293- url1 = url_obj.name + '%s'
1294- url2 = url_obj.url_seniat + '%s'
1295- url3 = url_obj.url_seniat2 + '%s'
1296- var_vat = self.read(cr,uid,vat,['vat'])
1297- if var_vat:
1298- aux = var_vat[0]['vat']
1299- if rp_obj.check_vat_ve(aux,context):
1300- context.update({'spf_info':True})
1301- res = su_obj._dom_giver(url1,url2,url3, aux,context)
1302+ vat = this.vat.upper()
1303+ res={'name': _('The requested contributor does not exist'),'vat_subjected': False,'vat':vat,'wh_iva_agent':False, 'wh_iva_rate': 0.0}
1304+
1305+ if 'VE' in vat:
1306+ vat = vat[2:]
1307+
1308+ if rp_obj.check_vat_ve(vat,context=context):
1309+ res = su_obj._dom_giver(cr, uid, vat,context)
1310 if res:
1311- res.update({'wh_iva_rate':su_obj._buscar_porcentaje(aux,url2)})
1312- else:
1313- raise osv.except_osv(_('Error'),_("Does not exist the contributor requested"))
1314- self.write(cr,uid,vat,res)
1315-
1316- return False
1317-
1318+ res.update({'wh_iva_rate':su_obj._buscar_porcentaje(cr, uid, vat)})
1319+ self.write(cr,uid,ids,res)
1320+
1321+ return {
1322+ 'type': 'ir.actions.act_window',
1323+ 'res_model': 'search.info.partner.seniat',
1324+ 'view_mode': 'form',
1325+ 'view_type': 'form',
1326+ 'res_id': this.id,
1327+ 'views': [(False, 'form')],
1328+ 'target': 'new',
1329+ }
1330 search_info_partner_seniat()
1331
1332=== modified file 'l10n_ve_fiscal_requirements/wizard/update_info_partner.py'
1333--- l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2012-02-14 14:19:25 +0000
1334+++ l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2012-12-10 03:34:20 +0000
1335@@ -32,15 +32,11 @@
1336
1337 def update_info(self, cr, uid, ids, context={}):
1338 aux=[]
1339- res_part_obj = self.pool.get('res.partner')
1340 seniat_url_obj = self.pool.get('seniat.url')
1341- sql= '''SELECT vat FROM res_partner GROUP BY vat HAVING count(vat) > 1 ;'''
1342- cr.execute(sql)
1343- record = cr.dictfetchall()
1344- for r in record:
1345- aux.append(r.values()[0])
1346- es_partner_ids= res_part_obj.search(cr, uid, [('vat','not in',aux)])
1347- seniat_url_obj.connect_seniat(cr, uid, es_partner_ids, context,True)
1348+ cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''')
1349+ record = cr.fetchall()
1350+ pids = record and map(lambda x: x[0],record) or []
1351+ seniat_url_obj.connect_seniat(cr, uid, pids, context=context, all_rif=True)
1352 return{}
1353
1354
1355
1356=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py'
1357--- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2012-09-24 15:42:44 +0000
1358+++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2012-12-10 03:34:20 +0000
1359@@ -95,13 +95,6 @@
1360 wizard_brw = self.browse(cr, uid, ids, context=None)
1361 wizard_deli_obj = self.pool.get('wz.picking.delivery.note')
1362 inv_id = context.get('active_id')
1363- #~ if context['menu']:
1364- #~ invoice_obj = self.pool.get('account.invoice')
1365- #~ inv_brw = invoice_obj.browse(cr, uid, invoice_obj.search(cr, uid, [], limit=1), context)
1366- #~ if inv_brw == []:
1367- #~ raise osv.except_osv(_("ERROR !"), _("You must have created at least one invoice to declare it as damaged"))
1368- #~ inv_id = inv_brw[0].id
1369- #~ inv_brw = inv_brw[0]
1370 for wizard in wizard_brw:
1371 if not wizard.sure:
1372 raise osv.except_osv(_("Validation error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))
1373
1374=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py'
1375--- l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2012-09-24 14:47:16 +0000
1376+++ l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2012-12-10 03:34:20 +0000
1377@@ -32,7 +32,7 @@
1378 _description = "Wizard that changes the invoice control number"
1379
1380 def set_noctrl(self, cr, uid, ids, context=None):
1381- if context==None:
1382+ if context is None:
1383 context={}
1384 data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0]
1385 if not data['sure']:
1386@@ -41,8 +41,6 @@
1387 n_ctrl = data['name']
1388
1389 invoice = inv_obj.browse(cr, uid, context['active_id'])
1390- if invoice.state == 'draft':
1391- raise osv.except_osv(_("Error!"), _("You cannot change the state of a Draft invoice"))
1392
1393 inv_obj.write(cr, uid, context.get('active_id'), {'nro_ctrl': n_ctrl}, context=context)
1394 return {}