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

Proposed by hbto [Vauxoo] http://www.vauxoo.com
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
=== modified file 'l10n_ve_fiscal_requirements/__openerp__.py'
--- l10n_ve_fiscal_requirements/__openerp__.py 2012-09-26 20:05:11 +0000
+++ l10n_ve_fiscal_requirements/__openerp__.py 2012-12-10 03:34:20 +0000
@@ -23,7 +23,7 @@
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25{25{
26 "name" : "Requirements for Venezuela",26 "name" : "Venezuelan Fiscal Requirements",
27 "version" : "0.2",27 "version" : "0.2",
28 "author" : "Vauxoo",28 "author" : "Vauxoo",
29 "website" : "http://vauxoo.com",29 "website" : "http://vauxoo.com",
3030
=== added file 'l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi'
--- l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi 1970-01-01 00:00:00 +0000
+++ l10n_ve_fiscal_requirements/doc/fiscal_requirements.xmi 2012-12-10 03:34:20 +0000
@@ -0,0 +1,234 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<XMI verified="false" xmi.version="1.2" timestamp="2012-12-01T15:25:02" xmlns:UML="http://schema.omg.org/spec/UML/1.3">
3 <XMI.header>
4 <XMI.documentation>
5 <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
6 <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
7 <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
8 </XMI.documentation>
9 <XMI.metamodel xmi.version="1.3" href="UML.xml" xmi.name="UML"/>
10 </XMI.header>
11 <XMI.content>
12 <UML:Model isSpecification="false" isAbstract="false" isLeaf="false" xmi.id="m1" isRoot="false" name="UML Model">
13 <UML:Namespace.ownedElement>
14 <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="folder" name="folder"/>
15 <UML:Stereotype visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="datatype" name="datatype"/>
16 <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Logical View" name="Logical View">
17 <UML:Namespace.ownedElement>
18 <UML:Package stereotype="folder" visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Datatypes" name="Datatypes">
19 <UML:Namespace.ownedElement>
20 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Hhr1p6xuKJbV" name="int"/>
21 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="se8bAs3OdVm5" name="char"/>
22 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="LoKxVQWk5Mjs" name="bool"/>
23 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="QgnlyMEo0MP9" name="float"/>
24 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="CSVpvHsE4AAX" name="double"/>
25 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="bgHg00XReKAc" name="short"/>
26 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="eOPdjomtFFhA" name="long"/>
27 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="UZPYkZ3JDKxE" name="unsigned int"/>
28 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="IUdxmlXR9w4q" name="unsigned short"/>
29 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="joky3R6XyV4g" name="unsigned long"/>
30 <UML:DataType stereotype="datatype" visibility="public" isSpecification="false" namespace="Datatypes" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="27xGSvSiN3f8" name="string"/>
31 </UML:Namespace.ownedElement>
32 </UML:Package>
33 </UML:Namespace.ownedElement>
34 <XMI.extension xmi.extender="umbrello">
35 <diagrams>
36 <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">
37 <widgets/>
38 <messages/>
39 <associations/>
40 </diagram>
41 <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">
42 <widgets/>
43 <messages/>
44 <associations/>
45 </diagram>
46 <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">
47 <widgets>
48 <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=""/>
49 <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=""/>
50 <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=""/>
51 <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=""/>
52 <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=""/>
53 <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"/>
54 <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=""/>
55 <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"/>
56 <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"/>
57 <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=""/>
58 <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=""/>
59 <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=""/>
60 <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=""/>
61 <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=""/>
62 <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=""/>
63 <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"/>
64 <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=""/>
65 <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"/>
66 <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"/>
67 <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"/>
68 <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=""/>
69 <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=""/>
70 <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"/>
71 <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"/>
72 <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=""/>
73 <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=""/>
74 </widgets>
75 <messages/>
76 <associations>
77 <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">
78 <linepath>
79 <startpoint startx="336" starty="28"/>
80 <endpoint endx="336" endy="53"/>
81 </linepath>
82 </assocwidget>
83 <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">
84 <linepath>
85 <startpoint startx="295" starty="480"/>
86 <endpoint endx="190" endy="575"/>
87 <point x="295" y="575"/>
88 </linepath>
89 </assocwidget>
90 <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">
91 <linepath>
92 <startpoint startx="128" starty="597"/>
93 <endpoint endx="128" endy="675"/>
94 </linepath>
95 </assocwidget>
96 <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">
97 <linepath>
98 <startpoint startx="297" starty="77"/>
99 <endpoint endx="297" endy="157"/>
100 </linepath>
101 </assocwidget>
102 <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">
103 <linepath>
104 <startpoint startx="138" starty="200"/>
105 <endpoint endx="138" endy="261"/>
106 </linepath>
107 </assocwidget>
108 <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">
109 <linepath>
110 <startpoint startx="138" starty="276"/>
111 <endpoint endx="252" endy="276"/>
112 </linepath>
113 </assocwidget>
114 <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">
115 <linepath>
116 <startpoint startx="132" starty="388"/>
117 <endpoint endx="132" endy="460"/>
118 </linepath>
119 </assocwidget>
120 <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">
121 <linepath>
122 <startpoint startx="292" starty="294"/>
123 <endpoint endx="292" endy="365"/>
124 </linepath>
125 </assocwidget>
126 <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">
127 <linepath>
128 <startpoint startx="283" starty="375"/>
129 <endpoint endx="206" endy="375"/>
130 </linepath>
131 </assocwidget>
132 <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">
133 <linepath>
134 <startpoint startx="292" starty="385"/>
135 <endpoint endx="292" endy="460"/>
136 </linepath>
137 </assocwidget>
138 <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">
139 <linepath>
140 <startpoint startx="192" starty="470"/>
141 <endpoint endx="283" endy="470"/>
142 </linepath>
143 </assocwidget>
144 <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">
145 <linepath>
146 <startpoint startx="118" starty="281"/>
147 <endpoint endx="118" endy="364"/>
148 </linepath>
149 </assocwidget>
150 <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">
151 <linepath>
152 <startpoint startx="303" starty="471"/>
153 <endpoint endx="427" endy="471"/>
154 </linepath>
155 </assocwidget>
156 <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">
157 <linepath>
158 <startpoint startx="437" starty="462"/>
159 <endpoint endx="437" endy="370"/>
160 </linepath>
161 </assocwidget>
162 <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">
163 <linepath>
164 <startpoint startx="497" starty="364"/>
165 <endpoint endx="652" endy="465"/>
166 <point x="653" y="364"/>
167 <point x="652" y="435"/>
168 </linepath>
169 </assocwidget>
170 <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">
171 <linepath>
172 <startpoint startx="653" starty="485"/>
173 <endpoint endx="653" endy="640"/>
174 </linepath>
175 </assocwidget>
176 <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">
177 <linepath>
178 <startpoint startx="447" starty="476"/>
179 <endpoint endx="642" endy="476"/>
180 </linepath>
181 </assocwidget>
182 </associations>
183 </diagram>
184 </diagrams>
185 </XMI.extension>
186 </UML:Model>
187 <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">
188 <UML:Namespace.ownedElement/>
189 </UML:Model>
190 <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Component View" name="Component View">
191 <UML:Namespace.ownedElement/>
192 </UML:Model>
193 <UML:Model stereotype="folder" visibility="public" isSpecification="false" namespace="m1" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="Deployment View" name="Deployment View">
194 <UML:Namespace.ownedElement/>
195 </UML:Model>
196 <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">
197 <UML:Namespace.ownedElement/>
198 </UML:Model>
199 </UML:Namespace.ownedElement>
200 </UML:Model>
201 </XMI.content>
202 <XMI.extensions xmi.extender="umbrello">
203 <docsettings viewid="trxpM1WN9Tbb" uniqueid="XxWLBwICwopl" documentation=""/>
204 <listview>
205 <listitem open="1" type="800" id="Views">
206 <listitem open="1" type="821" id="Component View"/>
207 <listitem open="1" type="827" id="Deployment View"/>
208 <listitem open="1" type="836" id="Entity Relationship Model"/>
209 <listitem open="1" type="801" id="Logical View">
210 <listitem open="0" type="809" id="trxpM1WN9Tbb" label="activity diagram"/>
211 <listitem open="0" type="807" id="oBZv5bkoPSkS" label="base_vat"/>
212 <listitem open="0" type="807" id="DnSQSq2Hcg6b" label="class diagram"/>
213 <listitem open="0" type="830" id="Datatypes">
214 <listitem open="1" type="829" id="LoKxVQWk5Mjs"/>
215 <listitem open="1" type="829" id="se8bAs3OdVm5"/>
216 <listitem open="1" type="829" id="CSVpvHsE4AAX"/>
217 <listitem open="1" type="829" id="QgnlyMEo0MP9"/>
218 <listitem open="1" type="829" id="Hhr1p6xuKJbV"/>
219 <listitem open="1" type="829" id="eOPdjomtFFhA"/>
220 <listitem open="1" type="829" id="bgHg00XReKAc"/>
221 <listitem open="1" type="829" id="27xGSvSiN3f8"/>
222 <listitem open="1" type="829" id="UZPYkZ3JDKxE"/>
223 <listitem open="1" type="829" id="joky3R6XyV4g"/>
224 <listitem open="1" type="829" id="IUdxmlXR9w4q"/>
225 </listitem>
226 </listitem>
227 <listitem open="1" type="802" id="Use Case View"/>
228 </listitem>
229 </listview>
230 <codegeneration>
231 <codegenerator language="C++"/>
232 </codegeneration>
233 </XMI.extensions>
234</XMI>
0235
=== modified file 'l10n_ve_fiscal_requirements/model/__init__.py'
--- l10n_ve_fiscal_requirements/model/__init__.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/__init__.py 2012-12-10 03:34:20 +0000
@@ -22,6 +22,7 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25import account
25import invoice26import invoice
26import partner27import partner
27import res_company28import res_company
2829
=== added file 'l10n_ve_fiscal_requirements/model/account.py'
--- l10n_ve_fiscal_requirements/model/account.py 1970-01-01 00:00:00 +0000
+++ l10n_ve_fiscal_requirements/model/account.py 2012-12-10 03:34:20 +0000
@@ -0,0 +1,49 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###########################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved
7###############Credits######################################################
8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.
11#############################################################################
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero 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 Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################
25
26from osv import fields, osv
27__TYPES__ = [('sale_debit', 'Sale Debit'),('purchase_debit', 'Purchase Debit')]
28
29__HELP__= " Select 'Sale Debit' for customer debit note journals. Select 'Purchase Debit' for supplier debit note journals."
30
31class account_journal(osv.osv):
32 _inherit = 'account.journal'
33
34 _columns = {
35'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'),
36 ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'),
37 ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'),
38 ('situation', 'Opening/Closing Situation'),('sale_debit', 'Sale Debit'),
39 ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True,
40 help = "Select 'Sale' for customer invoices journals."\
41 " Select 'Purchase' for supplier invoices journals."\
42 " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\
43 " Select 'General' for miscellaneous operations journals."\
44 " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\
45 " Select 'Sale Debit' for customer debit note journals."\
46 " Select 'Purchase Debit' for supplier debit note journals.")
47 }
48
49account_journal()
050
=== modified file 'l10n_ve_fiscal_requirements/model/invoice.py'
--- l10n_ve_fiscal_requirements/model/invoice.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/invoice.py 2012-12-10 03:34:20 +0000
@@ -27,6 +27,22 @@
27from tools.translate import _27from tools.translate import _
28class account_invoice(osv.osv):28class account_invoice(osv.osv):
2929
30 def _get_journal(self, cr, uid, context=None):
31 if context is None:
32 context = {}
33 journal_type_inv = context.get('journal_type', 'sale')
34 if journal_type_inv in ('sale_debit', 'purchase_debit'):
35 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
36 company_id = context.get('company_id', user.company_id.id)
37 journal_obj = self.pool.get('account.journal')
38 res = journal_obj.search(cr, uid, [('type', '=',journal_type_inv),
39 ('company_id', '=', company_id)],
40 limit=1)
41 return res and res[0] or False
42 else:
43 return super(account_invoice, self)._get_journal(cr, uid, context=context)
44
45
3046
31 def _unique_invoice_per_partner(self, cr, uid, ids, context=None):47 def _unique_invoice_per_partner(self, cr, uid, ids, context=None):
32 if context is None: context={}48 if context is None: context={}
3349
=== modified file 'l10n_ve_fiscal_requirements/model/l10n_ut.py'
--- l10n_ve_fiscal_requirements/model/l10n_ut.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/l10n_ut.py 2012-12-10 03:34:20 +0000
@@ -56,7 +56,8 @@
56 rate=cr.fetchall()[0][0]56 rate=cr.fetchall()[0][0]
57 return rate57 return rate
5858
59 def compute(self, cr, uid, from_amount, date=False, context={}):59 def compute(self, cr, uid, from_amount, date=False, context=None):
60 if context is None: context ={}
60 result = 0.061 result = 0.0
61 ut = self.get_amount_ut(cr, uid, date=False)62 ut = self.get_amount_ut(cr, uid, date=False)
62 if ut:63 if ut:
@@ -64,7 +65,8 @@
6465
65 return result66 return result
6667
67 def compute_ut_to_money(self, cr, uid, amount_ut, date=False, context={}):68 def compute_ut_to_money(self, cr, uid, amount_ut, date=False, context=None):
69 if context is None: context ={}
68 money = 0.070 money = 0.0
69 ut = self.get_amount_ut(cr, uid, date)71 ut = self.get_amount_ut(cr, uid, date)
70 if ut:72 if ut:
7173
=== modified file 'l10n_ve_fiscal_requirements/model/partner.py'
--- l10n_ve_fiscal_requirements/model/partner.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/partner.py 2012-12-10 03:34:20 +0000
@@ -14,6 +14,8 @@
14# Miguel Delgado <miguel@openerp.com.ve>14# Miguel Delgado <miguel@openerp.com.ve>
15# Israel Fermín Montilla <israel@openerp.com.ve>15# Israel Fermín Montilla <israel@openerp.com.ve>
16# Juan Márquez <jmarquez@tecvemar.com.ve>16# Juan Márquez <jmarquez@tecvemar.com.ve>
17# Humberto Arocha <hbto@vauxoo.com>
18# Yanina Aular <yanina.aular@vauxoo.com>
17#19#
18# This program is free software: you can redistribute it and/or modify20# This program is free software: you can redistribute it and/or modify
19# it under the terms of the GNU Affero General Public License as21# it under the terms of the GNU Affero General Public License as
@@ -30,17 +32,36 @@
30#32#
31##############################################################################33##############################################################################
3234
35from openerp.osv.orm import except_orm
33from osv import fields, osv36from osv import fields, osv
34from tools.translate import _37from tools.translate import _
35import re38import re
3639
37class res_partner(osv.osv):40class res_partner(osv.osv):
38 _inherit = 'res.partner'41 _inherit = 'res.partner'
39 42
43 def _get_country_code(self, cr, uid, context=None):
44 context = context or {}
45 user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
46 return user_company.partner_id and user_company.partner_id.country_id \
47 and user_company.partner_id.country_id.code or 'XX'
48
49 def default_get(self, cr, uid, fields, context=None):
50 context = context or {}
51 res = super(res_partner, self).default_get(cr, uid, fields, context=context)
52 res.update({'uid_country': self._get_country_code(cr,uid,context=context)})
53 return res
54
55 def _get_uid_country(self, cr, uid, ids, field_name, args, context=None):
56 context = context or {}
57 res= {}.fromkeys(ids,self._get_country_code(cr,uid,context=context))
58 return res
59
40 _columns = {60 _columns = {
41 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),61 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),
62 'uid_country': fields.function(_get_uid_country, type='char', string="uid_country", size=20),
42 }63 }
4364
44 _default = {65 _default = {
45 'seniat_updated': False,66 'seniat_updated': False,
46 }67 }
@@ -60,7 +81,7 @@
60 '''81 '''
61 def _check_partner_invoice_addr(self,cr,uid,ids,context={}):82 def _check_partner_invoice_addr(self,cr,uid,ids,context={}):
62 partner_obj = self.browse(cr,uid,ids[0])83 partner_obj = self.browse(cr,uid,ids[0])
63 if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE':84 if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id:
64 res = partner_obj.type == 'invoice'85 res = partner_obj.type == 'invoice'
65 if res:86 if res:
66 return True87 return True
@@ -70,26 +91,132 @@
70 return True91 return True
71 return True92 return True
7293
73 def _check_vat_uniqueness(self, cr, uid, ids, context={}):94 def _check_vat_uniqueness_def(self, cr, uid, ids, current_vat,list_node_tree, context=None):
74 #Check if its possible to use 'browse' in this 'read'95 if context is None: context = {}
96 nodes = self.search(cr, uid, [] )
97 nodes = list( set(nodes) - set(list_node_tree) )
98 nodes = self.search(cr, uid, [('vat','=',current_vat),('id','in',nodes)] )
99 return not nodes
100
101 def _check_vat_uniqueness(self, cr, uid, ids, context=None):
102 if context is None: context = {}
103
104 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
105
106 #User must be of VE
107 if not (user_company.partner_id and user_company.partner_id.country_id and user_company.partner_id.country_id.code == 'VE'):
108 return True
109
75 partner_brw = self.browse(cr, uid,ids)110 partner_brw = self.browse(cr, uid,ids)
76 if not 'VE' in [a.country_id.code for a in partner_brw ]:
77 return True
78
79 current_vat = partner_brw[0].vat111 current_vat = partner_brw[0].vat
80112 current_parent_id = partner_brw[0].parent_id
81 if not current_vat or current_vat.strip()=='':113
114 if not current_vat:
82 return True # Accept empty VAT's115 return True # Accept empty VAT's
83 116
84 duplicates = self.read(cr, uid, self.search(cr, uid, [('vat', '=', current_vat)]), ['vat'])117 #Partners without parent, must have RIF uniqueness
85118 if not current_parent_id:
86 return not current_vat in [p['vat'] for p in duplicates if p['id'] != partner_brw[0].id]119 duplicates = self.browse(cr, uid, self.search(cr, uid, [('vat', '=', current_vat),('parent_id','=',None),('id','!=',partner_brw[0].id)]))
120 return not duplicates
121
122 currrent_is_company =partner_brw[0].is_company
123
124 #Partners that are not company and have parent_id, can't have partners' RIF that are not part of its siblings or parent
125 if(current_parent_id and not currrent_is_company):
126 list_nodes = current_parent_id.child_ids
127 list_nodes = map(lambda x: x.id, list_nodes)
128 list_nodes.append(current_parent_id.id)
129 return self._check_vat_uniqueness_def(cr, uid, ids, current_vat, list_nodes , context=context)
130
131 return True
132
133 def _check_vat_mandatory(self, cr, uid, ids, context=None):
134 '''This method will check the vat mandatoriness in partners
135 for those user logged on with a Venezuelan Company
136
137 The method will return True when:
138 *) The user's company is not from Venezuela
139 *) The partner being created is the one for the a company being created [TODO]
140
141 The method will return False when:
142 *) The user's company is from Venezuela AND the vat field is empty AND:
143 +) partner is_company=True AND parent_id is not NULL
144 +) partner with parent_id is NULL
145 +) partner with parent_id is NOT NULL AND type of address is invoice
146 '''
147 if context is None: context = {}
148 # Avoiding Egg-Chicken Syndrome
149 # TODO: Refine this approach this is big exception
150 # One that can be handle be end user, I hope so!!!
151 if context.get('create_company',False):
152 return True
153
154 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
155 #Check if the user is not from a VE Company
156 if not (user_company.partner_id and user_company.partner_id.country_id and user_company.partner_id.country_id.code == 'VE'):
157 return True
158
159 partner_brw = self.browse(cr, uid,ids)
160 current_vat = partner_brw[0].vat
161 current_parent_id = partner_brw[0].parent_id
162 current_is_company =partner_brw[0].is_company
163 current_type = partner_brw[0].type
164
165 #Partners company type and with parent, not exists
166 if (current_is_company and current_parent_id):
167 return False
168
169 #Partners without parent must have vat
170 if not current_vat and not current_parent_id:
171 return False
172
173 #Partners invoice type that not be company and have parent, must have vat
174 if (current_type == 'invoice' and not current_vat and not current_is_company and current_parent_id):
175 return False
176
177 return True
178
179 def _validate(self, cr, uid, ids, context=None):
180 #In the original orm.py openerp does not allow using
181 #context within the constraint because we have to yield
182 # the same result always,
183 # we have overridden this behaviour
184 # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER
185 context = context or {}
186 lng = context.get('lang')
187 trans = self.pool.get('ir.translation')
188 error_msgs = []
189 for constraint in self._constraints:
190 fun, msg, fields = constraint
191 # We don't pass around the context here: validation code
192 # must always yield the same results.
193 if not fun(self, cr, uid, ids, context=context):
194 # Check presence of __call__ directly instead of using
195 # callable() because it will be deprecated as of Python 3.0
196 if hasattr(msg, '__call__'):
197 tmp_msg = msg(self, cr, uid, ids, context=context)
198 if isinstance(tmp_msg, tuple):
199 tmp_msg, params = tmp_msg
200 translated_msg = tmp_msg % params
201 else:
202 translated_msg = tmp_msg
203 else:
204 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)
205 error_msgs.append(
206 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
207 )
208 self._invalids.update(fields)
209 if error_msgs:
210 raise except_orm('ValidateError', '\n'.join(error_msgs))
211 else:
212 self._invalids.clear()
87213
88 _constraints = [214 _constraints = [
215 (_check_vat_mandatory, _("Error ! VAT is mandatory"), []),
89 (_check_vat_uniqueness, _("Error ! Partner's VAT must be a unique value or empty"), []),216 (_check_vat_uniqueness, _("Error ! Partner's VAT must be a unique value or empty"), []),
90 (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),217 #~ (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),
91 ]218 ]
92219
93 def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None):220 def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None):
94 if context is None:221 if context is None:
95 context={}222 context={}
@@ -117,10 +244,8 @@
117 if context is None:244 if context is None:
118 context={}245 context={}
119 if re.search(r'^[VJEG][0-9]{9}$', vat):246 if re.search(r'^[VJEG][0-9]{9}$', vat):
120 context.update({'ci_pas':False})
121 return True247 return True
122 if re.search(r'^([0-9]{1,8}|[D][0-9]{9})$', vat):248 if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):
123 context.update({'ci_pas':True})
124 return True249 return True
125 return False250 return False
126 251
@@ -130,5 +255,14 @@
130 su_obj = self.pool.get('seniat.url')255 su_obj = self.pool.get('seniat.url')
131 return su_obj.update_rif(cr, uid, ids, context=context)256 return su_obj.update_rif(cr, uid, ids, context=context)
132257
258 def button_check_vat(self, cr, uid, ids, context=None):
259 if context is None: context = {}
260 context.update({'update_fiscal_information':True})
261 super(res_partner, self).button_check_vat(cr, uid, ids, context=context)
262 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
263 if user_company.vat_check_vies:
264 # force full VIES online check
265 self.update_rif(cr, uid, ids, context=context)
266 return True
133res_partner()267res_partner()
134# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:268# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
135269
=== modified file 'l10n_ve_fiscal_requirements/model/res_company.py'
--- l10n_ve_fiscal_requirements/model/res_company.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/res_company.py 2012-12-10 03:34:20 +0000
@@ -37,5 +37,18 @@
37 'jour_id': fields.many2one('account.journal', 'Journal',required=False,help="Default journal for damaged invoices"),37 'jour_id': fields.many2one('account.journal', 'Journal',required=False,help="Default journal for damaged invoices"),
38 'acc_id': fields.many2one('account.account', 'Account',required=False,help="Default account used for invoices and lines from damaged invoices"),38 'acc_id': fields.many2one('account.account', 'Account',required=False,help="Default account used for invoices and lines from damaged invoices"),
39 }39 }
40
41 def create(self, cr, uid, vals, context=None):
42 if context is None: context = {}
43 context.update({'create_company':True})
44 return super(res_company, self).create(cr, uid, vals, context=context)
45
46 def write(self, cr, uid, ids, values, context=None):
47 context = context or {}
48 self.cache_restart(cr)
49 context.update({'create_company':True})
50 return super(res_company, self).write(cr, uid, ids, values, context=context)
51
52
40res_company()53res_company()
4154
4255
=== modified file 'l10n_ve_fiscal_requirements/model/seniat_url.py'
--- l10n_ve_fiscal_requirements/model/seniat_url.py 2012-11-29 19:13:14 +0000
+++ l10n_ve_fiscal_requirements/model/seniat_url.py 2012-12-10 03:34:20 +0000
@@ -63,7 +63,9 @@
63 retries -= 163 retries -= 1
64 return str_error64 return str_error
65 65
66 def _buscar_porcentaje(self,rif,url):66 def _buscar_porcentaje(self, cr, uid, rif):
67 url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
68 url = url_obj.url_seniat + '%s'
67 context={}69 context={}
68 html_data = self.pool.get('seniat.url')._load_url(3,url %rif)70 html_data = self.pool.get('seniat.url')._load_url(3,url %rif)
69 html_data = unicode(html_data, 'ISO-8859-1').encode('utf-8')71 html_data = unicode(html_data, 'ISO-8859-1').encode('utf-8')
@@ -84,11 +86,7 @@
84 self.logger.info("RIF: %s Found" % rif)86 self.logger.info("RIF: %s Found" % rif)
85 if name.count('(') > 0:87 if name.count('(') > 0:
86 name = name[:name.index('(')].rstrip()88 name = name[:name.index('(')].rstrip()
87 if context.get('spf_info'):89 return {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux,'wh_iva_agent':wh_agent}
88 res= {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux,'wh_iva_agent':wh_agent}
89 else:
90 res= {'name': name,'vat_subjected': vat_subjected,'vat':'VE'+rif_aux}
91 return res
9290
93 def _print_error(self, error, msg):91 def _print_error(self, error, msg):
94 raise osv.except_osv(error,msg)92 raise osv.except_osv(error,msg)
@@ -110,25 +108,41 @@
110 return True108 return True
111 else:109 else:
112 return False110 return False
111 def _get_rif(self, vat, url1, url2, context=None):
112 if context is None: context={}
113113
114 def _dom_giver(self, url1, url2, url3, vat, context):
115 if context.get('ci_pas'):
116 xml_data = self._load_url(3,url3 % vat)
117 match = re.search(r'No existe el contribuyente solicitado', xml_data)
118 vat = '0'*(8-len(vat))+vat
119 match2 = re.search(r'[VJEG]'+vat+'[0-9]{1}', xml_data)
120 if match:
121 return False
122 elif match2:
123 vat = match2.group(0)
124 xml_data = self._load_url(3,url1 % vat)114 xml_data = self._load_url(3,url1 % vat)
125 115 if not self._eval_seniat_data(xml_data,vat,context=context):
126 if not self._eval_seniat_data(xml_data,vat,context):
127 dom = parseString(xml_data)116 dom = parseString(xml_data)
128 return self._parse_dom(dom, vat, url2,context=context)117 return self._parse_dom(dom, vat, url2,context=context)
129 else:118
119 def _dom_giver(self, cr, uid, vat, context=None):
120 if context is None: context={}
121
122 url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
123 url1 = url_obj.name + '%s'
124 url2 = url_obj.url_seniat + '%s'
125 url3 = url_obj.url_seniat2 + '%s'
126 if re.search(r'^[VJEG][0-9]{9}$', vat):
127 '''Checked vat is a RIF'''
128 return self._get_rif(vat, url1, url2, context=context)
129
130 elif re.search(r'^([D][0-9]{9})$', vat):
131 '''Checked vat is a Passport'''
132 #TODO: NEEDS VALID NUMBERS TO CHECK THE VALIDITY AND COMPLETE THIS CODE
130 return False133 return False
131134
135 elif re.search(r'^([VE][0-9]{1,8})$', vat):
136 '''Checked vat is an ID'''
137 xml_data = self._load_url(3,url3 % str(int(vat[1:])))
138 vat = vat[1:].rjust(8,'0')
139 match2 = re.search(r'[VE]'+vat+'[0-9]{1}', xml_data)
140 if re.search(r'No existe el contribuyente solicitado', xml_data):
141 return False
142 elif match2:
143 vat = match2.group(0)
144 return self._get_rif(vat, url1, url2, context=context)
145
132 def _update_partner(self, cr, uid, id, context=None):146 def _update_partner(self, cr, uid, id, context=None):
133 rp_obj = self.pool.get('res.partner')147 rp_obj = self.pool.get('res.partner')
134 rp_obj.write(cr, uid, id, {'seniat_updated': True})148 rp_obj.write(cr, uid, id, {'seniat_updated': True})
@@ -136,47 +150,25 @@
136 def update_rif(self, cr, uid, ids, context={}):150 def update_rif(self, cr, uid, ids, context={}):
137 aux=[]151 aux=[]
138 rp_obj = self.pool.get('res.partner')152 rp_obj = self.pool.get('res.partner')
139 url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
140 url1 = url_obj.name + '%s'
141 url2 = url_obj.url_seniat + '%s'
142 url3 = url_obj.url_seniat2 + '%s'
143 if context.get('exec_wizard'):153 if context.get('exec_wizard'):
144 res = self._dom_giver(url1, url2, url3, context['vat'],context)154 res = self._dom_giver(cr, uid, context['vat'],context=context)
145 if res:155 if res:
146 self._update_partner(cr, uid, ids, context)156 self._update_partner(cr, uid, ids, context=context)
147 return res157 return res
148 else:158 else:
149 return False159 return False
150 for partner in rp_obj.browse(cr,uid,ids):160 for partner in rp_obj.browse(cr,uid,ids):
161 if not partner.vat or partner.vat[:2]!='VE':
162 continue
151 rp_obj.write(cr, uid, partner.id, {'seniat_updated': False})163 rp_obj.write(cr, uid, partner.id, {'seniat_updated': False})
152 if partner.vat and partner.type == 'invoice':164 res = self._dom_giver(cr, uid, partner.vat[2:],context=context)
153 partner_id =partner.id165 if res:
154 code = partner.country_id and partner.country_id.code166 rp_obj.write(cr,uid,partner.id,res)
155 if code == 'VE':167 self._update_partner(cr, uid, partner.id, context)
156 if rp_obj.check_vat_ve(partner.vat[2:],context):
157 res = self._dom_giver(url1, url2, url3,partner.vat[2:],context)
158 if res:
159 rp_obj.write(cr,uid,partner.id,res)
160 self._update_partner(cr, uid, partner.id, context)
161 else:
162 if not context.get('all_rif'):
163 return False
164 #~ self._print_error(_('Error'),_("Does not exist the contributor requested"))
165 else:
166 if not context.get('all_rif'):
167 return False
168 #~ 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"))
169 else:
170 if not context.get('all_rif'):
171 return False
172 #~ self._print_error(_('Error'),_("The country in invoice address is not Venezuela, can not establish connection with sSENIAT"))
173 else:168 else:
174 if partneri and partner.type == 'invoice':169 if not context.get('all_rif'):
175 invoices_addr_country = partner.country_id and [partner.country_id.code]170 return False
176 if invoices_addr_country:171 #~ 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"))
177 country = [j for j in invoices_addr_country if j]
178 if country and 'VE' in country and not context.get('all_rif',False):
179 self._print_error(_('Vat Error !'),_('The field vat is empty'))
180 return True172 return True
181173
182 def connect_seniat(self, cr, uid, ids, context={}, all_rif=False):174 def connect_seniat(self, cr, uid, ids, context={}, all_rif=False):
183175
=== modified file 'l10n_ve_fiscal_requirements/view/account_invoice_view.xml'
--- l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2012-11-07 21:33:58 +0000
+++ l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2012-12-10 03:34:20 +0000
@@ -68,7 +68,7 @@
68 type='action' 68 type='action'
69 string='Debit Note' 69 string='Debit Note'
70 icon="gtk-execute" 70 icon="gtk-execute"
71 attrs="{'invisible':['|',('state','in',['proforma2','proforma','cancel', 'draft']),('type','in',['out_refund', 'in_refund'])]}"/>71 attrs="{'invisible':['|','|',('state','in',['proforma2','proforma','cancel', 'draft']),('type','in',['out_refund', 'in_refund']),('parent_id','!=',False)]}"/>
72 </xpath>72 </xpath>
73 <xpath expr="//button[@string='Refund Invoice']" position="after">73 <xpath expr="//button[@string='Refund Invoice']" position="after">
74 <button name="%(action_account_invoice_parent)d" 74 <button name="%(action_account_invoice_parent)d"
@@ -181,9 +181,89 @@
181 </field>181 </field>
182 </record>182 </record>
183 183
184 184 <record id="action_sale_debit_tree" model="ir.actions.act_window">
185 185 <field name="name">Customer Debit Notes</field>
186 186 <field name="res_model">account.invoice</field>
187 187 <field name="view_type">form</field>
188 <field name="view_mode">tree,form,calendar,graph</field>
189 <field eval="False" name="view_id"/>
190 <field name="domain">[('type','=','out_invoice'),('parent_id','!=',False)]</field>
191 <field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale_debit'}</field>
192 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
193 <field name="help" type="html">
194 <p class="oe_view_nocontent_create">
195 Click to create a customer debit note.
196 </p><p>
197 OpenERP's electronic invoicing allows to ease and fasten the
198 collection of customer payments. Your customer receives the
199 invoice by email and he can pay online and/or import it
200 in his own system.
201 </p><p>
202 The discussions with your customer are automatically displayed at
203 the bottom of each invoice.
204 </p>
205 </field>
206 </record>
207
208 <record id="action_sale_debit_tree_view" model="ir.actions.act_window.view">
209 <field eval="1" name="sequence"/>
210 <field name="view_mode">tree</field>
211 <field name="act_window_id" ref="action_sale_debit_tree"/>
212 </record>
213
214 <record id="action_sale_debit_form_view" model="ir.actions.act_window.view">
215 <field eval="2" name="sequence"/>
216 <field name="view_mode">form</field>
217 <field name="view_id" ref="account.invoice_form"/>
218 <field name="act_window_id" ref="action_sale_debit_tree"/>
219 </record>
220
221
222
223 <menuitem action="action_sale_debit_tree" id="menu_action_sale_debit_tree" parent="account.menu_finance_receivables"/>
224
225 <record id="action_purchase_debit_tree" model="ir.actions.act_window">
226 <field name="name">Supplier Debit Notes</field>
227 <field name="res_model">account.invoice</field>
228 <field name="view_type">form</field>
229 <field name="view_mode">tree,form,calendar,graph</field>
230 <field eval="False" name="view_id"/>
231 <field name="domain">[('type','=','in_invoice'),('parent_id','!=',False)]</field>
232 <field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase_debit'}</field>
233 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
234 <field name="help" type="html">
235 <p class="oe_view_nocontent_create">
236 Click to record a new supplier debit note.
237 </p><p>
238 You can control the invoice from your supplier according to
239 what you purchased or received. OpenERP can also generate
240 draft invoices automatically from purchase orders or receipts.
241 </p>
242 </field>
243 </record>
244
245 <record id="action_purchase_debit_tree_view" model="ir.actions.act_window.view">
246 <field eval="1" name="sequence"/>
247 <field name="view_mode">tree</field>
248 <field name="act_window_id" ref="action_purchase_debit_tree"/>
249 </record>
250
251 <record id="action_purchase_debit_form_view" model="ir.actions.act_window.view">
252 <field eval="2" name="sequence"/>
253 <field name="view_mode">form</field>
254 <field name="view_id" ref="account.invoice_supplier_form"/>
255 <field name="act_window_id" ref="action_purchase_debit_tree"/>
256 </record>
257
258 <menuitem action="action_purchase_debit_tree" id="menu_action_purchase_debit_tree" parent="account.menu_finance_payables"/>
259
260 <record id="account.action_invoice_tree2" model="ir.actions.act_window">
261 <field name="domain">[('type','=','in_invoice'),('parent_id','=',False)]</field>
262 </record>
263
264 <record id="account.action_invoice_tree1" model="ir.actions.act_window">
265 <field name="domain">[('type','=','out_invoice'),('parent_id','=',False)]</field>
266 </record>
267
188 </data>268 </data>
189</openerp>269</openerp>
190270
=== modified file 'l10n_ve_fiscal_requirements/view/partner_view.xml'
--- l10n_ve_fiscal_requirements/view/partner_view.xml 2012-11-06 22:01:07 +0000
+++ l10n_ve_fiscal_requirements/view/partner_view.xml 2012-12-10 03:34:20 +0000
@@ -3,38 +3,44 @@
3 <data>3 <data>
44
5 <record id="view_partner_form2" model="ir.ui.view">5 <record id="view_partner_form2" model="ir.ui.view">
6 <field name="name">res.partner.vat.inherit2</field>6 <field name="name">res.partner.vat.inherit2</field>
7 <field name="model">res.partner</field>
8 <field name="inherit_id" ref="base_vat.view_partner_form"/>
9 <field name="arch" type="xml">
10 <field name="vat" position="replace">
11 </field>
12 </field>
13 </record>
14
15 <record id="view_partner_form3" model="ir.ui.view">
16 <field name="name">res.partner.vat.inherit3</field>
17 <field name="model">res.partner</field>7 <field name="model">res.partner</field>
18 <field name="type">form</field>8 <field name="type">form</field>
19 <field name="inherit_id" ref="base.view_partner_form"/>9 <field name="inherit_id" ref="base.view_partner_form"/>
20 <field name="arch" type="xml">10 <field name="arch" type="xml">
21 <xpath expr='//field[@name="lang"]' position='after'>11
22 <field name="vat" on_change="vat_change_fiscal_requirements(vat)" colspan="2"/>12 <xpath expr='//button[@name="button_check_vat"]' position='replace'></xpath>
23 <button name="update_rif" string="Update Fiscal Information" type="object" icon="gtk-execute" colspan="2"/>13 <xpath expr='//field[@name="vat"]' position='replace'></xpath>
24 </xpath>14
25 </field>
26 </record>
27
28 <record id="view_partner_form4" model="ir.ui.view">
29 <field name="name">res.partner.vat.inherit4</field>
30 <field name="model">res.partner</field>
31 <field name="inherit_id" ref="base.view_partner_form"/>
32 <field name="arch" type="xml">
33 <xpath expr="//field[@name='name']" position="replace">15 <xpath expr="//field[@name='name']" position="replace">
34 <field name="seniat_updated" invisible="1" />16 <field name="seniat_updated" invisible="1" />
35 <field name="name" attrs="{'readonly': [('seniat_updated', '!=', False)]}" />17 <field name="name" attrs="{'readonly': [('seniat_updated', '!=', False)]}" />
36 </xpath>18 </xpath>
37 </field>19
20 <xpath expr='//field[@name="parent_id"]' position='before'>
21 <label for="vat"/>
22 <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)] }" />
23 <button name="button_check_vat" string="Check Validity" type="object" icon="gtk-execute" class="oe_inline"/>
24 <field name="uid_country" colspan="2" invisible="1"/>
25 </xpath>
26
27 <xpath expr='//field[@name="street"]' position='replace'>
28 <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)] }" />
29 </xpath>
30
31 <xpath expr='//field[@name="city"]' position='replace'>
32 <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)] }" />
33 </xpath>
34
35 <xpath expr='//field[@name="country_id"]' position='replace'>
36 <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)] }" />
37 </xpath>
38
39 <xpath expr='//field[@name="phone"]' position='replace'>
40 <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)] }" />
41 </xpath>
42 </field>
38 </record>43 </record>
44
39 </data>45 </data>
40</openerp>46</openerp>
4147
=== modified file 'l10n_ve_fiscal_requirements/view/res_company_view.xml'
--- l10n_ve_fiscal_requirements/view/res_company_view.xml 2011-10-25 20:33:16 +0000
+++ l10n_ve_fiscal_requirements/view/res_company_view.xml 2012-12-10 03:34:20 +0000
@@ -5,15 +5,15 @@
5 <record id="il_company_invoice_damaged" model="ir.ui.view">5 <record id="il_company_invoice_damaged" model="ir.ui.view">
6 <field name="name">il_company_invoice_damaged</field>6 <field name="name">il_company_invoice_damaged</field>
7 <field name="model">res.company</field>7 <field name="model">res.company</field>
8 <field name="type">form</field>8 <field name="priority">24</field>
9 <field name="inherit_id" ref="base.view_company_form"/>9 <field name="inherit_id" ref="base.view_company_form"/>
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <page string="Configuration" position="inside">11 <xpath expr="//group[@name='account_grp']" position="after">
12 <separator string="Data used by default for invoices damaged" colspan="4"/>12 <group name='fr1_grp' string='Damaged Invoices Info'>
13 <field name="jour_id"/>13 <field name="jour_id"/>
14 <field name="acc_id"/>14 <field name="acc_id" domain="[('type','in',('other','receivable','payable'))]"/>
15 <newline/>15 </group>
16 </page>16 </xpath>
17 </field>17 </field>
18 </record>18 </record>
19 </data>19 </data>
2020
=== modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py'
--- l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2012-11-07 15:19:17 +0000
+++ l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2012-12-10 03:34:20 +0000
@@ -43,11 +43,16 @@
43 obj_journal = self.pool.get('account.journal')43 obj_journal = self.pool.get('account.journal')
44 if context is None:44 if context is None:
45 context = {}45 context = {}
46 journal = obj_journal.search(cr, uid, [('type', '=', 'sale')])46 journal = []
47 if context.get('type', False):47 company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
48 if context['type'] in ('in_invoice', 'in_refund'):48 company_id = context.get('company_id', company_id)
49 journal = obj_journal.search(cr, uid, [('type', '=', 'purchase')])49 if context.get('type', False) in ('out_invoice', 'out_refund'):
50 return journal and journal[0] or False50 journal = obj_journal.search(cr, uid, [('type', '=', 'sale_debit'),('company_id','=',company_id)])
51 elif context.get('type', False) in ('in_invoice', 'in_refund'):
52 journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_debit'),('company_id','=',company_id)])
53 if not journal:
54 raise osv.except_osv(_('No Debit Journal !'),_("You must define a debit journal"))
55 return journal[0]
5156
52 _defaults = {57 _defaults = {
53 'date': lambda *a: time.strftime('%Y-%m-%d'),58 'date': lambda *a: time.strftime('%Y-%m-%d'),
@@ -65,19 +70,23 @@
65 #type = context.get('journal_type', 'sale_refund')70 #type = context.get('journal_type', 'sale_refund')
66 type = context.get('journal_type', 'sale')71 type = context.get('journal_type', 'sale')
67 if type in ('sale', 'sale_refund'):72 if type in ('sale', 'sale_refund'):
68 type = 'sale'73 type = 'sale_debit'
69 else:74 else:
70 type = 'purchase'75 type = 'purchase_debit'
76 company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
77 company_id = context.get('company_id', company_id)
71 for field in res['fields']:78 for field in res['fields']:
72 if field == 'journal_id':79 if field == 'journal_id':
73 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)80 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type),('company_id','=',company_id)], context=context, limit=None, name_get_uid=1)
74 res['fields'][field]['selection'] = journal_select81 res['fields'][field]['selection'] = journal_select
75 return res82 return res
7683
77 def _get_period(self, cr, uid, context={}):84 def _get_period(self, cr, uid, context=None):
78 """85 """
79 Return default account period value86 Return default account period value
80 """87 """
88 if context is None:
89 context = {}
81 account_period_obj = self.pool.get('account.period')90 account_period_obj = self.pool.get('account.period')
82 ids = account_period_obj.find(cr, uid, context=context)91 ids = account_period_obj.find(cr, uid, context=context)
83 period_id = False92 period_id = False
@@ -85,10 +94,12 @@
85 period_id = ids[0]94 period_id = ids[0]
86 return period_id95 return period_id
8796
88 def _get_orig(self, cr, uid, inv, ref, context={}):97 def _get_orig(self, cr, uid, inv, ref, context=None):
89 """98 """
90 Return default origin value99 Return default origin value
91 """100 """
101 if context is None:
102 context = {}
92 nro_ref = ref103 nro_ref = ref
93 if inv.type == 'out_invoice':104 if inv.type == 'out_invoice':
94 nro_ref = inv.number105 nro_ref = inv.number
@@ -114,119 +125,122 @@
114 if context is None:125 if context is None:
115 context = {}126 context = {}
116127
117 for form in self.read(cr, uid, ids, context=context):128 form = self.browse(cr, uid, ids[0], context = context)
118 created_inv = []129 created_inv = []
119 date = False130 date = False
120 period = False131 period = False
121 description = False132 description = False
122 company = res_users_obj.browse(cr, uid, uid, context=context).company_id133 company = res_users_obj.browse(cr, uid, uid, context=context).company_id
123 journal_id = form.get('journal_id', False)134 journal_id = form.journal_id and form.journal_id.id or False
124 for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):135 inv = inv_obj.browse(cr, uid, context.get('active_ids')[0], context=context)
125 if inv.state in ['draft', 'proforma2', 'cancel']:136 if inv.state in ['draft', 'proforma2', 'cancel']:
126 raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))137 raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))
127 if inv.reconciled in ('cancel', 'modify'):138 if inv.reconciled in ('cancel', 'modify'):
128 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'))139 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'))
129 if inv.type not in ['in_invoice', 'out_invoice']:140 if inv.type not in ['in_invoice', 'out_invoice']:
130 raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))141 raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))
131 if form['period']:142 if form.period:
132 period = form['period']143 period = form.period.id
133 else:144 else:
134 #Take period from the current date145 #Take period from the current date
135 #period = inv.period_id and inv.period_id.id or False146 #period = inv.period_id and inv.period_id.id or False
136 period = self._get_period(cr, uid, context)147 period = self._get_period(cr, uid, context)
137148
138 if not journal_id:149 if not journal_id:
139 journal_id = inv.journal_id.id150 journal_id = inv.journal_id.id
140151
141 if form['date']:152 if form.date:
142 date = form['date']153 date = form.date
143 if not form['period']:154 if not form.period.id:
144 cr.execute("select name from ir_model_fields \155 cr.execute("select name from ir_model_fields \
145 where model = 'account.period' \156 where model = 'account.period' \
146 and name = 'company_id'")157 and name = 'company_id'")
147 result_query = cr.fetchone()158 result_query = cr.fetchone()
148 if result_query:159 if result_query:
149 #in multi company mode160 #in multi company mode
150 cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \161 cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \
151 and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))162 and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))
152 else:163 else:
153 #in mono company mode164 #in mono company mode
154 cr.execute("""SELECT id165 cr.execute("""SELECT id
155 from account_period where date(%s)166 from account_period where date(%s)
156 between date_start AND date_stop \167 between date_start AND date_stop \
157 limit 1 """, (date,))168 limit 1 """, (date,))
158 res = cr.fetchone()169 res = cr.fetchone()
159 if res:170 if res:
160 period = res[0]171 period = res[0]
161 else:172 else:
162 #Take current date173 #Take current date
163 #date = inv.date_invoice174 #date = inv.date_invoice
164 date = time.strftime('%Y-%m-%d')175 date = time.strftime('%Y-%m-%d')
165 if form['description']:176 if form.description:
166 description = form['description']177 description = form.description
167 else:178 else:
168 description = inv.name179 description = inv.name
169180
170 if not period:181 if not period:
171 raise osv.except_osv(_('Data Insufficient !'), \182 raise osv.except_osv(_('Data Insufficient !'), \
172 _('No Period found on Invoice!'))183 _('No Period found on Invoice!'))
173184
174 #we get original data of invoice to create a new invoice that is the copy of the original185 #we get original data of invoice to create a new invoice that is the copy of the original
175 invoice = inv_obj.read(cr, uid, [inv.id],186 invoice = inv_obj.read(cr, uid, [inv.id],
176 ['name', 'type', 'number', 'reference',187 ['name', 'type', 'number', 'reference',
177 'comment', 'date_due', 'partner_id',188 'comment', 'date_due', 'partner_id',
178 'partner_insite', 'partner_contact',189 'partner_insite', 'partner_contact',
179 'partner_ref', 'payment_term', 'account_id',190 'partner_ref', 'payment_term', 'account_id',
180 'currency_id', 'invoice_line', 'tax_line',191 'currency_id', 'invoice_line', 'tax_line',
181 'journal_id', 'period_id'], context=context)192 'journal_id', 'period_id'], context=context)
182 invoice = invoice[0]193 invoice = invoice[0]
183 del invoice['id']194 del invoice['id']
184 invoice_lines = []195 invoice_lines = []
185 tax_lines = []196 tax_lines = []
186 #Add origin, parent and comment values197 #Add origin, parent and comment values
187 orig = self._get_orig(cr, uid, inv, invoice['reference'], context)198 orig = self._get_orig(cr, uid, inv, invoice['reference'], context)
188 invoice.update({199 invoice.update({
189 'type': inv.type,200 'type': inv.type,
190 'date_invoice': date,201 'date_invoice': date,
191 'state': 'draft',202 'state': 'draft',
192 'number': False,203 'number': False,
193 'invoice_line': invoice_lines,204 'invoice_line': invoice_lines,
194 'tax_line': tax_lines,205 'tax_line': tax_lines,
195 'period_id': period,206 'period_id': period,
196 'parent_id':inv.id,207 'parent_id':inv.id,
197 'name': description,208 'name': description,
198 'origin': orig,209 'origin': orig,
199 'comment':form['comment']210 'comment':form.comment,
200 })211 'journal_id':journal_id
201 #take the id part of the tuple returned for many2one fields212 })
202 for field in ('partner_id',213 #take the id part of the tuple returned for many2one fields
203 'account_id', 'currency_id', 'payment_term', 'journal_id'):214 for field in ('partner_id',
204 invoice[field] = invoice[field] and invoice[field][0]215 'account_id', 'currency_id', 'payment_term'):
205 # create the new invoice216 invoice[field] = invoice[field] and invoice[field][0]
206 inv_id = inv_obj.create(cr, uid, invoice, {})217 # create the new invoice
207 # we compute due date218 inv_id = inv_obj.create(cr, uid, invoice, {})
208 if inv.payment_term.id:219 # we compute due date
209 data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)220 if inv.payment_term.id:
210 if 'value' in data and data['value']:221 data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
211 inv_obj.write(cr, uid, [inv_id], data['value'])222 if 'value' in data and data['value']:
212 created_inv.append(inv_id)223 inv_obj.write(cr, uid, [inv_id], data['value'])
213 #we get the view id224 created_inv.append(inv_id)
214 if inv.type in ('out_invoice', 'out_refund'):225 #we get the view id
215 xml_id = 'action_invoice_tree1'226 if inv.type in ('out_invoice', 'out_refund'):
216 else:227 xml_id = 'action_sale_debit_tree'
217 xml_id = 'action_invoice_tree2'228 else:
218 #we get the model229 xml_id = 'action_purchase_debit_tree'
219 result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)230 #we get the model
220 id = result and result[1] or False231 result = mod_obj.get_object_reference(cr, uid, 'l10n_ve_fiscal_requirements', xml_id)
221 # we read the act window232 id = result and result[1] or False
222 result = act_obj.read(cr, uid, id, context=context)233 # we read the act window
223 # we add the new invoices into domain list234 result = act_obj.read(cr, uid, id, context=context)
224 invoice_domain = eval(result['domain'])235 # we add the new invoices into domain list
225 invoice_domain.append(('id', 'in', created_inv))236 invoice_domain = eval(result['domain'])
226 result['domain'] = invoice_domain237 invoice_domain.append(('id', 'in', created_inv))
227 return result238 result['domain'] = invoice_domain
239 return result
228240
229 def invoice_debit(self, cr, uid, ids, context=None):241 def invoice_debit(self, cr, uid, ids, context=None):
242 if context is None:
243 context = {}
230 return self.compute_debit(cr, uid, ids, context=context)244 return self.compute_debit(cr, uid, ids, context=context)
231245
232246
233247
=== modified file 'l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py'
--- l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2012-09-26 20:44:41 +0000
+++ l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2012-12-10 03:34:20 +0000
@@ -35,28 +35,31 @@
35 'vat_subjected':fields.boolean('Pay VAY', help='Pay VAT, in spanish known as : Contribuyente formal'),35 'vat_subjected':fields.boolean('Pay VAY', help='Pay VAT, in spanish known as : Contribuyente formal'),
36 }36 }
3737
38 def search_partner_seniat(self, cr, uid, vat, context=None):38 def search_partner_seniat(self, cr, uid, ids, context=None):
39 if context is None:39 if context is None:
40 context={}40 context={}
41 aux = ''41 this = self.browse(cr, uid, ids)[0]
42 su_obj = self.pool.get('seniat.url')42 su_obj = self.pool.get('seniat.url')
43 rp_obj = self.pool.get('res.partner')43 rp_obj = self.pool.get('res.partner')
44 url_obj = su_obj.browse(cr, uid, su_obj.search(cr, uid, []))[0]44 vat = this.vat.upper()
45 url1 = url_obj.name + '%s'45 res={'name': _('The requested contributor does not exist'),'vat_subjected': False,'vat':vat,'wh_iva_agent':False, 'wh_iva_rate': 0.0}
46 url2 = url_obj.url_seniat + '%s'46
47 url3 = url_obj.url_seniat2 + '%s'47 if 'VE' in vat:
48 var_vat = self.read(cr,uid,vat,['vat'])48 vat = vat[2:]
49 if var_vat:49
50 aux = var_vat[0]['vat']50 if rp_obj.check_vat_ve(vat,context=context):
51 if rp_obj.check_vat_ve(aux,context):51 res = su_obj._dom_giver(cr, uid, vat,context)
52 context.update({'spf_info':True})
53 res = su_obj._dom_giver(url1,url2,url3, aux,context)
54 if res:52 if res:
55 res.update({'wh_iva_rate':su_obj._buscar_porcentaje(aux,url2)})53 res.update({'wh_iva_rate':su_obj._buscar_porcentaje(cr, uid, vat)})
56 else:54 self.write(cr,uid,ids,res)
57 raise osv.except_osv(_('Error'),_("Does not exist the contributor requested"))55
58 self.write(cr,uid,vat,res)56 return {
59 57 'type': 'ir.actions.act_window',
60 return False58 'res_model': 'search.info.partner.seniat',
61 59 'view_mode': 'form',
60 'view_type': 'form',
61 'res_id': this.id,
62 'views': [(False, 'form')],
63 'target': 'new',
64 }
62search_info_partner_seniat()65search_info_partner_seniat()
6366
=== modified file 'l10n_ve_fiscal_requirements/wizard/update_info_partner.py'
--- l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2012-02-14 14:19:25 +0000
+++ l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2012-12-10 03:34:20 +0000
@@ -32,15 +32,11 @@
32 32
33 def update_info(self, cr, uid, ids, context={}):33 def update_info(self, cr, uid, ids, context={}):
34 aux=[]34 aux=[]
35 res_part_obj = self.pool.get('res.partner')
36 seniat_url_obj = self.pool.get('seniat.url')35 seniat_url_obj = self.pool.get('seniat.url')
37 sql= '''SELECT vat FROM res_partner GROUP BY vat HAVING count(vat) > 1 ;'''36 cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''')
38 cr.execute(sql)37 record = cr.fetchall()
39 record = cr.dictfetchall()38 pids = record and map(lambda x: x[0],record) or []
40 for r in record:39 seniat_url_obj.connect_seniat(cr, uid, pids, context=context, all_rif=True)
41 aux.append(r.values()[0])
42 es_partner_ids= res_part_obj.search(cr, uid, [('vat','not in',aux)])
43 seniat_url_obj.connect_seniat(cr, uid, es_partner_ids, context,True)
44 return{}40 return{}
4541
46 42
4743
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2012-09-24 15:42:44 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2012-12-10 03:34:20 +0000
@@ -95,13 +95,6 @@
95 wizard_brw = self.browse(cr, uid, ids, context=None)95 wizard_brw = self.browse(cr, uid, ids, context=None)
96 wizard_deli_obj = self.pool.get('wz.picking.delivery.note')96 wizard_deli_obj = self.pool.get('wz.picking.delivery.note')
97 inv_id = context.get('active_id')97 inv_id = context.get('active_id')
98 #~ if context['menu']:
99 #~ invoice_obj = self.pool.get('account.invoice')
100 #~ inv_brw = invoice_obj.browse(cr, uid, invoice_obj.search(cr, uid, [], limit=1), context)
101 #~ if inv_brw == []:
102 #~ raise osv.except_osv(_("ERROR !"), _("You must have created at least one invoice to declare it as damaged"))
103 #~ inv_id = inv_brw[0].id
104 #~ inv_brw = inv_brw[0]
105 for wizard in wizard_brw:98 for wizard in wizard_brw:
106 if not wizard.sure:99 if not wizard.sure:
107 raise osv.except_osv(_("Validation error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))100 raise osv.except_osv(_("Validation error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))
108101
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2012-09-24 14:47:16 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2012-12-10 03:34:20 +0000
@@ -32,7 +32,7 @@
32 _description = "Wizard that changes the invoice control number"32 _description = "Wizard that changes the invoice control number"
3333
34 def set_noctrl(self, cr, uid, ids, context=None):34 def set_noctrl(self, cr, uid, ids, context=None):
35 if context==None:35 if context is None:
36 context={}36 context={}
37 data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0]37 data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0]
38 if not data['sure']:38 if not data['sure']:
@@ -41,8 +41,6 @@
41 n_ctrl = data['name']41 n_ctrl = data['name']
42 42
43 invoice = inv_obj.browse(cr, uid, context['active_id'])43 invoice = inv_obj.browse(cr, uid, context['active_id'])
44 if invoice.state == 'draft':
45 raise osv.except_osv(_("Error!"), _("You cannot change the state of a Draft invoice"))
4644
47 inv_obj.write(cr, uid, context.get('active_id'), {'nro_ctrl': n_ctrl}, context=context)45 inv_obj.write(cr, uid, context.get('active_id'), {'nro_ctrl': n_ctrl}, context=context)
48 return {}46 return {}