Merge lp:~jfb-tempo-consulting/unifield-server/US-8839 into lp:unifield-server
- US-8839
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 6110 |
Proposed branch: | lp:~jfb-tempo-consulting/unifield-server/US-8839 |
Merge into: | lp:unifield-server |
Diff against target: |
8352 lines (+2680/-2228) 75 files modified
bin/addons/account/account.py (+39/-0) bin/addons/account/account_invoice_payment_tab.xml (+1/-1) bin/addons/account/account_invoice_view.xml (+376/-113) bin/addons/account/account_menuitem.xml (+1/-1) bin/addons/account/account_view.xml (+154/-67) bin/addons/account/invoice.py (+125/-103) bin/addons/account/report/account_print_invoice.rml (+1/-0) bin/addons/account/report/export_invoice.py (+4/-4) bin/addons/account/report/invoice_excel_export.py (+25/-20) bin/addons/account/wizard/account_invoice_import.py (+1/-1) bin/addons/account/wizard/account_invoice_refund.py (+48/-56) bin/addons/account/wizard/account_invoice_refund_view.xml (+7/-3) bin/addons/account_hq_entries/account_view.xml (+0/-34) bin/addons/account_mcdb/account_view.xml (+0/-24) bin/addons/account_override/__init__.py (+6/-0) bin/addons/account_override/account.py (+1/-0) bin/addons/account_override/account_invoice_sync.py (+17/-13) bin/addons/account_override/account_invoice_view.xml (+14/-314) bin/addons/account_override/account_view.xml (+0/-95) bin/addons/account_override/invoice.py (+251/-219) bin/addons/account_override/report/account_print_invoice.rml (+4/-3) bin/addons/account_override/report/open_invoices_xls.mako (+9/-7) bin/addons/account_override/report/report_open_invoices.py (+6/-34) bin/addons/account_payment/__openerp__.py (+0/-1) bin/addons/account_period_closing_level/account_period.py (+53/-36) bin/addons/account_period_closing_level/account_period_closing_level_view.xml (+4/-1) bin/addons/account_period_closing_level/account_year_end_closing.xml (+1/-16) bin/addons/account_subscription/account_model_view.xml (+1/-1) bin/addons/analytic_distribution/account_commitment.py (+120/-24) bin/addons/analytic_distribution/account_commitment_view.xml (+140/-21) bin/addons/analytic_distribution/account_invoice_refund.py (+49/-13) bin/addons/analytic_distribution/account_invoice_view.xml (+5/-65) bin/addons/analytic_distribution/account_view.xml (+0/-32) bin/addons/analytic_distribution/analytic_line_view.xml (+3/-39) bin/addons/analytic_distribution_supply/__openerp__.py (+0/-1) bin/addons/analytic_distribution_supply/invoice.py (+67/-34) bin/addons/base/__openerp__.py (+1/-1) bin/addons/base/ir/ir_actions.py (+1/-1) bin/addons/base/migrations/8.0.1.7/pre-update-bar.py (+22/-0) bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql (+108/-0) bin/addons/base/module/instance_auto_creation.py (+8/-0) bin/addons/finance/account_analytic_line_view.xml (+16/-1) bin/addons/finance/account_view.xml (+0/-34) bin/addons/finance/board_account_view.xml (+5/-5) bin/addons/msf_accrual/__openerp__.py (+0/-1) bin/addons/msf_currency_revaluation/__openerp__.py (+0/-1) bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py (+3/-102) bin/addons/msf_instance/msf_instance_view.xml (+0/-13) bin/addons/msf_outgoing/msf_outgoing.py (+26/-22) bin/addons/msf_partner/partner.py (+40/-22) bin/addons/msf_profile/data/patches.xml (+8/-0) bin/addons/msf_profile/i18n/es_MF.po (+3/-107) bin/addons/msf_profile/i18n/fr_MF.po (+455/-186) bin/addons/msf_profile/msf_profile.py (+57/-2) bin/addons/msf_sync_data_post_synchro/data/account.analytic.journal.csv (+1/-0) bin/addons/msf_sync_data_post_synchro/data/account.journal.csv (+1/-0) bin/addons/product_attributes/product_attributes.py (+31/-42) bin/addons/purchase/purchase_order.py (+2/-3) bin/addons/purchase/purchase_order_line.py (+1/-1) bin/addons/register_accounting/account_bank_statement.py (+29/-34) bin/addons/register_accounting/account_invoice_view.xml (+4/-126) bin/addons/register_accounting/account_view.xml (+0/-103) bin/addons/register_accounting/wizard/account_direct_invoice_wizard_view.xml (+1/-1) bin/addons/sale/sale_order.py (+58/-1) bin/addons/sale/sale_workflow.py (+95/-3) bin/addons/stock/stock.py (+37/-20) bin/addons/stock_override/stock.py (+1/-0) bin/addons/unifield_setup/__openerp__.py (+1/-0) bin/addons/unifield_setup/installer/__init__.py (+1/-0) bin/addons/unifield_setup/installer/customer_commitment_voucher.xml (+55/-0) bin/addons/unifield_setup/installer/customer_commitment_voucher_setup.py (+67/-0) bin/addons/unifield_setup/setup_configuration.py (+2/-0) bin/import_xml.rng (+1/-0) bin/osv/orm.py (+2/-0) bin/tools/convert.py (+4/-0) |
To merge this branch: | bzr merge lp:~jfb-tempo-consulting/unifield-server/US-8839 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+411252@code.launchpad.net |
Commit message
Description of the change
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 'bin/addons/account/account.py' | |||
2 | --- bin/addons/account/account.py 2021-01-28 17:59:49 +0000 | |||
3 | +++ bin/addons/account/account.py 2021-11-03 13:33:55 +0000 | |||
4 | @@ -580,6 +580,43 @@ | |||
5 | 580 | class account_journal(osv.osv): | 580 | class account_journal(osv.osv): |
6 | 581 | _name = "account.journal" | 581 | _name = "account.journal" |
7 | 582 | _description = "Journal" | 582 | _description = "Journal" |
8 | 583 | |||
9 | 584 | def _get_false(self, cr, uid, ids, *a, **b): | ||
10 | 585 | """ | ||
11 | 586 | Returns False for all ids (cf. only the search method is used for the field) | ||
12 | 587 | """ | ||
13 | 588 | return {}.fromkeys(ids, False) | ||
14 | 589 | |||
15 | 590 | def _search_inv_doc_type(self, cr, uid, obj, name, args, context=None): | ||
16 | 591 | """ | ||
17 | 592 | Returns a domain (based on the context) to get all journals matching with the doc type of the selected invoice | ||
18 | 593 | """ | ||
19 | 594 | if context is None: | ||
20 | 595 | context = {} | ||
21 | 596 | if not args: | ||
22 | 597 | return [] | ||
23 | 598 | doc_type = context.get('doc_type', '') | ||
24 | 599 | if doc_type == 'str': | ||
25 | 600 | journal_types = ['sale'] | ||
26 | 601 | elif doc_type in ('isi', 'isr'): | ||
27 | 602 | journal_types = ['purchase'] | ||
28 | 603 | elif doc_type == 'donation': | ||
29 | 604 | journal_types = ['inkind', 'extra'] | ||
30 | 605 | else: | ||
31 | 606 | journals = { | ||
32 | 607 | 'out_invoice': 'sale', | ||
33 | 608 | 'in_invoice': 'purchase', | ||
34 | 609 | 'out_refund': 'sale_refund', | ||
35 | 610 | 'in_refund': 'purchase_refund', | ||
36 | 611 | } | ||
37 | 612 | journal_types = [journals.get(context.get('type', ''), 'purchase')] | ||
38 | 613 | journal_dom = [('type', 'in', journal_types), ('is_current_instance', '=', True)] | ||
39 | 614 | if doc_type in ('isi', 'isr'): | ||
40 | 615 | journal_dom.append(('code', '=', 'ISI')) | ||
41 | 616 | else: | ||
42 | 617 | journal_dom.append(('code', '!=', 'ISI')) | ||
43 | 618 | return journal_dom | ||
44 | 619 | |||
45 | 583 | _columns = { | 620 | _columns = { |
46 | 584 | 'name': fields.char('Journal Name', size=64, required=True), | 621 | 'name': fields.char('Journal Name', size=64, required=True), |
47 | 585 | 'code': fields.char('Code', size=5, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), | 622 | 'code': fields.char('Code', size=5, required=True, help="The code will be used to generate the numbers of the journal entries of this journal."), |
48 | @@ -609,6 +646,8 @@ | |||
49 | 609 | 'bank_account_name': fields.char('Bank Account Name', size=256, required=False), | 646 | 'bank_account_name': fields.char('Bank Account Name', size=256, required=False), |
50 | 610 | 'bank_swift_code': fields.char('Swift Code', size=32, required=False), | 647 | 'bank_swift_code': fields.char('Swift Code', size=32, required=False), |
51 | 611 | 'bank_address': fields.text('Address', required=False), | 648 | 'bank_address': fields.text('Address', required=False), |
52 | 649 | 'inv_doc_type': fields.function(_get_false, method=True, type='boolean', string='Document Type', store=False, | ||
53 | 650 | fnct_search=_search_inv_doc_type), | ||
54 | 612 | } | 651 | } |
55 | 613 | 652 | ||
56 | 614 | _defaults = { | 653 | _defaults = { |
57 | 615 | 654 | ||
58 | === modified file 'bin/addons/account/account_invoice_payment_tab.xml' | |||
59 | --- bin/addons/account/account_invoice_payment_tab.xml 2021-01-29 15:17:52 +0000 | |||
60 | +++ bin/addons/account/account_invoice_payment_tab.xml 2021-11-03 13:33:55 +0000 | |||
61 | @@ -1,5 +1,5 @@ | |||
62 | 1 | <!-- PAYMENT TAB --> | 1 | <!-- PAYMENT TAB --> |
64 | 2 | <!-- added in SI / SR / IVO / STV --> | 2 | <!-- added in SI / SR / ISI / ISR / IVO / STV --> |
65 | 3 | <page string="Payments" | 3 | <page string="Payments" |
66 | 4 | attrs="{'invisible': [('type', 'not in', ('in_refund', 'out_invoice')), | 4 | attrs="{'invisible': [('type', 'not in', ('in_refund', 'out_invoice')), |
67 | 5 | '|', ('type', '!=', 'in_invoice'), ('is_intermission', '=', True)]}"> | 5 | '|', ('type', '!=', 'in_invoice'), ('is_intermission', '=', True)]}"> |
68 | 6 | 6 | ||
69 | === modified file 'bin/addons/account/account_invoice_view.xml' | |||
70 | --- bin/addons/account/account_invoice_view.xml 2021-01-29 15:17:52 +0000 | |||
71 | +++ bin/addons/account/account_invoice_view.xml 2021-11-03 13:33:55 +0000 | |||
72 | @@ -144,6 +144,9 @@ | |||
73 | 144 | <field name="type">tree</field> | 144 | <field name="type">tree</field> |
74 | 145 | <field name="arch" type="xml"> | 145 | <field name="arch" type="xml"> |
75 | 146 | <tree colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')" string="Invoice"> | 146 | <tree colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')" string="Invoice"> |
76 | 147 | <field name="document_date"/> | ||
77 | 148 | <field name="supplier_reference"/> | ||
78 | 149 | |||
79 | 147 | <field name="date_invoice"/> | 150 | <field name="date_invoice"/> |
80 | 148 | <field name="number"/> | 151 | <field name="number"/> |
81 | 149 | <field name="partner_id" groups="base.group_user"/> | 152 | <field name="partner_id" groups="base.group_user"/> |
82 | @@ -151,17 +154,14 @@ | |||
83 | 151 | <field name="journal_id" invisible="1"/> | 154 | <field name="journal_id" invisible="1"/> |
84 | 152 | <field name="period_id" invisible="1" groups="account.group_account_user"/> | 155 | <field name="period_id" invisible="1" groups="account.group_account_user"/> |
85 | 153 | <field name="company_id" groups="base.group_multi_company" widget="selection"/> | 156 | <field name="company_id" groups="base.group_multi_company" widget="selection"/> |
86 | 154 | <field name="user_id"/> | ||
87 | 155 | <field name="date_due"/> | 157 | <field name="date_due"/> |
88 | 156 | <field name="origin"/> | 158 | <field name="origin"/> |
89 | 157 | <field name="line_count"/> | 159 | <field name="line_count"/> |
90 | 158 | <field name="currency_id"/> | 160 | <field name="currency_id"/> |
94 | 159 | <field name="residual" sum="Residual Amount"/> | 161 | <field name="residual" /> |
95 | 160 | <field name="amount_untaxed" sum="Untaxed Amount"/> | 162 | <field name="amount_total"/> |
93 | 161 | <field name="amount_total" sum="Total Amount"/> | ||
96 | 162 | <field name="state"/> | 163 | <field name="state"/> |
99 | 163 | 164 | <button name="invoice_open" states="draft,proforma2" type="object" string="Approve" icon="terp-camera_test"/> | |
98 | 164 | <button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/> | ||
100 | 165 | </tree> | 165 | </tree> |
101 | 166 | </field> | 166 | </field> |
102 | 167 | </record> | 167 | </record> |
103 | @@ -174,7 +174,10 @@ | |||
104 | 174 | <field name="arch" type="xml"> | 174 | <field name="arch" type="xml"> |
105 | 175 | <form string="Supplier Invoice"> | 175 | <form string="Supplier Invoice"> |
106 | 176 | <group col="8" colspan="4"> | 176 | <group col="8" colspan="4"> |
108 | 177 | <field name="journal_id" widget="selection"/> | 177 | <field name="journal_id" |
109 | 178 | domain="[('inv_doc_type', '=', True)]" | ||
110 | 179 | attrs="{'readonly': ['|', ('state', '!=', 'draft'), '&', ('type', '=', 'in_invoice'), ('synced', '=', True)]}"/> | ||
111 | 180 | <field name="vat_ok" invisible="1" /> | ||
112 | 178 | <field name="number" readonly="1"/> | 181 | <field name="number" readonly="1"/> |
113 | 179 | <field name="type" invisible="1"/> | 182 | <field name="type" invisible="1"/> |
114 | 180 | <field name="is_intermission" invisible="1"/> <!-- for Payment tab --> | 183 | <field name="is_intermission" invisible="1"/> <!-- for Payment tab --> |
115 | @@ -186,7 +189,7 @@ | |||
116 | 186 | 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/> | 189 | 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/> |
117 | 187 | <newline/> | 190 | <newline/> |
118 | 188 | <field string="Supplier" name="partner_id" domain="[('supplier', '=', True)]" | 191 | <field string="Supplier" name="partner_id" domain="[('supplier', '=', True)]" |
120 | 189 | on_change="onchange_partner_id(type, partner_id, date_invoice, payment_term, partner_bank_id, company_id)" | 192 | on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term,partner_bank_id,company_id,is_inkind_donation,is_intermission,is_debit_note,is_direct_invoice,False)" |
121 | 190 | context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" | 193 | context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" |
122 | 191 | attrs="{'readonly': ['|', | 194 | attrs="{'readonly': ['|', |
123 | 192 | ('state', '!=', 'draft'), | 195 | ('state', '!=', 'draft'), |
124 | @@ -195,25 +198,52 @@ | |||
125 | 195 | <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/> | 198 | <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/> |
126 | 196 | <field name="fiscal_position" groups="base.group_extended" widget="selection"/> | 199 | <field name="fiscal_position" groups="base.group_extended" widget="selection"/> |
127 | 197 | <newline/> | 200 | <newline/> |
128 | 201 | <field name="document_date" /> | ||
129 | 198 | <field name="date_invoice"/> | 202 | <field name="date_invoice"/> |
135 | 199 | <field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/> | 203 | <group colspan="2" col="1" /> |
136 | 200 | <group colspan="2" col="1" groups="account.group_account_user"> | 204 | </group> |
137 | 201 | <label align="0.0" string="(keep empty to use the current period)"/> | 205 | <newline /> |
138 | 202 | </group> | 206 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> |
139 | 203 | </group> | 207 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/> |
140 | 208 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
141 | 209 | </group> | ||
142 | 210 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"> | ||
143 | 211 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/> | ||
144 | 212 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
145 | 213 | </group> | ||
146 | 214 | <field name="analytic_distribution_id" invisible="1"/> | ||
147 | 215 | <group colspan="3"/> | ||
148 | 216 | |||
149 | 204 | <notebook colspan="4"> | 217 | <notebook colspan="4"> |
150 | 205 | <page string="Invoice"> | 218 | <page string="Invoice"> |
152 | 206 | <field domain="[('company_id', '=', company_id), ('type', '=', 'payable')]" name="account_id" groups="account.group_account_user"/> | 219 | <field domain="[('company_id', '=', company_id), ('restricted_area', '=', 'in_invoice')]" name="account_id" /> |
153 | 207 | <field name="reference_type" nolabel="1" size="0"/> | 220 | <field name="reference_type" nolabel="1" size="0"/> |
154 | 208 | <field name="reference" nolabel="1"/> | 221 | <field name="reference" nolabel="1"/> |
155 | 209 | <field name="date_due"/> | 222 | <field name="date_due"/> |
156 | 210 | <field name="check_total" required="2"/> | 223 | <field name="check_total" required="2"/> |
157 | 224 | <field name="supplier_reference"/> | ||
158 | 225 | <group name="import" string=" Import Lines " colspan="4" col="4" | ||
159 | 226 | attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'in_invoice')]}"> | ||
160 | 227 | <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
161 | 228 | attrs="{'readonly': [('state', '!=', 'draft')], | ||
162 | 229 | 'invisible': [('type', '!=', 'in_invoice')]}"/> | ||
163 | 230 | <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
164 | 231 | attrs="{'invisible': [('type', '!=', 'in_invoice')]}"/> | ||
165 | 232 | <newline/> | ||
166 | 233 | <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object" | ||
167 | 234 | attrs="{'invisible': [('state', '!=', 'draft')], | ||
168 | 235 | 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/> | ||
169 | 236 | </group> | ||
170 | 237 | |||
171 | 211 | <field colspan="4" default_get="{'check_total': check_total, 'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" name="invoice_line" nolabel="1"> | 238 | <field colspan="4" default_get="{'check_total': check_total, 'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" name="invoice_line" nolabel="1"> |
173 | 212 | <tree string="Invoice lines" editable="both"> | 239 | <tree string="Invoice lines" editable="both" colors="red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:analytic_distribution_state in ('none','valid') and inactive_product == False"> |
174 | 213 | <field name="from_supply" invisible="1"/> | 240 | <field name="from_supply" invisible="1"/> |
175 | 214 | <field name="line_synced" invisible="1"/> | 241 | <field name="line_synced" invisible="1"/> |
176 | 215 | <field name="invoice_type" invisible="1"/> | 242 | <field name="invoice_type" invisible="1"/> |
177 | 216 | <field name="partner_type" invisible="1"/> | 243 | <field name="partner_type" invisible="1"/> |
178 | 244 | <field name="line_number" displayon="noteditable"/> | ||
179 | 245 | <field name="is_corrected" invisible="1"/> | ||
180 | 246 | <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> | ||
181 | 217 | <field name="product_id" | 247 | <field name="product_id" |
182 | 218 | attrs="{'readonly': ['|', | 248 | attrs="{'readonly': ['|', |
183 | 219 | '&', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True), | 249 | '&', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True), |
184 | @@ -224,7 +254,13 @@ | |||
185 | 224 | domain="[('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]" | 254 | domain="[('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]" |
186 | 225 | /> | 255 | /> |
187 | 226 | <field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/> | 256 | <field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/> |
189 | 227 | <field domain="[('type','<>','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/> | 257 | <field name="inactive_product" invisible="1" /> |
190 | 258 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/> | ||
191 | 259 | <field name="analytic_distribution_state_recap"/> | ||
192 | 260 | <field name="have_analytic_distribution_from_header" invisible="1"/> | ||
193 | 261 | <field name="analytic_distribution_state" invisible="1"/> | ||
194 | 262 | <field name="is_allocatable" invisible="1"/> | ||
195 | 263 | |||
196 | 228 | <field name="quantity" | 264 | <field name="quantity" |
197 | 229 | attrs="{'readonly': ['|', | 265 | attrs="{'readonly': ['|', |
198 | 230 | '&', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True),('from_supply', '=', True), | 266 | '&', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True),('from_supply', '=', True), |
199 | @@ -240,7 +276,9 @@ | |||
200 | 240 | </tree> | 276 | </tree> |
201 | 241 | </field> | 277 | </field> |
202 | 242 | <group col="1" colspan="2"> | 278 | <group col="1" colspan="2"> |
204 | 243 | <field name="tax_line" nolabel="1" attrs="{'invisible': [('vat_ok', '=', False)], 'readonly': ['|', ('state','!=', 'draft'), '&', ('type', '=', 'in_invoice'), ('synced', '=', True)]}"> | 279 | <field name="tax_line" nolabel="1" |
205 | 280 | attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))], | ||
206 | 281 | 'readonly': ['|', ('state','!=', 'draft'), '&', ('type', '=', 'in_invoice'), ('synced', '=', True)]}"> | ||
207 | 244 | <tree editable="bottom" string="Taxes"> | 282 | <tree editable="bottom" string="Taxes"> |
208 | 245 | <field name="invoice_id" invisible="True"/> | 283 | <field name="invoice_id" invisible="True"/> |
209 | 246 | <field name="account_tax_id" on_change="tax_code_change(account_tax_id, parent.amount_untaxed, parent.partner_id, context)"/> | 284 | <field name="account_tax_id" on_change="tax_code_change(account_tax_id, parent.amount_untaxed, parent.partner_id, context)"/> |
210 | @@ -265,24 +303,66 @@ | |||
211 | 265 | </field> | 303 | </field> |
212 | 266 | </group> | 304 | </group> |
213 | 267 | <group col="4" colspan="2"> | 305 | <group col="4" colspan="2"> |
216 | 268 | <button colspan="2" name="button_reset_taxes" states="draft" string="Compute Taxes" type="object" icon="terp-stock_format-scientific"/> | 306 | <button colspan="2" name="button_reset_taxes" states="draft" string="Compute Taxes" |
217 | 269 | <field name="amount_untaxed"/> | 307 | type="object" icon="terp-stock_format-scientific" |
218 | 308 | attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))], | ||
219 | 309 | 'readonly': [('state', '!=', 'draft')]}"/> | ||
220 | 310 | <field name="amount_untaxed" attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))]}"/> | ||
221 | 270 | <label string="" colspan="2"/> | 311 | <label string="" colspan="2"/> |
223 | 271 | <field name="amount_tax"/> | 312 | <field name="amount_tax" attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))]}" /> |
224 | 272 | <field name="reconciled"/> | 313 | <field name="reconciled"/> |
225 | 273 | <field name="amount_total"/> | 314 | <field name="amount_total"/> |
226 | 274 | <field name="state"/> | 315 | <field name="state"/> |
227 | 275 | <field name="residual"/> | 316 | <field name="residual"/> |
228 | 276 | <group col="6" colspan="4"> | 317 | <group col="6" colspan="4"> |
232 | 277 | <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/> | 318 | <field name="doc_type" invisible="1"/> |
233 | 278 | <button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid,inv_close' icon="gtk-execute"/> | 319 | <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' icon="gtk-execute" |
234 | 279 | <button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/> | 320 | attrs="{'invisible': ['|', '|', |
235 | 321 | ('state', '=', 'draft'), | ||
236 | 322 | ('type', 'in', ['in_refund', 'out_refund']), | ||
237 | 323 | '&', ('doc_type', '=', 'isi'), ('counterpart_inv_status', '!=', 'inv_close')]}" | ||
238 | 324 | /> | ||
239 | 325 | <group attrs="{'invisible': [('doc_type', 'in', ('isi', 'isr'))]}"> | ||
240 | 326 | <button name="invoice_open" states="draft,proforma2" type="object" string="Validate" icon="gtk-go-forward"/> | ||
241 | 327 | <field name="is_direct_invoice" invisible="1"/> | ||
242 | 328 | <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/> | ||
243 | 329 | <newline/> | ||
244 | 330 | <field name="can_merge_lines" invisible="1"/> | ||
245 | 331 | <button name="button_merge_lines" type="object" | ||
246 | 332 | colspan="3" | ||
247 | 333 | string="Merge Lines by Account" icon="gtk-convert" | ||
248 | 334 | confirm="You are about to merge invoice lines; are you sure you want to proceed? THIS OPERATION CAN NOT BE UNDONE." | ||
249 | 335 | attrs="{'invisible': [('can_merge_lines', '!=', True)]}"/> | ||
250 | 336 | </group> | ||
251 | 337 | |||
252 | 280 | </group> | 338 | </group> |
253 | 281 | </group> | 339 | </group> |
254 | 340 | <!-- for ISI/STR the display of the buttons takes the whole width --> | ||
255 | 341 | <group col="8" colspan="6" attrs="{'invisible': [('doc_type', 'not in', ('isi', 'isr'))]}"> | ||
256 | 342 | <button name="button_merge_lines2" type="object" | ||
257 | 343 | string="Merge Lines by Account" | ||
258 | 344 | icon="gtk-convert" colspan="2" | ||
259 | 345 | confirm="You are about to merge invoice lines; are you sure you want to proceed? THIS OPERATION CAN NOT BE UNDONE." | ||
260 | 346 | attrs="{'invisible': [('can_merge_lines', '!=', True)]}" | ||
261 | 347 | /> | ||
262 | 348 | <button name="button_split_invoice2" type="object" | ||
263 | 349 | string="Split Invoice" | ||
264 | 350 | icon="gtk-cut" colspan="2" | ||
265 | 351 | states="draft" | ||
266 | 352 | /> | ||
267 | 353 | <button name="invoice_open2" type="object" | ||
268 | 354 | string="Validate" | ||
269 | 355 | icon="gtk-go-forward" colspan="4" | ||
270 | 356 | states="draft" | ||
271 | 357 | /> | ||
272 | 358 | </group> | ||
273 | 282 | </page> | 359 | </page> |
274 | 283 | <page string="Other Info"> | 360 | <page string="Other Info"> |
275 | 361 | <field name="amount_to_pay"/> | ||
276 | 284 | <field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/> | 362 | <field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/> |
278 | 285 | <field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/> | 363 | <field name="company_id" |
279 | 364 | on_change="onchange_company_id(company_id, partner_id, type, invoice_line, currency_id, context)" | ||
280 | 365 | widget="selection" groups="base.group_multi_company"/> | ||
281 | 286 | <newline/> | 366 | <newline/> |
282 | 287 | <field name="payment_term" widget="selection"/> | 367 | <field name="payment_term" widget="selection"/> |
283 | 288 | <field name="name" | 368 | <field name="name" |
284 | @@ -304,6 +384,31 @@ | |||
285 | 304 | <field colspan="4" name="comment" nolabel="1"/> | 384 | <field colspan="4" name="comment" nolabel="1"/> |
286 | 305 | </page> | 385 | </page> |
287 | 306 | &payment_tab; | 386 | &payment_tab; |
288 | 387 | <page string="Down Payments"> | ||
289 | 388 | <field name="down_payment_ids" nolabel="1" colspan="4"> | ||
290 | 389 | <tree string="Down Payment"> | ||
291 | 390 | <field name="move_id"/> | ||
292 | 391 | <field name="name" string="Description"/> | ||
293 | 392 | <field name="ref"/> | ||
294 | 393 | <field name="date"/> | ||
295 | 394 | <field name="partner_type"/> | ||
296 | 395 | <field name="reconcile_txt"/> | ||
297 | 396 | <field name="debit_currency"/> | ||
298 | 397 | <field name="credit_currency"/> | ||
299 | 398 | <field name="amount_currency" sum="Total Amount"/> | ||
300 | 399 | <field name="currency_id"/> | ||
301 | 400 | </tree> | ||
302 | 401 | </field> | ||
303 | 402 | </page> | ||
304 | 403 | <!-- display the Counterpart Invoice tab in SI, hide it in SR --> | ||
305 | 404 | <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'in_invoice')]}"> | ||
306 | 405 | <field name="from_supply" invisible="1"/> <!-- make the field exportable --> | ||
307 | 406 | <field name="synced" readonly="1"/> <!-- SI can never be ticked as "Synced" manually --> | ||
308 | 407 | <newline/> | ||
309 | 408 | <field name="counterpart_inv_number"/> | ||
310 | 409 | <field name="counterpart_inv_status"/> | ||
311 | 410 | </page> | ||
312 | 411 | |||
313 | 307 | </notebook> | 412 | </notebook> |
314 | 308 | </form> | 413 | </form> |
315 | 309 | </field> | 414 | </field> |
316 | @@ -314,38 +419,46 @@ | |||
317 | 314 | <field name="model">account.invoice</field> | 419 | <field name="model">account.invoice</field> |
318 | 315 | <field name="type">form</field> | 420 | <field name="type">form</field> |
319 | 316 | <field name="arch" type="xml"> | 421 | <field name="arch" type="xml"> |
321 | 317 | <form string="Invoice" noteditable="state=='cancel'"> | 422 | <form string="Stock Transfer Voucher" noteditable="state=='cancel'"> |
322 | 318 | <group colspan="4" col="8"> | 423 | <group colspan="4" col="8"> |
350 | 319 | <field name="journal_id" groups="base.group_user" widget="selection"/> | 424 | <field name="journal_id" domain="[('inv_doc_type', '=', True)]"/> |
351 | 320 | <field name="journal_type" invisible="1"/> | 425 | <field name="journal_type" invisible="1"/> |
352 | 321 | <field name="number"/> | 426 | <field name="number"/> |
353 | 322 | <field name="type" invisible="1"/> | 427 | <field name="type" invisible="1"/> |
354 | 323 | <field name="is_intermission" invisible="1"/> <!-- for Payment tab --> | 428 | <field name="is_intermission" invisible="1"/> <!-- for Payment tab --> |
355 | 324 | <field name="currency_id" width="50"/> | 429 | <field name="currency_id" width="50"/> |
356 | 325 | <button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/> | 430 | <button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/> |
357 | 326 | <newline/> | 431 | <newline/> |
358 | 327 | <field string="Customer" name="partner_id" | 432 | <field string="Customer" name="partner_id" |
359 | 328 | domain="[('customer', '=', True)]" | 433 | domain="[('customer', '=', True)]" |
360 | 329 | on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" | 434 | on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" |
361 | 330 | groups="base.group_user" context="{'search_default_customer': 1}" | 435 | groups="base.group_user" context="{'search_default_customer': 1}" |
362 | 331 | attrs="{'readonly': ['|', | 436 | attrs="{'readonly': ['|', |
363 | 332 | ('state', '!=', 'draft'), | 437 | ('state', '!=', 'draft'), |
364 | 333 | '&', '&', | 438 | '&', '&', |
365 | 334 | ('type', '=', 'out_invoice'), | 439 | ('type', '=', 'out_invoice'), |
366 | 335 | ('from_supply', '=', True), | 440 | ('from_supply', '=', True), |
367 | 336 | ('partner_type', 'in', ('intermission', 'section'))]}"/> | 441 | ('partner_type', 'in', ('intermission', 'section'))]}"/> |
368 | 337 | <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/> | 442 | <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/> |
369 | 338 | <field name="fiscal_position" groups="base.group_extended" widget="selection"/> | 443 | <newline/> |
370 | 339 | <newline/> | 444 | <field name="document_date"/> |
371 | 340 | <field name="date_invoice"/> | 445 | <field name="date_invoice"/> |
372 | 341 | <field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/> | 446 | <group colspan="2" col="1" groups="account.group_account_user"> |
373 | 342 | <group colspan="2" col="1" groups="account.group_account_user"> | 447 | </group> |
374 | 343 | <label align="0.0" string="(keep empty to use the current period)"/> | 448 | </group> |
375 | 344 | </group> | 449 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> |
376 | 345 | </group> | 450 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/> |
377 | 451 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
378 | 452 | </group> | ||
379 | 453 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"> | ||
380 | 454 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/> | ||
381 | 455 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
382 | 456 | </group> | ||
383 | 457 | <field name="analytic_distribution_id" invisible="1"/> | ||
384 | 458 | <group colspan="3"/> | ||
385 | 346 | <notebook colspan="4"> | 459 | <notebook colspan="4"> |
386 | 347 | <page string="Invoice"> | 460 | <page string="Invoice"> |
388 | 348 | <field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/> | 461 | <field domain="[('company_id', '=', company_id), ('restricted_area', '=', 'out_invoice')]" name="account_id" /> |
389 | 349 | <field name="name" attrs="{'readonly': ['|', | 462 | <field name="name" attrs="{'readonly': ['|', |
390 | 350 | ('state', '!=', 'draft'), | 463 | ('state', '!=', 'draft'), |
391 | 351 | '&', '&', | 464 | '&', '&', |
392 | @@ -353,6 +466,21 @@ | |||
393 | 353 | ('from_supply', '=', True), | 466 | ('from_supply', '=', True), |
394 | 354 | ('partner_type', 'in', ('intermission', 'section'))]}"/> | 467 | ('partner_type', 'in', ('intermission', 'section'))]}"/> |
395 | 355 | <field name="payment_term" widget="selection"/> | 468 | <field name="payment_term" widget="selection"/> |
396 | 469 | <group name="import" string=" Import Lines " colspan="4" col="4" | ||
397 | 470 | attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}"> | ||
398 | 471 | <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
399 | 472 | attrs="{'readonly': [('state', '!=', 'draft')], | ||
400 | 473 | 'invisible': [('type', '!=', 'out_invoice')]}"/> | ||
401 | 474 | <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
402 | 475 | attrs="{'invisible': [('type', '!=', 'out_invoice')]}" | ||
403 | 476 | force_editable="1"/> | ||
404 | 477 | <newline/> | ||
405 | 478 | <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object" | ||
406 | 479 | attrs="{'invisible': [('state', '!=', 'draft')], | ||
407 | 480 | 'readonly': [('type', '=', 'out_invoice'), | ||
408 | 481 | ('from_supply', '=', True), | ||
409 | 482 | ('partner_type', 'in', ('intermission', 'section'))]}"/> | ||
410 | 483 | </group> | ||
411 | 356 | <field colspan="4" name="invoice_line" nolabel="1" context="{'fake': 1, 'from_inv_form': True}"> | 484 | <field colspan="4" name="invoice_line" nolabel="1" context="{'fake': 1, 'from_inv_form': True}"> |
412 | 357 | <tree string="Invoice Line" | 485 | <tree string="Invoice Line" |
413 | 358 | colors="red:inactive_product == True or analytic_distribution_state in ('invalid', 'invalid_small_amount');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')" | 486 | colors="red:inactive_product == True or analytic_distribution_state in ('invalid', 'invalid_small_amount');blue:inactive_product == False and analytic_distribution_state in ('valid');black:inactive_product == False and analytic_distribution_state in ('none')" |
414 | @@ -397,44 +525,66 @@ | |||
415 | 397 | <field name="name"/> | 525 | <field name="name"/> |
416 | 398 | </tree> | 526 | </tree> |
417 | 399 | </field> | 527 | </field> |
440 | 400 | <group col="1" colspan="2"> | 528 | <group col="1" colspan="2" /> |
441 | 401 | <field name="tax_line" nolabel="1"> | 529 | <group col="8" colspan="4"> |
442 | 402 | <tree editable="bottom" string="Taxes"> | 530 | <label string="" colspan="3"/> |
421 | 403 | <field name="name"/> | ||
422 | 404 | <field name="account_id" groups="account.group_account_invoice"/> | ||
423 | 405 | <field name="base" | ||
424 | 406 | on_change="base_change(base, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)" | ||
425 | 407 | readonly="1"/> | ||
426 | 408 | <field name="amount" | ||
427 | 409 | on_change="amount_change(amount, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"/> | ||
428 | 410 | <field invisible="True" name="base_amount"/> | ||
429 | 411 | <field invisible="True" name="tax_amount"/> | ||
430 | 412 | <field name="factor_base" invisible="True"/> | ||
431 | 413 | <field name="factor_tax" invisible="True"/> | ||
432 | 414 | </tree> | ||
433 | 415 | </field> | ||
434 | 416 | </group> | ||
435 | 417 | <group col="4" colspan="2"> | ||
436 | 418 | <button colspan="2" name="button_reset_taxes" states="draft" string="Compute Taxes" type="object" groups="base.group_user" icon="terp-stock_format-scientific"/> | ||
437 | 419 | <field name="amount_untaxed"/> | ||
438 | 420 | <label string="" colspan="2"/> | ||
439 | 421 | <field name="amount_tax"/> | ||
443 | 422 | <field name="reconciled"/> | 531 | <field name="reconciled"/> |
444 | 423 | <field name="amount_total"/> | 532 | <field name="amount_total"/> |
445 | 533 | <label string="" colspan="3"/> | ||
446 | 424 | <field name="state"/> | 534 | <field name="state"/> |
447 | 425 | <field name="residual"/> | 535 | <field name="residual"/> |
456 | 426 | <group col="8" colspan="4" groups="base.group_user"> | 536 | <field name="is_debit_note" invisible="1"/> |
457 | 427 | <button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/> | 537 | </group> |
458 | 428 | 538 | <field name="partner_type" invisible="1"/> | |
459 | 429 | <button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid,inv_close' icon="gtk-execute"/> | 539 | <group col="8" colspan="4"> |
460 | 430 | <button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/> | 540 | |
461 | 431 | <button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/> | 541 | <field name="doc_type" invisible="1"/> |
462 | 432 | <button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/> | 542 | |
463 | 433 | </group> | 543 | <button string="Cancel document" name="invoice_cancel" |
464 | 544 | type="workflow" icon="gtk-cancel" | ||
465 | 545 | confirm="Do you really want to cancel this document?" | ||
466 | 546 | attrs="{'invisible': ['|', '|', | ||
467 | 547 | ('state', '!=', 'draft'), | ||
468 | 548 | ('type', '!=', 'out_invoice'), | ||
469 | 549 | ('from_supply', '=', False)]}"/> | ||
470 | 550 | |||
471 | 551 | <button name="button_split_invoice" type="object" string="Split Stock Transfer Voucher" | ||
472 | 552 | icon="gtk-cut" | ||
473 | 553 | context="{'from_stv': True}" | ||
474 | 554 | attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('doc_type', '!=', 'stv')]}"/> | ||
475 | 555 | |||
476 | 556 | <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' icon="gtk-execute" attrs="{'invisible': ['|', ('state', 'in', ['draft']), ('type', 'in', ['in_refund', 'out_refund'])]}"/> | ||
477 | 557 | <!-- add a confirmation step only for STV (not for CR/STR) | ||
478 | 558 | when the partner type is compatible with a synchro but "synced" isn't ticked --> | ||
479 | 559 | <button name="invoice_open" type="object" string="Validate" | ||
480 | 560 | icon="gtk-go-forward" | ||
481 | 561 | attrs="{'invisible': ['|', | ||
482 | 562 | ('state', '!=', 'draft'), | ||
483 | 563 | '&', | ||
484 | 564 | ('doc_type', '=', 'stv'), ('partner_type', 'in', ('intermission', 'section')) ]}"/> | ||
485 | 565 | <button name="invoice_open_with_confirmation" type="object" string="Validate" | ||
486 | 566 | icon="gtk-go-forward" | ||
487 | 567 | confirm="Are you sure you want to validate this invoice without synchronization?" | ||
488 | 568 | attrs="{'invisible': ['|', '|', '|', | ||
489 | 569 | ('state', '!=', 'draft'), | ||
490 | 570 | ('doc_type', '!=', 'stv'), | ||
491 | 571 | ('synced', '=', True), | ||
492 | 572 | ('partner_type', 'not in', ('intermission', 'section'))]}"/> | ||
493 | 573 | |||
494 | 574 | <button name="invoice_open_with_sync_confirmation" type="object" string="Validate" | ||
495 | 575 | icon="gtk-go-forward" | ||
496 | 576 | confirm="This invoice will sync to its counterpart instance." | ||
497 | 577 | attrs="{'invisible': ['|', '|', '|', | ||
498 | 578 | ('state', '!=', 'draft'), | ||
499 | 579 | ('doc_type', '!=', 'stv'), | ||
500 | 580 | ('synced', '=', False), | ||
501 | 581 | ('partner_type', 'not in', ('intermission', 'section'))]}"/> | ||
502 | 582 | <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/> | ||
503 | 434 | </group> | 583 | </group> |
504 | 435 | </page> | 584 | </page> |
505 | 436 | <page string="Other Info"> | 585 | <page string="Other Info"> |
507 | 437 | <field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id)" widget="selection" groups="base.group_multi_company"/> | 586 | <field name="company_id" on_change="onchange_company_id(company_id, partner_id, type, invoice_line, currency_id, context)" |
508 | 587 | widget="selection" groups="base.group_multi_company"/> | ||
509 | 438 | <newline/> | 588 | <newline/> |
510 | 439 | <field name="date_due"/> | 589 | <field name="date_due"/> |
511 | 440 | <field name="user_id" attrs="{'readonly': ['|', | 590 | <field name="user_id" attrs="{'readonly': ['|', |
512 | @@ -461,7 +611,7 @@ | |||
513 | 461 | <field colspan="4" name="comment" nolabel="1"/> | 611 | <field colspan="4" name="comment" nolabel="1"/> |
514 | 462 | </page> | 612 | </page> |
515 | 463 | &payment_tab; | 613 | &payment_tab; |
517 | 464 | <!-- display the Counterpart Invoice tab in STV, hide it in Customer Refunds --> | 614 | <!-- display the Counterpart Invoice tab in STV, hide it in CR/STR --> |
518 | 465 | <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'out_invoice')]}"> | 615 | <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'out_invoice')]}"> |
519 | 466 | <field name="from_supply" invisible="1"/> | 616 | <field name="from_supply" invisible="1"/> |
520 | 467 | <field name="synced" | 617 | <field name="synced" |
521 | @@ -484,16 +634,19 @@ | |||
522 | 484 | <search string="Search Invoice"> | 634 | <search string="Search Invoice"> |
523 | 485 | <group col="10" colspan="4"> | 635 | <group col="10" colspan="4"> |
524 | 486 | <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/> | 636 | <filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/> |
529 | 487 | <filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices"/> | 637 | <filter name="unpaid" icon="terp-dolar_ok!" string="Open" domain="[('state','=','open')]" help="Open Invoices"/> |
530 | 488 | <filter name="invoices" icon="terp-dolar" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/> | 638 | <filter name="paid" icon="terp-dolar" string="Paid" domain="[('state', '=', 'paid')]"/> |
531 | 489 | <separator orientation="vertical"/> | 639 | <filter name="closed" icon="terp-dialog-close" string="Closed" domain="[('state', '=', 'inv_close')]" /> |
532 | 490 | <filter name="unpaid" icon="terp-dolar_ok!" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/> | 640 | <filter name="cancel_state" icon="terp-gtk-stop" string="Cancelled" domain="[('state', '=', 'cancel')]"/> |
533 | 641 | <separator orientation="vertical"/> | ||
534 | 642 | <filter name="not_imported" icon="gtk-cancel" string="Not imported" domain="[('imported_state', '=', 'not')]"/> | ||
535 | 643 | <filter name="partial" icon="terp-dolar_ok!" string="Partially imported" domain="[('imported_state', '=', 'partial')]"/> | ||
536 | 644 | <filter name="imported" icon="gtk-apply" string="Imported" domain="[('imported_state', '=', 'imported')]"/> | ||
537 | 645 | <separator orientation="vertical"/> | ||
538 | 646 | |||
539 | 491 | <separator orientation="vertical"/> | 647 | <separator orientation="vertical"/> |
540 | 492 | <field name="number"/> | 648 | <field name="number"/> |
541 | 493 | <field name="partner_id"/> | 649 | <field name="partner_id"/> |
542 | 494 | <field name="user_id" select="1" widget="selection" string="Salesman"> | ||
543 | 495 | <filter domain="[('user_id','=',uid)]" help="My invoices" icon="terp-personal" separator="1"/> | ||
544 | 496 | </field> | ||
545 | 497 | <field name="origin"/> | 650 | <field name="origin"/> |
546 | 498 | <field name="amount_total"/> | 651 | <field name="amount_total"/> |
547 | 499 | </group> | 652 | </group> |
548 | @@ -501,11 +654,12 @@ | |||
549 | 501 | <group col="10" colspan="4"> | 654 | <group col="10" colspan="4"> |
550 | 502 | <field name="journal_id" widget="selection" select='1'/> | 655 | <field name="journal_id" widget="selection" select='1'/> |
551 | 503 | <field name="period_id" select='1' string="Period" domain="[('state', 'not in', ['done', 'created'])]"/> | 656 | <field name="period_id" select='1' string="Period" domain="[('state', 'not in', ['done', 'created'])]"/> |
552 | 657 | <field name="supplier_reference"/> | ||
553 | 658 | <field name="name"/> | ||
554 | 504 | </group> | 659 | </group> |
555 | 505 | <newline/> | 660 | <newline/> |
556 | 506 | <group expand="0" string="Group By..."> | 661 | <group expand="0" string="Group By..."> |
557 | 507 | <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> | 662 | <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> |
558 | 508 | <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> | ||
559 | 509 | <separator orientation="vertical"/> | 663 | <separator orientation="vertical"/> |
560 | 510 | <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/> | 664 | <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/> |
561 | 511 | <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> | 665 | <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> |
562 | @@ -552,15 +706,16 @@ | |||
563 | 552 | <field name="act_window_id" ref="action_invoice_tree"/> | 706 | <field name="act_window_id" ref="action_invoice_tree"/> |
564 | 553 | </record> | 707 | </record> |
565 | 554 | 708 | ||
568 | 555 | <record id="action_invoice_tree1" model="ir.actions.act_window"> | 709 | <!-- Fix customer invoice display with a bypass on 'is_debit_note' set to True --> |
569 | 556 | <field name="name">Customer Invoices</field> | 710 | <record id="account.action_invoice_tree1" model="ir.actions.act_window"> |
570 | 711 | <field name="name">Customer Invoices</field> <!-- Stock Transfer Vouchers --> | ||
571 | 557 | <field name="res_model">account.invoice</field> | 712 | <field name="res_model">account.invoice</field> |
572 | 558 | <field name="view_type">form</field> | 713 | <field name="view_type">form</field> |
573 | 559 | <field name="view_mode">tree,form,calendar,graph</field> | 714 | <field name="view_mode">tree,form,calendar,graph</field> |
574 | 560 | <field eval="False" name="view_id"/> | 715 | <field eval="False" name="view_id"/> |
578 | 561 | <field name="domain">[('type','=','out_invoice')]</field> | 716 | <field name="domain">[('doc_type', '=', 'stv')]</field> |
579 | 562 | <field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field> | 717 | <field name="context">{'doc_type': 'stv', 'type': 'out_invoice', 'journal_type': 'sale', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_unpaid': 1, 'search_default_paid': 1, 'search_default_closed': 1}</field> |
580 | 563 | <field name="search_view_id" ref="view_account_invoice_filter"/> | 718 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> |
581 | 564 | <field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field> | 719 | <field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field> |
582 | 565 | </record> | 720 | </record> |
583 | 566 | 721 | ||
584 | @@ -578,20 +733,26 @@ | |||
585 | 578 | <field name="act_window_id" ref="action_invoice_tree1"/> | 733 | <field name="act_window_id" ref="action_invoice_tree1"/> |
586 | 579 | </record> | 734 | </record> |
587 | 580 | 735 | ||
589 | 581 | <menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables"/> | 736 | <!-- STV --> |
590 | 737 | <menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables" sequence="3"/> | ||
591 | 582 | 738 | ||
593 | 583 | <record id="action_invoice_tree2" model="ir.actions.act_window"> | 739 | <!-- Fix supplier invoice display with a bypass on 'is_inkind_donation' set to True --> |
594 | 740 | <record id="account.action_invoice_tree2" model="ir.actions.act_window"> | ||
595 | 584 | <field name="name">Supplier Invoices</field> | 741 | <field name="name">Supplier Invoices</field> |
596 | 585 | <field name="res_model">account.invoice</field> | 742 | <field name="res_model">account.invoice</field> |
597 | 586 | <field name="view_type">form</field> | 743 | <field name="view_type">form</field> |
598 | 587 | <field name="view_mode">tree,form,calendar,graph</field> | 744 | <field name="view_mode">tree,form,calendar,graph</field> |
599 | 588 | <field eval="False" name="view_id"/> | 745 | <field eval="False" name="view_id"/> |
604 | 589 | <field name="domain">[('type','=','in_invoice')]</field> | 746 | <!-- US-2704 if the domain change, do not forget to update the domain of account_board_supplier_invoice_draft in finance/board_account_view.xml --> |
605 | 590 | <field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field> | 747 | <field name="domain">[('doc_type', '=', 'si')]</field> |
606 | 591 | <field name="search_view_id" ref="view_account_invoice_filter"/> | 748 | <field name="context">{'doc_type': 'si', 'type': 'in_invoice', 'journal_type': 'purchase', 'from_inv_form': True}</field> |
607 | 592 | <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice from your supplier according to what you purchased or received.</field> | 749 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> |
608 | 750 | <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. | ||
609 | 751 | OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice | ||
610 | 752 | from your supplier according to what you purchased or received.</field> | ||
611 | 593 | </record> | 753 | </record> |
613 | 594 | <menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/> | 754 | |
614 | 755 | <menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables" sequence="10"/> | ||
615 | 595 | 756 | ||
616 | 596 | <record id="action_invoice_tree3" model="ir.actions.act_window"> | 757 | <record id="action_invoice_tree3" model="ir.actions.act_window"> |
617 | 597 | <field name="name">Customer Refunds</field> | 758 | <field name="name">Customer Refunds</field> |
618 | @@ -599,8 +760,8 @@ | |||
619 | 599 | <field name="view_type">form</field> | 760 | <field name="view_type">form</field> |
620 | 600 | <field name="view_mode">tree,form,calendar,graph</field> | 761 | <field name="view_mode">tree,form,calendar,graph</field> |
621 | 601 | <field eval="False" name="view_id"/> | 762 | <field eval="False" name="view_id"/> |
624 | 602 | <field name="domain">[('type','=','out_refund')]</field> | 763 | <field name="domain">[('doc_type', '=', 'cr')]</field> |
625 | 603 | <field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field> | 764 | <field name="context">{'doc_type': 'cr', 'type': 'out_refund', 'journal_type': 'sale_refund'}</field> |
626 | 604 | <field name="search_view_id" ref="view_account_invoice_filter"/> | 765 | <field name="search_view_id" ref="view_account_invoice_filter"/> |
627 | 605 | <field name="help">With Customer Refunds you can manage the credit notes for your customers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field> | 766 | <field name="help">With Customer Refunds you can manage the credit notes for your customers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field> |
628 | 606 | </record> | 767 | </record> |
629 | @@ -617,7 +778,8 @@ | |||
630 | 617 | <field name="view_id" ref="invoice_form"/> | 778 | <field name="view_id" ref="invoice_form"/> |
631 | 618 | <field name="act_window_id" ref="action_invoice_tree3"/> | 779 | <field name="act_window_id" ref="action_invoice_tree3"/> |
632 | 619 | </record> | 780 | </record> |
634 | 620 | <menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables"/> | 781 | <!-- Customer Refunds Menu --> |
635 | 782 | <menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables" sequence="6"/> | ||
636 | 621 | 783 | ||
637 | 622 | <record id="action_invoice_tree4" model="ir.actions.act_window"> | 784 | <record id="action_invoice_tree4" model="ir.actions.act_window"> |
638 | 623 | <field name="name">Supplier Refunds</field> | 785 | <field name="name">Supplier Refunds</field> |
639 | @@ -625,14 +787,40 @@ | |||
640 | 625 | <field name="view_type">form</field> | 787 | <field name="view_type">form</field> |
641 | 626 | <field name="view_mode">tree,form,calendar,graph</field> | 788 | <field name="view_mode">tree,form,calendar,graph</field> |
642 | 627 | <field eval="False" name="view_id"/> | 789 | <field eval="False" name="view_id"/> |
645 | 628 | <field name="domain">[('type','=','in_refund')]</field> | 790 | <field name="domain">[('doc_type', '=', 'sr')]</field> |
646 | 629 | <field name="context">{'type':'in_refund', 'journal_type': 'purchase_refund'}</field> | 791 | <field name="context">{'doc_type': 'sr', 'type': 'in_refund', 'journal_type': 'purchase_refund'}</field> |
647 | 630 | <field name="search_view_id" ref="view_account_invoice_filter"/> | 792 | <field name="search_view_id" ref="view_account_invoice_filter"/> |
648 | 631 | <field name="help">With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field> | 793 | <field name="help">With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field> |
649 | 632 | </record> | 794 | </record> |
653 | 633 | <menuitem action="action_invoice_tree4" id="menu_action_invoice_tree4" parent="menu_finance_payables"/> | 795 | <menuitem action="action_invoice_tree4" id="menu_action_invoice_tree4" parent="menu_finance_payables" sequence="15"/> |
654 | 634 | 796 | ||
655 | 635 | <act_window context="{'search_default_partner_id':[active_id]}" id="act_res_partner_2_account_invoice_opened" name="Invoices" res_model="account.invoice" src_model="res.partner"/> | 797 | |
656 | 798 | <record id="generic_invoice_tree" model="ir.ui.view"> | ||
657 | 799 | <field name="name">account.invoice.generic.tree</field> | ||
658 | 800 | <field name="model">account.invoice</field> | ||
659 | 801 | <field name="type">tree</field> | ||
660 | 802 | <field name="priority" eval="100" /> | ||
661 | 803 | <field name="arch" type="xml"> | ||
662 | 804 | <tree colors="blue:state in ('draft');black:state in ('proforma','proforma2','open');gray:state in ('cancel')" string="Invoice" hide_new_button="1" hide_edit_button="1" hide_delete_button="1"> | ||
663 | 805 | <button name="invoice_open_form_view" string="Display Invoice" icon="gtk-go-forward" type="object"/> | ||
664 | 806 | <field name="doc_type"/> | ||
665 | 807 | <field name="date_invoice"/> | ||
666 | 808 | <field name="number"/> | ||
667 | 809 | <field name="partner_id"/> | ||
668 | 810 | <field name="name"/> | ||
669 | 811 | <field name="date_due"/> | ||
670 | 812 | <field name="origin"/> | ||
671 | 813 | <field name="line_count"/> | ||
672 | 814 | <field name="currency_id"/> | ||
673 | 815 | <field name="residual" sum="Residual Amount"/> | ||
674 | 816 | <field name="amount_untaxed" sum="Untaxed Amount"/> | ||
675 | 817 | <field name="amount_total" sum="Total Amount"/> | ||
676 | 818 | <field name="state"/> | ||
677 | 819 | </tree> | ||
678 | 820 | </field> | ||
679 | 821 | </record> | ||
680 | 822 | <act_window context="{'search_default_partner_id': [active_id], 'generic_invoice': True}" id="act_res_partner_2_account_invoice_opened" name="Invoices" res_model="account.invoice" src_model="res.partner" view_id="generic_invoice_tree" view_mode="tree" search_view_id="view_account_invoice_filter"/> | ||
681 | 823 | |||
682 | 636 | 824 | ||
683 | 637 | <act_window | 825 | <act_window |
684 | 638 | id="act_account_journal_2_account_invoice_opened" | 826 | id="act_account_journal_2_account_invoice_opened" |
685 | @@ -641,5 +829,80 @@ | |||
686 | 641 | res_model="account.invoice" | 829 | res_model="account.invoice" |
687 | 642 | src_model="account.journal"/> | 830 | src_model="account.journal"/> |
688 | 643 | 831 | ||
689 | 832 | <!-- STOCK TRANSFER REFUNDS --> | ||
690 | 833 | <record id="action_str" model="ir.actions.act_window"> | ||
691 | 834 | <field name="name">Stock Transfer Refunds</field> | ||
692 | 835 | <field name="res_model">account.invoice</field> | ||
693 | 836 | <field name="view_type">form</field> | ||
694 | 837 | <field name="view_mode">tree,form,calendar,graph</field> | ||
695 | 838 | <field eval="False" name="view_id"/> | ||
696 | 839 | <field name="domain">[('doc_type', '=', 'str')]</field> | ||
697 | 840 | <field name="context">{'doc_type': 'str', 'type': 'out_refund', 'from_inv_form': True}</field> | ||
698 | 841 | <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Customer Refunds --> | ||
699 | 842 | </record> | ||
700 | 843 | <record id="action_str_tree" model="ir.actions.act_window.view"> | ||
701 | 844 | <field eval="30" name="sequence"/> | ||
702 | 845 | <field name="view_mode">tree</field> | ||
703 | 846 | <field name="view_id" ref="invoice_tree"/> <!-- as for Customer Refunds (default tree view) --> | ||
704 | 847 | <field name="act_window_id" ref="action_str"/> | ||
705 | 848 | </record> | ||
706 | 849 | <record id="action_str_form" model="ir.actions.act_window.view"> | ||
707 | 850 | <field eval="35" name="sequence"/> | ||
708 | 851 | <field name="view_mode">form</field> | ||
709 | 852 | <field name="view_id" ref="invoice_form"/> <!-- as for Customer Refunds --> | ||
710 | 853 | <field name="act_window_id" ref="action_str"/> | ||
711 | 854 | </record> | ||
712 | 855 | <menuitem action="action_str" id="menu_action_str" parent="menu_finance_receivables" sequence="4"/> | ||
713 | 856 | |||
714 | 857 | <!-- INTERSECTION SUPPLIER INVOICES --> | ||
715 | 858 | <record id="action_isi" model="ir.actions.act_window"> | ||
716 | 859 | <field name="name">Intersection Supplier Invoices</field> | ||
717 | 860 | <field name="res_model">account.invoice</field> | ||
718 | 861 | <field name="view_type">form</field> | ||
719 | 862 | <field name="view_mode">tree,form,calendar,graph</field> | ||
720 | 863 | <field eval="False" name="view_id"/> | ||
721 | 864 | <field name="domain">[('doc_type', '=', 'isi')]</field> | ||
722 | 865 | <field name="context">{'doc_type': 'isi', 'type': 'in_invoice', 'from_inv_form': True}</field> | ||
723 | 866 | <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Supplier Invoices --> | ||
724 | 867 | </record> | ||
725 | 868 | <record id="action_isi_tree" model="ir.actions.act_window.view"> | ||
726 | 869 | <field eval="40" name="sequence"/> | ||
727 | 870 | <field name="view_mode">tree</field> | ||
728 | 871 | <field name="view_id" ref="invoice_tree"/> <!-- default tree view --> | ||
729 | 872 | <field name="act_window_id" ref="action_isi"/> | ||
730 | 873 | </record> | ||
731 | 874 | <record id="action_isi_form" model="ir.actions.act_window.view"> | ||
732 | 875 | <field eval="45" name="sequence"/> | ||
733 | 876 | <field name="view_mode">form</field> | ||
734 | 877 | <field name="view_id" ref="invoice_supplier_form"/> | ||
735 | 878 | <field name="act_window_id" ref="action_isi"/> | ||
736 | 879 | </record> | ||
737 | 880 | <menuitem action="action_isi" id="menu_action_isi" parent="menu_finance_payables" sequence="20"/> | ||
738 | 881 | |||
739 | 882 | <!-- INTERSECTION SUPPLIER REFUNDS --> | ||
740 | 883 | <record id="action_isr" model="ir.actions.act_window"> | ||
741 | 884 | <field name="name">Intersection Supplier Refunds</field> | ||
742 | 885 | <field name="res_model">account.invoice</field> | ||
743 | 886 | <field name="view_type">form</field> | ||
744 | 887 | <field name="view_mode">tree,form,calendar,graph</field> | ||
745 | 888 | <field eval="False" name="view_id"/> | ||
746 | 889 | <field name="domain">[('doc_type', '=', 'isr')]</field> | ||
747 | 890 | <field name="context">{'doc_type': 'isr', 'type': 'in_refund', 'from_inv_form': True}</field> | ||
748 | 891 | <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Supplier Refunds --> | ||
749 | 892 | </record> | ||
750 | 893 | <record id="action_isr_tree" model="ir.actions.act_window.view"> | ||
751 | 894 | <field eval="50" name="sequence"/> | ||
752 | 895 | <field name="view_mode">tree</field> | ||
753 | 896 | <field name="view_id" ref="invoice_tree"/> <!-- default tree view --> | ||
754 | 897 | <field name="act_window_id" ref="action_isr"/> | ||
755 | 898 | </record> | ||
756 | 899 | <record id="action_isr_form" model="ir.actions.act_window.view"> | ||
757 | 900 | <field eval="55" name="sequence"/> | ||
758 | 901 | <field name="view_mode">form</field> | ||
759 | 902 | <field name="view_id" ref="invoice_supplier_form"/> | ||
760 | 903 | <field name="act_window_id" ref="action_isr"/> | ||
761 | 904 | </record> | ||
762 | 905 | <menuitem action="action_isr" id="menu_action_isr" parent="menu_finance_payables" sequence="22"/> | ||
763 | 906 | |||
764 | 644 | </data> | 907 | </data> |
765 | 645 | </openerp> | 908 | </openerp> |
766 | 646 | 909 | ||
767 | === modified file 'bin/addons/account/account_menuitem.xml' | |||
768 | --- bin/addons/account/account_menuitem.xml 2017-04-13 14:08:16 +0000 | |||
769 | +++ bin/addons/account/account_menuitem.xml 2021-11-03 13:33:55 +0000 | |||
770 | @@ -8,7 +8,7 @@ | |||
771 | 8 | web_icon_hover="images/accounting-hover.png"/> | 8 | web_icon_hover="images/accounting-hover.png"/> |
772 | 9 | <menuitem id="menu_finance_receivables" name="Customers" parent="menu_finance" sequence="2"/> | 9 | <menuitem id="menu_finance_receivables" name="Customers" parent="menu_finance" sequence="2"/> |
773 | 10 | <menuitem id="menu_finance_payables" name="Suppliers" parent="menu_finance" sequence="3"/> | 10 | <menuitem id="menu_finance_payables" name="Suppliers" parent="menu_finance" sequence="3"/> |
775 | 11 | <menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="4" | 11 | <menuitem id="account.menu_finance_bank_and_cash" name="Registers" parent="account.menu_finance" sequence="1" /> |
776 | 12 | groups="group_account_user,group_account_manager"/> | 12 | groups="group_account_user,group_account_manager"/> |
777 | 13 | <menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="9" groups="group_account_user,group_account_manager"/> | 13 | <menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="9" groups="group_account_user,group_account_manager"/> |
778 | 14 | <!-- This menu is used in account_code module --> | 14 | <!-- This menu is used in account_code module --> |
779 | 15 | 15 | ||
780 | === modified file 'bin/addons/account/account_view.xml' | |||
781 | --- bin/addons/account/account_view.xml 2020-10-28 13:59:22 +0000 | |||
782 | +++ bin/addons/account/account_view.xml 2021-11-03 13:33:55 +0000 | |||
783 | @@ -167,35 +167,89 @@ | |||
784 | 167 | <field name="arch" type="xml"> | 167 | <field name="arch" type="xml"> |
785 | 168 | <form string="Account"> | 168 | <form string="Account"> |
786 | 169 | <group col="6" colspan="4"> | 169 | <group col="6" colspan="4"> |
794 | 170 | <field name="name" select="1"/> | 170 | <field name="name" select="1"/> |
795 | 171 | <field name="code" select="1"/> | 171 | <field name="code" select="1"/> |
796 | 172 | <field name="company_id" widget="selection" groups="base.group_multi_company"/> | 172 | <newline/> |
797 | 173 | <newline/> | 173 | <field name="parent_id"/> |
798 | 174 | <field name="parent_id"/> | 174 | <field name="type" select="1"/> |
799 | 175 | <field name="type" select="1"/> | 175 | <field name="user_type_code" invisible="1"/> |
800 | 176 | <field name="user_type" select="1"/> | 176 | <field name="is_analytic_addicted" invisible="1"/> |
801 | 177 | <field name="user_type" on_change="onchange_user_type(user_type, code)"/> | ||
802 | 178 | <field name="shrink_entries_for_hq"/> | ||
803 | 179 | <field name="is_child_of_coa" invisible="1" /> | ||
804 | 180 | <field name="display_in_reports" attrs="{'invisible': [('is_child_of_coa', '=', False)]}" /> | ||
805 | 181 | <field name="type_for_register"/> | ||
806 | 182 | <field name="accrual_account" /> | ||
807 | 183 | <field name="is_not_hq_correctible" on_change="onchange_is_not_hq_correctible(is_not_hq_correctible)"/> | ||
808 | 184 | <newline/> | ||
809 | 185 | <label string="" colspan="2"/> | ||
810 | 186 | <field name="is_not_ad_correctable" on_change="onchange_is_not_ad_correctable(is_not_ad_correctable)"/> | ||
811 | 177 | </group> | 187 | </group> |
812 | 178 | <notebook colspan="4"> | 188 | <notebook colspan="4"> |
813 | 179 | <page string="General Information"> | 189 | <page string="General Information"> |
829 | 180 | <field name="active" groups="base.group_extended" /> | 190 | <group col="6" colspan="4"> |
830 | 181 | <newline/> | 191 | <field name="activation_date"/> |
831 | 182 | <group col="2" colspan="2"> | 192 | <field name="inactivation_date"/> |
832 | 183 | <separator string="Currency" colspan="2"/> | 193 | <group col="2" colspan="2"> |
833 | 184 | <field name="currency_id"/> | 194 | <field name="reconcile" on_change="onchange_reconcile(reconcile)"/> |
834 | 185 | <field name="currency_mode" attrs="{'readonly': [('currency_id','=',False)]}"/> | 195 | <field name="prevent_multi_curr_rec" attrs="{'readonly': [('reconcile', '=', False)]}"/> |
835 | 186 | </group> | 196 | <field name="reconciliation_debit_account_id"/> |
836 | 187 | <group col="2" colspan="2"> | 197 | <field name="reconciliation_credit_account_id"/> |
837 | 188 | <separator string="Reconcile" colspan="2"/> | 198 | </group> |
838 | 189 | <field name="reconcile"/> | 199 | </group> |
839 | 190 | </group> | 200 | </page> |
840 | 191 | <separator string="Default Taxes" colspan="4"/> | 201 | <page string="Analytical Destination"> |
841 | 192 | <field colspan="4" name="tax_ids" nolabel="1" domain="[('parent_id','=',False)]"/> | 202 | <field name="default_destination_id" colspan="2" |
842 | 193 | <separator string="Consolidated Children" colspan="4"/> | 203 | attrs="{'required': [('is_analytic_addicted', '=', True)], 'readonly': [('is_analytic_addicted', '!=', True)]}"/> |
843 | 194 | <field name="child_consol_ids" colspan="4" nolabel="1" attrs="{'readonly':[('type','!=','consolidation')]}"/> | 204 | <label string="" colspan="2"/> |
844 | 205 | <field name="destination_ids" nolabel="1" colspan="4" domain="[('type', '!=', 'view'), ('category', '=', 'DEST')]"> | ||
845 | 206 | <tree string="Destinations"> | ||
846 | 207 | <field name="name"/> | ||
847 | 208 | <field name="description"/> | ||
848 | 209 | <field name="date_start"/> | ||
849 | 210 | <field name="date"/> | ||
850 | 211 | </tree> | ||
851 | 212 | </field> | ||
852 | 213 | </page> | ||
853 | 214 | <page string="Allowed Partner types"> | ||
854 | 215 | <group col="4" colspan="4"> | ||
855 | 216 | <group col="2" colspan="2"> | ||
856 | 217 | <field name="has_partner_type_internal" /> | ||
857 | 218 | <field name="has_partner_type_external" /> | ||
858 | 219 | <field name="has_partner_type_esc" /> | ||
859 | 220 | <newline /> | ||
860 | 221 | <field name="has_partner_type_local" /> | ||
861 | 222 | <field name="has_partner_type_ex" /> | ||
862 | 223 | <field name="has_partner_type_empty" /> | ||
863 | 224 | <newline /> | ||
864 | 225 | <field name="has_partner_type_book" /> | ||
865 | 226 | </group> | ||
866 | 227 | |||
867 | 228 | <group col="2" colspan="2"> | ||
868 | 229 | <field name="has_partner_type_intermission" /> | ||
869 | 230 | <field name="has_partner_type_section" /> | ||
870 | 231 | |||
871 | 232 | <label /><label /> | ||
872 | 233 | <newline /> | ||
873 | 234 | <label /><label /> | ||
874 | 235 | <label /><label /> | ||
875 | 236 | <newline /> | ||
876 | 237 | <label /><label /> | ||
877 | 238 | </group> | ||
878 | 239 | </group> | ||
879 | 195 | </page> | 240 | </page> |
880 | 196 | <page string="Notes"> | 241 | <page string="Notes"> |
881 | 197 | <field colspan="4" name="note" nolabel="1"/> | 242 | <field colspan="4" name="note" nolabel="1"/> |
882 | 198 | </page> | 243 | </page> |
883 | 244 | <page string="Currency Revaluation" attrs="{'invisible': [('instance_level', '=', 'project')]}"> | ||
884 | 245 | <field name="instance_level" invisible="1"/> | ||
885 | 246 | <field name="currency_revaluation" | ||
886 | 247 | attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('user_type_code', 'not in', ['receivables', 'payables', 'cash', 'asset', 'stock'])]}"/> | ||
887 | 248 | </page> | ||
888 | 249 | <page string="End Year Closing" attrs="{'invisible': [('instance_level', '=', 'project')]}"> | ||
889 | 250 | <field name="include_in_yearly_move" | ||
890 | 251 | attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('type', 'not in', ['other', ])]}"/> | ||
891 | 252 | </page> | ||
892 | 199 | </notebook> | 253 | </notebook> |
893 | 200 | </form> | 254 | </form> |
894 | 201 | </field> | 255 | </field> |
895 | @@ -290,26 +344,24 @@ | |||
896 | 290 | </field> | 344 | </field> |
897 | 291 | </record> | 345 | </record> |
898 | 292 | 346 | ||
901 | 293 | <record id="view_account_list" model="ir.ui.view"> | 347 | <!-- Tree view for default tree view of accounts --> |
902 | 294 | <field name="name">account.account.list</field> | 348 | <record id="account.view_account_list" model="ir.ui.view"> |
903 | 349 | <field name="name">account.account_activable.list</field> | ||
904 | 295 | <field name="model">account.account</field> | 350 | <field name="model">account.account</field> |
905 | 296 | <field name="type">tree</field> | 351 | <field name="type">tree</field> |
906 | 297 | <field name="field_parent">child_id</field> | 352 | <field name="field_parent">child_id</field> |
907 | 353 | <field name="priority" eval="10"/> | ||
908 | 298 | <field name="arch" type="xml"> | 354 | <field name="arch" type="xml"> |
910 | 299 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" > | 355 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" nolink="1"> |
911 | 300 | <field name="code"/> | 356 | <field name="code"/> |
912 | 301 | <field name="name"/> | 357 | <field name="name"/> |
913 | 302 | <field name="parent_id" invisible="1"/> | ||
914 | 303 | <field name="user_type" invisible="1"/> | ||
915 | 304 | <field name="debit"/> | ||
916 | 305 | <field name="credit"/> | ||
917 | 306 | <field name="balance"/> | ||
918 | 307 | <field name="type"/> | 358 | <field name="type"/> |
921 | 308 | <field name="company_id" groups="base.group_multi_company"/> | 359 | <field name="activation_date"/> |
922 | 309 | <field name="company_currency_id"/> | 360 | <field name="inactivation_date"/> |
923 | 310 | </tree> | 361 | </tree> |
924 | 311 | </field> | 362 | </field> |
925 | 312 | </record> | 363 | </record> |
926 | 364 | |||
927 | 313 | <record id="view_treasory_graph" model="ir.ui.view"> | 365 | <record id="view_treasory_graph" model="ir.ui.view"> |
928 | 314 | <field name="name">account.treasury.graph</field> | 366 | <field name="name">account.treasury.graph</field> |
929 | 315 | <field name="model">account.account</field> | 367 | <field name="model">account.account</field> |
930 | @@ -334,26 +386,29 @@ | |||
931 | 334 | <menuitem id="account_account_menu" name="Accounts" parent="menu_finance_accounting"/> | 386 | <menuitem id="account_account_menu" name="Accounts" parent="menu_finance_accounting"/> |
932 | 335 | <menuitem action="action_account_form" id="menu_action_account_form" parent="account_account_menu"/> | 387 | <menuitem action="action_account_form" id="menu_action_account_form" parent="account_account_menu"/> |
933 | 336 | 388 | ||
936 | 337 | <record id="view_account_tree" model="ir.ui.view"> | 389 | <record model="ir.ui.view" id="account.view_account_tree"> |
937 | 338 | <field name="name">account.account.tree</field> | 390 | <field name="name">account.account_activable.tree</field> |
938 | 339 | <field name="model">account.account</field> | 391 | <field name="model">account.account</field> |
939 | 340 | <field name="type">tree</field> | 392 | <field name="type">tree</field> |
940 | 341 | <field name="field_parent">child_id</field> | 393 | <field name="field_parent">child_id</field> |
942 | 342 | <field name="priority" eval="13"/> | 394 | <field name="priority" eval="12"/> |
943 | 343 | <field name="arch" type="xml"> | 395 | <field name="arch" type="xml"> |
945 | 344 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" > | 396 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" expand_button="1" nolink="1"> |
946 | 345 | <field name="code"/> | 397 | <field name="code"/> |
947 | 346 | <field name="name"/> | 398 | <field name="name"/> |
954 | 347 | <field name="debit"/> | 399 | <field name="note"/> |
955 | 348 | <field name="credit"/> | 400 | <field name="type" invisible="1"/> |
956 | 349 | <field name="balance"/> | 401 | <field name="type_for_register" invisible="1"/> |
957 | 350 | <field name="company_currency_id"/> | 402 | <field name="accrual_account" invisible="1"/> |
958 | 351 | <field name="company_id" groups="base.group_multi_company"/> | 403 | <field name="is_not_hq_correctible" invisible="1"/> |
959 | 352 | <field name="type"/> | 404 | <field name="activation_date" invisible="1"/> |
960 | 405 | <field name="inactivation_date" invisible="1"/> | ||
961 | 353 | <field name="parent_id" invisible="1"/> | 406 | <field name="parent_id" invisible="1"/> |
962 | 407 | <field name="is_analytic_addicted" invisible="1"/> | ||
963 | 354 | </tree> | 408 | </tree> |
964 | 355 | </field> | 409 | </field> |
965 | 356 | </record> | 410 | </record> |
966 | 411 | |||
967 | 357 | <record id="action_account_tree" model="ir.actions.act_window"> | 412 | <record id="action_account_tree" model="ir.actions.act_window"> |
968 | 358 | <field name="name">Chart of Accounts</field> | 413 | <field name="name">Chart of Accounts</field> |
969 | 359 | <field name="res_model">account.account</field> | 414 | <field name="res_model">account.account</field> |
970 | @@ -546,52 +601,84 @@ | |||
971 | 546 | </record> | 601 | </record> |
972 | 547 | <menuitem action="action_account_journal_form" id="menu_action_account_journal_form" parent="menu_journals"/> | 602 | <menuitem action="action_account_journal_form" id="menu_action_account_journal_form" parent="menu_journals"/> |
973 | 548 | 603 | ||
975 | 549 | <record id="view_account_bank_statement_filter" model="ir.ui.view"> | 604 | <!-- Bank Statement Filter --> |
976 | 605 | <record id="account.view_account_bank_statement_filter" model="ir.ui.view"> | ||
977 | 550 | <field name="name">account.cash.statement.select</field> | 606 | <field name="name">account.cash.statement.select</field> |
978 | 551 | <field name="model">account.bank.statement</field> | 607 | <field name="model">account.bank.statement</field> |
979 | 552 | <field name="type">search</field> | 608 | <field name="type">search</field> |
980 | 553 | <field name="priority" eval="18"/> | ||
981 | 554 | <field name="arch" type="xml"> | 609 | <field name="arch" type="xml"> |
982 | 555 | <search string="Search Bank Statements"> | 610 | <search string="Search Bank Statements"> |
983 | 556 | <group col="8" colspan="4"> | 611 | <group col="8" colspan="4"> |
986 | 557 | <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/> | 612 | <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new" name="draft"/> |
987 | 558 | <filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/> | 613 | <filter string="Open" domain="[('state', '=', 'open')]" icon="terp-camera_test" name="open"/> |
988 | 614 | <filter string="Closed" domain="[('state','=','confirm')]" icon="terp-dialog-close" name="confirm"/> | ||
989 | 559 | <separator orientation="vertical"/> | 615 | <separator orientation="vertical"/> |
991 | 560 | <field name="date"/> | 616 | <field name="instance_id" domain="[('instance_to_display_ids','=',True)]"/> |
992 | 561 | <field name="name"/> | 617 | <field name="name"/> |
994 | 562 | <field name="journal_id" widget='selection' domain="[('type', '=', 'cash')]" /> | 618 | <newline/> |
995 | 619 | <field name="period_id" domain="[('state', '!=', 'created')]"/> | ||
996 | 620 | <field name="journal_id" domain="[('type', '=', 'cash')]" /> | ||
997 | 563 | </group> | 621 | </group> |
998 | 564 | <newline/> | 622 | <newline/> |
1000 | 565 | <group expand="0" string="Group By..."> | 623 | <group expand="1" string="Group By..."> |
1001 | 566 | <filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/> | 624 | <filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/> |
1002 | 567 | <filter string="State" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/> | 625 | <filter string="State" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/> |
1003 | 568 | <separator orientation="vertical"/> | 626 | <separator orientation="vertical"/> |
1004 | 569 | <filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/> | 627 | <filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/> |
1005 | 628 | <filter string="Instance" context="{'group_by': 'instance_id'}" icon="terp-stage"/> | ||
1006 | 570 | </group> | 629 | </group> |
1007 | 571 | </search> | 630 | </search> |
1008 | 572 | </field> | 631 | </field> |
1009 | 573 | </record> | 632 | </record> |
1010 | 574 | 633 | ||
1012 | 575 | <record id="view_bank_statement_tree" model="ir.ui.view"> | 634 | |
1013 | 635 | <!-- Bank Statement Tree US-807: force the priority to 10 to avoid showing the view in addons, for default tree view, check the view named account.view_bank_statement_tree_for_journal for more info --> | ||
1014 | 636 | <record id="account.view_bank_statement_tree" model="ir.ui.view"> | ||
1015 | 576 | <field name="name">account.bank.statement.tree</field> | 637 | <field name="name">account.bank.statement.tree</field> |
1016 | 577 | <field name="model">account.bank.statement</field> | 638 | <field name="model">account.bank.statement</field> |
1017 | 578 | <field name="type">tree</field> | 639 | <field name="type">tree</field> |
1034 | 579 | <field name="priority" eval="19"/> | 640 | <field name="priority" eval="10"/> |
1035 | 580 | <field name="arch" type="xml"> | 641 | <field name="arch" type="xml"> |
1036 | 581 | <tree colors="red:balance_end_real!=balance_end and state=='draft';blue:state=='draft' and (balance_end_real==balance_end);black:state=='confirm'" string="Statement"> | 642 | <tree colors="blue:state=='draft';black:state in ('open','confirm')" string="Register" hide_new_button="1" hide_delete_button="1"> |
1037 | 582 | <field name="name"/> | 643 | <field name="name"/> |
1038 | 583 | <field name="date"/> | 644 | <field name="date"/> |
1039 | 584 | <field name="period_id"/> | 645 | <field name="period_id"/> |
1040 | 585 | <field name="journal_id"/> | 646 | <field name="currency"/> |
1041 | 586 | <field name="balance_start"/> | 647 | <field name="journal_id"/> |
1042 | 587 | <field name="balance_end_real"/> | 648 | <field name="balance_start"/> |
1043 | 588 | <field name="balance_end" invisible="1"/> | 649 | <field name="balance_end" /> |
1044 | 589 | <field name="state"/> | 650 | <field name="balance_end_real"/> |
1045 | 590 | <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="gtk-cancel"/> | 651 | <field name="state"/> |
1046 | 591 | <button type="object" string="Confirm" name="button_confirm_bank" states="draft" icon="terp-camera_test"/> | 652 | <button name="button_open_bank_register" states="draft" string="Open Bank" type="object" icon="terp-gtk-go-back-rtl"/> |
1047 | 592 | </tree> | 653 | <button name="button_confirm_bank" states="open" string="Close Register" type="object" icon="terp-camera_test"/> |
1048 | 593 | </field> | 654 | </tree> |
1049 | 594 | </record> | 655 | </field> |
1050 | 656 | </record> | ||
1051 | 657 | |||
1052 | 658 | <!-- US-807: force the priority to 5 to show by default for all cases, BUT when the tree is called from Bank/Cash/Cheque main menu, then the explicit view name will be picked in the python code "register_accounting/account_bank_statement.py" method: get_statement() --> | ||
1053 | 659 | <record id="account.view_bank_statement_tree_for_journal" model="ir.ui.view"> | ||
1054 | 660 | <field name="name">account.bank.statement.tree.journal</field> | ||
1055 | 661 | <field name="model">account.bank.statement</field> | ||
1056 | 662 | <field name="type">tree</field> | ||
1057 | 663 | <field name="priority" eval="5"/> | ||
1058 | 664 | <field name="arch" type="xml"> | ||
1059 | 665 | <tree colors="blue:state=='draft';black:state in ('open','confirm')" string="Register" hide_new_button="1" hide_delete_button="1" editable="bottom" noteditable="1"> | ||
1060 | 666 | <field name="name"/> | ||
1061 | 667 | <field name="date"/> | ||
1062 | 668 | <field name="period_id"/> | ||
1063 | 669 | <field name="currency"/> | ||
1064 | 670 | <field name="journal_id"/> | ||
1065 | 671 | <field name="balance_start"/> | ||
1066 | 672 | <field name="balance_end" /> | ||
1067 | 673 | <field name="balance_end_real"/> | ||
1068 | 674 | <field name="state"/> | ||
1069 | 675 | </tree> | ||
1070 | 676 | </field> | ||
1071 | 677 | </record> | ||
1072 | 678 | |||
1073 | 679 | |||
1074 | 680 | |||
1075 | 681 | |||
1076 | 595 | <record id="view_bank_statement_search" model="ir.ui.view"> | 682 | <record id="view_bank_statement_search" model="ir.ui.view"> |
1077 | 596 | <field name="name">account.bank.statement.search</field> | 683 | <field name="name">account.bank.statement.search</field> |
1078 | 597 | <field name="model">account.bank.statement</field> | 684 | <field name="model">account.bank.statement</field> |
1079 | @@ -1821,7 +1908,7 @@ | |||
1080 | 1821 | <filter icon="terp-camera_test" string="Running" name="running" domain="[('state', '=', 'running')]"/> | 1908 | <filter icon="terp-camera_test" string="Running" name="running" domain="[('state', '=', 'running')]"/> |
1081 | 1822 | <filter icon="terp-dialog-close" string="Done" name="done" domain="[('state', '=', 'done')]" /> | 1909 | <filter icon="terp-dialog-close" string="Done" name="done" domain="[('state', '=', 'done')]" /> |
1082 | 1823 | <field name="name"/> | 1910 | <field name="name"/> |
1084 | 1824 | <field name="journal_id" domain="[('type', '=', 'purchase'), ('is_current_instance', '=', True)]"/> | 1911 | <field name="journal_id" domain="[('type', '=', 'purchase'), ('code', '!=', 'ISI'), ('is_current_instance', '=', True)]"/> |
1085 | 1825 | </group> | 1912 | </group> |
1086 | 1826 | <newline/> | 1913 | <newline/> |
1087 | 1827 | <group expand="0" string="Group By..."> | 1914 | <group expand="0" string="Group By..."> |
1088 | 1828 | 1915 | ||
1089 | === modified file 'bin/addons/account/invoice.py' | |||
1090 | --- bin/addons/account/invoice.py 2021-04-23 16:43:40 +0000 | |||
1091 | +++ bin/addons/account/invoice.py 2021-11-03 13:33:55 +0000 | |||
1092 | @@ -28,7 +28,7 @@ | |||
1093 | 28 | from tools.translate import _ | 28 | from tools.translate import _ |
1094 | 29 | from msf_partner import PARTNER_TYPE | 29 | from msf_partner import PARTNER_TYPE |
1095 | 30 | from base import currency_date | 30 | from base import currency_date |
1097 | 31 | 31 | from tools.safe_eval import safe_eval | |
1098 | 32 | 32 | ||
1099 | 33 | class account_invoice(osv.osv): | 33 | class account_invoice(osv.osv): |
1100 | 34 | def _amount_all(self, cr, uid, ids, name, args, context=None): | 34 | def _amount_all(self, cr, uid, ids, name, args, context=None): |
1101 | @@ -46,21 +46,6 @@ | |||
1102 | 46 | res[invoice.id]['amount_total'] = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed'] | 46 | res[invoice.id]['amount_total'] = res[invoice.id]['amount_tax'] + res[invoice.id]['amount_untaxed'] |
1103 | 47 | return res | 47 | return res |
1104 | 48 | 48 | ||
1105 | 49 | def _get_journal(self, cr, uid, context=None): | ||
1106 | 50 | if context is None: | ||
1107 | 51 | context = {} | ||
1108 | 52 | type_inv = context.get('type', 'out_invoice') | ||
1109 | 53 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) | ||
1110 | 54 | company_id = context.get('company_id', user.company_id.id) | ||
1111 | 55 | type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'} | ||
1112 | 56 | refund_journal = {'out_invoice': False, 'in_invoice': False, 'out_refund': True, 'in_refund': True} | ||
1113 | 57 | journal_obj = self.pool.get('account.journal') | ||
1114 | 58 | res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')), | ||
1115 | 59 | ('company_id', '=', company_id), | ||
1116 | 60 | ('refund_journal', '=', refund_journal.get(type_inv, False))], | ||
1117 | 61 | limit=1) | ||
1118 | 62 | return res and res[0] or False | ||
1119 | 63 | |||
1120 | 64 | def _get_journal_analytic(self, cr, uid, type_inv, context=None): | 49 | def _get_journal_analytic(self, cr, uid, type_inv, context=None): |
1121 | 65 | type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'} | 50 | type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'} |
1122 | 66 | tt = type2journal.get(type_inv, 'sale') | 51 | tt = type2journal.get(type_inv, 'sale') |
1123 | @@ -363,7 +348,6 @@ | |||
1124 | 363 | _defaults = { | 348 | _defaults = { |
1125 | 364 | 'type': _get_type, | 349 | 'type': _get_type, |
1126 | 365 | 'state': 'draft', | 350 | 'state': 'draft', |
1127 | 366 | 'journal_id': _get_journal, | ||
1128 | 367 | 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c), | 351 | 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c), |
1129 | 368 | 'reference_type': 'none', | 352 | 'reference_type': 'none', |
1130 | 369 | 'check_total': 0.0, | 353 | 'check_total': 0.0, |
1131 | @@ -371,52 +355,76 @@ | |||
1132 | 371 | 'user_id': lambda s, cr, u, c: u, | 355 | 'user_id': lambda s, cr, u, c: u, |
1133 | 372 | } | 356 | } |
1134 | 373 | 357 | ||
1135 | 358 | def _set_invoice_name(self, cr, uid, doc, context=None): | ||
1136 | 359 | """ | ||
1137 | 360 | Sets the correct invoice name to be displayed depending on the doc_type | ||
1138 | 361 | """ | ||
1139 | 362 | if context is None: | ||
1140 | 363 | context = {} | ||
1141 | 364 | if context.get('doc_type'): | ||
1142 | 365 | for doc_type in self._get_invoice_type_list(cr, uid, context=context): | ||
1143 | 366 | if context['doc_type'] in doc_type: | ||
1144 | 367 | doc.attrib['string'] = doc_type[1] | ||
1145 | 368 | break | ||
1146 | 369 | return True | ||
1147 | 370 | |||
1148 | 374 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): | 371 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): |
1149 | 375 | journal_obj = self.pool.get('account.journal') | ||
1150 | 376 | if context is None: | 372 | if context is None: |
1151 | 377 | context = {} | 373 | context = {} |
1152 | 378 | |||
1153 | 379 | if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']: | ||
1154 | 380 | partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0] | ||
1155 | 381 | if not view_type: | ||
1156 | 382 | view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')]) | ||
1157 | 383 | view_type = 'tree' | ||
1158 | 384 | if view_type == 'form': | ||
1159 | 385 | if partner['supplier'] and not partner['customer']: | ||
1160 | 386 | view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')]) | ||
1161 | 387 | else: | ||
1162 | 388 | view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')]) | ||
1163 | 389 | if view_id and isinstance(view_id, (list, tuple)): | 374 | if view_id and isinstance(view_id, (list, tuple)): |
1164 | 390 | view_id = view_id[0] | 375 | view_id = view_id[0] |
1165 | 391 | res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) | 376 | res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) |
1176 | 392 | 377 | if view_type == 'form': | |
1167 | 393 | type = context.get('journal_type', 'sale') | ||
1168 | 394 | if 'journal_id' in res['fields']: | ||
1169 | 395 | filter_journal = [('type', '=', type), ('is_current_instance','=',True)] | ||
1170 | 396 | if type == 'inkind' and context.get('is_inkind_donation'): | ||
1171 | 397 | filter_journal = [('is_current_instance','=',True), ('type', 'in', ('inkind', 'extra'))] | ||
1172 | 398 | journal_select = journal_obj._name_search(cr, uid, '', filter_journal, context=context, limit=None, name_get_uid=1) | ||
1173 | 399 | res['fields']['journal_id']['selection'] = journal_select | ||
1174 | 400 | |||
1175 | 401 | if view_type == 'form' and context.get('type', 'out_invoice') == 'in_refund': | ||
1177 | 402 | doc = etree.XML(res['arch']) | 378 | doc = etree.XML(res['arch']) |
1182 | 403 | doc.attrib['string'] = _('Supplier Refund') | 379 | if context.get('type', 'out_invoice') == 'in_refund' or context.get('doc_type', '') == 'isr': |
1183 | 404 | nodes = doc.xpath("//field[@name='amount_to_pay']") | 380 | nodes = doc.xpath("//field[@name='amount_to_pay']") |
1184 | 405 | for node in nodes: | 381 | for node in nodes: |
1185 | 406 | node.set('string', _('Amount to be refunded')) | 382 | node.set('string', _('Amount to be refunded')) |
1186 | 383 | # adapt the form name depending on the doc_type (used e.g. when clicking on a res.log) | ||
1187 | 384 | self._set_invoice_name(cr, uid, doc, context=context) | ||
1188 | 385 | """ | ||
1189 | 386 | Restriction on allowed partners: | ||
1190 | 387 | - for STV/STR: Intersection or External customers only | ||
1191 | 388 | - for ISI/ISR: Intersection suppliers only | ||
1192 | 389 | - for SI/SR: non-Intersection suppliers only | ||
1193 | 390 | """ | ||
1194 | 391 | partner_domain = "" | ||
1195 | 392 | if context.get('doc_type', '') in ('stv', 'str') or ( | ||
1196 | 393 | context.get('type', False) == 'out_invoice' and context.get('journal_type', False) == 'sale' and | ||
1197 | 394 | not context.get('is_debit_note', False) and not context.get('is_intermission', False) | ||
1198 | 395 | ): | ||
1199 | 396 | partner_domain = "[('partner_type', 'in', ('section', 'external')), ('customer', '=', True)]" | ||
1200 | 397 | elif context.get('doc_type', '') in ('isi', 'isr'): | ||
1201 | 398 | partner_domain = "[('partner_type', '=', 'section'), ('supplier', '=', True)]" | ||
1202 | 399 | elif (context.get('doc_type', '') in ('si', 'sr')) or \ | ||
1203 | 400 | (context.get('type') == 'in_invoice' and context.get('journal_type') == 'purchase') or \ | ||
1204 | 401 | (context.get('type') == 'in_refund' and context.get('journal_type') == 'purchase_refund'): | ||
1205 | 402 | partner_domain = "[('partner_type', '!=', 'section'), ('supplier', '=', True)]" | ||
1206 | 403 | if partner_domain: | ||
1207 | 404 | partner_nodes = doc.xpath("//field[@name='partner_id']") | ||
1208 | 405 | for node in partner_nodes: | ||
1209 | 406 | node.set('domain', partner_domain) | ||
1210 | 407 | res['arch'] = etree.tostring(doc) | 407 | res['arch'] = etree.tostring(doc) |
1213 | 408 | 408 | elif view_type == 'tree': | |
1212 | 409 | if view_type == 'tree': | ||
1214 | 410 | doc = etree.XML(res['arch']) | 409 | doc = etree.XML(res['arch']) |
1215 | 411 | nodes = doc.xpath("//field[@name='partner_id']") | ||
1216 | 412 | # (US-777) Remove the possibility to create new invoices through the "Advance Return" Wizard | 410 | # (US-777) Remove the possibility to create new invoices through the "Advance Return" Wizard |
1217 | 413 | if context.get('from_wizard') and context.get('from_wizard')['model'] == 'wizard.cash.return': | 411 | if context.get('from_wizard') and context.get('from_wizard')['model'] == 'wizard.cash.return': |
1218 | 414 | doc.set('hide_new_button', 'True') | 412 | doc.set('hide_new_button', 'True') |
1221 | 415 | partner_string = _('Customer') | 413 | # adapt the name of the Partner field depending on the view |
1222 | 416 | if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'): | 414 | nodes = doc.xpath("//field[@name='partner_id']") |
1223 | 415 | if context.get('generic_invoice') or context.get('journal_type') == 'intermission': | ||
1224 | 416 | # for tree views combining Customer and Supplier Invoices, or for IVI/IVO | ||
1225 | 417 | partner_string = _('Partner') | ||
1226 | 418 | elif context.get('journal_type', False) == 'inkind': | ||
1227 | 419 | partner_string = _('Donor') | ||
1228 | 420 | elif context.get('type', 'out_invoice') in ('in_invoice', 'in_refund') or context.get('doc_type', '') in ('isi', 'isr'): | ||
1229 | 417 | partner_string = _('Supplier') | 421 | partner_string = _('Supplier') |
1230 | 422 | else: | ||
1231 | 423 | partner_string = _('Customer') | ||
1232 | 418 | for node in nodes: | 424 | for node in nodes: |
1233 | 419 | node.set('string', partner_string) | 425 | node.set('string', partner_string) |
1234 | 426 | # ensure that the doc name remains consistent even after clicking on a filter in the Search View | ||
1235 | 427 | self._set_invoice_name(cr, uid, doc, context=context) | ||
1236 | 420 | res['arch'] = etree.tostring(doc) | 428 | res['arch'] = etree.tostring(doc) |
1237 | 421 | elif view_type == 'search': | 429 | elif view_type == 'search': |
1238 | 422 | # remove the Cancel filter in all invoices but IVO and STV (in Donations the filter is named differently) | 430 | # remove the Cancel filter in all invoices but IVO and STV (in Donations the filter is named differently) |
1239 | @@ -430,20 +438,14 @@ | |||
1240 | 430 | if filter_node: | 438 | if filter_node: |
1241 | 431 | filter_node[0].getparent().remove(filter_node[0]) | 439 | filter_node[0].getparent().remove(filter_node[0]) |
1242 | 432 | res['arch'] = etree.tostring(doc) | 440 | res['arch'] = etree.tostring(doc) |
1243 | 441 | if view_type in ('tree', 'search') and (context.get('type') in ['out_invoice', 'out_refund'] or context.get('doc_type') == 'str'): | ||
1244 | 442 | doc = etree.XML(res['arch']) | ||
1245 | 443 | nodes = doc.xpath("//field[@name='supplier_reference']") | ||
1246 | 444 | for node in nodes: | ||
1247 | 445 | node.getparent().remove(node) | ||
1248 | 446 | res['arch'] = etree.tostring(doc) | ||
1249 | 433 | return res | 447 | return res |
1250 | 434 | 448 | ||
1251 | 435 | def get_log_context(self, cr, uid, context=None): | ||
1252 | 436 | if context is None: | ||
1253 | 437 | context = {} | ||
1254 | 438 | is_intermission = context.get('is_intermission', False) | ||
1255 | 439 | if is_intermission: | ||
1256 | 440 | res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_intermission_form') | ||
1257 | 441 | else: | ||
1258 | 442 | res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form') | ||
1259 | 443 | view_id = res and res[1] or False | ||
1260 | 444 | context.update({'view_id': view_id}) | ||
1261 | 445 | return context | ||
1262 | 446 | |||
1263 | 447 | def create(self, cr, uid, vals, context=None): | 449 | def create(self, cr, uid, vals, context=None): |
1264 | 448 | if context is None: | 450 | if context is None: |
1265 | 449 | context = {} | 451 | context = {} |
1266 | @@ -453,8 +455,6 @@ | |||
1267 | 453 | ctx = context.copy() | 455 | ctx = context.copy() |
1268 | 454 | if 'is_intermission' in vals: | 456 | if 'is_intermission' in vals: |
1269 | 455 | ctx.update({'is_intermission': vals['is_intermission']}) | 457 | ctx.update({'is_intermission': vals['is_intermission']}) |
1270 | 456 | if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'): | ||
1271 | 457 | ctx = self.get_log_context(cr, uid, context=ctx) | ||
1272 | 458 | if 'type' in vals: | 458 | if 'type' in vals: |
1273 | 459 | ctx.update({'type': vals['type']}) | 459 | ctx.update({'type': vals['type']}) |
1274 | 460 | if '_terp_view_name' in ctx: | 460 | if '_terp_view_name' in ctx: |
1275 | @@ -633,10 +633,8 @@ | |||
1276 | 633 | def onchange_partner_bank(self, cursor, user, ids, partner_bank_id=False): | 633 | def onchange_partner_bank(self, cursor, user, ids, partner_bank_id=False): |
1277 | 634 | return {'value': {}} | 634 | return {'value': {}} |
1278 | 635 | 635 | ||
1280 | 636 | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id): | 636 | def onchange_company_id(self, cr, uid, ids, company_id, part_id, type, invoice_line, currency_id, context=None): |
1281 | 637 | val = {} | 637 | val = {} |
1282 | 638 | dom = {} | ||
1283 | 639 | obj_journal = self.pool.get('account.journal') | ||
1284 | 640 | account_obj = self.pool.get('account.account') | 638 | account_obj = self.pool.get('account.account') |
1285 | 641 | inv_line_obj = self.pool.get('account.invoice.line') | 639 | inv_line_obj = self.pool.get('account.invoice.line') |
1286 | 642 | if company_id and part_id and type: | 640 | if company_id and part_id and type: |
1287 | @@ -683,35 +681,13 @@ | |||
1288 | 683 | _('Invoice line account company does not match with invoice company.')) | 681 | _('Invoice line account company does not match with invoice company.')) |
1289 | 684 | else: | 682 | else: |
1290 | 685 | continue | 683 | continue |
1291 | 686 | if company_id and type: | ||
1292 | 687 | if type in ('out_invoice'): | ||
1293 | 688 | journal_type = 'sale' | ||
1294 | 689 | elif type in ('out_refund'): | ||
1295 | 690 | journal_type = 'sale_refund' | ||
1296 | 691 | elif type in ('in_refund'): | ||
1297 | 692 | journal_type = 'purchase_refund' | ||
1298 | 693 | else: | ||
1299 | 694 | journal_type = 'purchase' | ||
1300 | 695 | journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)]) | ||
1301 | 696 | if journal_ids: | ||
1302 | 697 | val['journal_id'] = journal_ids[0] | ||
1303 | 698 | res_journal_default = self.pool.get('ir.values').get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice']) | ||
1304 | 699 | for r in res_journal_default: | ||
1305 | 700 | if r[1] == 'journal_id' and r[2] in journal_ids: | ||
1306 | 701 | val['journal_id'] = r[2] | ||
1307 | 702 | if not val.get('journal_id', False): | ||
1308 | 703 | raise osv.except_osv(_('Configuration Error !'), (_('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.') % (journal_type))) | ||
1309 | 704 | dom = {'journal_id': [('id', 'in', journal_ids)]} | ||
1310 | 705 | else: | ||
1311 | 706 | journal_ids = obj_journal.search(cr, uid, []) | ||
1312 | 707 | |||
1313 | 708 | if currency_id and company_id: | 684 | if currency_id and company_id: |
1314 | 709 | currency = self.pool.get('res.currency').browse(cr, uid, currency_id) | 685 | currency = self.pool.get('res.currency').browse(cr, uid, currency_id) |
1315 | 710 | if currency.company_id and currency.company_id.id != company_id: | 686 | if currency.company_id and currency.company_id.id != company_id: |
1316 | 711 | val['currency_id'] = False | 687 | val['currency_id'] = False |
1317 | 712 | else: | 688 | else: |
1318 | 713 | val['currency_id'] = currency.id | 689 | val['currency_id'] = currency.id |
1320 | 714 | return {'value': val, 'domain': dom} | 690 | return {'value': val} |
1321 | 715 | 691 | ||
1322 | 716 | def onchange_synced(self, cr, uid, ids, synced, partner_id): | 692 | def onchange_synced(self, cr, uid, ids, synced, partner_id): |
1323 | 717 | """ | 693 | """ |
1324 | @@ -899,11 +875,12 @@ | |||
1325 | 899 | i['currency_id'] = inv.currency_id.id | 875 | i['currency_id'] = inv.currency_id.id |
1326 | 900 | i['amount_currency'] = i['price'] | 876 | i['amount_currency'] = i['price'] |
1327 | 901 | i['ref'] = ref | 877 | i['ref'] = ref |
1329 | 902 | if inv.type in ('out_invoice','in_refund'): | 878 | # the direction of the amounts depends on the invoice type |
1330 | 879 | if inv.doc_type in ('stv', 'ivo', 'dn', 'sr', 'isr'): | ||
1331 | 903 | i['price'] = -i['price'] | 880 | i['price'] = -i['price'] |
1332 | 904 | i['amount_currency'] = - i['amount_currency'] | 881 | i['amount_currency'] = - i['amount_currency'] |
1333 | 905 | i['change_sign'] = True | 882 | i['change_sign'] = True |
1335 | 906 | else: | 883 | else: # 'str', 'ivi', 'si', 'di', 'isi', 'cr', 'donation' |
1336 | 907 | i['change_sign'] = False | 884 | i['change_sign'] = False |
1337 | 908 | total -= i['amount_currency'] | 885 | total -= i['amount_currency'] |
1338 | 909 | return total, invoice_move_lines | 886 | return total, invoice_move_lines |
1339 | @@ -1008,6 +985,7 @@ | |||
1340 | 1008 | # UTP-594: Get ref and name | 985 | # UTP-594: Get ref and name |
1341 | 1009 | if inv.type == 'in_invoice': | 986 | if inv.type == 'in_invoice': |
1342 | 1010 | is_ivi = inv.is_intermission and not inv.is_debit_note and not inv.is_inkind_donation | 987 | is_ivi = inv.is_intermission and not inv.is_debit_note and not inv.is_inkind_donation |
1343 | 988 | # SI or ISI | ||
1344 | 1011 | is_si = not inv.is_direct_invoice and not inv.is_inkind_donation and not inv.is_debit_note and not inv.is_intermission | 989 | is_si = not inv.is_direct_invoice and not inv.is_inkind_donation and not inv.is_debit_note and not inv.is_intermission |
1345 | 1012 | intersection = inv.partner_id.partner_type == 'section' | 990 | intersection = inv.partner_id.partner_type == 'section' |
1346 | 1013 | external = inv.partner_id.partner_type == 'external' | 991 | external = inv.partner_id.partner_type == 'external' |
1347 | @@ -1232,8 +1210,6 @@ | |||
1348 | 1232 | 1210 | ||
1349 | 1233 | for inv_id, name in self.name_get(cr, uid, [id]): | 1211 | for inv_id, name in self.name_get(cr, uid, [id]): |
1350 | 1234 | ctx = context.copy() | 1212 | ctx = context.copy() |
1351 | 1235 | if obj_inv.type in ('out_invoice', 'out_refund'): | ||
1352 | 1236 | ctx = self.get_log_context(cr, uid, context=ctx) | ||
1353 | 1237 | ctx['type'] = obj_inv.type | 1213 | ctx['type'] = obj_inv.type |
1354 | 1238 | message = _('Invoice ') + " '" + name + "' "+ _("is validated.") | 1214 | message = _('Invoice ') + " '" + name + "' "+ _("is validated.") |
1355 | 1239 | self.log(cr, uid, inv_id, message, context=ctx) | 1215 | self.log(cr, uid, inv_id, message, context=ctx) |
1356 | @@ -1243,6 +1219,13 @@ | |||
1357 | 1243 | """ | 1219 | """ |
1358 | 1244 | Sets the invoice to Cancelled and not Synchronized | 1220 | Sets the invoice to Cancelled and not Synchronized |
1359 | 1245 | """ | 1221 | """ |
1360 | 1222 | if isinstance(ids, (int, long)): | ||
1361 | 1223 | ids = [ids] | ||
1362 | 1224 | |||
1363 | 1225 | draft_invoice_ids = self.search(cr, uid, [('state', '=', 'draft'), ('id', 'in', ids)]) | ||
1364 | 1226 | if draft_invoice_ids: | ||
1365 | 1227 | self.update_commitments(cr, uid, draft_invoice_ids) | ||
1366 | 1228 | |||
1367 | 1246 | self.write(cr, uid, ids, {'state': 'cancel', 'synced': False}) | 1229 | self.write(cr, uid, ids, {'state': 'cancel', 'synced': False}) |
1368 | 1247 | return True | 1230 | return True |
1369 | 1248 | 1231 | ||
1370 | @@ -1291,13 +1274,22 @@ | |||
1371 | 1291 | def name_get(self, cr, uid, ids, context=None): | 1274 | def name_get(self, cr, uid, ids, context=None): |
1372 | 1292 | if not ids: | 1275 | if not ids: |
1373 | 1293 | return [] | 1276 | return [] |
1379 | 1294 | types = { | 1277 | doc_types = { |
1380 | 1295 | 'out_invoice': 'CI: ', | 1278 | 'stv': _('STV: '), |
1381 | 1296 | 'in_invoice': 'SI: ', | 1279 | 'str': _('STR: '), |
1382 | 1297 | 'out_refund': 'OR: ', | 1280 | 'cr': _('CR: '), |
1383 | 1298 | 'in_refund': 'SR: ', | 1281 | 'dn': _('DN: '), |
1384 | 1282 | 'ivo': _('IVO: '), | ||
1385 | 1283 | 'si': _('SI: '), | ||
1386 | 1284 | 'di': _('DI: '), | ||
1387 | 1285 | 'sr': _('SR: '), | ||
1388 | 1286 | 'isi': _('ISI: '), | ||
1389 | 1287 | 'isr': _('ISR: '), | ||
1390 | 1288 | 'donation': _('DON: '), | ||
1391 | 1289 | 'ivi': _('IVI: '), | ||
1392 | 1299 | } | 1290 | } |
1394 | 1300 | return [(r['id'], (r['number']) or types[r['type']] + (r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')] | 1291 | return [(r['id'], (r['number']) or doc_types[r['doc_type']] + (r['name'] or '')) for r in |
1395 | 1292 | self.read(cr, uid, ids, ['doc_type', 'number', 'name'], context, load='_classic_write')] | ||
1396 | 1301 | 1293 | ||
1397 | 1302 | def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): | 1294 | def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): |
1398 | 1303 | if not args: | 1295 | if not args: |
1399 | @@ -1364,8 +1356,8 @@ | |||
1400 | 1364 | """ | 1356 | """ |
1401 | 1365 | res = [ | 1357 | res = [ |
1402 | 1366 | 'name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', | 1358 | 'name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', |
1405 | 1367 | 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', | 1359 | 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', |
1406 | 1368 | 'analytic_distribution_id', 'document_date', | 1360 | 'journal_id', 'analytic_distribution_id', 'document_date', 'doc_type', |
1407 | 1369 | ] | 1361 | ] |
1408 | 1370 | return res | 1362 | return res |
1409 | 1371 | 1363 | ||
1410 | @@ -1441,10 +1433,24 @@ | |||
1411 | 1441 | else: | 1433 | else: |
1412 | 1442 | refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')]) | 1434 | refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')]) |
1413 | 1443 | 1435 | ||
1414 | 1436 | if invoice.get('doc_type') == 'stv': | ||
1415 | 1437 | doc_type = 'str' | ||
1416 | 1438 | elif invoice.get('doc_type') == 'isi': | ||
1417 | 1439 | doc_type = 'isr' | ||
1418 | 1440 | elif invoice.get('doc_type') in ('si', 'di'): | ||
1419 | 1441 | doc_type = 'sr' | ||
1420 | 1442 | elif invoice.get('doc_type') == 'ivo': | ||
1421 | 1443 | doc_type = 'ivi' | ||
1422 | 1444 | elif invoice.get('doc_type') == 'ivi': | ||
1423 | 1445 | doc_type = 'ivo' | ||
1424 | 1446 | else: | ||
1425 | 1447 | doc_type = '' | ||
1426 | 1448 | |||
1427 | 1444 | if not date: | 1449 | if not date: |
1428 | 1445 | date = time.strftime('%Y-%m-%d') | 1450 | date = time.strftime('%Y-%m-%d') |
1429 | 1446 | invoice.update({ | 1451 | invoice.update({ |
1430 | 1447 | 'type': type_dict[invoice['type']], | 1452 | 'type': type_dict[invoice['type']], |
1431 | 1453 | 'real_doc_type': doc_type, | ||
1432 | 1448 | 'date_invoice': date, | 1454 | 'date_invoice': date, |
1433 | 1449 | 'state': 'draft', | 1455 | 'state': 'draft', |
1434 | 1450 | 'number': False, | 1456 | 'number': False, |
1435 | @@ -1474,7 +1480,7 @@ | |||
1436 | 1474 | invoice[field] = invoice[field] and invoice[field][0] | 1480 | invoice[field] = invoice[field] and invoice[field][0] |
1437 | 1475 | invoice = self._hook_refund_data(cr, uid, invoice) or invoice | 1481 | invoice = self._hook_refund_data(cr, uid, invoice) or invoice |
1438 | 1476 | # create the new invoice | 1482 | # create the new invoice |
1440 | 1477 | new_ids.append(self.create(cr, uid, invoice)) | 1483 | new_ids.append(self.create(cr, uid, invoice, context=context)) |
1441 | 1478 | 1484 | ||
1442 | 1479 | return new_ids | 1485 | return new_ids |
1443 | 1480 | 1486 | ||
1444 | @@ -1584,6 +1590,21 @@ | |||
1445 | 1584 | 'account.invoice.update_counterpart_inv', self._logger, check_identifier=False, context=context) | 1590 | 'account.invoice.update_counterpart_inv', self._logger, check_identifier=False, context=context) |
1446 | 1585 | return True | 1591 | return True |
1447 | 1586 | 1592 | ||
1448 | 1593 | def invoice_open_form_view(self, cr, uid, ids, context=None): | ||
1449 | 1594 | if not ids: | ||
1450 | 1595 | return True | ||
1451 | 1596 | view_data = self._get_invoice_act_window(cr, uid, ids[0], views_order=['form', 'tree'], context=context) | ||
1452 | 1597 | view_data['res_id'] = ids[0] | ||
1453 | 1598 | view_data['target'] = 'current' | ||
1454 | 1599 | view_data['keep_open'] = True | ||
1455 | 1600 | if context.get('search_default_partner_id'): | ||
1456 | 1601 | dom = [] | ||
1457 | 1602 | if view_data['domain']: | ||
1458 | 1603 | dom = safe_eval(view_data['domain']) | ||
1459 | 1604 | dom.append(('partner_id', '=', context.get('search_default_partner_id'))) | ||
1460 | 1605 | view_data['domain'] = dom | ||
1461 | 1606 | return view_data | ||
1462 | 1607 | |||
1463 | 1587 | account_invoice() | 1608 | account_invoice() |
1464 | 1588 | 1609 | ||
1465 | 1589 | class account_invoice_line(osv.osv): | 1610 | class account_invoice_line(osv.osv): |
1466 | @@ -2140,7 +2161,7 @@ | |||
1467 | 2140 | def get(self, cr, uid, key, key2, models, meta=False, context=None, res_id_req=False, without_user=True, key2_req=True, view_id=False): | 2161 | def get(self, cr, uid, key, key2, models, meta=False, context=None, res_id_req=False, without_user=True, key2_req=True, view_id=False): |
1468 | 2141 | """ | 2162 | """ |
1469 | 2142 | Hides the reports: | 2163 | Hides the reports: |
1471 | 2143 | - "Invoice Excel Export" in the menu of other invoices than IVO/IVI | 2164 | - "Invoice Excel Export" in the menu of other invoices than IVO/IVI/STV |
1472 | 2144 | - "FO Follow-up Finance" in the menu of other invoices than IVO/STV | 2165 | - "FO Follow-up Finance" in the menu of other invoices than IVO/STV |
1473 | 2145 | - "STV/IVO lines follow-up" in the menu of other invoices than IVO/STV (+ renames it depending on the inv. type) | 2166 | - "STV/IVO lines follow-up" in the menu of other invoices than IVO/STV (+ renames it depending on the inv. type) |
1474 | 2146 | """ | 2167 | """ |
1475 | @@ -2162,7 +2183,8 @@ | |||
1476 | 2162 | elif context_stv: | 2183 | elif context_stv: |
1477 | 2163 | v[2]['name'] = _('STV lines follow-up') | 2184 | v[2]['name'] = _('STV lines follow-up') |
1478 | 2164 | # display | 2185 | # display |
1480 | 2165 | if not context.get('is_intermission') and len(v) > 2 and v[2].get('report_name', '') == 'invoice.excel.export': | 2186 | if not context.get('is_intermission') and not context_stv and len(v) > 2 and \ |
1481 | 2187 | v[2].get('report_name', '') == 'invoice.excel.export': | ||
1482 | 2166 | continue | 2188 | continue |
1483 | 2167 | elif not context_ivo and not context_stv and len(v) > 1 and v[1] in ('fo_follow_up_finance', 'invoice_lines_follow_up'): | 2189 | elif not context_ivo and not context_stv and len(v) > 1 and v[1] in ('fo_follow_up_finance', 'invoice_lines_follow_up'): |
1484 | 2168 | continue | 2190 | continue |
1485 | 2169 | 2191 | ||
1486 | === modified file 'bin/addons/account/report/account_print_invoice.rml' | |||
1487 | --- bin/addons/account/report/account_print_invoice.rml 2019-03-22 14:16:36 +0000 | |||
1488 | +++ bin/addons/account/report/account_print_invoice.rml 2021-11-03 13:33:55 +0000 | |||
1489 | @@ -139,6 +139,7 @@ | |||
1490 | 139 | </stylesheet> | 139 | </stylesheet> |
1491 | 140 | <story> | 140 | <story> |
1492 | 141 | <pto> | 141 | <pto> |
1493 | 142 | <!-- NOTE: this report seems to be overwritten by account_override/report/account_print_invoice.rml --> | ||
1494 | 142 | <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para> | 143 | <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para> |
1495 | 143 | <para style="terp_default_8"></para> | 144 | <para style="terp_default_8"></para> |
1496 | 144 | <pto_header><!-- Must be after setLang() --> | 145 | <pto_header><!-- Must be after setLang() --> |
1497 | 145 | 146 | ||
1498 | === modified file 'bin/addons/account/report/export_invoice.py' | |||
1499 | --- bin/addons/account/report/export_invoice.py 2021-04-27 16:09:42 +0000 | |||
1500 | +++ bin/addons/account/report/export_invoice.py 2021-11-03 13:33:55 +0000 | |||
1501 | @@ -27,13 +27,13 @@ | |||
1502 | 27 | """ | 27 | """ |
1503 | 28 | Returns True if the fields Product and Quantity of the invoice must be readonly = not editable | 28 | Returns True if the fields Product and Quantity of the invoice must be readonly = not editable |
1504 | 29 | """ | 29 | """ |
1506 | 30 | if inv.type == 'in_invoice' and not inv.is_direct_invoice and not inv.is_inkind_donation: # IVI or SI | 30 | if inv.doc_type in ('ivi', 'si', 'isi'): |
1507 | 31 | is_readonly = inv.from_supply or inv.synced | 31 | is_readonly = inv.from_supply or inv.synced |
1509 | 32 | elif inv.type == 'out_invoice' and inv.is_intermission: # IVO | 32 | elif inv.doc_type == 'ivo': |
1510 | 33 | is_readonly = inv.from_supply | 33 | is_readonly = inv.from_supply |
1512 | 34 | elif inv.type == 'out_invoice' and not inv.is_intermission and not inv.is_debit_note: # STV | 34 | elif inv.doc_type == 'stv': |
1513 | 35 | is_readonly = inv.from_supply and inv.partner_type == 'section' | 35 | is_readonly = inv.from_supply and inv.partner_type == 'section' |
1515 | 36 | elif inv.type == 'in_invoice' and inv.is_inkind_donation: # Donation | 36 | elif inv.doc_type == 'donation': |
1516 | 37 | is_readonly = inv.from_supply | 37 | is_readonly = inv.from_supply |
1517 | 38 | else: # other inv. types are not supposed to be handled in this report | 38 | else: # other inv. types are not supposed to be handled in this report |
1518 | 39 | is_readonly = True | 39 | is_readonly = True |
1519 | 40 | 40 | ||
1520 | === modified file 'bin/addons/account/report/invoice_excel_export.py' | |||
1521 | --- bin/addons/account/report/invoice_excel_export.py 2020-04-09 09:06:08 +0000 | |||
1522 | +++ bin/addons/account/report/invoice_excel_export.py 2021-11-03 13:33:55 +0000 | |||
1523 | @@ -37,8 +37,10 @@ | |||
1524 | 37 | 37 | ||
1525 | 38 | def _get_distribution_lines(self, inv_line): | 38 | def _get_distribution_lines(self, inv_line): |
1526 | 39 | """ | 39 | """ |
1529 | 40 | Returns distrib. line data related to the invoice line in parameter, as a list of dicts | 40 | Returns distrib. line data related to the invoice line in parameter, as a list of dicts. |
1530 | 41 | Note: it gives a result even for lines without AD: the line subtotal is retrieved in any cases | 41 | Notes: |
1531 | 42 | - it gives a result even for lines without AD: the line subtotal is retrieved in any cases | ||
1532 | 43 | - only CC and Dest are retrieved, FP is excluded. | ||
1533 | 42 | """ | 44 | """ |
1534 | 43 | fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line') | 45 | fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line') |
1535 | 44 | distrib_lines = [] | 46 | distrib_lines = [] |
1536 | @@ -69,18 +71,19 @@ | |||
1537 | 69 | 71 | ||
1538 | 70 | def _get_shipment_number(self, inv): | 72 | def _get_shipment_number(self, inv): |
1539 | 71 | """ | 73 | """ |
1542 | 72 | Returns the "shipment" or "simple OUT" number having generated the IVO if linked to a supply workflow | 74 | Returns the "shipment" or "simple OUT" number having generated the IVO/STV if linked to a supply workflow |
1543 | 73 | Displayed for both the IVO and the IVI. | 75 | Displayed for both the IVO/STV and the IVI. |
1544 | 74 | """ | 76 | """ |
1545 | 75 | if self.invoices.get(inv.id, {}).get('shipment', None) is not None: | 77 | if self.invoices.get(inv.id, {}).get('shipment', None) is not None: |
1546 | 76 | # process only once per invoice | 78 | # process only once per invoice |
1547 | 77 | return self.invoices[inv.id]['shipment'] | 79 | return self.invoices[inv.id]['shipment'] |
1548 | 78 | ship_or_out_ref = '' | 80 | ship_or_out_ref = '' |
1551 | 79 | if inv.from_supply and inv.is_intermission: | 81 | if inv.from_supply: |
1552 | 80 | if inv.type == 'out_invoice': # IVO | 82 | inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type'] |
1553 | 83 | if inv_type in ('ivo', 'stv'): | ||
1554 | 81 | if inv.name: | 84 | if inv.name: |
1555 | 82 | ship_or_out_ref = inv.name.split()[-1] | 85 | ship_or_out_ref = inv.name.split()[-1] |
1557 | 83 | elif inv.type == 'in_invoice': # IVI | 86 | elif inv_type == 'ivi': |
1558 | 84 | if inv.picking_id: | 87 | if inv.picking_id: |
1559 | 85 | ship_or_out_ref = inv.picking_id.shipment_ref or '' | 88 | ship_or_out_ref = inv.picking_id.shipment_ref or '' |
1560 | 86 | self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref}) | 89 | self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref}) |
1561 | @@ -88,20 +91,21 @@ | |||
1562 | 88 | 91 | ||
1563 | 89 | def _get_fo_number(self, inv): | 92 | def _get_fo_number(self, inv): |
1564 | 90 | """ | 93 | """ |
1567 | 91 | Returns the FO number related to the IVO if any. | 94 | Returns the FO number related to the IVO/STV if any. |
1568 | 92 | Displayed for both the IVO and the IVI. | 95 | Displayed for both the IVO/STV and the IVI. |
1569 | 93 | """ | 96 | """ |
1570 | 94 | if self.invoices.get(inv.id, {}).get('fo', None) is not None: | 97 | if self.invoices.get(inv.id, {}).get('fo', None) is not None: |
1571 | 95 | # process only once per invoice | 98 | # process only once per invoice |
1572 | 96 | return self.invoices[inv.id]['fo'] | 99 | return self.invoices[inv.id]['fo'] |
1573 | 97 | fo_number = '' | 100 | fo_number = '' |
1576 | 98 | if inv.from_supply and inv.is_intermission: | 101 | if inv.from_supply: |
1577 | 99 | if inv.type == 'out_invoice': # IVO | 102 | inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type'] |
1578 | 103 | if inv_type in ('ivo', 'stv'): | ||
1579 | 100 | if inv.origin: | 104 | if inv.origin: |
1580 | 101 | inv_source_doc_split = inv.origin.split(':') | 105 | inv_source_doc_split = inv.origin.split(':') |
1581 | 102 | if inv_source_doc_split: | 106 | if inv_source_doc_split: |
1582 | 103 | fo_number = inv_source_doc_split[-1] | 107 | fo_number = inv_source_doc_split[-1] |
1584 | 104 | elif inv.type == 'in_invoice': # IVI | 108 | elif inv_type == 'ivi': |
1585 | 105 | if inv.main_purchase_id: | 109 | if inv.main_purchase_id: |
1586 | 106 | fo_number = inv.main_purchase_id.short_partner_ref or '' | 110 | fo_number = inv.main_purchase_id.short_partner_ref or '' |
1587 | 107 | self.invoices.setdefault(inv.id, {}).update({'fo': fo_number}) | 111 | self.invoices.setdefault(inv.id, {}).update({'fo': fo_number}) |
1588 | @@ -109,25 +113,26 @@ | |||
1589 | 109 | 113 | ||
1590 | 110 | def _get_po_number(self, inv_line): | 114 | def _get_po_number(self, inv_line): |
1591 | 111 | """ | 115 | """ |
1594 | 112 | Returns the PO number for Intermission Voucher Lines linked to a supply workflow. | 116 | Returns the PO number for the lines linked to a supply workflow. |
1595 | 113 | For the IVO: PO to the external partner in order to buy the goods | 117 | For the IVO/STV: PO to the external partner in order to buy the goods |
1596 | 114 | For the IVI: PO to the intermission partner which triggered the creation of the FO | 118 | For the IVI: PO to the intermission partner which triggered the creation of the FO |
1597 | 115 | """ | 119 | """ |
1598 | 116 | inv = inv_line.invoice_id | 120 | inv = inv_line.invoice_id |
1602 | 117 | ivo_from_supply = inv.is_intermission and inv.type == 'out_invoice' and inv.from_supply | 121 | inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type'] |
1603 | 118 | if not ivo_from_supply and self.invoices.get(inv.id, {}).get('po', None) is not None: | 122 | out_inv_from_supply = inv_type in ('ivo', 'stv') and inv.from_supply |
1604 | 119 | # process only once per invoice except for IVO from Supply where the check must be done line by line | 123 | if not out_inv_from_supply and self.invoices.get(inv.id, {}).get('po', None) is not None: |
1605 | 124 | # process only once per invoice except for IVO/STV from Supply where the check must be done line by line | ||
1606 | 120 | return self.invoices[inv.id]['po'] | 125 | return self.invoices[inv.id]['po'] |
1607 | 121 | po_number = '' | 126 | po_number = '' |
1608 | 122 | po_line_obj = self.pool.get('purchase.order.line') | 127 | po_line_obj = self.pool.get('purchase.order.line') |
1611 | 123 | if inv.from_supply and inv.is_intermission: | 128 | if inv.from_supply: |
1612 | 124 | if inv.type == 'out_invoice': # IVO | 129 | if inv_type in ('ivo', 'stv'): |
1613 | 125 | fo_line = inv_line.sale_order_line_id | 130 | fo_line = inv_line.sale_order_line_id |
1614 | 126 | if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO | 131 | if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO |
1615 | 127 | pol_ids = po_line_obj.search(self.cr, self.uid, [('sale_order_line_id', '=', fo_line.id)]) | 132 | pol_ids = po_line_obj.search(self.cr, self.uid, [('sale_order_line_id', '=', fo_line.id)]) |
1616 | 128 | if pol_ids: | 133 | if pol_ids: |
1617 | 129 | po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name | 134 | po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name |
1619 | 130 | elif inv.type == 'in_invoice': # IVI | 135 | elif inv_type == 'ivi': |
1620 | 131 | if inv.main_purchase_id: | 136 | if inv.main_purchase_id: |
1621 | 132 | po_number = inv.main_purchase_id.name | 137 | po_number = inv.main_purchase_id.name |
1622 | 133 | self.invoices.setdefault(inv.id, {}).update({'po': po_number}) | 138 | self.invoices.setdefault(inv.id, {}).update({'po': po_number}) |
1623 | 134 | 139 | ||
1624 | === modified file 'bin/addons/account/wizard/account_invoice_import.py' | |||
1625 | --- bin/addons/account/wizard/account_invoice_import.py 2021-04-28 15:14:26 +0000 | |||
1626 | +++ bin/addons/account/wizard/account_invoice_import.py 2021-11-03 13:33:55 +0000 | |||
1627 | @@ -200,7 +200,7 @@ | |||
1628 | 200 | elif invoice.is_inkind_donation: # for Donations | 200 | elif invoice.is_inkind_donation: # for Donations |
1629 | 201 | restricted_area = 'donation_lines' | 201 | restricted_area = 'donation_lines' |
1630 | 202 | else: | 202 | else: |
1632 | 203 | restricted_area = 'invoice_lines' # for SI / STV | 203 | restricted_area = 'invoice_lines' # for SI / STV / ISI |
1633 | 204 | if not account_obj.search_exist(cr, uid, [('id', '=', account.id), ('restricted_area', '=', restricted_area)], | 204 | if not account_obj.search_exist(cr, uid, [('id', '=', account.id), ('restricted_area', '=', restricted_area)], |
1634 | 205 | context=context): | 205 | context=context): |
1635 | 206 | errors.append(_("Line %s: the account %s is not allowed.") % (current_line_num, account_code)) | 206 | errors.append(_("Line %s: the account %s is not allowed.") % (current_line_num, account_code)) |
1636 | 207 | 207 | ||
1637 | === modified file 'bin/addons/account/wizard/account_invoice_refund.py' | |||
1638 | --- bin/addons/account/wizard/account_invoice_refund.py 2020-02-10 13:07:40 +0000 | |||
1639 | +++ bin/addons/account/wizard/account_invoice_refund.py 2021-11-03 13:33:55 +0000 | |||
1640 | @@ -32,13 +32,17 @@ | |||
1641 | 32 | 32 | ||
1642 | 33 | def _get_filter_refund(self, cr, uid, context=None): | 33 | def _get_filter_refund(self, cr, uid, context=None): |
1643 | 34 | """ | 34 | """ |
1645 | 35 | Returns the selectable Refund Types (no simple "Refund" in case of an IVO/IVI) | 35 | Returns the selectable Refund Types (no simple "Refund" in case of an IVO/IVI or STV, only Refund/Cancel in case of an ISI) |
1646 | 36 | """ | 36 | """ |
1647 | 37 | if context is None: | 37 | if context is None: |
1648 | 38 | context = {} | 38 | context = {} |
1652 | 39 | if context.get('is_intermission', False): | 39 | refund_types = [('modify', 'Modify'), ('refund', 'Refund'), ('cancel', 'Cancel')] |
1653 | 40 | return [('modify', 'Modify'), ('cancel', 'Cancel')] | 40 | if context.get('is_intermission', False) or context.get('doc_type', '') == 'stv': |
1654 | 41 | return [('modify', 'Modify'), ('refund', 'Refund'), ('cancel', 'Cancel')] | 41 | refund_types = [('modify', 'Modify'), ('cancel', 'Cancel')] |
1655 | 42 | elif context.get('doc_type', '') == 'isi': | ||
1656 | 43 | # note: Refund Cancel is allowed only if the counterpart invoice is closed (handled directly in ISI form) | ||
1657 | 44 | refund_types = [('cancel', 'Cancel')] | ||
1658 | 45 | return refund_types | ||
1659 | 42 | 46 | ||
1660 | 43 | _columns = { | 47 | _columns = { |
1661 | 44 | 'date': fields.date('Operation date', help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'), | 48 | 'date': fields.date('Operation date', help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'), |
1662 | @@ -49,35 +53,10 @@ | |||
1663 | 49 | 'filter_refund': fields.selection(_get_filter_refund, "Refund Type", required=True, help='Refund invoice based on this type. You can not Modify and Cancel if the invoice is already reconciled'), | 53 | 'filter_refund': fields.selection(_get_filter_refund, "Refund Type", required=True, help='Refund invoice based on this type. You can not Modify and Cancel if the invoice is already reconciled'), |
1664 | 50 | } | 54 | } |
1665 | 51 | 55 | ||
1666 | 52 | def _get_journal(self, cr, uid, context=None): | ||
1667 | 53 | obj_journal = self.pool.get('account.journal') | ||
1668 | 54 | if context is None: | ||
1669 | 55 | context = {} | ||
1670 | 56 | journal = obj_journal.search(cr, uid, [('type', '=', 'sale_refund')]) | ||
1671 | 57 | if context.get('type', False): | ||
1672 | 58 | if context['type'] in ('in_invoice', 'in_refund'): | ||
1673 | 59 | journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_refund')]) | ||
1674 | 60 | return journal and journal[0] or False | ||
1675 | 61 | |||
1676 | 62 | _defaults = { | 56 | _defaults = { |
1677 | 63 | 'journal_id': _get_journal, | ||
1678 | 64 | 'filter_refund': 'modify', | 57 | 'filter_refund': 'modify', |
1679 | 65 | } | 58 | } |
1680 | 66 | 59 | ||
1681 | 67 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): | ||
1682 | 68 | journal_obj = self.pool.get('account.journal') | ||
1683 | 69 | res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) | ||
1684 | 70 | type = context.get('journal_type', 'sale_refund') | ||
1685 | 71 | if type in ('sale', 'sale_refund'): | ||
1686 | 72 | type = 'sale_refund' | ||
1687 | 73 | else: | ||
1688 | 74 | type = 'purchase_refund' | ||
1689 | 75 | for field in res['fields']: | ||
1690 | 76 | if field == 'journal_id': | ||
1691 | 77 | journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1) | ||
1692 | 78 | res['fields'][field]['selection'] = journal_select | ||
1693 | 79 | return res | ||
1694 | 80 | |||
1695 | 81 | def _hook_fields_for_modify_refund(self, cr, uid, *args): | 60 | def _hook_fields_for_modify_refund(self, cr, uid, *args): |
1696 | 82 | """ | 61 | """ |
1697 | 83 | Permits to change values that are taken from initial invoice to new invoice(s) | 62 | Permits to change values that are taken from initial invoice to new invoice(s) |
1698 | @@ -94,11 +73,24 @@ | |||
1699 | 94 | res = ['address_contact_id', 'address_invoice_id', 'partner_id', 'account_id', 'currency_id', 'payment_term', 'journal_id'] | 73 | res = ['address_contact_id', 'address_invoice_id', 'partner_id', 'account_id', 'currency_id', 'payment_term', 'journal_id'] |
1700 | 95 | return res | 74 | return res |
1701 | 96 | 75 | ||
1703 | 97 | def _hook_create_invoice(self, cr, uid, data, form, *args): | 76 | def _get_invoice_context(self, context): |
1704 | 77 | """ | ||
1705 | 78 | Gets the context to be used in _hook_create_invoice | ||
1706 | 79 | |||
1707 | 80 | US-8585: for now only "from_refund_button" is handled, the context is otherwise empty in order not to break the current behavior. | ||
1708 | 81 | """ | ||
1709 | 82 | if context and context.get('from_refund_button'): | ||
1710 | 83 | inv_context = {'from_refund_button': True} | ||
1711 | 84 | else: | ||
1712 | 85 | inv_context = {} | ||
1713 | 86 | return inv_context | ||
1714 | 87 | |||
1715 | 88 | def _hook_create_invoice(self, cr, uid, data, form, context=None): | ||
1716 | 98 | """ | 89 | """ |
1717 | 99 | Permits to adapt invoice creation | 90 | Permits to adapt invoice creation |
1718 | 100 | """ | 91 | """ |
1720 | 101 | res = self.pool.get('account.invoice').create(cr, uid, data, {}) | 92 | inv_context = self._get_invoice_context(context) |
1721 | 93 | res = self.pool.get('account.invoice').create(cr, uid, data, context=inv_context) | ||
1722 | 102 | return res | 94 | return res |
1723 | 103 | 95 | ||
1724 | 104 | def _hook_create_refund(self, cr, uid, inv_ids, date, period, description, journal_id, form, context=None): | 96 | def _hook_create_refund(self, cr, uid, inv_ids, date, period, description, journal_id, form, context=None): |
1725 | @@ -134,7 +126,6 @@ | |||
1726 | 134 | inv_obj = self.pool.get('account.invoice') | 126 | inv_obj = self.pool.get('account.invoice') |
1727 | 135 | reconcile_obj = self.pool.get('account.move.reconcile') | 127 | reconcile_obj = self.pool.get('account.move.reconcile') |
1728 | 136 | account_m_line_obj = self.pool.get('account.move.line') | 128 | account_m_line_obj = self.pool.get('account.move.line') |
1729 | 137 | mod_obj = self.pool.get('ir.model.data') | ||
1730 | 138 | act_obj = self.pool.get('ir.actions.act_window') | 129 | act_obj = self.pool.get('ir.actions.act_window') |
1731 | 139 | wf_service = netsvc.LocalService('workflow') | 130 | wf_service = netsvc.LocalService('workflow') |
1732 | 140 | inv_tax_obj = self.pool.get('account.invoice.tax') | 131 | inv_tax_obj = self.pool.get('account.invoice.tax') |
1733 | @@ -158,14 +149,13 @@ | |||
1734 | 158 | if mode in ('cancel', 'modify') and not inv.account_id.reconcile: | 149 | if mode in ('cancel', 'modify') and not inv.account_id.reconcile: |
1735 | 159 | raise osv.except_osv(_('Error !'), _("Cannot Cancel / Modify if the account can't be reconciled.")) | 150 | raise osv.except_osv(_('Error !'), _("Cannot Cancel / Modify if the account can't be reconciled.")) |
1736 | 160 | if mode in ('cancel', 'modify') and inv_obj.has_one_line_reconciled(cr, uid, [inv.id], context=context): | 151 | if mode in ('cancel', 'modify') and inv_obj.has_one_line_reconciled(cr, uid, [inv.id], context=context): |
1742 | 161 | if inv.is_intermission: | 152 | if inv.state == 'inv_close' or inv.is_intermission or inv.doc_type in ('stv', 'isi'): |
1743 | 162 | # error specific to IVO/IVI for which there is no simple refund option | 153 | # error msg specific to UC where there is no simple refund option |
1744 | 163 | raise osv.except_osv(_('Error !'), _('Cannot %s an Intermission Voucher which is already reconciled, it should be unreconciled first.') % _(mode)) | 154 | raise osv.except_osv(_('Error !'), _('Cannot %s an invoice which is already reconciled, ' |
1745 | 164 | if inv.state == 'inv_close': | 155 | 'it should be unreconciled first.') % _(mode)) |
1741 | 165 | raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first.') % (mode)) | ||
1746 | 166 | else: | 156 | else: |
1749 | 167 | raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode)) | 157 | raise osv.except_osv(_('Error !'), _('Cannot %s an invoice which is already reconciled, ' |
1750 | 168 | 158 | 'it should be unreconciled first. You can only Refund this invoice.') % _(mode)) | |
1751 | 169 | if mode == 'refund' and inv.state == 'inv_close': | 159 | if mode == 'refund' and inv.state == 'inv_close': |
1752 | 170 | raise osv.except_osv(_('Error !'), _('It is not possible to refund a Closed invoice')) | 160 | raise osv.except_osv(_('Error !'), _('It is not possible to refund a Closed invoice')) |
1753 | 171 | 161 | ||
1754 | @@ -252,6 +242,7 @@ | |||
1755 | 252 | source_doc = invoice.get('number', False) | 242 | source_doc = invoice.get('number', False) |
1756 | 253 | invoice.update({ | 243 | invoice.update({ |
1757 | 254 | 'type': inv.type, | 244 | 'type': inv.type, |
1758 | 245 | 'real_doc_type': inv.doc_type or '', | ||
1759 | 255 | 'date_invoice': date, | 246 | 'date_invoice': date, |
1760 | 256 | 'state': 'draft', | 247 | 'state': 'draft', |
1761 | 257 | 'number': False, | 248 | 'number': False, |
1762 | @@ -264,7 +255,7 @@ | |||
1763 | 264 | }) | 255 | }) |
1764 | 265 | for field in self._hook_fields_m2o_for_modify_refund(cr, uid): | 256 | for field in self._hook_fields_m2o_for_modify_refund(cr, uid): |
1765 | 266 | invoice[field] = invoice[field] and invoice[field][0] | 257 | invoice[field] = invoice[field] and invoice[field][0] |
1767 | 267 | inv_id = self._hook_create_invoice(cr, uid, invoice, form) | 258 | inv_id = self._hook_create_invoice(cr, uid, invoice, form, context=context) |
1768 | 268 | if inv.payment_term.id: | 259 | if inv.payment_term.id: |
1769 | 269 | data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date) | 260 | data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date) |
1770 | 270 | if 'value' in data and data['value']: | 261 | if 'value' in data and data['value']: |
1771 | @@ -283,28 +274,29 @@ | |||
1772 | 283 | ji_ids.extend([sr_ji.id for sr_ji in refund.move_id.line_id]) | 274 | ji_ids.extend([sr_ji.id for sr_ji in refund.move_id.line_id]) |
1773 | 284 | # write on JIs without recreating AJIs | 275 | # write on JIs without recreating AJIs |
1774 | 285 | account_m_line_obj.write(cr, uid, ji_ids, {'is_si_refund': True}, context=context, check=False, update_check=False) | 276 | account_m_line_obj.write(cr, uid, ji_ids, {'is_si_refund': True}, context=context, check=False, update_check=False) |
1791 | 286 | 277 | # return to a tree view containing the refund generated | |
1792 | 287 | if context.get('is_intermission', False): | 278 | from_doc_type = context.get('doc_type', '') |
1793 | 288 | module = 'account_override' | 279 | if from_doc_type == 'stv': |
1794 | 289 | if inv.type == 'in_invoice': | 280 | return_doc_type = 'str' |
1795 | 290 | xml_id = 'action_intermission_out' | 281 | elif from_doc_type == 'ivo': |
1796 | 291 | else: | 282 | return_doc_type = 'ivi' |
1797 | 292 | xml_id = 'action_intermission_in' | 283 | elif from_doc_type == 'ivi': |
1798 | 293 | else: | 284 | return_doc_type = 'ivo' |
1799 | 294 | module = 'account' | 285 | elif from_doc_type == 'isi': |
1800 | 295 | if inv.type in ('out_invoice', 'out_refund'): | 286 | return_doc_type = 'isr' |
1801 | 296 | xml_id = 'action_invoice_tree3' | 287 | else: # i.e. si, di |
1802 | 297 | else: | 288 | return_doc_type = 'sr' |
1803 | 298 | xml_id = 'action_invoice_tree4' | 289 | action_act_window = inv_obj._invoice_action_act_window[return_doc_type] |
1804 | 299 | result = mod_obj.get_object_reference(cr, uid, module, xml_id) | 290 | result = act_obj.open_view_from_xmlid(cr, uid, action_act_window, context=context) |
1789 | 300 | id = result and result[1] or False | ||
1790 | 301 | result = act_obj.read(cr, uid, id, context=context) | ||
1805 | 302 | invoice_domain = eval(result['domain']) | 291 | invoice_domain = eval(result['domain']) |
1806 | 303 | invoice_domain.append(('id', 'in', created_inv)) | 292 | invoice_domain.append(('id', 'in', created_inv)) |
1807 | 304 | result['domain'] = invoice_domain | 293 | result['domain'] = invoice_domain |
1808 | 305 | return result | 294 | return result |
1809 | 306 | 295 | ||
1810 | 307 | def invoice_refund(self, cr, uid, ids, context=None): | 296 | def invoice_refund(self, cr, uid, ids, context=None): |
1811 | 297 | if context is None: | ||
1812 | 298 | context = {} | ||
1813 | 299 | context.update({'from_refund_button': True}) | ||
1814 | 308 | data_refund = self.read(cr, uid, ids[0], ['filter_refund'], context=context)['filter_refund'] | 300 | data_refund = self.read(cr, uid, ids[0], ['filter_refund'], context=context)['filter_refund'] |
1815 | 309 | return self.compute_refund(cr, uid, ids, data_refund, context=context) | 301 | return self.compute_refund(cr, uid, ids, data_refund, context=context) |
1816 | 310 | 302 | ||
1817 | 311 | 303 | ||
1818 | === modified file 'bin/addons/account/wizard/account_invoice_refund_view.xml' | |||
1819 | --- bin/addons/account/wizard/account_invoice_refund_view.xml 2019-06-24 14:40:19 +0000 | |||
1820 | +++ bin/addons/account/wizard/account_invoice_refund_view.xml 2021-11-03 13:33:55 +0000 | |||
1821 | @@ -14,13 +14,17 @@ | |||
1822 | 14 | <field name="journal_id" required="1"/> | 14 | <field name="journal_id" required="1"/> |
1823 | 15 | <field name="date" required="1"/> | 15 | <field name="date" required="1"/> |
1824 | 16 | <field name="period"/> | 16 | <field name="period"/> |
1826 | 17 | <field name="filter_refund"/> | 17 | <field name="filter_refund" attrs="{'readonly': [('is_isi', '=', True)]}"/> |
1827 | 18 | <field name="is_intermission" invisible="1"/> | 18 | <field name="is_intermission" invisible="1"/> |
1828 | 19 | <field name="is_stv" invisible="1"/> | ||
1829 | 20 | <field name="is_isi" invisible="1"/> | ||
1830 | 19 | </group> | 21 | </group> |
1831 | 20 | <separator colspan="4"/> | 22 | <separator colspan="4"/> |
1832 | 21 | <group col="4" colspan="4" fill="1"> | 23 | <group col="4" colspan="4" fill="1"> |
1835 | 22 | <label align="0.0" width="550" colspan="4" string="Modify Invoice: Cancels the current invoice and creates a new copy of it ready for editing."/> | 24 | <group attrs="{'invisible': [('is_isi', '=', True)]}"> |
1836 | 23 | <group attrs="{'invisible': [('is_intermission', '=', True)] }"> | 25 | <label align="0.0" width="550" colspan="4" string="Modify Invoice: Cancels the current invoice and creates a new copy of it ready for editing."/> |
1837 | 26 | </group> | ||
1838 | 27 | <group attrs="{'invisible': ['|', '|', ('is_intermission', '=', True), ('is_stv', '=', True), ('is_isi', '=', True)]}"> | ||
1839 | 24 | <label align="0.0" width="300" string="Refund Invoice: Creates the refund invoice, ready for editing."/> | 28 | <label align="0.0" width="300" string="Refund Invoice: Creates the refund invoice, ready for editing."/> |
1840 | 25 | </group> | 29 | </group> |
1841 | 26 | <label align="0.0" width="500" colspan="4" string="Cancel Invoice: Creates the refund invoice, validate and reconcile it to cancel the current invoice."/> | 30 | <label align="0.0" width="500" colspan="4" string="Cancel Invoice: Creates the refund invoice, validate and reconcile it to cancel the current invoice."/> |
1842 | 27 | 31 | ||
1843 | === modified file 'bin/addons/account_hq_entries/account_view.xml' | |||
1844 | --- bin/addons/account_hq_entries/account_view.xml 2019-01-10 13:48:23 +0000 | |||
1845 | +++ bin/addons/account_hq_entries/account_view.xml 2021-11-03 13:33:55 +0000 | |||
1846 | @@ -192,40 +192,6 @@ | |||
1847 | 192 | </field> | 192 | </field> |
1848 | 193 | </record> | 193 | </record> |
1849 | 194 | 194 | ||
1850 | 195 | <!-- | ||
1851 | 196 | New account attribute for HQ entries corrections | ||
1852 | 197 | --> | ||
1853 | 198 | |||
1854 | 199 | <record id="inherit_view_account_form2" model="ir.ui.view"> | ||
1855 | 200 | <field name='name'>inherit.view.account.form2</field> | ||
1856 | 201 | <field name='model'>account.account</field> | ||
1857 | 202 | <field name="type">form</field> | ||
1858 | 203 | <field name='inherit_id' ref='account.view_account_form'/> | ||
1859 | 204 | <field name="priority">30</field> | ||
1860 | 205 | <field name="arch" type="xml"> | ||
1861 | 206 | <xpath expr="//field[@name='user_type']" position="after"> | ||
1862 | 207 | <field name="is_not_hq_correctible" on_change="onchange_is_not_hq_correctible(is_not_hq_correctible)"/> | ||
1863 | 208 | <newline/> | ||
1864 | 209 | <label string="" colspan="2"/> | ||
1865 | 210 | <field name="is_not_ad_correctable" on_change="onchange_is_not_ad_correctable(is_not_ad_correctable)"/> | ||
1866 | 211 | </xpath> | ||
1867 | 212 | </field> | ||
1868 | 213 | </record> | ||
1869 | 214 | |||
1870 | 215 | <record id="inherit_view_account_tree2" model="ir.ui.view"> | ||
1871 | 216 | <field name='name'>inherit.view.account.tree2</field> | ||
1872 | 217 | <field name='model'>account.account</field> | ||
1873 | 218 | <field name="type">tree</field> | ||
1874 | 219 | <field name='inherit_id' ref='account.view_account_tree'/> | ||
1875 | 220 | <field name="priority" eval="20"/> | ||
1876 | 221 | <field name="arch" type="xml"> | ||
1877 | 222 | <xpath expr="//field[@name='activation_date']" position="before"> | ||
1878 | 223 | <field name="is_not_hq_correctible" invisible="1"/> | ||
1879 | 224 | </xpath> | ||
1880 | 225 | </field> | ||
1881 | 226 | </record> | ||
1882 | 227 | |||
1883 | 228 | |||
1884 | 229 | <!-- Actions: Menu actions --> | 195 | <!-- Actions: Menu actions --> |
1885 | 230 | <record id="action_hq_entries_import_wizard" model="ir.actions.act_window"> | 196 | <record id="action_hq_entries_import_wizard" model="ir.actions.act_window"> |
1886 | 231 | <field name="name">Import HQ Entries</field> | 197 | <field name="name">Import HQ Entries</field> |
1887 | 232 | 198 | ||
1888 | === modified file 'bin/addons/account_mcdb/account_view.xml' | |||
1889 | --- bin/addons/account_mcdb/account_view.xml 2020-08-06 16:10:07 +0000 | |||
1890 | +++ bin/addons/account_mcdb/account_view.xml 2021-11-03 13:33:55 +0000 | |||
1891 | @@ -87,30 +87,6 @@ | |||
1892 | 87 | </field> | 87 | </field> |
1893 | 88 | </record> | 88 | </record> |
1894 | 89 | 89 | ||
1895 | 90 | <!-- Account analytic line tree view --> | ||
1896 | 91 | <record model="ir.ui.view" id="account_analytic_line_default"> | ||
1897 | 92 | <field name="name">account.analytic.line.default</field> | ||
1898 | 93 | <field name="model">account.analytic.line</field> | ||
1899 | 94 | <field name="type">tree</field> | ||
1900 | 95 | <field name="inherit_id" ref="account.view_account_analytic_line_tree"/> | ||
1901 | 96 | <field name="priority" eval="40"/> | ||
1902 | 97 | <field name="arch" type="xml"> | ||
1903 | 98 | <data> | ||
1904 | 99 | <xpath expr="/tree/field[@name='journal_id']" position="before"> | ||
1905 | 100 | <field name="is_reversal" invisible="1"/> | ||
1906 | 101 | <field name="journal_type" invisible="1"/> | ||
1907 | 102 | <field name="is_corrigible" invisible="1"/> | ||
1908 | 103 | <button name="button_corrections" type="object" string="Accounting info/correction" | ||
1909 | 104 | attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> | ||
1910 | 105 | <field name="is_reallocated" invisible="1"/> | ||
1911 | 106 | <field name="last_corrected_id" invisible="1"/> | ||
1912 | 107 | <field name="is_engi" invisible="1"/> | ||
1913 | 108 | <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False), ('last_corrected_id', '=', False)]}" icon="terp-mail-" colspan="2" name="button_open_analytic_corrections" type="object"/> | ||
1914 | 109 | </xpath> | ||
1915 | 110 | </data> | ||
1916 | 111 | </field> | ||
1917 | 112 | </record> | ||
1918 | 113 | |||
1919 | 114 | <!-- Actions --> | 90 | <!-- Actions --> |
1920 | 115 | <act_window id="analytic_distribution.action_mass_reallocation" | 91 | <act_window id="analytic_distribution.action_mass_reallocation" |
1921 | 116 | name="Mass reallocation" | 92 | name="Mass reallocation" |
1922 | 117 | 93 | ||
1923 | === modified file 'bin/addons/account_override/__init__.py' | |||
1924 | --- bin/addons/account_override/__init__.py 2019-06-13 16:16:46 +0000 | |||
1925 | +++ bin/addons/account_override/__init__.py 2021-11-03 13:33:55 +0000 | |||
1926 | @@ -51,6 +51,8 @@ | |||
1927 | 51 | #+ Supplier Invoice | 51 | #+ Supplier Invoice |
1928 | 52 | #+ Direct Invoice | 52 | #+ Direct Invoice |
1929 | 53 | #+ Supplier refund | 53 | #+ Supplier refund |
1930 | 54 | #+ Intersection Supplier Invoice | ||
1931 | 55 | #+ Intersection Supplier Refund | ||
1932 | 54 | 'in_invoice': [ | 56 | 'in_invoice': [ |
1933 | 55 | ('type', '!=', 'view'), | 57 | ('type', '!=', 'view'), |
1934 | 56 | # Either Payable/Payables or Payable/Tax or Regular/Debt or Regular/Cash or Regular/Income accounts | 58 | # Either Payable/Payables or Payable/Tax or Regular/Debt or Regular/Cash or Regular/Income accounts |
1935 | @@ -61,6 +63,7 @@ | |||
1936 | 61 | ], | 63 | ], |
1937 | 62 | # HEADER OF: | 64 | # HEADER OF: |
1938 | 63 | #+ Stock Transfer Voucher | 65 | #+ Stock Transfer Voucher |
1939 | 66 | #+ Stock Transfer Refund | ||
1940 | 64 | #+ Customer Refund | 67 | #+ Customer Refund |
1941 | 65 | #+ Debit Notes | 68 | #+ Debit Notes |
1942 | 66 | 'out_invoice': [ | 69 | 'out_invoice': [ |
1943 | @@ -81,7 +84,10 @@ | |||
1944 | 81 | #+ Supplier invoice | 84 | #+ Supplier invoice |
1945 | 82 | #+ Direct invoice | 85 | #+ Direct invoice |
1946 | 83 | #+ Supplier refund | 86 | #+ Supplier refund |
1947 | 87 | #+ Intersection supplier invoice | ||
1948 | 88 | #+ Intersection supplier refund | ||
1949 | 84 | #+ Stock transfer voucher | 89 | #+ Stock transfer voucher |
1950 | 90 | #+ Stock transfer refund | ||
1951 | 85 | #+ Customer refund | 91 | #+ Customer refund |
1952 | 86 | #+ Debit notes | 92 | #+ Debit notes |
1953 | 87 | 'invoice_lines': [ | 93 | 'invoice_lines': [ |
1954 | 88 | 94 | ||
1955 | === modified file 'bin/addons/account_override/account.py' | |||
1956 | --- bin/addons/account_override/account.py 2021-04-23 12:31:26 +0000 | |||
1957 | +++ bin/addons/account_override/account.py 2021-11-03 13:33:55 +0000 | |||
1958 | @@ -974,6 +974,7 @@ | |||
1959 | 974 | required=True, states={'posted':[('readonly',True)]}, | 974 | required=True, states={'posted':[('readonly',True)]}, |
1960 | 975 | domain="[('type', 'not in', " | 975 | domain="[('type', 'not in', " |
1961 | 976 | " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq'])," | 976 | " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq'])," |
1962 | 977 | "('code', '!=', 'ISI'), " | ||
1963 | 977 | "('instance_filter', '=', True)]", | 978 | "('instance_filter', '=', True)]", |
1964 | 978 | hide_default_menu=True), | 979 | hide_default_menu=True), |
1965 | 979 | 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"), | 980 | 'document_date': fields.date('Document Date', size=255, required=True, help="Used for manual journal entries"), |
1966 | 980 | 981 | ||
1967 | === modified file 'bin/addons/account_override/account_invoice_sync.py' | |||
1968 | --- bin/addons/account_override/account_invoice_sync.py 2021-08-05 15:24:04 +0000 | |||
1969 | +++ bin/addons/account_override/account_invoice_sync.py 2021-11-03 13:33:55 +0000 | |||
1970 | @@ -174,7 +174,7 @@ | |||
1971 | 174 | """ | 174 | """ |
1972 | 175 | Creates automatic counterpart invoice at synchro time. | 175 | Creates automatic counterpart invoice at synchro time. |
1973 | 176 | Intermission workflow: an IVO sent generates an IVI | 176 | Intermission workflow: an IVO sent generates an IVI |
1975 | 177 | Intersection workflow: an STV sent generates an SI | 177 | Intersection workflow: an STV sent generates an ISI |
1976 | 178 | """ | 178 | """ |
1977 | 179 | self._logger.info("+++ Create an account.invoice in %s matching the one sent by %s" % (cr.dbname, source)) | 179 | self._logger.info("+++ Create an account.invoice in %s matching the one sent by %s" % (cr.dbname, source)) |
1978 | 180 | if context is None: | 180 | if context is None: |
1979 | @@ -213,21 +213,24 @@ | |||
1980 | 213 | inv_lines = invoice_dict.get('invoice_line', []) | 213 | inv_lines = invoice_dict.get('invoice_line', []) |
1981 | 214 | po = False | 214 | po = False |
1982 | 215 | vals = {} | 215 | vals = {} |
1984 | 216 | # STV in sending instance: generates an SI in the receiving instance | 216 | # STV in sending instance: generates an ISI in the receiving instance |
1985 | 217 | if journal_type == 'sale': | 217 | if journal_type == 'sale': |
1993 | 218 | pur_journal_ids = journal_obj.search(cr, uid, [('type', '=', 'purchase'), ('is_current_instance', '=', True)], limit=1, context=context) | 218 | isi_journal_ids = journal_obj.search(cr, uid, |
1994 | 219 | if not pur_journal_ids: | 219 | [('type', '=', 'purchase'), ('code', '=', 'ISI'), ('is_current_instance', '=', True)], |
1995 | 220 | raise osv.except_osv(_('Error'), _("No Purchase journal found for the current instance.")) | 220 | limit=1, context=context) |
1996 | 221 | # for the SI use the Account Payable of the partner | 221 | if not isi_journal_ids: |
1997 | 222 | si_account = partner.property_account_payable | 222 | raise osv.except_osv(_('Error'), _("No Intersection Supplier Invoice journal found for the current instance.")) |
1998 | 223 | if not si_account or posting_date < si_account.activation_date or \ | 223 | # for the ISI use the Account Payable of the partner |
1999 | 224 | (si_account.inactivation_date and posting_date >= si_account.inactivation_date): | 224 | isi_account = partner.property_account_payable |
2000 | 225 | if not isi_account or posting_date < isi_account.activation_date or \ | ||
2001 | 226 | (isi_account.inactivation_date and posting_date >= isi_account.inactivation_date): | ||
2002 | 225 | raise osv.except_osv(_('Error'), _("Account Payable not found or inactive for the partner %s.") % partner.name) | 227 | raise osv.except_osv(_('Error'), _("Account Payable not found or inactive for the partner %s.") % partner.name) |
2003 | 226 | vals.update( | 228 | vals.update( |
2004 | 227 | { | 229 | { |
2007 | 228 | 'journal_id': pur_journal_ids[0], | 230 | 'journal_id': isi_journal_ids[0], |
2008 | 229 | 'account_id': si_account.id, | 231 | 'account_id': isi_account.id, |
2009 | 230 | 'type': 'in_invoice', | 232 | 'type': 'in_invoice', |
2010 | 233 | 'real_doc_type': 'isi', | ||
2011 | 231 | 'is_direct_invoice': False, | 234 | 'is_direct_invoice': False, |
2012 | 232 | 'is_inkind_donation': False, | 235 | 'is_inkind_donation': False, |
2013 | 233 | 'is_debit_note': False, | 236 | 'is_debit_note': False, |
2014 | @@ -249,6 +252,7 @@ | |||
2015 | 249 | 'journal_id': int_journal_ids[0], | 252 | 'journal_id': int_journal_ids[0], |
2016 | 250 | 'account_id': ivi_account.id, | 253 | 'account_id': ivi_account.id, |
2017 | 251 | 'type': 'in_invoice', | 254 | 'type': 'in_invoice', |
2018 | 255 | 'real_doc_type': 'ivi', | ||
2019 | 252 | 'is_inkind_donation': False, | 256 | 'is_inkind_donation': False, |
2020 | 253 | 'is_debit_note': False, | 257 | 'is_debit_note': False, |
2021 | 254 | 'is_intermission': True, | 258 | 'is_intermission': True, |
2022 | @@ -321,7 +325,7 @@ | |||
2023 | 321 | if inv_id: | 325 | if inv_id: |
2024 | 322 | self._create_invoice_lines(cr, uid, inv_lines, inv_id, posting_date, po, from_supply, context=context) | 326 | self._create_invoice_lines(cr, uid, inv_lines, inv_id, posting_date, po, from_supply, context=context) |
2025 | 323 | if journal_type == 'sale': | 327 | if journal_type == 'sale': |
2027 | 324 | msg = "SI No. %s created successfully." % inv_id | 328 | msg = "ISI No. %s created successfully." % inv_id |
2028 | 325 | elif journal_type == 'intermission': | 329 | elif journal_type == 'intermission': |
2029 | 326 | msg = "IVI No. %s created successfully." % inv_id | 330 | msg = "IVI No. %s created successfully." % inv_id |
2030 | 327 | self._logger.info(msg) | 331 | self._logger.info(msg) |
2031 | @@ -352,7 +356,7 @@ | |||
2032 | 352 | if counterpart_inv_number: | 356 | if counterpart_inv_number: |
2033 | 353 | inv_ids = self.search(cr, uid, [('number', '=', counterpart_inv_number)], limit=1, context=context) | 357 | inv_ids = self.search(cr, uid, [('number', '=', counterpart_inv_number)], limit=1, context=context) |
2034 | 354 | elif not counterpart_inv_number and number: | 358 | elif not counterpart_inv_number and number: |
2036 | 355 | # use case where the state of the IVO/STV is updated before the related IVI/SI has been opened | 359 | # use case where the state of the IVO/STV is updated before the related IVI/ISI has been opened |
2037 | 356 | inv_ids = self.search(cr, uid, [('counterpart_inv_number', '=', number)], limit=1, context=context) | 360 | inv_ids = self.search(cr, uid, [('counterpart_inv_number', '=', number)], limit=1, context=context) |
2038 | 357 | if inv_ids: | 361 | if inv_ids: |
2039 | 358 | self.write(cr, uid, inv_ids[0], vals, context=context) | 362 | self.write(cr, uid, inv_ids[0], vals, context=context) |
2040 | 359 | 363 | ||
2041 | === modified file 'bin/addons/account_override/account_invoice_view.xml' | |||
2042 | --- bin/addons/account_override/account_invoice_view.xml 2021-04-29 10:12:12 +0000 | |||
2043 | +++ bin/addons/account_override/account_invoice_view.xml 2021-11-03 13:33:55 +0000 | |||
2044 | @@ -27,46 +27,6 @@ | |||
2045 | 27 | </field> | 27 | </field> |
2046 | 28 | </record> | 28 | </record> |
2047 | 29 | 29 | ||
2048 | 30 | <!-- | ||
2049 | 31 | Supplier Invoice | ||
2050 | 32 | --> | ||
2051 | 33 | <record id="invoice_supplier_form_3" model="ir.ui.view"> | ||
2052 | 34 | <field name="name">account.invoice.supplier.form.3</field> | ||
2053 | 35 | <field name="model">account.invoice</field> | ||
2054 | 36 | <field name="type">form</field> | ||
2055 | 37 | <field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
2056 | 38 | <field name="priority">20</field> | ||
2057 | 39 | <field name="arch" type="xml"> | ||
2058 | 40 | <data> | ||
2059 | 41 | <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes"> | ||
2060 | 42 | <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'in_invoice')]</attribute> | ||
2061 | 43 | </xpath> | ||
2062 | 44 | <xpath expr="/form/group[1]/field[@name='partner_id']" position="attributes"> | ||
2063 | 45 | <attribute name="on_change">onchange_partner_id(type,partner_id,date_invoice,payment_term,partner_bank_id,company_id,is_inkind_donation,is_intermission,is_debit_note,is_direct_invoice,False)</attribute> | ||
2064 | 46 | </xpath> | ||
2065 | 47 | <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before"> | ||
2066 | 48 | <field name="line_number" displayon="noteditable"/> | ||
2067 | 49 | </xpath> | ||
2068 | 50 | <xpath expr="//field[@name='date_invoice']" position="before"> | ||
2069 | 51 | <field name="document_date" /> | ||
2070 | 52 | </xpath> | ||
2071 | 53 | <xpath expr="//field[@name='period_id']" position="replace"> | ||
2072 | 54 | </xpath> | ||
2073 | 55 | <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace"> | ||
2074 | 56 | </xpath> | ||
2075 | 57 | <xpath expr="//button[@name='invoice_open']" position="after" > | ||
2076 | 58 | <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/> | ||
2077 | 59 | <newline/> | ||
2078 | 60 | <field name="can_merge_lines" invisible="1"/> | ||
2079 | 61 | <button name="button_merge_lines" type="object" | ||
2080 | 62 | colspan="3" | ||
2081 | 63 | string="Merge Lines by Account" icon="gtk-convert" | ||
2082 | 64 | confirm="You are about to merge invoice lines; are you sure you want to proceed ? THIS OPERATION CAN NOT BE UNDONE" | ||
2083 | 65 | attrs="{'invisible': [('can_merge_lines', '!=', True)]}"/> | ||
2084 | 66 | </xpath> | ||
2085 | 67 | </data> | ||
2086 | 68 | </field> | ||
2087 | 69 | </record> | ||
2088 | 70 | 30 | ||
2089 | 71 | <!-- Change account_id domain --> | 31 | <!-- Change account_id domain --> |
2090 | 72 | <record id="invoice_line_form3" model="ir.ui.view"> | 32 | <record id="invoice_line_form3" model="ir.ui.view"> |
2091 | @@ -82,131 +42,6 @@ | |||
2092 | 82 | </field> | 42 | </field> |
2093 | 83 | </record> | 43 | </record> |
2094 | 84 | 44 | ||
2095 | 85 | <!-- | ||
2096 | 86 | Delete some field from account_invoice tree: | ||
2097 | 87 | - Salesman or User (user_id) | ||
2098 | 88 | - Total amount (amount_total) | ||
2099 | 89 | - Untaxed (amount_untaxed) | ||
2100 | 90 | Add some elements: | ||
2101 | 91 | - Document date | ||
2102 | 92 | --> | ||
2103 | 93 | <record id="inherit_invoice_tree" model="ir.ui.view"> | ||
2104 | 94 | <field name="name">inherit.invoice.tree</field> | ||
2105 | 95 | <field name="model">account.invoice</field> | ||
2106 | 96 | <field name="type">tree</field> | ||
2107 | 97 | <field name="inherit_id" ref="account.invoice_tree"/> | ||
2108 | 98 | <field name="priority">17</field> | ||
2109 | 99 | <field name="arch" type="xml"> | ||
2110 | 100 | <data> | ||
2111 | 101 | <xpath expr="/tree/field[@name='date_invoice']" position="before"> | ||
2112 | 102 | <field name="document_date"/> | ||
2113 | 103 | <field name="supplier_reference"/> | ||
2114 | 104 | </xpath> | ||
2115 | 105 | <xpath expr="/tree/field[@name='user_id']" position="replace"> | ||
2116 | 106 | </xpath> | ||
2117 | 107 | <xpath expr="/tree/field[@name='amount_untaxed']" position="replace"> | ||
2118 | 108 | </xpath> | ||
2119 | 109 | <xpath expr="/tree/field[@name='residual']" position="attributes"> | ||
2120 | 110 | <attribute name="sum"></attribute> | ||
2121 | 111 | </xpath> | ||
2122 | 112 | <xpath expr="/tree/field[@name='amount_total']" position="attributes"> | ||
2123 | 113 | <attribute name="sum"></attribute> | ||
2124 | 114 | </xpath> | ||
2125 | 115 | </data> | ||
2126 | 116 | </field> | ||
2127 | 117 | </record> | ||
2128 | 118 | |||
2129 | 119 | <!-- | ||
2130 | 120 | Delete some element from Search views: | ||
2131 | 121 | - Salesman or user (user_id) | ||
2132 | 122 | - Total (amount_total) | ||
2133 | 123 | - Responsible button (group by) | ||
2134 | 124 | - Proforma button | ||
2135 | 125 | - Invoices button | ||
2136 | 126 | - Unpaid button | ||
2137 | 127 | And add some ones: | ||
2138 | 128 | - Open button | ||
2139 | 129 | - Paid button | ||
2140 | 130 | --> | ||
2141 | 131 | <record id="inherit_view_account_invoice_filter" model="ir.ui.view"> | ||
2142 | 132 | <field name="name">inherit.view.account.invoice.filter</field> | ||
2143 | 133 | <field name="model">account.invoice</field> | ||
2144 | 134 | <field name="type">search</field> | ||
2145 | 135 | <field name="inherit_id" ref="account.view_account_invoice_filter"/> | ||
2146 | 136 | <field name="priority">17</field> | ||
2147 | 137 | <field name="arch" type="xml"> | ||
2148 | 138 | <data> | ||
2149 | 139 | <xpath expr="/search/group[1]/filter[@name='proforma']" position="replace"> | ||
2150 | 140 | </xpath> | ||
2151 | 141 | <xpath expr="/search/group[1]/filter[@name='invoices']" position="replace"> | ||
2152 | 142 | </xpath> | ||
2153 | 143 | <xpath expr="/search/group[1]/filter[@name='unpaid']" position="attributes"> | ||
2154 | 144 | <attribute name="string">Open</attribute> | ||
2155 | 145 | <attribute name="help">Open Invoices</attribute> | ||
2156 | 146 | </xpath> | ||
2157 | 147 | <xpath expr="/search/group[1]/field[@name='user_id']" position="replace"> | ||
2158 | 148 | </xpath> | ||
2159 | 149 | <xpath expr="/search/group[3]/filter[@string='Responsible']" position="replace"> | ||
2160 | 150 | </xpath> | ||
2161 | 151 | <xpath expr="/search/group[2]/field[@name='period_id']" position="after"> | ||
2162 | 152 | <field name="supplier_reference"/> | ||
2163 | 153 | <field name="name"/> | ||
2164 | 154 | </xpath> | ||
2165 | 155 | <xpath expr="/search/group[1]/separator[1]" position="replace"> | ||
2166 | 156 | </xpath> | ||
2167 | 157 | <xpath expr="/search/group[1]/filter[@name='unpaid']" position="after"> | ||
2168 | 158 | <filter name="paid" icon="terp-dolar" string="Paid" domain="[('state', '=', 'paid')]"/> | ||
2169 | 159 | <filter name="closed" icon="terp-dialog-close" string="Closed" domain="[('state', '=', 'inv_close')]" /> | ||
2170 | 160 | <filter name="cancel_state" icon="terp-gtk-stop" string="Cancelled" domain="[('state', '=', 'cancel')]"/> | ||
2171 | 161 | <separator orientation="vertical"/> | ||
2172 | 162 | <filter name="not_imported" icon="gtk-cancel" string="Not imported" domain="[('imported_state', '=', 'not')]"/> | ||
2173 | 163 | <filter name="partial" icon="terp-dolar_ok!" string="Partially imported" domain="[('imported_state', '=', 'partial')]"/> | ||
2174 | 164 | <filter name="imported" icon="gtk-apply" string="Imported" domain="[('imported_state', '=', 'imported')]"/> | ||
2175 | 165 | <separator orientation="vertical"/> | ||
2176 | 166 | </xpath> | ||
2177 | 167 | </data> | ||
2178 | 168 | </field> | ||
2179 | 169 | </record> | ||
2180 | 170 | |||
2181 | 171 | <!-- | ||
2182 | 172 | Delete some elements from Stock transfer voucher (customer invoices): | ||
2183 | 173 | - period_id | ||
2184 | 174 | - label with "keep empty…" | ||
2185 | 175 | Add some others elements: | ||
2186 | 176 | - document_date | ||
2187 | 177 | --> | ||
2188 | 178 | <record id="invoice_form_4" model="ir.ui.view"> | ||
2189 | 179 | <field name="name">account.invoice.supplier.form.4</field> | ||
2190 | 180 | <field name="model">account.invoice</field> | ||
2191 | 181 | <field name="type">form</field> | ||
2192 | 182 | <field name="inherit_id" ref="account.invoice_form"/> | ||
2193 | 183 | <field name="priority">22</field> | ||
2194 | 184 | <field name="arch" type="xml"> | ||
2195 | 185 | <data> | ||
2196 | 186 | <xpath expr="//field[@name='date_invoice']" position="before"> | ||
2197 | 187 | <field name="document_date"/> | ||
2198 | 188 | </xpath> | ||
2199 | 189 | <xpath expr="//field[@name='period_id']" position="replace"> | ||
2200 | 190 | </xpath> | ||
2201 | 191 | <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace"> | ||
2202 | 192 | </xpath> | ||
2203 | 193 | </data> | ||
2204 | 194 | </field> | ||
2205 | 195 | </record> | ||
2206 | 196 | |||
2207 | 197 | <!-- Add Split Invoice Button on invoices --> | ||
2208 | 198 | <record id="invoice_form_3" model="ir.ui.view"> | ||
2209 | 199 | <field name="name">account.invoice.form.3</field> | ||
2210 | 200 | <field name="model">account.invoice</field> | ||
2211 | 201 | <field name="type">form</field> | ||
2212 | 202 | <field name="inherit_id" ref="account.invoice_form"/> | ||
2213 | 203 | <field name="priority">40</field> | ||
2214 | 204 | <field name="arch" type="xml"> | ||
2215 | 205 | <button name='invoice_open' position="after"> | ||
2216 | 206 | <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/> | ||
2217 | 207 | </button> | ||
2218 | 208 | </field> | ||
2219 | 209 | </record> | ||
2220 | 210 | 45 | ||
2221 | 211 | <!-- | 46 | <!-- |
2222 | 212 | Debit Note views | 47 | Debit Note views |
2223 | @@ -245,7 +80,7 @@ | |||
2224 | 245 | <field name="arch" type="xml"> | 80 | <field name="arch" type="xml"> |
2225 | 246 | <form string="Debit Note" hide_duplicate_button="1"> | 81 | <form string="Debit Note" hide_duplicate_button="1"> |
2226 | 247 | <group colspan="4" col="8"> | 82 | <group colspan="4" col="8"> |
2228 | 248 | <field name="journal_id" domain="[('is_current_instance','=',True), ('type', '=', context.get('journal_type'))]"/> | 83 | <field name="journal_id" domain="[('inv_doc_type', '=', True)]"/> |
2229 | 249 | <field name="number"/> | 84 | <field name="number"/> |
2230 | 250 | <field name="type" invisible="1"/> | 85 | <field name="type" invisible="1"/> |
2231 | 251 | <field name="currency_id" width="50"/> | 86 | <field name="currency_id" width="50"/> |
2232 | @@ -345,7 +180,7 @@ | |||
2233 | 345 | <field name="arch" type="xml"> | 180 | <field name="arch" type="xml"> |
2234 | 346 | <form string="In-kind Donation" noteditable="state=='cancel'"> | 181 | <form string="In-kind Donation" noteditable="state=='cancel'"> |
2235 | 347 | <group colspan="4" col="8"> | 182 | <group colspan="4" col="8"> |
2237 | 348 | <field name="journal_id" domain="[('is_current_instance','=',True), ('type', 'in', ('inkind', 'extra'))]"/> | 183 | <field name="journal_id" domain="[('inv_doc_type', '=', True)]"/> |
2238 | 349 | <field name="number"/> | 184 | <field name="number"/> |
2239 | 350 | <field name="type" invisible="1"/> | 185 | <field name="type" invisible="1"/> |
2240 | 351 | <field name="is_inkind_donation" invisible="1"/> | 186 | <field name="is_inkind_donation" invisible="1"/> |
2241 | @@ -508,7 +343,7 @@ | |||
2242 | 508 | <field name="arch" type="xml"> | 343 | <field name="arch" type="xml"> |
2243 | 509 | <form string="Intermission Voucher" noteditable="state=='cancel'"> | 344 | <form string="Intermission Voucher" noteditable="state=='cancel'"> |
2244 | 510 | <group colspan="4" col="8"> | 345 | <group colspan="4" col="8"> |
2246 | 511 | <field name="fake_journal_id" domain="[('is_current_instance','=',True)]" /> | 346 | <field name="fake_journal_id"/> <!-- readonly --> |
2247 | 512 | <field name="journal_type" invisible="1"/> | 347 | <field name="journal_type" invisible="1"/> |
2248 | 513 | <field name="number"/> | 348 | <field name="number"/> |
2249 | 514 | <field name="type" invisible="1"/> | 349 | <field name="type" invisible="1"/> |
2250 | @@ -747,113 +582,6 @@ | |||
2251 | 747 | </record> | 582 | </record> |
2252 | 748 | 583 | ||
2253 | 749 | <!-- | 584 | <!-- |
2254 | 750 | Delete some elements on customer invoices: | ||
2255 | 751 | - fiscal_position field | ||
2256 | 752 | - proforma button (invoice_proforma2) | ||
2257 | 753 | - payment_term field | ||
2258 | 754 | - tax frame | ||
2259 | 755 | - compute tax button (button_reset_taxes) | ||
2260 | 756 | - amount untaxed field | ||
2261 | 757 | - amount tax field | ||
2262 | 758 | Update some other ones: | ||
2263 | 759 | - account_id field to add a domain on accounts regarding "ACCOUNT_RESTRICTED_AREA" variable | ||
2264 | 760 | --> | ||
2265 | 761 | <record id="inherit_invoice_form" model="ir.ui.view"> | ||
2266 | 762 | <field name="name">inherit.invoice.form</field> | ||
2267 | 763 | <field name="model">account.invoice</field> | ||
2268 | 764 | <field name="type">form</field> | ||
2269 | 765 | <field name="inherit_id" ref="account.invoice_form"/> | ||
2270 | 766 | <field name="priority">61</field> | ||
2271 | 767 | <field name="arch" type="xml"> | ||
2272 | 768 | <data> | ||
2273 | 769 | <xpath expr="/form" position="attributes"> | ||
2274 | 770 | <attribute name="string">Stock Transfer Voucher</attribute> | ||
2275 | 771 | </xpath> | ||
2276 | 772 | <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes"> | ||
2277 | 773 | <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'out_invoice')]</attribute> | ||
2278 | 774 | </xpath> | ||
2279 | 775 | <field name="fiscal_position" position="replace"/> | ||
2280 | 776 | <field name="payment_term" position="replace"/> | ||
2281 | 777 | <field name="tax_line" position="replace"/> | ||
2282 | 778 | <button name="button_reset_taxes" position="replace"/> | ||
2283 | 779 | <button name="invoice_proforma2" position="replace"/> | ||
2284 | 780 | <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='invoice_line']" position="before" > | ||
2285 | 781 | <group name="import" string=" Import Lines " colspan="4" col="4" | ||
2286 | 782 | attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}"> | ||
2287 | 783 | <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
2288 | 784 | attrs="{'readonly': [('state', '!=', 'draft')], | ||
2289 | 785 | 'invisible': [('type', '!=', 'out_invoice')]}"/> | ||
2290 | 786 | <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object" | ||
2291 | 787 | attrs="{'invisible': [('type', '!=', 'out_invoice')]}" | ||
2292 | 788 | force_editable="1"/> | ||
2293 | 789 | <newline/> | ||
2294 | 790 | <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object" | ||
2295 | 791 | attrs="{'invisible': [('state', '!=', 'draft')], | ||
2296 | 792 | 'readonly': [('type', '=', 'out_invoice'), | ||
2297 | 793 | ('from_supply', '=', True), | ||
2298 | 794 | ('partner_type', 'in', ('intermission', 'section'))]}"/> | ||
2299 | 795 | </group> | ||
2300 | 796 | </xpath> | ||
2301 | 797 | <xpath expr="/form/notebook/page[@string='Invoice']/group[3]" position="replace"> | ||
2302 | 798 | <group col="8" colspan="4"> | ||
2303 | 799 | <label string="" colspan="3"/> | ||
2304 | 800 | <field name="reconciled"/> | ||
2305 | 801 | <field name="amount_total"/> | ||
2306 | 802 | <label string="" colspan="3"/> | ||
2307 | 803 | <field name="state"/> | ||
2308 | 804 | <field name="residual"/> | ||
2309 | 805 | <field name="is_debit_note" invisible="1"/> | ||
2310 | 806 | </group> | ||
2311 | 807 | <field name="partner_type" invisible="1"/> | ||
2312 | 808 | <group col="8" colspan="4"> | ||
2313 | 809 | |||
2314 | 810 | <button string="Cancel document" name="invoice_cancel" | ||
2315 | 811 | type="workflow" icon="gtk-cancel" | ||
2316 | 812 | confirm="Do you really want to cancel this document?" | ||
2317 | 813 | attrs="{'invisible': ['|', '|', | ||
2318 | 814 | ('state', '!=', 'draft'), | ||
2319 | 815 | ('type', '!=', 'out_invoice'), | ||
2320 | 816 | ('from_supply', '=', False)]}"/> | ||
2321 | 817 | |||
2322 | 818 | <button name="button_split_invoice" type="object" string="Split Stock Transfer Voucher" | ||
2323 | 819 | icon="gtk-cut" | ||
2324 | 820 | context="{'from_stv': True}" | ||
2325 | 821 | attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}"/> | ||
2326 | 822 | |||
2327 | 823 | <button name="%(account.action_account_invoice_refund)d" type='action' string='Refund' icon="gtk-execute" attrs="{'invisible': ['|', ('state', 'in', ['draft']), ('type', 'in', ['in_refund', 'out_refund'])]}"/> | ||
2328 | 824 | <!-- add a confirmation step only for STV (not for Customer Refunds) | ||
2329 | 825 | when the partner type is compatible with a synchro but "synced" isn't ticked --> | ||
2330 | 826 | <button name="invoice_open" type="object" string="Validate" | ||
2331 | 827 | icon="gtk-go-forward" | ||
2332 | 828 | attrs="{'invisible': ['|', | ||
2333 | 829 | ('state', '!=', 'draft'), | ||
2334 | 830 | '&', | ||
2335 | 831 | ('type', '=', 'out_invoice'), ('partner_type', 'in', ('intermission', 'section')) ]}"/> | ||
2336 | 832 | <button name="invoice_open_with_confirmation" type="object" string="Validate" | ||
2337 | 833 | icon="gtk-go-forward" | ||
2338 | 834 | confirm="Are you sure you want to validate this invoice without synchronization?" | ||
2339 | 835 | attrs="{'invisible': ['|', '|', '|', | ||
2340 | 836 | ('state', '!=', 'draft'), | ||
2341 | 837 | ('type', '!=', 'out_invoice'), | ||
2342 | 838 | ('synced', '=', True), | ||
2343 | 839 | ('partner_type', 'not in', ('intermission', 'section'))]}"/> | ||
2344 | 840 | |||
2345 | 841 | <button name="invoice_open_with_sync_confirmation" type="object" string="Validate" | ||
2346 | 842 | icon="gtk-go-forward" | ||
2347 | 843 | confirm="This invoice will sync to its counterpart instance." | ||
2348 | 844 | attrs="{'invisible': ['|', '|', '|', | ||
2349 | 845 | ('state', '!=', 'draft'), | ||
2350 | 846 | ('type', '!=', 'out_invoice'), | ||
2351 | 847 | ('synced', '=', False), | ||
2352 | 848 | ('partner_type', 'not in', ('intermission', 'section'))]}"/> | ||
2353 | 849 | <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/> | ||
2354 | 850 | </group> | ||
2355 | 851 | </xpath> | ||
2356 | 852 | </data> | ||
2357 | 853 | </field> | ||
2358 | 854 | </record> | ||
2359 | 855 | |||
2360 | 856 | <!-- | ||
2361 | 857 | Debit note actions | 585 | Debit note actions |
2362 | 858 | --> | 586 | --> |
2363 | 859 | 587 | ||
2364 | @@ -864,8 +592,8 @@ | |||
2365 | 864 | <field name="view_type">form</field> | 592 | <field name="view_type">form</field> |
2366 | 865 | <field name="view_mode">tree,form,calendar,graph</field> | 593 | <field name="view_mode">tree,form,calendar,graph</field> |
2367 | 866 | <field eval="False" name="view_id"/> | 594 | <field eval="False" name="view_id"/> |
2370 | 867 | <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '!=', False), ('is_inkind_donation', '=', False)]</field> | 595 | <field name="domain">[('doc_type', '=', 'dn')]</field> |
2371 | 868 | <field name="context">{'type':'out_invoice', 'journal_type': 'sale', 'is_debit_note': True}</field> | 596 | <field name="context">{'doc_type': 'dn', 'type': 'out_invoice', 'journal_type': 'sale', 'is_debit_note': True}</field> |
2372 | 869 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> | 597 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> |
2373 | 870 | </record> | 598 | </record> |
2374 | 871 | 599 | ||
2375 | @@ -931,8 +659,8 @@ | |||
2376 | 931 | <field name="view_type">form</field> | 659 | <field name="view_type">form</field> |
2377 | 932 | <field name="view_mode">tree,form,calendar,graph</field> | 660 | <field name="view_mode">tree,form,calendar,graph</field> |
2378 | 933 | <field eval="False" name="view_id"/> | 661 | <field eval="False" name="view_id"/> |
2381 | 934 | <field name="domain">[('type','=','in_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', True)]</field> | 662 | <field name="domain">[('doc_type', '=', 'donation')]</field> |
2382 | 935 | <field name="context">{'type': 'in_invoice', 'journal_type': 'inkind', 'is_inkind_donation': '1', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_open': 1}</field> | 663 | <field name="context">{'doc_type': 'donation', 'type': 'in_invoice', 'journal_type': 'inkind', 'is_inkind_donation': '1', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_open': 1}</field> |
2383 | 936 | <field name="search_view_id" ref="view_account_invoice_filter_donation"/> | 664 | <field name="search_view_id" ref="view_account_invoice_filter_donation"/> |
2384 | 937 | </record> | 665 | </record> |
2385 | 938 | 666 | ||
2386 | @@ -959,8 +687,8 @@ | |||
2387 | 959 | <field name="view_type">form</field> | 687 | <field name="view_type">form</field> |
2388 | 960 | <field name="view_mode">tree,form,calendar,graph</field> | 688 | <field name="view_mode">tree,form,calendar,graph</field> |
2389 | 961 | <field eval="False" name="view_id"/> | 689 | <field eval="False" name="view_id"/> |
2392 | 962 | <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]</field> | 690 | <field name="domain">[('doc_type', '=', 'ivo')]</field> |
2393 | 963 | <field name="context">{'type': 'out_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'out', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_unpaid': 1, 'search_default_paid': 1, 'search_default_closed': 1}</field> | 691 | <field name="context">{'doc_type': 'ivo', 'type': 'out_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'out', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_unpaid': 1, 'search_default_paid': 1, 'search_default_closed': 1}</field> |
2394 | 964 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> | 692 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> |
2395 | 965 | </record> | 693 | </record> |
2396 | 966 | 694 | ||
2397 | @@ -987,8 +715,8 @@ | |||
2398 | 987 | <field name="view_type">form</field> | 715 | <field name="view_type">form</field> |
2399 | 988 | <field name="view_mode">tree,form,calendar,graph</field> | 716 | <field name="view_mode">tree,form,calendar,graph</field> |
2400 | 989 | <field name="view_id" ref="view_intermission_form"/> | 717 | <field name="view_id" ref="view_intermission_form"/> |
2403 | 990 | <field name="domain">[('type','=','in_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]</field> | 718 | <field name="domain">[('doc_type', '=', 'ivi')]</field> |
2404 | 991 | <field name="context">{'type':'in_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'in', 'from_inv_form': True}</field> | 719 | <field name="context">{'doc_type': 'ivi', 'type': 'in_invoice', 'journal_type': 'intermission', 'is_intermission': True, 'intermission_type': 'in', 'from_inv_form': True}</field> |
2405 | 992 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> | 720 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> |
2406 | 993 | </record> | 721 | </record> |
2407 | 994 | 722 | ||
2408 | @@ -1008,34 +736,6 @@ | |||
2409 | 1008 | <field name="act_window_id" ref="action_intermission_in"/> | 736 | <field name="act_window_id" ref="action_intermission_in"/> |
2410 | 1009 | </record> | 737 | </record> |
2411 | 1010 | 738 | ||
2412 | 1011 | <!-- Fix customer invoice display with a bypass on 'is_debit_note' set to True --> | ||
2413 | 1012 | <record id="account.action_invoice_tree1" model="ir.actions.act_window"> | ||
2414 | 1013 | <field name="name">Customer Invoices</field> <!-- Stock Transfer Vouchers --> | ||
2415 | 1014 | <field name="res_model">account.invoice</field> | ||
2416 | 1015 | <field name="view_type">form</field> | ||
2417 | 1016 | <field name="view_mode">tree,form,calendar,graph</field> | ||
2418 | 1017 | <field eval="False" name="view_id"/> | ||
2419 | 1018 | <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', False)]</field> | ||
2420 | 1019 | <field name="context">{'type':'out_invoice', 'journal_type': 'sale', 'from_inv_form': True, 'search_default_draft': 1, 'search_default_unpaid': 1, 'search_default_paid': 1, 'search_default_closed': 1}</field> | ||
2421 | 1020 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> | ||
2422 | 1021 | <field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field> | ||
2423 | 1022 | </record> | ||
2424 | 1023 | |||
2425 | 1024 | <!-- Fix supplier invoice display with a bypass on 'is_inkind_donation' set to True --> | ||
2426 | 1025 | <record id="account.action_invoice_tree2" model="ir.actions.act_window"> | ||
2427 | 1026 | <field name="name">Supplier Invoices</field> | ||
2428 | 1027 | <field name="res_model">account.invoice</field> | ||
2429 | 1028 | <field name="view_type">form</field> | ||
2430 | 1029 | <field name="view_mode">tree,form,calendar,graph</field> | ||
2431 | 1030 | <field eval="False" name="view_id"/> | ||
2432 | 1031 | <!-- US-2704 if the domain change, do not forget to update the domain of account_board_supplier_invoice_draft in finance/board_account_view.xml --> | ||
2433 | 1032 | <field name="domain">[('type','=','in_invoice'), ('is_direct_invoice', '=', False), ('is_inkind_donation', '=', False), ('is_debit_note', "=", False), ('is_intermission', '=', False)]</field> | ||
2434 | 1033 | <field name="context">{'type': 'in_invoice', 'journal_type': 'purchase', 'from_inv_form': True}</field> | ||
2435 | 1034 | <field name="search_view_id" ref="account.view_account_invoice_filter"/> | ||
2436 | 1035 | <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. | ||
2437 | 1036 | OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice | ||
2438 | 1037 | from your supplier according to what you purchased or received.</field> | ||
2439 | 1038 | </record> | ||
2440 | 1039 | 739 | ||
2441 | 1040 | <!-- | 740 | <!-- |
2442 | 1041 | Debit Note Menu | 741 | Debit Note Menu |
2443 | @@ -1045,13 +745,13 @@ | |||
2444 | 1045 | <menuitem action="action_debit_note" id="menu_action_debit_note" parent="account.menu_finance_receivables" sequence="10"/> | 745 | <menuitem action="action_debit_note" id="menu_action_debit_note" parent="account.menu_finance_receivables" sequence="10"/> |
2445 | 1046 | 746 | ||
2446 | 1047 | <!-- In-kind Donation Menu in "Supplier Invoices" --> | 747 | <!-- In-kind Donation Menu in "Supplier Invoices" --> |
2448 | 1048 | <menuitem action="action_inkind_donation" id="menu_action_inkind_donation" parent="account.menu_finance_payables" sequence="11"/> | 748 | <menuitem action="action_inkind_donation" id="menu_action_inkind_donation" parent="account.menu_finance_payables" sequence="30"/> |
2449 | 1049 | 749 | ||
2450 | 1050 | <!-- Intermission Voucher OUT in "Customer Invoices" --> | 750 | <!-- Intermission Voucher OUT in "Customer Invoices" --> |
2452 | 1051 | <menuitem action="action_intermission_out" id="menu_action_intermission_out" parent="account.menu_finance_receivables" sequence="10"/> | 751 | <menuitem action="action_intermission_out" id="menu_action_intermission_out" parent="account.menu_finance_receivables" sequence="12"/> |
2453 | 1052 | 752 | ||
2454 | 1053 | <!-- Intermission Voucher IN in "Supplier Invoices" --> | 753 | <!-- Intermission Voucher IN in "Supplier Invoices" --> |
2456 | 1054 | <menuitem action="action_intermission_in" id="menu_action_intermission_in" parent="account.menu_finance_payables" sequence="12"/> | 754 | <menuitem action="action_intermission_in" id="menu_action_intermission_in" parent="account.menu_finance_payables" sequence="40"/> |
2457 | 1055 | 755 | ||
2458 | 1056 | <!-- | 756 | <!-- |
2459 | 1057 | Account invoice report redefinition | 757 | Account invoice report redefinition |
2460 | 1058 | 758 | ||
2461 | === modified file 'bin/addons/account_override/account_view.xml' | |||
2462 | --- bin/addons/account_override/account_view.xml 2019-06-18 11:15:45 +0000 | |||
2463 | +++ bin/addons/account_override/account_view.xml 2021-11-03 13:33:55 +0000 | |||
2464 | @@ -2,61 +2,6 @@ | |||
2465 | 2 | <openerp> | 2 | <openerp> |
2466 | 3 | <data> | 3 | <data> |
2467 | 4 | 4 | ||
2468 | 5 | <record model="ir.ui.view" id="view_account_activable_form"> | ||
2469 | 6 | <field name="name">account.account_activable.form</field> | ||
2470 | 7 | <field name="model">account.account</field> | ||
2471 | 8 | <field name="type">form</field> | ||
2472 | 9 | <field name="inherit_id" ref="account.view_account_form"/> | ||
2473 | 10 | <field name="priority">20</field> | ||
2474 | 11 | <field name="arch" type="xml"> | ||
2475 | 12 | <field name="company_id" position="replace"/> | ||
2476 | 13 | <page string="General Information" position="replace"> | ||
2477 | 14 | <page string="General Information"> | ||
2478 | 15 | <group col="6" colspan="4"> | ||
2479 | 16 | <field name="activation_date"/> | ||
2480 | 17 | <field name="inactivation_date"/> | ||
2481 | 18 | <group col="2" colspan="2"> | ||
2482 | 19 | <field name="reconcile" on_change="onchange_reconcile(reconcile)"/> | ||
2483 | 20 | <field name="prevent_multi_curr_rec" attrs="{'readonly': [('reconcile', '=', False)]}"/> | ||
2484 | 21 | <field name="reconciliation_debit_account_id"/> | ||
2485 | 22 | <field name="reconciliation_credit_account_id"/> | ||
2486 | 23 | </group> | ||
2487 | 24 | </group> | ||
2488 | 25 | </page> | ||
2489 | 26 | </page> | ||
2490 | 27 | |||
2491 | 28 | <page string="Notes" position="before"> | ||
2492 | 29 | <page string="Allowed Partner types"> | ||
2493 | 30 | <group col="4" colspan="4"> | ||
2494 | 31 | <group col="2" colspan="2"> | ||
2495 | 32 | <field name="has_partner_type_internal" /> | ||
2496 | 33 | <field name="has_partner_type_external" /> | ||
2497 | 34 | <field name="has_partner_type_esc" /> | ||
2498 | 35 | <newline /> | ||
2499 | 36 | <field name="has_partner_type_local" /> | ||
2500 | 37 | <field name="has_partner_type_ex" /> | ||
2501 | 38 | <field name="has_partner_type_empty" /> | ||
2502 | 39 | <newline /> | ||
2503 | 40 | <field name="has_partner_type_book" /> | ||
2504 | 41 | </group> | ||
2505 | 42 | |||
2506 | 43 | <group col="2" colspan="2"> | ||
2507 | 44 | <field name="has_partner_type_intermission" /> | ||
2508 | 45 | <field name="has_partner_type_section" /> | ||
2509 | 46 | |||
2510 | 47 | <label /><label /> | ||
2511 | 48 | <newline /> | ||
2512 | 49 | <label /><label /> | ||
2513 | 50 | <label /><label /> | ||
2514 | 51 | <newline /> | ||
2515 | 52 | <label /><label /> | ||
2516 | 53 | </group> | ||
2517 | 54 | </group> | ||
2518 | 55 | </page> | ||
2519 | 56 | </page> | ||
2520 | 57 | </field> | ||
2521 | 58 | </record> | ||
2522 | 59 | |||
2523 | 60 | <!-- Tree view for Balance by Account result: granularity by parent account --> | 5 | <!-- Tree view for Balance by Account result: granularity by parent account --> |
2524 | 61 | <record model="ir.ui.view" id="balance_account_tree"> | 6 | <record model="ir.ui.view" id="balance_account_tree"> |
2525 | 62 | <field name="name">balance.account.tree</field> | 7 | <field name="name">balance.account.tree</field> |
2526 | @@ -99,46 +44,6 @@ | |||
2527 | 99 | </field> | 44 | </field> |
2528 | 100 | </record> | 45 | </record> |
2529 | 101 | 46 | ||
2530 | 102 | <!-- Tree view for chart of account result --> | ||
2531 | 103 | <record model="ir.ui.view" id="account.view_account_tree"> | ||
2532 | 104 | <field name="name">account.account_activable.tree</field> | ||
2533 | 105 | <field name="model">account.account</field> | ||
2534 | 106 | <field name="type">tree</field> | ||
2535 | 107 | <field name="field_parent">child_id</field> | ||
2536 | 108 | <field name="priority" eval="12"/> | ||
2537 | 109 | <field name="arch" type="xml"> | ||
2538 | 110 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" expand_button="1" nolink="1"> | ||
2539 | 111 | <field name="code"/> | ||
2540 | 112 | <field name="name"/> | ||
2541 | 113 | <field name="note"/> | ||
2542 | 114 | <field name="type" invisible="1"/> | ||
2543 | 115 | <field name="user_type" invisible="1"/> | ||
2544 | 116 | <field name="activation_date" invisible="1"/> | ||
2545 | 117 | <field name="inactivation_date" invisible="1"/> | ||
2546 | 118 | <field name="parent_id" invisible="1"/> | ||
2547 | 119 | <field name="is_analytic_addicted" invisible="1"/> | ||
2548 | 120 | </tree> | ||
2549 | 121 | </field> | ||
2550 | 122 | </record> | ||
2551 | 123 | |||
2552 | 124 | <!-- Tree view for default tree view of accounts --> | ||
2553 | 125 | <record id="account.view_account_list" model="ir.ui.view"> | ||
2554 | 126 | <field name="name">account.account_activable.list</field> | ||
2555 | 127 | <field name="model">account.account</field> | ||
2556 | 128 | <field name="type">tree</field> | ||
2557 | 129 | <field name="field_parent">child_id</field> | ||
2558 | 130 | <field name="priority" eval="10"/> | ||
2559 | 131 | <field name="arch" type="xml"> | ||
2560 | 132 | <tree colors="blue:type in ('view');black:type in ('other','receivable','payable','consolidation');gray:type in ('closed')" string="Chart of accounts" toolbar="1" nolink="1"> | ||
2561 | 133 | <field name="code"/> | ||
2562 | 134 | <field name="name"/> | ||
2563 | 135 | <field name="type"/> | ||
2564 | 136 | <field name="activation_date"/> | ||
2565 | 137 | <field name="inactivation_date"/> | ||
2566 | 138 | </tree> | ||
2567 | 139 | </field> | ||
2568 | 140 | </record> | ||
2569 | 141 | |||
2570 | 142 | <record id="action_account_activable_form" model="ir.actions.act_window"> | 47 | <record id="action_account_activable_form" model="ir.actions.act_window"> |
2571 | 143 | <field name="name">Accounts</field> | 48 | <field name="name">Accounts</field> |
2572 | 144 | <field name="res_model">account.account</field> | 49 | <field name="res_model">account.account</field> |
2573 | 145 | 50 | ||
2574 | === modified file 'bin/addons/account_override/invoice.py' | |||
2575 | --- bin/addons/account_override/invoice.py 2021-08-11 15:37:51 +0000 | |||
2576 | +++ bin/addons/account_override/invoice.py 2021-11-03 13:33:55 +0000 | |||
2577 | @@ -26,7 +26,6 @@ | |||
2578 | 26 | from osv import fields | 26 | from osv import fields |
2579 | 27 | from time import strftime | 27 | from time import strftime |
2580 | 28 | from tools.translate import _ | 28 | from tools.translate import _ |
2581 | 29 | from lxml import etree | ||
2582 | 30 | from datetime import datetime | 29 | from datetime import datetime |
2583 | 31 | from msf_partner import PARTNER_TYPE | 30 | from msf_partner import PARTNER_TYPE |
2584 | 32 | import re | 31 | import re |
2585 | @@ -51,55 +50,40 @@ | |||
2586 | 51 | inv_name = inv.number or inv.name or 'No_description' | 50 | inv_name = inv.number or inv.name or 'No_description' |
2587 | 52 | prefix = 'STV_' | 51 | prefix = 'STV_' |
2588 | 53 | 52 | ||
2590 | 54 | if inv.type == 'out_refund': # Customer refund | 53 | if inv.doc_type == 'cr': |
2591 | 55 | prefix = 'CR_' | 54 | prefix = 'CR_' |
2593 | 56 | elif inv.type == 'in_refund': # Supplier refund | 55 | elif inv.doc_type == 'sr': |
2594 | 57 | prefix = 'SR_' | 56 | prefix = 'SR_' |
2597 | 58 | elif inv.type == 'out_invoice': | 57 | elif inv.doc_type == 'stv': |
2596 | 59 | # Stock transfer voucher | ||
2598 | 60 | prefix = 'STV_' | 58 | prefix = 'STV_' |
2607 | 61 | # Debit note | 59 | elif inv.doc_type == 'dn': |
2608 | 62 | if inv.is_debit_note and not inv.is_inkind_donation and not inv.is_intermission: | 60 | prefix = 'DN_' |
2609 | 63 | prefix = 'DN_' | 61 | elif inv.doc_type == 'ivo': |
2610 | 64 | # Intermission voucher OUT | 62 | prefix = 'IVO_' |
2611 | 65 | elif not inv.is_debit_note and not inv.is_inkind_donation and inv.is_intermission: | 63 | elif inv.doc_type == 'si': |
2604 | 66 | prefix = 'IVO_' | ||
2605 | 67 | elif inv.type == 'in_invoice': | ||
2606 | 68 | # Supplier invoice | ||
2612 | 69 | prefix = 'SI_' | 64 | prefix = 'SI_' |
2622 | 70 | # Intermission voucher IN | 65 | elif inv.doc_type == 'ivi': |
2623 | 71 | if not inv.is_debit_note and not inv.is_inkind_donation and inv.is_intermission: | 66 | prefix = 'IVI_' |
2624 | 72 | prefix = 'IVI_' | 67 | elif inv.doc_type == 'di': |
2625 | 73 | # Direct invoice | 68 | prefix = 'DI_' |
2626 | 74 | elif inv.is_direct_invoice: | 69 | elif inv.doc_type == 'donation': |
2627 | 75 | prefix = 'DI_' | 70 | prefix = 'DON_' |
2628 | 76 | # In-kind donation | 71 | elif inv.doc_type == 'str': |
2629 | 77 | elif not inv.is_debit_note and inv.is_inkind_donation: | 72 | prefix = 'STR_' |
2630 | 78 | prefix = 'DON_' | 73 | elif inv.doc_type == 'isi': |
2631 | 74 | prefix = 'ISI_' | ||
2632 | 75 | elif inv.doc_type == 'isr': | ||
2633 | 76 | prefix = 'ISR_' | ||
2634 | 79 | return '%s%s' % (prefix, inv_name) | 77 | return '%s%s' % (prefix, inv_name) |
2635 | 80 | 78 | ||
2636 | 81 | def _get_journal(self, cr, uid, context=None): | 79 | def _get_journal(self, cr, uid, context=None): |
2637 | 82 | """ | 80 | """ |
2639 | 83 | WARNING: This method has been taken from account module from OpenERP | 81 | Returns the journal to be used by default, depending on the doc type of the selected invoice |
2640 | 84 | """ | 82 | """ |
2641 | 85 | # @@@override@account.invoice.py | ||
2642 | 86 | if context is None: | 83 | if context is None: |
2643 | 87 | context = {} | 84 | context = {} |
2644 | 88 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) | ||
2645 | 89 | if context.get('is_inkind_donation'): | ||
2646 | 90 | args = [('type', 'in', ['inkind', 'extra'])] | ||
2647 | 91 | else: | ||
2648 | 92 | type_inv = context.get('type', 'out_invoice') | ||
2649 | 93 | company_id = context.get('company_id', user.company_id.id) | ||
2650 | 94 | type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'} | ||
2651 | 95 | refund_journal = {'out_invoice': False, 'in_invoice': False, 'out_refund': True, 'in_refund': True} | ||
2652 | 96 | args = [('type', '=', type2journal.get(type_inv, 'sale')), | ||
2653 | 97 | ('company_id', '=', company_id), | ||
2654 | 98 | ('refund_journal', '=', refund_journal.get(type_inv, False))] | ||
2655 | 99 | if user.company_id.instance_id: | ||
2656 | 100 | args.append(('is_current_instance','=',True)) | ||
2657 | 101 | journal_obj = self.pool.get('account.journal') | 85 | journal_obj = self.pool.get('account.journal') |
2659 | 102 | res = journal_obj.search(cr, uid, args, order='id', limit=1, context=context) | 86 | res = journal_obj.search(cr, uid, [('inv_doc_type', '=', True)], order='id', limit=1, context=context) |
2660 | 103 | return res and res[0] or False | 87 | return res and res[0] or False |
2661 | 104 | 88 | ||
2662 | 105 | def _get_fake(self, cr, uid, ids, field_name=None, arg=None, context=None): | 89 | def _get_fake(self, cr, uid, ids, field_name=None, arg=None, context=None): |
2663 | @@ -209,14 +193,10 @@ | |||
2664 | 209 | ids = [ids] | 193 | ids = [ids] |
2665 | 210 | 194 | ||
2666 | 211 | for inv_br in self.browse(cr, uid, ids, context=context): | 195 | for inv_br in self.browse(cr, uid, ids, context=context): |
2668 | 212 | # US-357: allow merge of line only for draft SI | 196 | # allow to merge lines only for draft SI/ISI |
2669 | 213 | res[inv_br.id] = inv_br.state and inv_br.state == 'draft' \ | 197 | res[inv_br.id] = inv_br.state and inv_br.state == 'draft' \ |
2670 | 214 | and inv_br.invoice_line \ | 198 | and inv_br.invoice_line \ |
2676 | 215 | and inv_br.type == 'in_invoice' \ | 199 | and inv_br.doc_type in ('si', 'isi') \ |
2672 | 216 | and not inv_br.is_direct_invoice \ | ||
2673 | 217 | and not inv_br.is_inkind_donation \ | ||
2674 | 218 | and not inv_br.is_debit_note \ | ||
2675 | 219 | and not inv_br.is_intermission \ | ||
2677 | 220 | or False | 200 | or False |
2678 | 221 | 201 | ||
2679 | 222 | return res | 202 | return res |
2680 | @@ -234,6 +214,158 @@ | |||
2681 | 234 | res[inv.id] = len(inv.invoice_line) | 214 | res[inv.id] = len(inv.invoice_line) |
2682 | 235 | return res | 215 | return res |
2683 | 236 | 216 | ||
2684 | 217 | def _get_invoice_type_list(self, cr, uid, context=None): | ||
2685 | 218 | """ | ||
2686 | 219 | Returns the list of possible types for the account.invoice document. | ||
2687 | 220 | """ | ||
2688 | 221 | return [('dn', _('Debit Note')), | ||
2689 | 222 | ('donation', _('Donation')), | ||
2690 | 223 | ('ivi', _('Intermission Voucher IN')), | ||
2691 | 224 | ('ivo', _('Intermission Voucher OUT')), | ||
2692 | 225 | ('di', _('Direct Invoice')), | ||
2693 | 226 | ('si', _('Supplier Invoice')), | ||
2694 | 227 | ('sr', _('Supplier Refund')), | ||
2695 | 228 | ('stv', _('Stock Transfer Voucher')), | ||
2696 | 229 | ('cr', _('Customer Refund')), | ||
2697 | 230 | ('str', _('Stock Transfer Refund')), | ||
2698 | 231 | ('isi', _('Intersection Supplier Invoice')), | ||
2699 | 232 | ('isr', _('Intersection Supplier Refund')), | ||
2700 | 233 | ('unknown', _('Unknown')), | ||
2701 | 234 | ] | ||
2702 | 235 | |||
2703 | 236 | _invoice_action_act_window = { | ||
2704 | 237 | 'dn': 'account_override.action_debit_note', | ||
2705 | 238 | 'donation': 'account_override.action_inkind_donation', | ||
2706 | 239 | 'ivi': 'account_override.action_intermission_in', | ||
2707 | 240 | 'ivo': 'account_override.action_intermission_out', | ||
2708 | 241 | 'di': 'register_accounting.action_direct_invoice', | ||
2709 | 242 | 'si': 'account.action_invoice_tree2', | ||
2710 | 243 | 'sr': 'account.action_invoice_tree4', | ||
2711 | 244 | 'stv': 'account.action_invoice_tree1', | ||
2712 | 245 | 'cr': 'account.action_invoice_tree3', | ||
2713 | 246 | 'str': 'account.action_str', | ||
2714 | 247 | 'isi': 'account.action_isi', | ||
2715 | 248 | 'isr': 'account.action_isr', | ||
2716 | 249 | } | ||
2717 | 250 | |||
2718 | 251 | def _get_invoice_act_window(self, cr, uid, invoice_id, views_order=None, context=None): | ||
2719 | 252 | inv_doc_type = self.read(cr, uid, invoice_id, ['doc_type'], context=context)['doc_type'] | ||
2720 | 253 | return self.pool.get('ir.actions.act_window').open_view_from_xmlid(cr, uid, self._invoice_action_act_window[inv_doc_type], views_order=views_order, context=context) | ||
2721 | 254 | |||
2722 | 255 | def _get_doc_type(self, cr, uid, ids, field_name=None, arg=None, context=None): | ||
2723 | 256 | """ | ||
2724 | 257 | Returns a dict with key = id of the account.invoice, and value = doc type (see the list of types in _get_invoice_type_list). | ||
2725 | 258 | If a "real_doc_type" exists: it is used. Otherwise: the doc type is deduced from the other fields. | ||
2726 | 259 | """ | ||
2727 | 260 | res = {} | ||
2728 | 261 | fields = ['real_doc_type', 'type', 'is_debit_note', 'is_inkind_donation', 'is_intermission', 'is_direct_invoice'] | ||
2729 | 262 | for inv in self.browse(cr, uid, ids, fields_to_fetch=fields, context=context): | ||
2730 | 263 | inv_type = 'unknown' | ||
2731 | 264 | if inv.real_doc_type: # str, isi, isr... | ||
2732 | 265 | inv_type = inv.real_doc_type | ||
2733 | 266 | elif inv.is_debit_note: | ||
2734 | 267 | if inv.type == 'out_invoice': | ||
2735 | 268 | inv_type = 'dn' # Debit Note | ||
2736 | 269 | elif inv.is_inkind_donation: | ||
2737 | 270 | if inv.type == 'in_invoice': | ||
2738 | 271 | inv_type = 'donation' | ||
2739 | 272 | elif inv.is_intermission: | ||
2740 | 273 | if inv.type == 'in_invoice': | ||
2741 | 274 | inv_type = 'ivi' # Intermission Voucher In | ||
2742 | 275 | elif inv.type == 'out_invoice': | ||
2743 | 276 | inv_type = 'ivo' # Intermission Voucher Out | ||
2744 | 277 | elif inv.type == 'in_invoice': | ||
2745 | 278 | if inv.is_direct_invoice: | ||
2746 | 279 | inv_type = 'di' # Direct Invoice | ||
2747 | 280 | else: | ||
2748 | 281 | inv_type = 'si' # Supplier Invoice | ||
2749 | 282 | elif inv.type == 'in_refund': | ||
2750 | 283 | inv_type = 'sr' # Supplier Refund | ||
2751 | 284 | elif inv.type == 'out_invoice': | ||
2752 | 285 | inv_type = 'stv' # Stock Transfer Voucher | ||
2753 | 286 | elif inv.type == 'out_refund': | ||
2754 | 287 | inv_type = 'cr' # Customer Refund | ||
2755 | 288 | res[inv.id] = inv_type | ||
2756 | 289 | return res | ||
2757 | 290 | |||
2758 | 291 | def _get_dom_by_doc_type(self, doc_type): | ||
2759 | 292 | """ | ||
2760 | 293 | Returns the domain matching with the doc type (see the list of types in _get_invoice_type_list). | ||
2761 | 294 | """ | ||
2762 | 295 | if doc_type in ('str', 'isi', 'isr'): | ||
2763 | 296 | dom = [('real_doc_type', '=', doc_type)] | ||
2764 | 297 | elif doc_type == 'dn': # Debit Note | ||
2765 | 298 | dom = ['|', | ||
2766 | 299 | ('real_doc_type', '=', doc_type), | ||
2767 | 300 | '&', '&', '&', | ||
2768 | 301 | ('real_doc_type', '=', False), ('type', '=', 'out_invoice'), | ||
2769 | 302 | ('is_debit_note', '!=', False), ('is_inkind_donation', '=', False)] | ||
2770 | 303 | elif doc_type == 'donation': | ||
2771 | 304 | dom = ['|', | ||
2772 | 305 | ('real_doc_type', '=', doc_type), | ||
2773 | 306 | '&', '&', '&', | ||
2774 | 307 | ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), | ||
2775 | 308 | ('is_debit_note', '=', False), ('is_inkind_donation', '=', True)] | ||
2776 | 309 | elif doc_type == 'ivi': # Intermission Voucher In | ||
2777 | 310 | dom = ['|', | ||
2778 | 311 | ('real_doc_type', '=', doc_type), | ||
2779 | 312 | '&', '&', '&', '&', | ||
2780 | 313 | ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_debit_note', '=', False), | ||
2781 | 314 | ('is_inkind_donation', '=', False), ('is_intermission', '=', True)] | ||
2782 | 315 | elif doc_type == 'ivo': # Intermission Voucher Out | ||
2783 | 316 | dom = ['|', | ||
2784 | 317 | ('real_doc_type', '=', doc_type), | ||
2785 | 318 | '&', '&', '&', '&', | ||
2786 | 319 | ('real_doc_type', '=', False), ('type', '=', 'out_invoice'), ('is_debit_note', '=', False), | ||
2787 | 320 | ('is_inkind_donation', '=', False), ('is_intermission', '=', True)] | ||
2788 | 321 | elif doc_type == 'di': # Direct Invoice | ||
2789 | 322 | dom = ['|', | ||
2790 | 323 | ('real_doc_type', '=', doc_type), | ||
2791 | 324 | '&', '&', ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_direct_invoice', '!=', False)] | ||
2792 | 325 | elif doc_type == 'si': # Supplier Invoice | ||
2793 | 326 | dom = ['|', | ||
2794 | 327 | ('real_doc_type', '=', doc_type), | ||
2795 | 328 | '&', '&', '&', '&', '&', | ||
2796 | 329 | ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_direct_invoice', '=', False), | ||
2797 | 330 | ('is_inkind_donation', '=', False), ('is_debit_note', '=', False), ('is_intermission', '=', False)] | ||
2798 | 331 | elif doc_type == 'sr': # Supplier Refund | ||
2799 | 332 | dom = ['|', | ||
2800 | 333 | ('real_doc_type', '=', doc_type), | ||
2801 | 334 | '&', ('real_doc_type', '=', False), ('type', '=', 'in_refund')] | ||
2802 | 335 | elif doc_type == 'stv': # Stock Transfer Voucher | ||
2803 | 336 | dom = ['|', | ||
2804 | 337 | ('real_doc_type', '=', doc_type), | ||
2805 | 338 | '&', '&', '&', '&', | ||
2806 | 339 | ('real_doc_type', '=', False), ('type', '=', 'out_invoice'), ('is_debit_note', '=', False), | ||
2807 | 340 | ('is_inkind_donation', '=', False), ('is_intermission', '=', False)] | ||
2808 | 341 | elif doc_type == 'cr': # Customer Refund | ||
2809 | 342 | dom = ['|', | ||
2810 | 343 | ('real_doc_type', '=', doc_type), | ||
2811 | 344 | '&', ('real_doc_type', '=', False), ('type', '=', 'out_refund')] | ||
2812 | 345 | else: # "unknown" or any undefined type | ||
2813 | 346 | dom = [('id', '=', 0)] | ||
2814 | 347 | return dom | ||
2815 | 348 | |||
2816 | 349 | def _search_doc_type(self, cr, uid, obj, name, args, context=None): | ||
2817 | 350 | """ | ||
2818 | 351 | Returns a domain to get all invoices matching the selected doc types (see the list of types in _get_invoice_type_list). | ||
2819 | 352 | """ | ||
2820 | 353 | if not args: | ||
2821 | 354 | return [] | ||
2822 | 355 | dom = [('id', '=', 0)] | ||
2823 | 356 | if not args[0] or len(args[0]) < 3 or args[0][1] not in ('=', 'in'): | ||
2824 | 357 | raise osv.except_osv(_('Error'), _('Filter not implemented yet.')) | ||
2825 | 358 | if args[0][1] == '=' and args[0][2]: | ||
2826 | 359 | doc_type = args[0][2] | ||
2827 | 360 | dom = self._get_dom_by_doc_type(doc_type) | ||
2828 | 361 | if args[0][1] == 'in' and args[0][2] and isinstance(args[0][2], (list, tuple)): | ||
2829 | 362 | dom = [] | ||
2830 | 363 | for i in range(len(args[0][2]) - 1): | ||
2831 | 364 | dom.append('|') | ||
2832 | 365 | for doc_type in args[0][2]: | ||
2833 | 366 | dom.extend(self._get_dom_by_doc_type(doc_type)) | ||
2834 | 367 | return dom | ||
2835 | 368 | |||
2836 | 237 | _columns = { | 369 | _columns = { |
2837 | 238 | 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade', | 370 | 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade', |
2838 | 239 | help="This field contains the information related to the numbering of the lines of this order."), | 371 | help="This field contains the information related to the numbering of the lines of this order."), |
2839 | @@ -271,6 +403,9 @@ | |||
2840 | 271 | 'refunded_invoice_id': fields.many2one('account.invoice', string='Refunded Invoice', readonly=True, | 403 | 'refunded_invoice_id': fields.many2one('account.invoice', string='Refunded Invoice', readonly=True, |
2841 | 272 | help='The refunded invoice which has generated this document'), # 2 inv types for Refund Modify | 404 | help='The refunded invoice which has generated this document'), # 2 inv types for Refund Modify |
2842 | 273 | 'line_count': fields.function(_get_line_count, string='Line count', method=True, type='integer', store=False), | 405 | 'line_count': fields.function(_get_line_count, string='Line count', method=True, type='integer', store=False), |
2843 | 406 | 'real_doc_type': fields.selection(_get_invoice_type_list, 'Real Document Type', readonly=True), | ||
2844 | 407 | 'doc_type': fields.function(_get_doc_type, method=True, type='selection', selection=_get_invoice_type_list, | ||
2845 | 408 | string='Document Type', store=False, fnct_search=_search_doc_type), | ||
2846 | 274 | } | 409 | } |
2847 | 275 | 410 | ||
2848 | 276 | _defaults = { | 411 | _defaults = { |
2849 | @@ -283,6 +418,8 @@ | |||
2850 | 283 | 'vat_ok': lambda obj, cr, uid, context: obj.pool.get('unifield.setup.configuration').get_config(cr, uid).vat_ok, | 418 | 'vat_ok': lambda obj, cr, uid, context: obj.pool.get('unifield.setup.configuration').get_config(cr, uid).vat_ok, |
2851 | 284 | 'can_merge_lines': lambda *a: False, | 419 | 'can_merge_lines': lambda *a: False, |
2852 | 285 | 'is_merged_by_account': lambda *a: False, | 420 | 'is_merged_by_account': lambda *a: False, |
2853 | 421 | # set a default value on doc type so that the restrictions on fields apply even before the form is saved | ||
2854 | 422 | 'doc_type': lambda obj, cr, uid, c: c and c.get('doc_type') or False, | ||
2855 | 286 | } | 423 | } |
2856 | 287 | 424 | ||
2857 | 288 | def import_data_web(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None, | 425 | def import_data_web(self, cr, uid, fields, datas, mode='init', current_module='', noupdate=False, context=None, filename=None, |
2858 | @@ -420,30 +557,6 @@ | |||
2859 | 420 | noupdate=noupdate, context=context, filename=filename, | 557 | noupdate=noupdate, context=context, filename=filename, |
2860 | 421 | display_all_errors=display_all_errors, has_header=has_header) | 558 | display_all_errors=display_all_errors, has_header=has_header) |
2861 | 422 | 559 | ||
2862 | 423 | def onchange_company_id(self, cr, uid, ids, company_id, part_id, ctype, invoice_line, currency_id): | ||
2863 | 424 | """ | ||
2864 | 425 | This is a method to redefine the journal_id domain with the current_instance taken into account | ||
2865 | 426 | """ | ||
2866 | 427 | res = super(account_invoice, self).onchange_company_id(cr, uid, ids, company_id, part_id, ctype, invoice_line, currency_id) | ||
2867 | 428 | if company_id and ctype: | ||
2868 | 429 | res.setdefault('domain', {}) | ||
2869 | 430 | res.setdefault('value', {}) | ||
2870 | 431 | ass = { | ||
2871 | 432 | 'out_invoice': 'sale', | ||
2872 | 433 | 'in_invoice': 'purchase', | ||
2873 | 434 | 'out_refund': 'sale_refund', | ||
2874 | 435 | 'in_refund': 'purchase_refund', | ||
2875 | 436 | } | ||
2876 | 437 | journal_ids = self.pool.get('account.journal').search(cr, uid, [ | ||
2877 | 438 | ('company_id','=',company_id), ('type', '=', ass.get(ctype, 'purchase')), ('is_current_instance', '=', True) | ||
2878 | 439 | ], order='id') | ||
2879 | 440 | if not journal_ids: | ||
2880 | 441 | raise osv.except_osv(_('Configuration Error !'), _('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.') % (ass.get(type, 'purchase'), )) | ||
2881 | 442 | res['value']['journal_id'] = journal_ids[0] | ||
2882 | 443 | # TODO: it's very bad to set a domain by onchange method, no time to rewrite UniField ! | ||
2883 | 444 | res['domain']['journal_id'] = [('id', 'in', journal_ids)] | ||
2884 | 445 | return res | ||
2885 | 446 | |||
2886 | 447 | def onchange_partner_id(self, cr, uid, ids, ctype, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, | 560 | def onchange_partner_id(self, cr, uid, ids, ctype, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, |
2887 | 448 | company_id=False, is_inkind_donation=False, is_intermission=False, is_debit_note=False, is_direct_invoice=False, | 561 | company_id=False, is_inkind_donation=False, is_intermission=False, is_debit_note=False, is_direct_invoice=False, |
2888 | 449 | account_id=False): | 562 | account_id=False): |
2889 | @@ -522,58 +635,27 @@ | |||
2890 | 522 | 635 | ||
2891 | 523 | def check_po_link(self, cr, uid, ids, context=None): | 636 | def check_po_link(self, cr, uid, ids, context=None): |
2892 | 524 | """ | 637 | """ |
2894 | 525 | Check that invoice (only supplier invoices) has no link with a PO. This is because of commitments presence. | 638 | Checks that the invoices aren't linked to any PO (because of the commitments). |
2895 | 526 | """ | 639 | """ |
2896 | 527 | if not context: | 640 | if not context: |
2897 | 528 | context = {} | 641 | context = {} |
2898 | 529 | if isinstance(ids, (int, long)): | 642 | if isinstance(ids, (int, long)): |
2899 | 530 | ids = [ids] | 643 | ids = [ids] |
2902 | 531 | for inv in self.read(cr, uid, ids, ['purchase_ids', 'type', 'is_inkind_donation', 'is_debit_note', 'is_intermission', 'state']): | 644 | for inv in self.read(cr, uid, ids, ['purchase_ids', 'doc_type', 'state']): |
2903 | 532 | if inv.get('type', '') == 'in_invoice' and not inv.get('is_inkind_donation', False) and not inv.get('is_debit_note', False): | 645 | if inv.get('doc_type', '') in ('ivi', 'si', 'isi'): |
2904 | 533 | if inv.get('purchase_ids', False): | 646 | if inv.get('purchase_ids', False): |
2906 | 534 | if inv.get('is_intermission'): | 647 | if inv['doc_type'] == 'ivi': |
2907 | 535 | if inv.get('state', '') != 'draft': # only draft IVIs can be deleted | 648 | if inv.get('state', '') != 'draft': # only draft IVIs can be deleted |
2908 | 536 | raise osv.except_osv(_('Warning'), | 649 | raise osv.except_osv(_('Warning'), |
2909 | 537 | _('Intermission Vouchers linked to a PO can be deleted only in Draft state.')) | 650 | _('Intermission Vouchers linked to a PO can be deleted only in Draft state.')) |
2910 | 651 | elif inv['doc_type'] == 'isi': | ||
2911 | 652 | raise osv.except_osv(_('Warning'), | ||
2912 | 653 | _('You cannot cancel or delete an Intersection Supplier Invoice linked to a PO.')) | ||
2913 | 538 | else: | 654 | else: |
2914 | 539 | # US-1702 Do not allow at all the deletion of SI coming from PO | 655 | # US-1702 Do not allow at all the deletion of SI coming from PO |
2915 | 540 | raise osv.except_osv(_('Warning'), _('You cannot cancel or delete a supplier invoice linked to a PO.')) | 656 | raise osv.except_osv(_('Warning'), _('You cannot cancel or delete a supplier invoice linked to a PO.')) |
2916 | 541 | return True | 657 | return True |
2917 | 542 | 658 | ||
2918 | 543 | |||
2919 | 544 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): | ||
2920 | 545 | """ | ||
2921 | 546 | Rename Supplier/Customer to "Donor" if view_type == tree | ||
2922 | 547 | """ | ||
2923 | 548 | if not context: | ||
2924 | 549 | context = {} | ||
2925 | 550 | res = super(account_invoice, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) | ||
2926 | 551 | if view_type == 'tree' and (context.get('journal_type', False) == 'inkind' or context.get('journal_type', False) == 'intermission'): | ||
2927 | 552 | doc = etree.XML(res['arch']) | ||
2928 | 553 | nodes = doc.xpath("//field[@name='partner_id']") | ||
2929 | 554 | name = _('Donor') | ||
2930 | 555 | if context.get('journal_type') == 'intermission': | ||
2931 | 556 | name = _('Partner') | ||
2932 | 557 | for node in nodes: | ||
2933 | 558 | node.set('string', name) | ||
2934 | 559 | res['arch'] = etree.tostring(doc) | ||
2935 | 560 | elif view_type in ('tree', 'search') and context.get('type') in ['out_invoice', 'out_refund']: | ||
2936 | 561 | doc = etree.XML(res['arch']) | ||
2937 | 562 | nodes = doc.xpath("//field[@name='supplier_reference']") | ||
2938 | 563 | for node in nodes: | ||
2939 | 564 | node.getparent().remove(node) | ||
2940 | 565 | res['arch'] = etree.tostring(doc) | ||
2941 | 566 | elif view_type == 'form' and context.get('type', False) == 'out_invoice' and context.get('journal_type', False) == 'sale' \ | ||
2942 | 567 | and not context.get('is_debit_note', False) and not context.get('is_intermission', False): | ||
2943 | 568 | # Restriction on allowed partners for STV: Inter-section or External type, customers only | ||
2944 | 569 | doc = etree.XML(res['arch']) | ||
2945 | 570 | partner_nodes = doc.xpath("//field[@name='partner_id']") | ||
2946 | 571 | partner_domain_stv = "[('partner_type', 'in', ('section', 'external')), ('customer', '=', True)]" | ||
2947 | 572 | for node in partner_nodes: | ||
2948 | 573 | node.set('domain', partner_domain_stv) | ||
2949 | 574 | res['arch'] = etree.tostring(doc) | ||
2950 | 575 | return res | ||
2951 | 576 | |||
2952 | 577 | def default_get(self, cr, uid, fields, context=None, from_web=False): | 659 | def default_get(self, cr, uid, fields, context=None, from_web=False): |
2953 | 578 | """ | 660 | """ |
2954 | 579 | Fill in account and journal for intermission invoice | 661 | Fill in account and journal for intermission invoice |
2955 | @@ -704,6 +786,9 @@ | |||
2956 | 704 | context=context): | 786 | context=context): |
2957 | 705 | vals['supplier_reference'] = partner['ref'] | 787 | vals['supplier_reference'] = partner['ref'] |
2958 | 706 | 788 | ||
2959 | 789 | if not vals.get('real_doc_type') and context.get('doc_type') and not context.get('from_refund_button'): | ||
2960 | 790 | vals.update({'real_doc_type': context['doc_type']}) | ||
2961 | 791 | |||
2962 | 707 | self.pool.get('data.tools').replace_line_breaks_from_vals(vals, ['name']) | 792 | self.pool.get('data.tools').replace_line_breaks_from_vals(vals, ['name']) |
2963 | 708 | 793 | ||
2964 | 709 | return super(account_invoice, self).create(cr, uid, vals, context) | 794 | return super(account_invoice, self).create(cr, uid, vals, context) |
2965 | @@ -742,7 +827,7 @@ | |||
2966 | 742 | def unlink(self, cr, uid, ids, context=None): | 827 | def unlink(self, cr, uid, ids, context=None): |
2967 | 743 | """ | 828 | """ |
2968 | 744 | Delete register line if this invoice is a Direct Invoice. | 829 | Delete register line if this invoice is a Direct Invoice. |
2970 | 745 | Don't delete an invoice that is linked to a PO. This is only for supplier invoices. | 830 | Don't delete an invoice that is linked to a PO. |
2971 | 746 | """ | 831 | """ |
2972 | 747 | if not context: | 832 | if not context: |
2973 | 748 | context = {} | 833 | context = {} |
2974 | @@ -783,65 +868,20 @@ | |||
2975 | 783 | 868 | ||
2976 | 784 | def log(self, cr, uid, inv_id, message, secondary=False, action_xmlid=False, context=None): | 869 | def log(self, cr, uid, inv_id, message, secondary=False, action_xmlid=False, context=None): |
2977 | 785 | """ | 870 | """ |
2980 | 786 | Change first "Invoice" word from message into "Debit Note" if this invoice is a debit note. | 871 | Updates the log message with the right document name + link it to the right action_act_window |
2979 | 787 | Change it to "In-kind donation" if this invoice is an In-kind donation. | ||
2981 | 788 | """ | 872 | """ |
2983 | 789 | if not context: | 873 | if context is None: |
2984 | 790 | context = {} | 874 | context = {} |
3009 | 791 | local_ctx = context.copy() | 875 | # update the message |
2986 | 792 | # Prepare some values | ||
2987 | 793 | # Search donation view and return it | ||
2988 | 794 | try: | ||
2989 | 795 | # try / except for runbot | ||
2990 | 796 | debit_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_debit_note_form') | ||
2991 | 797 | inkind_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_inkind_donation_form') | ||
2992 | 798 | intermission_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_intermission_form') | ||
2993 | 799 | supplier_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_supplier_form') | ||
2994 | 800 | customer_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form') | ||
2995 | 801 | supplier_direct_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'register_accounting', 'direct_supplier_invoice_form') | ||
2996 | 802 | except ValueError: | ||
2997 | 803 | return super(account_invoice, self).log(cr, uid, inv_id, message, secondary, action_xmlid, context) | ||
2998 | 804 | debit_view_id = debit_res and debit_res[1] or False | ||
2999 | 805 | debit_note_ctx = {'view_id': debit_view_id, 'type':'out_invoice', 'journal_type': 'sale', 'is_debit_note': True} | ||
3000 | 806 | # Search donation view and return it | ||
3001 | 807 | inkind_view_id = inkind_res and inkind_res[1] or False | ||
3002 | 808 | inkind_ctx = {'view_id': inkind_view_id, 'type':'in_invoice', 'journal_type': 'inkind', 'is_inkind_donation': True} | ||
3003 | 809 | # Search intermission view | ||
3004 | 810 | intermission_view_id = intermission_res and intermission_res[1] or False | ||
3005 | 811 | intermission_ctx = {'view_id': intermission_view_id, 'journal_type': 'intermission', 'is_intermission': True} | ||
3006 | 812 | customer_view_id = customer_invoice_res[1] or False | ||
3007 | 813 | customer_ctx = {'view_id': customer_view_id, 'type': 'out_invoice', 'journal_type': 'sale'} | ||
3008 | 814 | message_changed = False | ||
3010 | 815 | pattern = re.compile('^(Invoice)') | 876 | pattern = re.compile('^(Invoice)') |
3040 | 816 | for el in [('is_debit_note', 'Debit Note', debit_note_ctx), ('is_inkind_donation', 'In-kind Donation', inkind_ctx), ('is_intermission', 'Intermission Voucher', intermission_ctx)]: | 877 | doc_type = self.read(cr, uid, inv_id, ['doc_type'], context=context)['doc_type'] or '' |
3041 | 817 | if self.read(cr, uid, inv_id, [el[0]]).get(el[0], False) is True: | 878 | action_xmlid = self._invoice_action_act_window.get(doc_type) or action_xmlid |
3042 | 818 | m = re.match(pattern, message) | 879 | doc_name = dict(self.fields_get(cr, uid, context=context)['doc_type']['selection']).get(doc_type) |
3043 | 819 | if m and m.groups(): | 880 | if doc_name: |
3044 | 820 | message = re.sub(pattern, el[1], message, 1) | 881 | m = re.match(pattern, message) |
3045 | 821 | message_changed = True | 882 | if m and m.groups(): |
3046 | 822 | local_ctx.update(el[2]) | 883 | message = re.sub(pattern, doc_name, message, 1) |
3047 | 823 | # UF-1112: Give all customer invoices a name as "Stock Transfer Voucher". | 884 | return super(account_invoice, self).log(cr, uid, inv_id, message, secondary, action_xmlid=action_xmlid, context=context) |
3019 | 824 | if not message_changed and self.read(cr, uid, inv_id, ['type']).get('type', False) == 'out_invoice': | ||
3020 | 825 | if local_ctx.get('is_intermission', False): | ||
3021 | 826 | message = re.sub(pattern, 'Intermission Voucher', message, 1) | ||
3022 | 827 | local_ctx.update(intermission_ctx) | ||
3023 | 828 | else: | ||
3024 | 829 | message = re.sub(pattern, 'Stock Transfer Voucher', message, 1) | ||
3025 | 830 | local_ctx.update(customer_ctx) | ||
3026 | 831 | |||
3027 | 832 | # UF-1307: for supplier invoice log (from the incoming shipment), the context was not | ||
3028 | 833 | # filled with all the information; this leaded to having a "Sale" journal in the supplier | ||
3029 | 834 | # invoice if it was saved after coming from this link. Here's the fix. | ||
3030 | 835 | if local_ctx.get('type', False) == 'in_invoice': | ||
3031 | 836 | if not local_ctx.get('journal_type', False): | ||
3032 | 837 | supplier_view_id = supplier_invoice_res and supplier_invoice_res[1] or False | ||
3033 | 838 | local_ctx.update({'journal_type': 'purchase', | ||
3034 | 839 | 'view_id': supplier_view_id}) | ||
3035 | 840 | elif local_ctx.get('direct_invoice_view', False): # UFTP-166: The wrong context saved in log | ||
3036 | 841 | supplier_view_id = supplier_direct_invoice_res and supplier_direct_invoice_res[1] or False | ||
3037 | 842 | local_ctx = {'journal_type': 'purchase', | ||
3038 | 843 | 'view_id': supplier_view_id} | ||
3039 | 844 | return super(account_invoice, self).log(cr, uid, inv_id, message, secondary, action_xmlid, local_ctx) | ||
3048 | 845 | 885 | ||
3049 | 846 | def _check_tax_allowed(self, cr, uid, ids, context=None): | 886 | def _check_tax_allowed(self, cr, uid, ids, context=None): |
3050 | 847 | """ | 887 | """ |
3051 | @@ -931,6 +971,12 @@ | |||
3052 | 931 | 971 | ||
3053 | 932 | return True | 972 | return True |
3054 | 933 | 973 | ||
3055 | 974 | def invoice_open2(self, cr, uid, ids, context=None): | ||
3056 | 975 | """ | ||
3057 | 976 | Alias for invoice_open (used to handle different characteristics on both buttons) | ||
3058 | 977 | """ | ||
3059 | 978 | return self.invoice_open(cr, uid, ids, context=context) | ||
3060 | 979 | |||
3061 | 934 | def invoice_open_with_confirmation(self, cr, uid, ids, context=None): | 980 | def invoice_open_with_confirmation(self, cr, uid, ids, context=None): |
3062 | 935 | """ | 981 | """ |
3063 | 936 | Simply calls "invoice_open" (asking for confirmation is done at form level) | 982 | Simply calls "invoice_open" (asking for confirmation is done at form level) |
3064 | @@ -996,7 +1042,7 @@ | |||
3065 | 996 | def action_cancel(self, cr, uid, ids, *args): | 1042 | def action_cancel(self, cr, uid, ids, *args): |
3066 | 997 | """ | 1043 | """ |
3067 | 998 | Reverse move if this object is a In-kind Donation. Otherwise do normal job: cancellation. | 1044 | Reverse move if this object is a In-kind Donation. Otherwise do normal job: cancellation. |
3069 | 999 | Don't delete an invoice that is linked to a PO. This is only for supplier invoices. | 1045 | Don't cancel an invoice that is linked to a PO. |
3070 | 1000 | """ | 1046 | """ |
3071 | 1001 | # Oct. 2019: log if this method is used at least once (cf it may be dead code?) | 1047 | # Oct. 2019: log if this method is used at least once (cf it may be dead code?) |
3072 | 1002 | self.pool.get('ir.config_parameter').set_param(cr, 1, 'action_cancel.in_use', True) | 1048 | self.pool.get('ir.config_parameter').set_param(cr, 1, 'action_cancel.in_use', True) |
3073 | @@ -1041,43 +1087,6 @@ | |||
3074 | 1041 | self._check_document_date(cr, uid, ids) | 1087 | self._check_document_date(cr, uid, ids) |
3075 | 1042 | return res | 1088 | return res |
3076 | 1043 | 1089 | ||
3077 | 1044 | def get_account_invoice_type(self, cr, uid, inv_id, context=None): | ||
3078 | 1045 | """ | ||
3079 | 1046 | Returns the type of the account.invoice document as a string | ||
3080 | 1047 | It can be: 'si', 'sr', 'di', 'ivi', 'ivo', 'stv', 'dn', 'cr', 'donation' | ||
3081 | 1048 | Raises an error if the type is not recognized. | ||
3082 | 1049 | """ | ||
3083 | 1050 | if context is None: | ||
3084 | 1051 | context = {} | ||
3085 | 1052 | inv_type = False | ||
3086 | 1053 | fields = ['type', 'is_debit_note', 'is_inkind_donation', 'is_intermission', 'is_direct_invoice', 'internal_number'] | ||
3087 | 1054 | inv = self.browse(cr, uid, inv_id, fields_to_fetch=fields, context=context) | ||
3088 | 1055 | if inv.is_debit_note: | ||
3089 | 1056 | if inv.type == 'out_invoice': | ||
3090 | 1057 | inv_type = 'dn' # Debit Note | ||
3091 | 1058 | elif inv.is_inkind_donation: | ||
3092 | 1059 | if inv.type == 'in_invoice': | ||
3093 | 1060 | inv_type = 'donation' | ||
3094 | 1061 | elif inv.is_intermission: | ||
3095 | 1062 | if inv.type == 'in_invoice': | ||
3096 | 1063 | inv_type = 'ivi' # Intermission Voucher In | ||
3097 | 1064 | elif inv.type == 'out_invoice': | ||
3098 | 1065 | inv_type = 'ivo' # Intermission Voucher Out | ||
3099 | 1066 | elif inv.type == 'in_invoice': | ||
3100 | 1067 | if inv.is_direct_invoice: | ||
3101 | 1068 | inv_type = 'di' # Direct Invoice | ||
3102 | 1069 | else: | ||
3103 | 1070 | inv_type = 'si' # Supplier Invoice | ||
3104 | 1071 | elif inv.type == 'in_refund': | ||
3105 | 1072 | inv_type = 'sr' # Supplier Refund | ||
3106 | 1073 | elif inv.type == 'out_invoice': | ||
3107 | 1074 | inv_type = 'stv' # Stock Transfer Voucher' | ||
3108 | 1075 | elif inv.type == 'out_refund': | ||
3109 | 1076 | inv_type = 'cr' # Customer Refund' | ||
3110 | 1077 | if not inv_type: | ||
3111 | 1078 | raise osv.except_osv(_('Error'), _('The type of the document %s is unknown.') % inv.internal_number or '') | ||
3112 | 1079 | return inv_type | ||
3113 | 1080 | |||
3114 | 1081 | def _check_journal(self, cr, uid, inv_id, inv_type=None, context=None): | 1090 | def _check_journal(self, cr, uid, inv_id, inv_type=None, context=None): |
3115 | 1082 | """ | 1091 | """ |
3116 | 1083 | Raises an error if the type of the account.invoice and the journal used are not compatible | 1092 | Raises an error if the type of the account.invoice and the journal used are not compatible |
3117 | @@ -1087,10 +1096,11 @@ | |||
3118 | 1087 | journal = self.browse(cr, uid, inv_id, fields_to_fetch=['journal_id'], context=context).journal_id | 1096 | journal = self.browse(cr, uid, inv_id, fields_to_fetch=['journal_id'], context=context).journal_id |
3119 | 1088 | j_type = journal.type | 1097 | j_type = journal.type |
3120 | 1089 | if inv_type is None: | 1098 | if inv_type is None: |
3125 | 1090 | inv_type = self.get_account_invoice_type(cr, uid, inv_id, context=context) | 1099 | inv_type = self.read(cr, uid, inv_id, ['doc_type'])['doc_type'] |
3126 | 1091 | if inv_type in ('si', 'di') and j_type != 'purchase' or inv_type == 'sr' and j_type != 'purchase_refund' or \ | 1100 | if inv_type in ('si', 'di', 'isi', 'isr') and j_type != 'purchase' or inv_type == 'sr' and j_type != 'purchase_refund' or \ |
3127 | 1092 | inv_type in ('ivi', 'ivo') and j_type != 'intermission' or inv_type in ('stv', 'dn') and j_type != 'sale' or \ | 1101 | inv_type in ('ivi', 'ivo') and j_type != 'intermission' or inv_type in ('stv', 'str', 'dn') and j_type != 'sale' or \ |
3128 | 1093 | inv_type == 'cr' and j_type != 'sale_refund' or inv_type == 'donation' and j_type not in ('inkind', 'extra'): | 1102 | inv_type == 'cr' and j_type != 'sale_refund' or inv_type == 'donation' and j_type not in ('inkind', 'extra') or \ |
3129 | 1103 | inv_type in ('isi', 'isr') and journal.code != 'ISI' or inv_type not in ('isi', 'isr') and journal.code == 'ISI': | ||
3130 | 1094 | raise osv.except_osv(_('Error'), _("The journal %s is not allowed for this document.") % journal.name) | 1104 | raise osv.except_osv(_('Error'), _("The journal %s is not allowed for this document.") % journal.name) |
3131 | 1095 | 1105 | ||
3132 | 1096 | def _check_partner(self, cr, uid, inv_id, inv_type=None, context=None): | 1106 | def _check_partner(self, cr, uid, inv_id, inv_type=None, context=None): |
3133 | @@ -1102,13 +1112,15 @@ | |||
3134 | 1102 | partner = self.browse(cr, uid, inv_id, fields_to_fetch=['partner_id'], context=context).partner_id | 1112 | partner = self.browse(cr, uid, inv_id, fields_to_fetch=['partner_id'], context=context).partner_id |
3135 | 1103 | p_type = partner.partner_type | 1113 | p_type = partner.partner_type |
3136 | 1104 | if inv_type is None: | 1114 | if inv_type is None: |
3138 | 1105 | inv_type = self.get_account_invoice_type(cr, uid, inv_id, context=context) | 1115 | inv_type = self.read(cr, uid, inv_id, ['doc_type'])['doc_type'] |
3139 | 1106 | # if a supplier/customer is expected for the doc: check that the partner used has the right flag | 1116 | # if a supplier/customer is expected for the doc: check that the partner used has the right flag |
3142 | 1107 | supplier_ko = inv_type in ('si', 'di', 'sr', 'ivi', 'donation') and not partner.supplier | 1117 | # note: SI/SR on Intersection partners are blocked only at form level (the validation of old docs should still be possible) |
3143 | 1108 | customer_ko = inv_type in ('ivo', 'stv', 'dn', 'cr') and not partner.customer | 1118 | supplier_ko = inv_type in ('si', 'di', 'sr', 'ivi', 'donation', 'isi', 'isr') and not partner.supplier |
3144 | 1119 | customer_ko = inv_type in ('ivo', 'stv', 'dn', 'cr', 'str') and not partner.customer | ||
3145 | 1109 | if supplier_ko or customer_ko or inv_type in ('ivi', 'ivo') and p_type != 'intermission' or \ | 1120 | if supplier_ko or customer_ko or inv_type in ('ivi', 'ivo') and p_type != 'intermission' or \ |
3148 | 1110 | inv_type == 'stv' and p_type not in ('section', 'external') or \ | 1121 | inv_type in ('stv', 'str') and p_type not in ('section', 'external') or \ |
3149 | 1111 | inv_type == 'donation' and p_type not in ('esc', 'external', 'section'): | 1122 | inv_type == 'donation' and p_type not in ('esc', 'external', 'section') or \ |
3150 | 1123 | inv_type in ('isi', 'isr') and p_type != 'section': | ||
3151 | 1112 | raise osv.except_osv(_('Error'), _("The partner %s is not allowed for this document.") % partner.name) | 1124 | raise osv.except_osv(_('Error'), _("The partner %s is not allowed for this document.") % partner.name) |
3152 | 1113 | 1125 | ||
3153 | 1114 | def _check_header_account(self, cr, uid, inv_id, inv_type=None, context=None): | 1126 | def _check_header_account(self, cr, uid, inv_id, inv_type=None, context=None): |
3154 | @@ -1120,11 +1132,11 @@ | |||
3155 | 1120 | account_obj = self.pool.get('account.account') | 1132 | account_obj = self.pool.get('account.account') |
3156 | 1121 | account = self.browse(cr, uid, inv_id, fields_to_fetch=['account_id'], context=context).account_id | 1133 | account = self.browse(cr, uid, inv_id, fields_to_fetch=['account_id'], context=context).account_id |
3157 | 1122 | if inv_type is None: | 1134 | if inv_type is None: |
3159 | 1123 | inv_type = self.get_account_invoice_type(cr, uid, inv_id, context=context) | 1135 | inv_type = self.read(cr, uid, inv_id, ['doc_type'])['doc_type'] |
3160 | 1124 | account_domain = [] | 1136 | account_domain = [] |
3162 | 1125 | if inv_type in ('si', 'di', 'sr'): | 1137 | if inv_type in ('si', 'di', 'sr', 'isi', 'isr'): |
3163 | 1126 | account_domain.append(('restricted_area', '=', 'in_invoice')) | 1138 | account_domain.append(('restricted_area', '=', 'in_invoice')) |
3165 | 1127 | elif inv_type in ('stv', 'cr'): | 1139 | elif inv_type in ('stv', 'cr', 'str'): |
3166 | 1128 | account_domain.append(('restricted_area', '=', 'out_invoice')) | 1140 | account_domain.append(('restricted_area', '=', 'out_invoice')) |
3167 | 1129 | elif inv_type == 'dn': | 1141 | elif inv_type == 'dn': |
3168 | 1130 | account_domain.append(('restricted_area', '=', 'out_invoice')) | 1142 | account_domain.append(('restricted_area', '=', 'out_invoice')) |
3169 | @@ -1152,9 +1164,9 @@ | |||
3170 | 1152 | inv_line_obj = self.pool.get('account.invoice.line') | 1164 | inv_line_obj = self.pool.get('account.invoice.line') |
3171 | 1153 | lines = inv_line_obj.search(cr, uid, [('invoice_id', '=', inv_id)], context=context, order='NO_ORDER') | 1165 | lines = inv_line_obj.search(cr, uid, [('invoice_id', '=', inv_id)], context=context, order='NO_ORDER') |
3172 | 1154 | if inv_type is None: | 1166 | if inv_type is None: |
3174 | 1155 | inv_type = self.get_account_invoice_type(cr, uid, inv_id, context=context) | 1167 | inv_type = self.read(cr, uid, inv_id, ['doc_type'])['doc_type'] |
3175 | 1156 | account_domain = [] | 1168 | account_domain = [] |
3177 | 1157 | if inv_type in ('si', 'di', 'sr', 'cr'): | 1169 | if inv_type in ('si', 'di', 'sr', 'cr', 'isi', 'isr', 'str'): |
3178 | 1158 | account_domain.append(('restricted_area', '=', 'invoice_lines')) | 1170 | account_domain.append(('restricted_area', '=', 'invoice_lines')) |
3179 | 1159 | elif inv_type == 'stv': | 1171 | elif inv_type == 'stv': |
3180 | 1160 | context.update(({'check_line_stv': True, })) | 1172 | context.update(({'check_line_stv': True, })) |
3181 | @@ -1175,7 +1187,7 @@ | |||
3182 | 1175 | if context is None: | 1187 | if context is None: |
3183 | 1176 | context = {} | 1188 | context = {} |
3184 | 1177 | for inv_id in ids: | 1189 | for inv_id in ids: |
3186 | 1178 | inv_type = self.get_account_invoice_type(cr, uid, inv_id, context=context) | 1190 | inv_type = self.read(cr, uid, inv_id, ['doc_type'])['doc_type'] |
3187 | 1179 | self._check_journal(cr, uid, inv_id, inv_type=inv_type, context=context) | 1191 | self._check_journal(cr, uid, inv_id, inv_type=inv_type, context=context) |
3188 | 1180 | self._check_partner(cr, uid, inv_id, inv_type=inv_type, context=context) | 1192 | self._check_partner(cr, uid, inv_id, inv_type=inv_type, context=context) |
3189 | 1181 | self._check_header_account(cr, uid, inv_id, inv_type=inv_type, context=context) | 1193 | self._check_header_account(cr, uid, inv_id, inv_type=inv_type, context=context) |
3190 | @@ -1298,6 +1310,12 @@ | |||
3191 | 1298 | } | 1310 | } |
3192 | 1299 | return False | 1311 | return False |
3193 | 1300 | 1312 | ||
3194 | 1313 | def button_split_invoice2(self, cr, uid, ids, context=None): | ||
3195 | 1314 | """ | ||
3196 | 1315 | Alias for button_split_invoice (used to handle different characteristics on both buttons) | ||
3197 | 1316 | """ | ||
3198 | 1317 | return self.button_split_invoice(cr, uid, ids, context=context) | ||
3199 | 1318 | |||
3200 | 1301 | def button_donation_certificate(self, cr, uid, ids, context=None): | 1319 | def button_donation_certificate(self, cr, uid, ids, context=None): |
3201 | 1302 | """ | 1320 | """ |
3202 | 1303 | Open a view containing a list of all donation certificates linked to the given invoice. | 1321 | Open a view containing a list of all donation certificates linked to the given invoice. |
3203 | @@ -1578,6 +1596,12 @@ | |||
3204 | 1578 | 1596 | ||
3205 | 1579 | return res | 1597 | return res |
3206 | 1580 | 1598 | ||
3207 | 1599 | def button_merge_lines2(self, cr, uid, ids, context=None): | ||
3208 | 1600 | """ | ||
3209 | 1601 | Alias for button_merge_lines (used to handle different characteristics on both buttons) | ||
3210 | 1602 | """ | ||
3211 | 1603 | return self.button_merge_lines(cr, uid, ids, context=context) | ||
3212 | 1604 | |||
3213 | 1581 | def check_accounts_for_partner(self, cr, uid, ids, context=None, | 1605 | def check_accounts_for_partner(self, cr, uid, ids, context=None, |
3214 | 1582 | header_obj=False, lines_field='invoice_line', | 1606 | header_obj=False, lines_field='invoice_line', |
3215 | 1583 | line_level_partner_type=False): | 1607 | line_level_partner_type=False): |
3216 | @@ -1766,6 +1790,12 @@ | |||
3217 | 1766 | res[i] = False | 1790 | res[i] = False |
3218 | 1767 | return res | 1791 | return res |
3219 | 1768 | 1792 | ||
3220 | 1793 | def _get_line_doc_type(self, cr, uid, context=None): | ||
3221 | 1794 | """ | ||
3222 | 1795 | Gets the list of possible invoice types | ||
3223 | 1796 | """ | ||
3224 | 1797 | return self.pool.get('account.invoice')._get_invoice_type_list(cr, uid, context=context) | ||
3225 | 1798 | |||
3226 | 1769 | _columns = { | 1799 | _columns = { |
3227 | 1770 | 'line_number': fields.integer(string='Line Number'), | 1800 | 'line_number': fields.integer(string='Line Number'), |
3228 | 1771 | 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Account Computation')), | 1801 | 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Account Computation')), |
3229 | @@ -1798,6 +1828,8 @@ | |||
3230 | 1798 | # (avoids having 2 fields with the same name within the same view) | 1828 | # (avoids having 2 fields with the same name within the same view) |
3231 | 1799 | 'line_synced': fields.related('invoice_id', 'synced', type='boolean', string='Synchronized', readonly=True, store=False, | 1829 | 'line_synced': fields.related('invoice_id', 'synced', type='boolean', string='Synchronized', readonly=True, store=False, |
3232 | 1800 | help='Technical field, similar to "synced"'), | 1830 | help='Technical field, similar to "synced"'), |
3233 | 1831 | 'line_doc_type': fields.related('invoice_id', 'doc_type', type='selection', selection=_get_line_doc_type, | ||
3234 | 1832 | string='Document Type', store=False), | ||
3235 | 1801 | 'invoice_type': fields.related('invoice_id', 'type', string='Invoice Type', type='selection', readonly=True, store=False, | 1833 | 'invoice_type': fields.related('invoice_id', 'type', string='Invoice Type', type='selection', readonly=True, store=False, |
3236 | 1802 | selection=[('out_invoice', 'Customer Invoice'), | 1834 | selection=[('out_invoice', 'Customer Invoice'), |
3237 | 1803 | ('in_invoice', 'Supplier Invoice'), | 1835 | ('in_invoice', 'Supplier Invoice'), |
3238 | @@ -1856,14 +1888,14 @@ | |||
3239 | 1856 | inv_fields = ['from_supply', 'synced', 'type', 'is_inkind_donation', 'partner_type'] | 1888 | inv_fields = ['from_supply', 'synced', 'type', 'is_inkind_donation', 'partner_type'] |
3240 | 1857 | inv = inv_obj.browse(cr, uid, invoice_id, fields_to_fetch=inv_fields, context=context) | 1889 | inv = inv_obj.browse(cr, uid, invoice_id, fields_to_fetch=inv_fields, context=context) |
3241 | 1858 | if not inv.is_inkind_donation: # never block manual line creation in Donations whatever the workflow and partner type | 1890 | if not inv.is_inkind_donation: # never block manual line creation in Donations whatever the workflow and partner type |
3243 | 1859 | ivi_or_si_synced = inv.type == 'in_invoice' and inv.synced | 1891 | ivi_or_isi_synced = inv.type == 'in_invoice' and inv.synced |
3244 | 1860 | intermission_or_section_from_supply = inv.partner_type in ('intermission', 'section') and inv.from_supply | 1892 | intermission_or_section_from_supply = inv.partner_type in ('intermission', 'section') and inv.from_supply |
3245 | 1861 | from_split = context.get('from_split') | 1893 | from_split = context.get('from_split') |
3246 | 1862 | if context.get('from_inv_form'): | 1894 | if context.get('from_inv_form'): |
3248 | 1863 | if from_split and ivi_or_si_synced: | 1895 | if from_split and ivi_or_isi_synced: |
3249 | 1864 | raise osv.except_osv(_('Error'), _('This document has been generated via synchronization. ' | 1896 | raise osv.except_osv(_('Error'), _('This document has been generated via synchronization. ' |
3250 | 1865 | 'You can\'t split its lines.')) | 1897 | 'You can\'t split its lines.')) |
3252 | 1866 | elif not from_split and (ivi_or_si_synced or intermission_or_section_from_supply): | 1898 | elif not from_split and (ivi_or_isi_synced or intermission_or_section_from_supply): |
3253 | 1867 | raise osv.except_osv(_('Error'), _('This document has been generated via a Supply workflow or via synchronization. ' | 1899 | raise osv.except_osv(_('Error'), _('This document has been generated via a Supply workflow or via synchronization. ' |
3254 | 1868 | 'You can\'t add lines manually.')) | 1900 | 'You can\'t add lines manually.')) |
3255 | 1869 | 1901 | ||
3256 | 1870 | 1902 | ||
3257 | === modified file 'bin/addons/account_override/report/account_print_invoice.rml' | |||
3258 | --- bin/addons/account_override/report/account_print_invoice.rml 2021-04-26 10:34:04 +0000 | |||
3259 | +++ bin/addons/account_override/report/account_print_invoice.rml 2021-11-03 13:33:55 +0000 | |||
3260 | @@ -227,9 +227,10 @@ | |||
3261 | 227 | [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para> | 227 | [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para> |
3262 | 228 | <para style="terp_header">[[ o.is_debit_note and translate('Cancelled Debit Note') or o.is_intermission and translate('Cancelled Intermission Voucher OUT') or o.is_inkind_donation and translate('Cancelled In-kind Donation') or translate('Cancelled Invoice') ]] [[ o.number or '' ]] | 228 | <para style="terp_header">[[ o.is_debit_note and translate('Cancelled Debit Note') or o.is_intermission and translate('Cancelled Intermission Voucher OUT') or o.is_inkind_donation and translate('Cancelled In-kind Donation') or translate('Cancelled Invoice') ]] [[ o.number or '' ]] |
3263 | 229 | [[ (((o.type == 'out_invoice' or o.is_inkind_donation) and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para> | 229 | [[ (((o.type == 'out_invoice' or o.is_inkind_donation) and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para> |
3267 | 230 | <para style="terp_header">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> | 230 | <para style="terp_header">Refund [[ (o.doc_type in ('cr', 'str') or removeParentNode('para')) and '' ]] [[ o.number ]]</para> |
3268 | 231 | <para style="terp_header">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> | 231 | <para style="terp_header">Supplier Refund [[ (o.doc_type == 'sr' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> |
3269 | 232 | <para style="terp_header">[[ o.is_inkind_donation == True and translate('In-kind Donation') or o.is_intermission and translate('Intermission Voucher IN') or ( o.type == 'in_invoice' and not o.register_line_ids ) and translate('Supplier Invoice') or translate('Supplier Direct Invoice') ]] [[ o.number ]] | 232 | <para style="terp_header">Intersection Supplier Refund [[ (o.doc_type == 'isr' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> |
3270 | 233 | <para style="terp_header">[[ o.doc_type == 'donation' and translate('In-kind Donation') or o.doc_type == 'ivi' and translate('Intermission Voucher IN') or o.doc_type == 'si' and translate('Supplier Invoice') or o.doc_type == 'isi' and translate('Intersection Supplier Invoice') or translate('Supplier Direct Invoice') ]] [[ o.number ]] | ||
3271 | 233 | [[ (o.type == 'in_invoice' and (not o.is_inkind_donation or o.state != 'cancel') or removeParentNode('para')) and '' ]]</para> | 234 | [[ (o.type == 'in_invoice' and (not o.is_inkind_donation or o.state != 'cancel') or removeParentNode('para')) and '' ]]</para> |
3272 | 234 | <para style="terp_default_8"> | 235 | <para style="terp_default_8"> |
3273 | 235 | <font color="white"> </font> | 236 | <font color="white"> </font> |
3274 | 236 | 237 | ||
3275 | === modified file 'bin/addons/account_override/report/open_invoices_xls.mako' | |||
3276 | --- bin/addons/account_override/report/open_invoices_xls.mako 2017-08-04 15:15:29 +0000 | |||
3277 | +++ bin/addons/account_override/report/open_invoices_xls.mako 2021-11-03 13:33:55 +0000 | |||
3278 | @@ -302,10 +302,12 @@ | |||
3279 | 302 | <Row><Cell><Data ss:Type="String"></Data></Cell></Row> | 302 | <Row><Cell><Data ss:Type="String"></Data></Cell></Row> |
3280 | 303 | 303 | ||
3281 | 304 | <% inv = invoices(data) %> | 304 | <% inv = invoices(data) %> |
3284 | 305 | <% doc_type_list = [('si_di', _('Supplier Invoices')), ('sr', _('Supplier Refunds')), ('donation', _('Donations')), | 305 | <% doc_type_list = [('si_di', _('Supplier Invoices')), ('sr', _('Supplier Refunds')), |
3285 | 306 | ('ivi', _('Intermission Vouchers IN')), ('stv', _('Stock Transfer Vouchers')), ('cr', _('Customer Refunds')), | 306 | ('isi', _('Intersection Supplier Invoices')), ('isr', _('Intersection Supplier Refunds')), |
3286 | 307 | ('donation', _('Donations')), ('ivi', _('Intermission Vouchers IN')), | ||
3287 | 308 | ('stv', _('Stock Transfer Vouchers')), ('str', _('Stock Transfer Refunds')), ('cr', _('Customer Refunds')), | ||
3288 | 307 | ('dn', _('Debit Notes')), ('ivo', _('Intermission Vouchers OUT'))] %> | 309 | ('dn', _('Debit Notes')), ('ivo', _('Intermission Vouchers OUT'))] %> |
3290 | 308 | % for (type, title) in doc_type_list: | 310 | % for (doc_type, title) in doc_type_list: |
3291 | 309 | <Row > | 311 | <Row > |
3292 | 310 | <Cell ss:StyleID="s23"><Data ss:Type="String">${title}</Data></Cell> | 312 | <Cell ss:StyleID="s23"><Data ss:Type="String">${title}</Data></Cell> |
3293 | 311 | <Cell ss:StyleID="s24"/> | 313 | <Cell ss:StyleID="s24"/> |
3294 | @@ -329,9 +331,9 @@ | |||
3295 | 329 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Number')}</Data></Cell> | 331 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Number')}</Data></Cell> |
3296 | 330 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Document Date')}</Data></Cell> | 332 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Document Date')}</Data></Cell> |
3297 | 331 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Posting Date')}</Data></Cell> | 333 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Posting Date')}</Data></Cell> |
3299 | 332 | % if type in ['stv', 'ivo', 'dn', 'cr']: | 334 | % if doc_type in ['stv', 'ivo', 'dn', 'cr', 'str']: |
3300 | 333 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Customer')}</Data></Cell> | 335 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Customer')}</Data></Cell> |
3302 | 334 | % elif type in ['si_di', 'ivi', 'donation', 'sr']: | 336 | % elif doc_type in ['si_di', 'ivi', 'donation', 'sr', 'isi', 'isr']: |
3303 | 335 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Supplier')}</Data></Cell> | 337 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Supplier')}</Data></Cell> |
3304 | 336 | % else: | 338 | % else: |
3305 | 337 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Partner')}</Data></Cell> | 339 | <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Partner')}</Data></Cell> |
3306 | @@ -357,8 +359,8 @@ | |||
3307 | 357 | 359 | ||
3308 | 358 | <% nb_line = 0 %> | 360 | <% nb_line = 0 %> |
3309 | 359 | 361 | ||
3312 | 360 | % if type in inv: | 362 | % if doc_type in inv: |
3313 | 361 | % for o in inv[type]: | 363 | % for o in inv[doc_type]: |
3314 | 362 | <Row> | 364 | <Row> |
3315 | 363 | <% nb_line += 1 %> | 365 | <% nb_line += 1 %> |
3316 | 364 | <% update_percent(nb_line, context) %> | 366 | <% update_percent(nb_line, context) %> |
3317 | 365 | 367 | ||
3318 | === modified file 'bin/addons/account_override/report/report_open_invoices.py' | |||
3319 | --- bin/addons/account_override/report/report_open_invoices.py 2019-07-25 14:01:42 +0000 | |||
3320 | +++ bin/addons/account_override/report/report_open_invoices.py 2021-11-03 13:33:55 +0000 | |||
3321 | @@ -72,48 +72,20 @@ | |||
3322 | 72 | self.percent = 0.05 # 5% of the process | 72 | self.percent = 0.05 # 5% of the process |
3323 | 73 | bg_obj.update_percent(self.cr, self.uid, [bg_id], self.percent) | 73 | bg_obj.update_percent(self.cr, self.uid, [bg_id], self.percent) |
3324 | 74 | states = context.get('paid_invoice') and ['paid', 'inv_close'] or ['open'] | 74 | states = context.get('paid_invoice') and ['paid', 'inv_close'] or ['open'] |
3326 | 75 | for type in ['si_di', 'sr', 'donation', 'ivi', 'stv', 'cr', 'dn', 'ivo']: | 75 | for doc_type in ['si_di', 'sr', 'isi', 'isr', 'donation', 'ivi', 'stv', 'str', 'cr', 'dn', 'ivo']: |
3327 | 76 | # determine the domain to use according to the report type and the doc type | 76 | # determine the domain to use according to the report type and the doc type |
3328 | 77 | domain = [('state', 'in', states)] | 77 | domain = [('state', 'in', states)] |
3329 | 78 | if context.get('paid_invoice') and beginning_date and ending_date: | 78 | if context.get('paid_invoice') and beginning_date and ending_date: |
3330 | 79 | domain += [('date_invoice', '>=', beginning_date), ('date_invoice', '<=', ending_date)] | 79 | domain += [('date_invoice', '>=', beginning_date), ('date_invoice', '<=', ending_date)] |
3363 | 80 | if type == 'si_di': | 80 | if doc_type == 'si_di': |
3364 | 81 | domain += [('type', '=', 'in_invoice'), | 81 | domain += [('doc_type', 'in', ['si', 'di'])] |
3365 | 82 | ('is_inkind_donation', '=', False), | 82 | elif doc_type in ('sr', 'isi', 'isr', 'donation', 'ivi', 'stv', 'str', 'cr', 'dn', 'ivo'): |
3366 | 83 | ('is_debit_note', '=', False), | 83 | domain += [('doc_type', '=', doc_type)] |
3335 | 84 | ('is_intermission', '=', False)] | ||
3336 | 85 | elif type == 'sr': | ||
3337 | 86 | domain += [('type', '=', 'in_refund')] | ||
3338 | 87 | elif type == 'donation': | ||
3339 | 88 | domain += [('type', '=', 'in_invoice'), | ||
3340 | 89 | ('is_debit_note', '=', False), | ||
3341 | 90 | ('is_inkind_donation', '=', True)] | ||
3342 | 91 | elif type == 'ivi': | ||
3343 | 92 | domain += [('type', '=', 'in_invoice'), | ||
3344 | 93 | ('is_debit_note', '=', False), | ||
3345 | 94 | ('is_inkind_donation', '=', False), | ||
3346 | 95 | ('is_intermission', '=', True)] | ||
3347 | 96 | elif type == 'stv': | ||
3348 | 97 | domain += [('type', '=', 'out_invoice'), | ||
3349 | 98 | ('is_debit_note', '=', False), | ||
3350 | 99 | ('is_inkind_donation', '=', False), | ||
3351 | 100 | ('is_intermission', '=', False)] | ||
3352 | 101 | elif type == 'cr': | ||
3353 | 102 | domain += [('type', '=', 'out_refund')] | ||
3354 | 103 | elif type == 'dn': | ||
3355 | 104 | domain += [('type', '=', 'out_invoice'), | ||
3356 | 105 | ('is_debit_note', '!=', False), | ||
3357 | 106 | ('is_inkind_donation', '=', False)] | ||
3358 | 107 | elif type == 'ivo': | ||
3359 | 108 | domain += [('type','=','out_invoice'), | ||
3360 | 109 | ('is_debit_note', '=', False), | ||
3361 | 110 | ('is_inkind_donation', '=', False), | ||
3362 | 111 | ('is_intermission', '=', True)] | ||
3367 | 112 | type_ids = inv_obj.search(self.cr, self.uid, domain, context=context, order='move_name') | 84 | type_ids = inv_obj.search(self.cr, self.uid, domain, context=context, order='move_name') |
3368 | 113 | if isinstance(type_ids, (int, long)): | 85 | if isinstance(type_ids, (int, long)): |
3369 | 114 | type_ids = [type_ids] | 86 | type_ids = [type_ids] |
3370 | 115 | self.nb_lines += len(type_ids) | 87 | self.nb_lines += len(type_ids) |
3372 | 116 | res.update({type: inv_obj.browse(self.cr, self.uid, type_ids, context)}) | 88 | res.update({doc_type: inv_obj.browse(self.cr, self.uid, type_ids, context)}) |
3373 | 117 | if bg_id: | 89 | if bg_id: |
3374 | 118 | self.percent += 0.20 # 25% of the process | 90 | self.percent += 0.20 # 25% of the process |
3375 | 119 | bg_obj.update_percent(self.cr, self.uid, [bg_id], self.percent) | 91 | bg_obj.update_percent(self.cr, self.uid, [bg_id], self.percent) |
3376 | 120 | 92 | ||
3377 | === modified file 'bin/addons/account_payment/__openerp__.py' | |||
3378 | --- bin/addons/account_payment/__openerp__.py 2019-10-10 15:06:49 +0000 | |||
3379 | +++ bin/addons/account_payment/__openerp__.py 2021-11-03 13:33:55 +0000 | |||
3380 | @@ -33,7 +33,6 @@ | |||
3381 | 33 | 'author': 'OpenERP SA', | 33 | 'author': 'OpenERP SA', |
3382 | 34 | 'depends': ['account'], | 34 | 'depends': ['account'], |
3383 | 35 | 'update_xml': [ | 35 | 'update_xml': [ |
3384 | 36 | 'account_invoice_view.xml', | ||
3385 | 37 | ], | 36 | ], |
3386 | 38 | 'demo_xml': [], | 37 | 'demo_xml': [], |
3387 | 39 | 'test': [ | 38 | 'test': [ |
3388 | 40 | 39 | ||
3389 | === removed file 'bin/addons/account_payment/account_invoice_view.xml' | |||
3390 | === modified file 'bin/addons/account_period_closing_level/account_period.py' | |||
3391 | --- bin/addons/account_period_closing_level/account_period.py 2021-08-25 14:50:30 +0000 | |||
3392 | +++ bin/addons/account_period_closing_level/account_period.py 2021-11-03 13:33:55 +0000 | |||
3393 | @@ -501,7 +501,7 @@ | |||
3394 | 501 | context = {} | 501 | context = {} |
3395 | 502 | return self.register_view(cr, uid, ids, 'cash', context=context) | 502 | return self.register_view(cr, uid, ids, 'cash', context=context) |
3396 | 503 | 503 | ||
3398 | 504 | def invoice_view(self, cr, uid, ids, action_xmlid=None, context=None): | 504 | def invoice_view(self, cr, uid, ids, action_xmlid=None, doc_type=None, context=None): |
3399 | 505 | """ | 505 | """ |
3400 | 506 | Open an invoice tree view with the given domain for the period in ids | 506 | Open an invoice tree view with the given domain for the period in ids |
3401 | 507 | """ | 507 | """ |
3402 | @@ -510,17 +510,11 @@ | |||
3403 | 510 | context = {} | 510 | context = {} |
3404 | 511 | if isinstance(ids, (int, long)): | 511 | if isinstance(ids, (int, long)): |
3405 | 512 | ids = [ids] | 512 | ids = [ids] |
3417 | 513 | 513 | if not action_xmlid and doc_type: | |
3418 | 514 | # to get action_xmlid: | 514 | action_xmlid = self.pool.get('account.invoice')._invoice_action_act_window.get(doc_type) |
3419 | 515 | # 1/ on the web interface get id of ir.ui.menu menu | 515 | if not action_xmlid: |
3420 | 516 | # 2/ get id of ir.actions.act_window: | 516 | raise osv.except_osv(_('Warning'), _('Impossible to retrieve the view to display.')) |
3421 | 517 | # select value from ir_values where model='ir.ui.menu' and res_id=<menu_id>; | 517 | act = self.pool.get('ir.actions.act_window').open_view_from_xmlid(cr, uid, action_xmlid, context=context) |
3411 | 518 | # 3/ get xmlid: | ||
3412 | 519 | # select module||'.'||name from ir_model_data where res_id=<act_id> and module!='sd' and model='ir.actions.act_window'; | ||
3413 | 520 | module, xmlid = action_xmlid.split('.', 1) | ||
3414 | 521 | act_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, xmlid)[1] | ||
3415 | 522 | keys = ['display_menu_tip', 'help', 'type', 'domain', 'res_model', 'view_id', 'search_view_id', 'view_mode', 'view_ids', 'context', 'name', 'views', 'view_type'] | ||
3416 | 523 | act = self.pool.get('ir.actions.act_window').read(cr, uid, act_id, keys, context=context) | ||
3422 | 524 | act_domain = act.get('domain', "[]") or "[]" | 518 | act_domain = act.get('domain', "[]") or "[]" |
3423 | 525 | act_context = act.get('context', "{}") or "{}" | 519 | act_context = act.get('context', "{}") or "{}" |
3424 | 526 | globals_dict = {'uid': uid} | 520 | globals_dict = {'uid': uid} |
3425 | @@ -535,7 +529,22 @@ | |||
3426 | 535 | eval_domain += [('date_invoice', '<=', period['date_stop']), ('state', 'in', ['draft', 'open'])] | 529 | eval_domain += [('date_invoice', '<=', period['date_stop']), ('state', 'in', ['draft', 'open'])] |
3427 | 536 | 530 | ||
3428 | 537 | eval_context = safe_eval(act_context, globals_dict) | 531 | eval_context = safe_eval(act_context, globals_dict) |
3430 | 538 | eval_context['search_default_draft'] = 0 | 532 | |
3431 | 533 | model_name = hasattr(model_obj, '_name') and getattr(model_obj, '_name') | ||
3432 | 534 | model_inherit_name = hasattr(model_obj, '_inherit') and getattr(model_obj, '_inherit') | ||
3433 | 535 | if model_name == 'account.invoice' or model_inherit_name == 'account.invoice': | ||
3434 | 536 | # activate the Draft and Open filters | ||
3435 | 537 | eval_context['search_default_draft'] = 1 | ||
3436 | 538 | if eval_context.get('doc_type') == 'donation': | ||
3437 | 539 | eval_context['search_default_open'] = 1 | ||
3438 | 540 | eval_context['search_cancel_state_donation'] = 0 | ||
3439 | 541 | else: | ||
3440 | 542 | eval_context['search_default_unpaid'] = 1 # Open | ||
3441 | 543 | eval_context['search_default_paid'] = 0 | ||
3442 | 544 | eval_context['search_default_closed'] = 0 | ||
3443 | 545 | if eval_context.get('doc_type') in ('ivo', 'stv'): | ||
3444 | 546 | eval_context['search_default_cancel_state'] = 0 | ||
3445 | 547 | |||
3446 | 539 | act['context'] = eval_context | 548 | act['context'] = eval_context |
3447 | 540 | act['domain'] = eval_domain | 549 | act['domain'] = eval_domain |
3448 | 541 | act['target'] = 'current' | 550 | act['target'] = 'current' |
3449 | @@ -546,68 +555,76 @@ | |||
3450 | 546 | """ | 555 | """ |
3451 | 547 | Create a new tab with Open stock transfer vouchers from given period. | 556 | Create a new tab with Open stock transfer vouchers from given period. |
3452 | 548 | """ | 557 | """ |
3454 | 549 | return self.invoice_view(cr, uid, ids, action_xmlid='account.action_invoice_tree1', context=context) | 558 | return self.invoice_view(cr, uid, ids, doc_type='stv', context=context) |
3455 | 550 | 559 | ||
3456 | 551 | def button_customer_refunds(self, cr, uid, ids, context=None): | 560 | def button_customer_refunds(self, cr, uid, ids, context=None): |
3457 | 552 | """ | 561 | """ |
3458 | 553 | Create a new tab with Customer refunds from given period. | 562 | Create a new tab with Customer refunds from given period. |
3459 | 554 | """ | 563 | """ |
3461 | 555 | return self.invoice_view(cr, uid, ids, action_xmlid='account.action_invoice_tree3', context=context) | 564 | return self.invoice_view(cr, uid, ids, doc_type='cr', context=context) |
3462 | 556 | 565 | ||
3463 | 557 | # Debit note | 566 | # Debit note |
3464 | 558 | def button_debit_note(self, cr, uid, ids, context=None): | 567 | def button_debit_note(self, cr, uid, ids, context=None): |
3468 | 559 | return self.invoice_view(cr, uid, ids, | 568 | return self.invoice_view(cr, uid, ids, doc_type='dn', context=context) |
3466 | 560 | action_xmlid='account_override.action_debit_note', | ||
3467 | 561 | context=context) | ||
3469 | 562 | 569 | ||
3470 | 563 | # Intermission voucher OUT | 570 | # Intermission voucher OUT |
3471 | 564 | def button_intermission_out(self, cr, uid, ids, context=None): | 571 | def button_intermission_out(self, cr, uid, ids, context=None): |
3475 | 565 | return self.invoice_view(cr, uid, ids, | 572 | return self.invoice_view(cr, uid, ids, doc_type='ivo', context=context) |
3473 | 566 | action_xmlid='account_override.action_intermission_out', | ||
3474 | 567 | context=context) | ||
3476 | 568 | 573 | ||
3477 | 569 | def button_supplier_refunds(self, cr, uid, ids, context=None): | 574 | def button_supplier_refunds(self, cr, uid, ids, context=None): |
3478 | 570 | """ | 575 | """ |
3480 | 571 | Open a view that display Supplier invoices for given period | 576 | Open a view that displays Supplier Refunds for given period |
3481 | 572 | """ | 577 | """ |
3484 | 573 | return self.invoice_view(cr, uid, ids, | 578 | return self.invoice_view(cr, uid, ids, doc_type='sr', context=context) |
3483 | 574 | action_xmlid='account.action_invoice_tree4', context=context) | ||
3485 | 575 | 579 | ||
3486 | 576 | # Supplier direct invoices | 580 | # Supplier direct invoices |
3487 | 577 | def button_supplier_direct_invoices(self, cr, uid, ids, context=None): | 581 | def button_supplier_direct_invoices(self, cr, uid, ids, context=None): |
3488 | 578 | """ | 582 | """ |
3489 | 579 | Open a view that display Direct invoices for this period | 583 | Open a view that display Direct invoices for this period |
3490 | 580 | """ | 584 | """ |
3494 | 581 | return self.invoice_view(cr, uid, ids, | 585 | return self.invoice_view(cr, uid, ids, doc_type='di', context=context) |
3492 | 582 | action_xmlid='register_accounting.action_direct_invoice', | ||
3493 | 583 | context=context) | ||
3495 | 584 | 586 | ||
3496 | 585 | # In-kind donation | 587 | # In-kind donation |
3497 | 586 | def button_donation(self, cr, uid, ids, context=None): | 588 | def button_donation(self, cr, uid, ids, context=None): |
3498 | 587 | """ | 589 | """ |
3499 | 588 | Open a view that display Inkind donation for this period | 590 | Open a view that display Inkind donation for this period |
3500 | 589 | """ | 591 | """ |
3504 | 590 | return self.invoice_view(cr, uid, ids, | 592 | return self.invoice_view(cr, uid, ids, doc_type='donation', context=context) |
3502 | 591 | action_xmlid='account_override.action_inkind_donation', | ||
3503 | 592 | context=context) | ||
3505 | 593 | 593 | ||
3506 | 594 | # Intermission voucher IN | 594 | # Intermission voucher IN |
3507 | 595 | def button_intermission_in(self, cr, uid, ids, context=None): | 595 | def button_intermission_in(self, cr, uid, ids, context=None): |
3508 | 596 | """ | 596 | """ |
3509 | 597 | Open a view that display intermission voucher in for this period | 597 | Open a view that display intermission voucher in for this period |
3510 | 598 | """ | 598 | """ |
3514 | 599 | return self.invoice_view(cr, uid, ids, | 599 | return self.invoice_view(cr, uid, ids, doc_type='ivi', context=context) |
3512 | 600 | action_xmlid='account_override.action_intermission_in', | ||
3513 | 601 | context=context) | ||
3515 | 602 | 600 | ||
3516 | 603 | # Supplier invoice | 601 | # Supplier invoice |
3517 | 604 | def button_supplier_invoices(self, cr, uid, ids, context=None): | 602 | def button_supplier_invoices(self, cr, uid, ids, context=None): |
3518 | 605 | """ | 603 | """ |
3519 | 606 | Open a view that display supplier invoices for this period | 604 | Open a view that display supplier invoices for this period |
3520 | 607 | """ | 605 | """ |
3524 | 608 | return self.invoice_view(cr, uid, ids, | 606 | return self.invoice_view(cr, uid, ids, doc_type='si', context=context) |
3525 | 609 | action_xmlid='account.action_invoice_tree2', | 607 | |
3526 | 610 | context=context) | 608 | # Intersection Supplier Invoice |
3527 | 609 | def button_intersection_supplier_invoices(self, cr, uid, ids, context=None): | ||
3528 | 610 | """ | ||
3529 | 611 | Opens a view with the ISI to check before closing the period | ||
3530 | 612 | """ | ||
3531 | 613 | return self.invoice_view(cr, uid, ids, doc_type='isi', context=context) | ||
3532 | 614 | |||
3533 | 615 | # Intersection Supplier Refund | ||
3534 | 616 | def button_intersection_supplier_refunds(self, cr, uid, ids, context=None): | ||
3535 | 617 | """ | ||
3536 | 618 | Opens a view with the ISR to check before closing the period | ||
3537 | 619 | """ | ||
3538 | 620 | return self.invoice_view(cr, uid, ids, doc_type='isr', context=context) | ||
3539 | 621 | |||
3540 | 622 | # Stock Transfer Refund | ||
3541 | 623 | def button_stock_transfer_refunds(self, cr, uid, ids, context=None): | ||
3542 | 624 | """ | ||
3543 | 625 | Opens a view with the STR to check before closing the period | ||
3544 | 626 | """ | ||
3545 | 627 | return self.invoice_view(cr, uid, ids, doc_type='str', context=context) | ||
3546 | 611 | 628 | ||
3547 | 612 | def button_close_field_period(self, cr, uid, ids, context=None): | 629 | def button_close_field_period(self, cr, uid, ids, context=None): |
3548 | 613 | if not context: | 630 | if not context: |
3549 | 614 | 631 | ||
3550 | === modified file 'bin/addons/account_period_closing_level/account_period_closing_level_view.xml' | |||
3551 | --- bin/addons/account_period_closing_level/account_period_closing_level_view.xml 2019-10-29 14:39:06 +0000 | |||
3552 | +++ bin/addons/account_period_closing_level/account_period_closing_level_view.xml 2021-11-03 13:33:55 +0000 | |||
3553 | @@ -152,15 +152,18 @@ | |||
3554 | 152 | <label string="Did you check draft and open customer documents?" colspan="6" align="0.0"/> | 152 | <label string="Did you check draft and open customer documents?" colspan="6" align="0.0"/> |
3555 | 153 | <group colspan="6" col="6"> | 153 | <group colspan="6" col="6"> |
3556 | 154 | <button string="Stock transfer vouchers" name="button_stock_transfer_vouchers" type="object" icon="gtk-dnd" colspan="2"/> | 154 | <button string="Stock transfer vouchers" name="button_stock_transfer_vouchers" type="object" icon="gtk-dnd" colspan="2"/> |
3557 | 155 | <button string="Stock Transfer Refunds" name="button_stock_transfer_refunds" type="object" icon="gtk-dnd" colspan="2"/> | ||
3558 | 155 | <button string="Customer Refunds" name="button_customer_refunds" type="object" icon="gtk-dnd" colspan="2"/> | 156 | <button string="Customer Refunds" name="button_customer_refunds" type="object" icon="gtk-dnd" colspan="2"/> |
3559 | 157 | <button string="Intermission Voucher OUT" name="button_intermission_out" type="object" icon="gtk-dnd" colspan="2"/> | ||
3560 | 156 | <button string="Debit Note" name="button_debit_note" type="object" icon="gtk-dnd" colspan="2"/> | 158 | <button string="Debit Note" name="button_debit_note" type="object" icon="gtk-dnd" colspan="2"/> |
3561 | 157 | <button string="Intermission Voucher OUT" name="button_intermission_out" type="object" icon="gtk-dnd" colspan="2"/> | ||
3562 | 158 | </group> | 159 | </group> |
3563 | 159 | <label string="Did you check draft and open supplier documents?" colspan="6" align="0.0"/> | 160 | <label string="Did you check draft and open supplier documents?" colspan="6" align="0.0"/> |
3564 | 160 | <group colspan="6" col="6"> | 161 | <group colspan="6" col="6"> |
3565 | 161 | <button string="Supplier invoices" name="button_supplier_invoices" type="object" icon="gtk-dnd" colspan="2"/> | 162 | <button string="Supplier invoices" name="button_supplier_invoices" type="object" icon="gtk-dnd" colspan="2"/> |
3566 | 162 | <button string="Supplier refunds" name="button_supplier_refunds" type="object" icon="gtk-dnd" colspan="2"/> | 163 | <button string="Supplier refunds" name="button_supplier_refunds" type="object" icon="gtk-dnd" colspan="2"/> |
3567 | 163 | <button string="Supplier direct invoices" name="button_supplier_direct_invoices" type="object" icon="gtk-dnd" colspan="2"/> | 164 | <button string="Supplier direct invoices" name="button_supplier_direct_invoices" type="object" icon="gtk-dnd" colspan="2"/> |
3568 | 165 | <button string="Intersection Supplier Invoices" name="button_intersection_supplier_invoices" type="object" icon="gtk-dnd" colspan="2"/> | ||
3569 | 166 | <button string="Intersection Supplier Refunds" name="button_intersection_supplier_refunds" type="object" icon="gtk-dnd" colspan="2"/> | ||
3570 | 164 | <button string="Donation" name="button_donation" type="object" icon="gtk-dnd" colspan="2"/> | 167 | <button string="Donation" name="button_donation" type="object" icon="gtk-dnd" colspan="2"/> |
3571 | 165 | <button string="Intermission Voucher IN" name="button_intermission_in" type="object" icon="gtk-dnd" colspan="2"/> | 168 | <button string="Intermission Voucher IN" name="button_intermission_in" type="object" icon="gtk-dnd" colspan="2"/> |
3572 | 166 | </group> | 169 | </group> |
3573 | 167 | 170 | ||
3574 | === modified file 'bin/addons/account_period_closing_level/account_year_end_closing.xml' | |||
3575 | --- bin/addons/account_period_closing_level/account_year_end_closing.xml 2016-11-04 12:57:37 +0000 | |||
3576 | +++ bin/addons/account_period_closing_level/account_year_end_closing.xml 2021-11-03 13:33:55 +0000 | |||
3577 | @@ -2,21 +2,6 @@ | |||
3578 | 2 | <openerp> | 2 | <openerp> |
3579 | 3 | <data> | 3 | <data> |
3580 | 4 | 4 | ||
3581 | 5 | <record id="view_account_form_inherit" model="ir.ui.view"> | ||
3582 | 6 | <field name="name">account.account.form</field> | ||
3583 | 7 | <field name="model">account.account</field> | ||
3584 | 8 | <field name="type">form</field> | ||
3585 | 9 | <field name="priority">55</field> | ||
3586 | 10 | <field name="inherit_id" ref="account.view_account_form"/> | ||
3587 | 11 | <field name="arch" type="xml"> | ||
3588 | 12 | <xpath expr="//notebook" position="inside"> | ||
3589 | 13 | <page string="End Year Closing" attrs="{'invisible': [('instance_level', '=', 'project')]}"> | ||
3590 | 14 | <field name="include_in_yearly_move" | ||
3591 | 15 | attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('type', 'not in', ['other', ])]}"/> | ||
3592 | 16 | </page> | ||
3593 | 17 | </xpath> | ||
3594 | 18 | </field> | ||
3595 | 19 | </record> | ||
3596 | 20 | 5 | ||
3597 | 21 | <record id="account.action_account_fiscalyear_form" model="ir.actions.act_window"> | 6 | <record id="account.action_account_fiscalyear_form" model="ir.actions.act_window"> |
3598 | 22 | <field name="name">Fiscal Years</field> | 7 | <field name="name">Fiscal Years</field> |
3599 | @@ -37,4 +22,4 @@ | |||
3600 | 37 | </record> | 22 | </record> |
3601 | 38 | 23 | ||
3602 | 39 | </data> | 24 | </data> |
3603 | 40 | </openerp> | ||
3604 | 41 | \ No newline at end of file | 25 | \ No newline at end of file |
3605 | 26 | </openerp> | ||
3606 | 42 | 27 | ||
3607 | === modified file 'bin/addons/account_subscription/account_model_view.xml' | |||
3608 | --- bin/addons/account_subscription/account_model_view.xml 2020-08-17 16:32:14 +0000 | |||
3609 | +++ bin/addons/account_subscription/account_model_view.xml 2021-11-03 13:33:55 +0000 | |||
3610 | @@ -26,7 +26,7 @@ | |||
3611 | 26 | <group col="6" colspan="4"> | 26 | <group col="6" colspan="4"> |
3612 | 27 | <group attrs="{'readonly': [('state', '=', 'done')]}" colspan="6" col="6"> | 27 | <group attrs="{'readonly': [('state', '=', 'done')]}" colspan="6" col="6"> |
3613 | 28 | <field name="name"/> | 28 | <field name="name"/> |
3615 | 29 | <field name="journal_id" domain="[('type', '=', 'purchase'), ('is_current_instance', '=', True)]"/> | 29 | <field name="journal_id" domain="[('type', '=', 'purchase'), ('code', '!=', 'ISI'), ('is_current_instance', '=', True)]"/> |
3616 | 30 | <field name="currency_id"/> | 30 | <field name="currency_id"/> |
3617 | 31 | </group> | 31 | </group> |
3618 | 32 | <group colspan="6" col="6" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> | 32 | <group colspan="6" col="6" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> |
3619 | 33 | 33 | ||
3620 | === modified file 'bin/addons/analytic_distribution/account_commitment.py' | |||
3621 | --- bin/addons/analytic_distribution/account_commitment.py 2021-08-17 13:24:42 +0000 | |||
3622 | +++ bin/addons/analytic_distribution/account_commitment.py 2021-11-03 13:33:55 +0000 | |||
3623 | @@ -29,7 +29,7 @@ | |||
3624 | 29 | import decimal_precision as dp | 29 | import decimal_precision as dp |
3625 | 30 | from account_override.period import get_period_from_date | 30 | from account_override.period import get_period_from_date |
3626 | 31 | from tools.misc import flatten | 31 | from tools.misc import flatten |
3628 | 32 | 32 | import netsvc | |
3629 | 33 | 33 | ||
3630 | 34 | class account_commitment(osv.osv): | 34 | class account_commitment(osv.osv): |
3631 | 35 | _name = 'account.commitment' | 35 | _name = 'account.commitment' |
3632 | @@ -48,11 +48,23 @@ | |||
3633 | 48 | ids = [ids] | 48 | ids = [ids] |
3634 | 49 | # Prepare some values | 49 | # Prepare some values |
3635 | 50 | res = {} | 50 | res = {} |
3636 | 51 | for _id in ids: | ||
3637 | 52 | res[_id] = 0 | ||
3638 | 51 | # Browse commitments | 53 | # Browse commitments |
3643 | 52 | for co in self.browse(cr, uid, ids, context=context): | 54 | if ids: |
3644 | 53 | res[co.id] = 0.0 | 55 | cr.execute(''' |
3645 | 54 | for line in co.line_ids: | 56 | select |
3646 | 55 | res[co.id] += line.amount | 57 | commit_id, sum(amount) |
3647 | 58 | from | ||
3648 | 59 | account_commitment_line | ||
3649 | 60 | where | ||
3650 | 61 | commit_id in %s | ||
3651 | 62 | group by | ||
3652 | 63 | commit_id | ||
3653 | 64 | ''', (tuple(ids),)) | ||
3654 | 65 | for x in cr.fetchall(): | ||
3655 | 66 | res[x[0]] = round(x[1], 2) | ||
3656 | 67 | |||
3657 | 56 | return res | 68 | return res |
3658 | 57 | 69 | ||
3659 | 58 | def _get_cv(self, cr, uid, ids, context=None): | 70 | def _get_cv(self, cr, uid, ids, context=None): |
3660 | @@ -86,8 +98,9 @@ | |||
3661 | 86 | 98 | ||
3662 | 87 | def _display_super_done_button(self, cr, uid, ids, name, arg, context=None): | 99 | def _display_super_done_button(self, cr, uid, ids, name, arg, context=None): |
3663 | 88 | """ | 100 | """ |
3666 | 89 | For now the "Super" Done button, which allows to always set a CV to Done whatever its state and origin, | 101 | The "Super" Done button, which allows to always set a CV to Done whatever its state and origin, is displayed: |
3667 | 90 | is visible only by the Admin user. It is displayed only when the standard Done button isn't usable. | 102 | - when the standard Done button isn't usable. |
3668 | 103 | - only for some "admin" users (the restriction is made by User Rights). | ||
3669 | 91 | """ | 104 | """ |
3670 | 92 | if context is None: | 105 | if context is None: |
3671 | 93 | context = {} | 106 | context = {} |
3672 | @@ -96,14 +109,14 @@ | |||
3673 | 96 | res = {} | 109 | res = {} |
3674 | 97 | for cv in self.read(cr, uid, ids, ['state', 'type'], context=context): | 110 | for cv in self.read(cr, uid, ids, ['state', 'type'], context=context): |
3675 | 98 | other_done_button_usable = cv['state'] == 'open' and cv['type'] not in ('external', 'intermission', 'intersection') | 111 | other_done_button_usable = cv['state'] == 'open' and cv['type'] not in ('external', 'intermission', 'intersection') |
3677 | 99 | res[cv['id']] = not other_done_button_usable and uid == 1 and cv['state'] != 'done' | 112 | res[cv['id']] = not other_done_button_usable and cv['state'] != 'done' |
3678 | 100 | return res | 113 | return res |
3679 | 101 | 114 | ||
3680 | 102 | _columns = { | 115 | _columns = { |
3681 | 103 | 'journal_id': fields.many2one('account.analytic.journal', string="Journal", readonly=True, required=True), | 116 | 'journal_id': fields.many2one('account.analytic.journal', string="Journal", readonly=True, required=True), |
3682 | 104 | 'name': fields.char(string="Number", size=64, readonly=True, required=True), | 117 | 'name': fields.char(string="Number", size=64, readonly=True, required=True), |
3683 | 105 | 'currency_id': fields.many2one('res.currency', string="Currency", required=True), | 118 | 'currency_id': fields.many2one('res.currency', string="Currency", required=True), |
3685 | 106 | 'partner_id': fields.many2one('res.partner', string="Supplier", required=True), | 119 | 'partner_id': fields.many2one('res.partner', string="Partner", required=True), |
3686 | 107 | 'period_id': fields.many2one('account.period', string="Period", readonly=True, required=True), | 120 | 'period_id': fields.many2one('account.period', string="Period", readonly=True, required=True), |
3687 | 108 | 'state': fields.selection([('draft', 'Draft'), ('open', 'Validated'), ('done', 'Done')], readonly=True, string="State", required=True), | 121 | 'state': fields.selection([('draft', 'Draft'), ('open', 'Validated'), ('done', 'Done')], readonly=True, string="State", required=True), |
3688 | 109 | 'date': fields.date(string="Commitment Date", readonly=True, required=True, states={'draft': [('readonly', False)], 'open': [('readonly', False)]}), | 122 | 'date': fields.date(string="Commitment Date", readonly=True, required=True, states={'draft': [('readonly', False)], 'open': [('readonly', False)]}), |
3689 | @@ -115,7 +128,9 @@ | |||
3690 | 115 | 'analytic_distribution_id': fields.many2one('analytic.distribution', string="Analytic distribution"), | 128 | 'analytic_distribution_id': fields.many2one('analytic.distribution', string="Analytic distribution"), |
3691 | 116 | 'type': fields.selection(get_cv_type, string="Type", readonly=True), | 129 | 'type': fields.selection(get_cv_type, string="Type", readonly=True), |
3692 | 117 | 'notes': fields.text(string="Comment"), | 130 | 'notes': fields.text(string="Comment"), |
3693 | 131 | 'cv_flow_type': fields.selection([('customer', 'Customer'), ('supplier', 'Supplier')], string="Type of CV"), | ||
3694 | 118 | 'purchase_id': fields.many2one('purchase.order', string="Source document", readonly=True), | 132 | 'purchase_id': fields.many2one('purchase.order', string="Source document", readonly=True), |
3695 | 133 | 'sale_id': fields.many2one('sale.order', string="Source document", readonly=True), | ||
3696 | 119 | 'description': fields.char(string="Description", size=256), | 134 | 'description': fields.char(string="Description", size=256), |
3697 | 120 | 'version': fields.integer('Version', required=True, | 135 | 'version': fields.integer('Version', required=True, |
3698 | 121 | help="Technical field to distinguish old CVs from new ones which have a different behavior."), | 136 | help="Technical field to distinguish old CVs from new ones which have a different behavior."), |
3699 | @@ -155,6 +170,10 @@ | |||
3700 | 155 | partner = self.pool.get('res.partner').browse(cr, uid, [partner_id]) | 170 | partner = self.pool.get('res.partner').browse(cr, uid, [partner_id]) |
3701 | 156 | if partner and partner[0] and not partner[0].active: | 171 | if partner and partner[0] and not partner[0].active: |
3702 | 157 | raise osv.except_osv(_('Warning'), _("Partner '%s' is not active.") % (partner[0] and partner[0].name or '',)) | 172 | raise osv.except_osv(_('Warning'), _("Partner '%s' is not active.") % (partner[0] and partner[0].name or '',)) |
3703 | 173 | if vals.get('sale_id'): | ||
3704 | 174 | vals['cv_flow_type'] = 'customer' | ||
3705 | 175 | elif vals.get('purchase_id'): | ||
3706 | 176 | vals['cv_flow_type'] = 'supplier' | ||
3707 | 158 | # Add sequence | 177 | # Add sequence |
3708 | 159 | sequence_number = self.pool.get('ir.sequence').get(cr, uid, self._name) | 178 | sequence_number = self.pool.get('ir.sequence').get(cr, uid, self._name) |
3709 | 160 | instance = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id | 179 | instance = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id |
3710 | @@ -441,6 +460,9 @@ | |||
3711 | 441 | ids = [ids] | 460 | ids = [ids] |
3712 | 442 | # Browse commitments | 461 | # Browse commitments |
3713 | 443 | for c in self.browse(cr, uid, ids, context=context): | 462 | for c in self.browse(cr, uid, ids, context=context): |
3714 | 463 | sign = 1 | ||
3715 | 464 | if c.cv_flow_type == 'customer': | ||
3716 | 465 | sign = -1 | ||
3717 | 444 | for cl in c.line_ids: | 466 | for cl in c.line_ids: |
3718 | 445 | # Verify that analytic distribution is present | 467 | # Verify that analytic distribution is present |
3719 | 446 | if cl.analytic_distribution_state != 'valid': | 468 | if cl.analytic_distribution_state != 'valid': |
3720 | @@ -456,10 +478,10 @@ | |||
3721 | 456 | if not al_ids: | 478 | if not al_ids: |
3722 | 457 | # Create engagement journal lines | 479 | # Create engagement journal lines |
3723 | 458 | self.pool.get('analytic.distribution').\ | 480 | self.pool.get('analytic.distribution').\ |
3725 | 459 | create_account_analytic_lines(cr, uid, [distrib_id], c.description or c.name, c.date, cl.amount, | 481 | create_account_analytic_lines(cr, uid, [distrib_id], c.description or c.name, c.date, sign * cl.amount, |
3726 | 460 | c.journal_id and c.journal_id.id, | 482 | c.journal_id and c.journal_id.id, |
3727 | 461 | c.currency_id and c.currency_id.id, c.date or False, | 483 | c.currency_id and c.currency_id.id, c.date or False, |
3729 | 462 | (c.purchase_id and c.purchase_id.name) or c.name or False, c.date, | 484 | (c.purchase_id and c.purchase_id.name or c.sale_id and c.sale_id.name) or c.name or False, c.date, |
3730 | 463 | cl.account_id and cl.account_id.id or False, False, False, cl.id, context=context) | 485 | cl.account_id and cl.account_id.id or False, False, False, cl.id, context=context) |
3731 | 464 | return True | 486 | return True |
3732 | 465 | 487 | ||
3733 | @@ -500,12 +522,56 @@ | |||
3734 | 500 | self.write(cr, uid, [c.id], {'state':'done'}, context=context) | 522 | self.write(cr, uid, [c.id], {'state':'done'}, context=context) |
3735 | 501 | return True | 523 | return True |
3736 | 502 | 524 | ||
3737 | 525 | def test_and_close_cv_so(self, cr, uid, ids, invoice_ids=None, context=None): | ||
3738 | 526 | """ | ||
3739 | 527 | set amout=0 on CV lines linked to closed, cancelled(-r) FO line (no more invoices expected) | ||
3740 | 528 | and with no draft invoice | ||
3741 | 529 | |||
3742 | 530 | |||
3743 | 531 | invoice_ids: list of draft invoices to ignore (state will be changed later in the code) | ||
3744 | 532 | """ | ||
3745 | 533 | |||
3746 | 534 | if invoice_ids is None: | ||
3747 | 535 | invoice_ids = [] | ||
3748 | 536 | |||
3749 | 537 | iv_ids = invoice_ids[:] | ||
3750 | 538 | if not iv_ids: | ||
3751 | 539 | iv_ids.append(0) | ||
3752 | 540 | |||
3753 | 541 | cv_line_obj = self.pool.get('account.commitment.line') | ||
3754 | 542 | cr.execute(''' | ||
3755 | 543 | select | ||
3756 | 544 | line.id, line.amount | ||
3757 | 545 | from | ||
3758 | 546 | account_commitment_line line | ||
3759 | 547 | left join | ||
3760 | 548 | sale_order_line sol on sol.id = line.so_line_id | ||
3761 | 549 | left join | ||
3762 | 550 | account_invoice_line inv_line on inv_line.sale_order_line_id = sol.id and inv_line.invoice_id not in %s | ||
3763 | 551 | left join | ||
3764 | 552 | account_invoice inv on inv_line.invoice_id = inv.id and inv.type = 'out_invoice' and inv.from_supply = 't' | ||
3765 | 553 | where | ||
3766 | 554 | sol.state in ('done', 'cancel', 'cancel_r') and | ||
3767 | 555 | line.amount != 0 and | ||
3768 | 556 | line.commit_id in %s | ||
3769 | 557 | group by | ||
3770 | 558 | line.id, line.amount | ||
3771 | 559 | having (count(inv.state='draft' or NULL) = 0) | ||
3772 | 560 | ''', (tuple(iv_ids), tuple(ids))) | ||
3773 | 561 | # from_supply + out_invoice : to ignore draft refund | ||
3774 | 562 | |||
3775 | 563 | for x in cr.fetchall(): | ||
3776 | 564 | cv_line_obj._update_so_commitment_line(cr, uid, x[0], x[1], from_cancel=True, context=context) | ||
3777 | 565 | |||
3778 | 566 | return True | ||
3779 | 567 | |||
3780 | 568 | |||
3781 | 503 | account_commitment() | 569 | account_commitment() |
3782 | 504 | 570 | ||
3783 | 505 | class account_commitment_line(osv.osv): | 571 | class account_commitment_line(osv.osv): |
3784 | 506 | _name = 'account.commitment.line' | 572 | _name = 'account.commitment.line' |
3785 | 507 | _description = "Account Commitment Voucher Line" | 573 | _description = "Account Commitment Voucher Line" |
3787 | 508 | _order = "po_line_id, id desc" | 574 | _order = "line_number, id desc" |
3788 | 509 | _rec_name = 'account_id' | 575 | _rec_name = 'account_id' |
3789 | 510 | _trace = True | 576 | _trace = True |
3790 | 511 | 577 | ||
3791 | @@ -574,10 +640,9 @@ | |||
3792 | 574 | string="Purchase Order Lines (deprecated)", readonly=True), | 640 | string="Purchase Order Lines (deprecated)", readonly=True), |
3793 | 575 | # for CV starting from version 2 | 641 | # for CV starting from version 2 |
3794 | 576 | 'po_line_id': fields.many2one('purchase.order.line', "PO Line"), | 642 | 'po_line_id': fields.many2one('purchase.order.line', "PO Line"), |
3799 | 577 | 'po_line_product_id': fields.related('po_line_id', 'product_id', type='many2one', relation='product.product', | 643 | 'so_line_id': fields.many2one('sale.order.line', "SO Line"), |
3800 | 578 | string="Product", readonly=True, store=True, write_relate=False), | 644 | 'line_product_id': fields.many2one('product.product', string="Product", readonly=True), |
3801 | 579 | 'po_line_number': fields.related('po_line_id', 'line_number', type='integer_null', string="PO Line", readonly=True, | 645 | 'line_number': fields.integer_null('Line', readonly=True), |
3798 | 580 | store=True, write_relate=False, _fnct_migrate=lambda *a: True), | ||
3802 | 581 | } | 646 | } |
3803 | 582 | 647 | ||
3804 | 583 | _defaults = { | 648 | _defaults = { |
3805 | @@ -608,20 +673,23 @@ | |||
3806 | 608 | # Prepare some values | 673 | # Prepare some values |
3807 | 609 | for cl in self.browse(cr, uid, ids, context=context): | 674 | for cl in self.browse(cr, uid, ids, context=context): |
3808 | 610 | # Browse distribution | 675 | # Browse distribution |
3809 | 676 | sign = 1 | ||
3810 | 677 | if cl.commit_id.cv_flow_type == 'customer': | ||
3811 | 678 | sign = -1 | ||
3812 | 611 | distrib_id = cl.analytic_distribution_id and cl.analytic_distribution_id.id or False | 679 | distrib_id = cl.analytic_distribution_id and cl.analytic_distribution_id.id or False |
3813 | 612 | if not distrib_id: | 680 | if not distrib_id: |
3814 | 613 | distrib_id = cl.commit_id and cl.commit_id.analytic_distribution_id and cl.commit_id.analytic_distribution_id.id or False | 681 | distrib_id = cl.commit_id and cl.commit_id.analytic_distribution_id and cl.commit_id.analytic_distribution_id.id or False |
3815 | 614 | if distrib_id: | 682 | if distrib_id: |
3816 | 615 | analytic_line_ids = self.pool.get('account.analytic.line').search(cr, uid, [('commitment_line_id', '=', cl.id)], context=context) | 683 | analytic_line_ids = self.pool.get('account.analytic.line').search(cr, uid, [('commitment_line_id', '=', cl.id)], context=context) |
3817 | 616 | self.pool.get('account.analytic.line').unlink(cr, uid, analytic_line_ids, context=context) | 684 | self.pool.get('account.analytic.line').unlink(cr, uid, analytic_line_ids, context=context) |
3819 | 617 | ref = cl.commit_id and cl.commit_id.purchase_id and cl.commit_id.purchase_id.name or False | 685 | ref = cl.commit_id and cl.commit_id.purchase_id and cl.commit_id.purchase_id.name or cl.commit_id.sale_id and cl.commit_id.sale_id.name or False |
3820 | 618 | if cl.commit_id: | 686 | if cl.commit_id: |
3821 | 619 | desc = cl.commit_id.description or cl.commit_id.name | 687 | desc = cl.commit_id.description or cl.commit_id.name |
3822 | 620 | else: | 688 | else: |
3823 | 621 | desc = 'Commitment voucher line' | 689 | desc = 'Commitment voucher line' |
3824 | 622 | self.pool.get('analytic.distribution').\ | 690 | self.pool.get('analytic.distribution').\ |
3825 | 623 | create_account_analytic_lines(cr, uid, [distrib_id], desc, | 691 | create_account_analytic_lines(cr, uid, [distrib_id], desc, |
3827 | 624 | cl.commit_id.date, amount, cl.commit_id.journal_id.id, cl.commit_id.currency_id.id, | 692 | cl.commit_id.date, sign * amount, cl.commit_id.journal_id.id, cl.commit_id.currency_id.id, |
3828 | 625 | cl.commit_id and cl.commit_id.date or False, ref, cl.commit_id.date, | 693 | cl.commit_id and cl.commit_id.date or False, ref, cl.commit_id.date, |
3829 | 626 | account_id or cl.account_id.id, move_id=False, invoice_line_id=False, | 694 | account_id or cl.account_id.id, move_id=False, invoice_line_id=False, |
3830 | 627 | commitment_line_id=cl.id, context=context) | 695 | commitment_line_id=cl.id, context=context) |
3831 | @@ -678,15 +746,16 @@ | |||
3832 | 678 | account = self.pool.get('account.account').browse(cr, uid, [account_id], context=context)[0] | 746 | account = self.pool.get('account.account').browse(cr, uid, [account_id], context=context)[0] |
3833 | 679 | if account.type in ['view']: | 747 | if account.type in ['view']: |
3834 | 680 | raise osv.except_osv(_('Error'), _("You cannot write a commitment voucher line on a 'view' account type!")) | 748 | raise osv.except_osv(_('Error'), _("You cannot write a commitment voucher line on a 'view' account type!")) |
3835 | 681 | # Verify amount validity | ||
3836 | 682 | if 'amount' in vals and vals.get('amount', 0.0) < 0.0: | ||
3837 | 683 | raise osv.except_osv(_('Warning'), _('Amount Left should be equal or superior to 0!')) | ||
3838 | 684 | if 'initial_amount' in vals and vals.get('initial_amount', 0.0) <= 0.0: | ||
3839 | 685 | raise osv.except_osv(_('Warning'), _('Initial Amount should be superior to 0!')) | ||
3840 | 686 | # Update analytic distribution if needed and initial_amount | 749 | # Update analytic distribution if needed and initial_amount |
3841 | 687 | for line in self.browse(cr, uid, ids, context=context): | 750 | for line in self.browse(cr, uid, ids, context=context): |
3842 | 751 | # Verify amount validity | ||
3843 | 752 | if 'amount' in vals and vals.get('amount', 0.0) < 0.0: | ||
3844 | 753 | raise osv.except_osv(_('Warning'), _('Amount Left should be equal or superior to 0!')) | ||
3845 | 754 | if 'initial_amount' in vals and vals.get('initial_amount', 0.0) <= 0.0: | ||
3846 | 755 | raise osv.except_osv(_('Warning'), _('Initial Amount should be superior to 0!')) | ||
3847 | 756 | message = _('Initial Amount should be superior to Amount Left') | ||
3848 | 757 | |||
3849 | 688 | # verify that initial amount is superior to amount left | 758 | # verify that initial amount is superior to amount left |
3850 | 689 | message = _('Initial Amount should be superior to Amount Left') | ||
3851 | 690 | if 'amount' in vals and 'initial_amount' in vals: | 759 | if 'amount' in vals and 'initial_amount' in vals: |
3852 | 691 | if vals.get('initial_amount') < vals.get('amount'): | 760 | if vals.get('initial_amount') < vals.get('amount'): |
3853 | 692 | raise osv.except_osv(_('Warning'), message) | 761 | raise osv.except_osv(_('Warning'), message) |
3854 | @@ -783,5 +852,32 @@ | |||
3855 | 783 | 'context': context, | 852 | 'context': context, |
3856 | 784 | } | 853 | } |
3857 | 785 | 854 | ||
3858 | 855 | def _update_so_commitment_line(self, cr, uid, id, amount, from_cancel=True, context=None): | ||
3859 | 856 | """ | ||
3860 | 857 | reduce amount on CV line from SO | ||
3861 | 858 | called when: | ||
3862 | 859 | * FO line is canceled(-r) | ||
3863 | 860 | * SI is opened or canceled | ||
3864 | 861 | """ | ||
3865 | 862 | if context is None: | ||
3866 | 863 | context = {} | ||
3867 | 864 | wf_service = netsvc.LocalService("workflow") | ||
3868 | 865 | cv_obj = self.pool.get('account.commitment') | ||
3869 | 866 | |||
3870 | 867 | cv_line = self.browse(cr, uid, id, context=context) | ||
3871 | 868 | if not from_cancel and cv_line.commit_id.state == 'draft': | ||
3872 | 869 | wf_service.trg_validate(uid, 'account.commitment', cv_line.commit_id.id, 'commitment_open', cr) | ||
3873 | 870 | |||
3874 | 871 | amount_left = max(round(cv_line.amount - amount, 2), 0) | ||
3875 | 872 | # this will trigger AJIs update | ||
3876 | 873 | self.write(cr, uid, [id], {'amount': amount_left}, context=context) | ||
3877 | 874 | |||
3878 | 875 | cv = cv_obj.read(cr, uid, cv_line.commit_id.id, ['total'], context=context) | ||
3879 | 876 | if abs(cv['total']) < 0.001: | ||
3880 | 877 | cv_obj.action_commitment_done(cr, uid, [cv_line.commit_id.id], context=context) | ||
3881 | 878 | |||
3882 | 879 | return True | ||
3883 | 880 | |||
3884 | 881 | |||
3885 | 786 | account_commitment_line() | 882 | account_commitment_line() |
3886 | 787 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 883 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3887 | 788 | 884 | ||
3888 | === modified file 'bin/addons/analytic_distribution/account_commitment_view.xml' | |||
3889 | --- bin/addons/analytic_distribution/account_commitment_view.xml 2021-08-25 14:50:30 +0000 | |||
3890 | +++ bin/addons/analytic_distribution/account_commitment_view.xml 2021-11-03 13:33:55 +0000 | |||
3891 | @@ -8,12 +8,15 @@ | |||
3892 | 8 | <field name="model">account.commitment</field> | 8 | <field name="model">account.commitment</field> |
3893 | 9 | <field name="type">form</field> | 9 | <field name="type">form</field> |
3894 | 10 | <field name="arch" type="xml"> | 10 | <field name="arch" type="xml"> |
3896 | 11 | <form string="Commitment Voucher" hide_duplicate_button="1"> | 11 | <form string="Supplier Commitment Voucher" hide_duplicate_button="1"> |
3897 | 12 | <group col="6" colspan="4"> | 12 | <group col="6" colspan="4"> |
3898 | 13 | <field name="journal_id" domain="[('is_current_instance','=',True)]"/> | 13 | <field name="journal_id" domain="[('is_current_instance','=',True)]"/> |
3900 | 14 | <field name="partner_id" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" attrs="{'readonly': ['|', ('type', '!=', 'manual'), ('state', '!=', 'draft')]}"/> | 14 | <field name="partner_id" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" attrs="{'readonly': ['|', ('type', '!=', 'manual'), ('state', '!=', 'draft')]}" string="Supplier"/> |
3901 | 15 | <newline/> | 15 | <newline/> |
3902 | 16 | <field name="name"/> | 16 | <field name="name"/> |
3903 | 17 | <field name="cv_flow_type" invisible="1" /> | ||
3904 | 18 | <field name="purchase_id" attrs="{'invisible': [('cv_flow_type', '!=', 'supplier')]}"/> | ||
3905 | 19 | <field name="sale_id" attrs="{'invisible': [('cv_flow_type', '!=', 'customer')]}"/> | ||
3906 | 17 | <newline/> | 20 | <newline/> |
3907 | 18 | <field name="date" on_change="onchange_date(date, period_id)"/> | 21 | <field name="date" on_change="onchange_date(date, period_id)"/> |
3908 | 19 | <field name="period_id"/> | 22 | <field name="period_id"/> |
3909 | @@ -54,7 +57,7 @@ | |||
3910 | 54 | 'readonly': [('type', 'in', ['external', 'intermission', 'intersection'])]}" | 57 | 'readonly': [('type', 'in', ['external', 'intermission', 'intersection'])]}" |
3911 | 55 | /> | 58 | /> |
3912 | 56 | <!-- button which allows to always set a CV to Done (whatever its state and origin) --> | 59 | <!-- button which allows to always set a CV to Done (whatever its state and origin) --> |
3914 | 57 | <button name="commitment_always_validate" string="Done (for Administrator only)" | 60 | <button name="commitment_always_validate" string="Force Done" |
3915 | 58 | icon="terp-gtk-go-back-rtl" colspan="6" | 61 | icon="terp-gtk-go-back-rtl" colspan="6" |
3916 | 59 | confirm='You are about to set this Commitment Voucher to the state "Done". Do you want to proceed?' | 62 | confirm='You are about to set this Commitment Voucher to the state "Done". Do you want to proceed?' |
3917 | 60 | attrs="{'invisible': [('display_super_done_button', '=', False)]}"/> | 63 | attrs="{'invisible': [('display_super_done_button', '=', False)]}"/> |
3918 | @@ -70,10 +73,11 @@ | |||
3919 | 70 | <field name="model">account.commitment</field> | 73 | <field name="model">account.commitment</field> |
3920 | 71 | <field name="type">tree</field> | 74 | <field name="type">tree</field> |
3921 | 72 | <field name="arch" type="xml"> | 75 | <field name="arch" type="xml"> |
3923 | 73 | <tree string="Commitment Voucher" colors="blue:state == 'draft';grey:state == 'done';black:state == 'open'"> | 76 | <tree string="Supplier Commitment Vouchers" colors="blue:state == 'draft';grey:state == 'done';black:state == 'open'"> |
3924 | 74 | <field name="date"/> | 77 | <field name="date"/> |
3925 | 75 | <field name="name"/> | 78 | <field name="name"/> |
3927 | 76 | <field name="partner_id"/> | 79 | <field name="partner_id" string="Supplier"/> |
3928 | 80 | <field name="purchase_id" /> | ||
3929 | 77 | <field name="currency_id"/> | 81 | <field name="currency_id"/> |
3930 | 78 | <field name="total" digits="(16,2)"/> | 82 | <field name="total" digits="(16,2)"/> |
3931 | 79 | <field name="type"/> | 83 | <field name="type"/> |
3932 | @@ -83,6 +87,7 @@ | |||
3933 | 83 | </field> | 87 | </field> |
3934 | 84 | </record> | 88 | </record> |
3935 | 85 | 89 | ||
3936 | 90 | |||
3937 | 86 | <!-- Commitment Lines --> | 91 | <!-- Commitment Lines --> |
3938 | 87 | <record model="ir.ui.view" id="account_commitment_line_tree"> | 92 | <record model="ir.ui.view" id="account_commitment_line_tree"> |
3939 | 88 | <field name="name">account.commitment.line.tree</field> | 93 | <field name="name">account.commitment.line.tree</field> |
3940 | @@ -95,8 +100,8 @@ | |||
3941 | 95 | hide_delete_button="1" | 100 | hide_delete_button="1" |
3942 | 96 | > | 101 | > |
3943 | 97 | <field name="commit_type"/> | 102 | <field name="commit_type"/> |
3946 | 98 | <field name="po_line_product_id"/> | 103 | <field name="line_product_id"/> |
3947 | 99 | <field name="po_line_number"/> | 104 | <field name="line_number"/> |
3948 | 100 | <field name="account_id" domain="[('restricted_area', '=', 'commitment_lines')]"/> | 105 | <field name="account_id" domain="[('restricted_area', '=', 'commitment_lines')]"/> |
3949 | 101 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" | 106 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" |
3950 | 102 | icon="terp-stock_symbol-selection" context="context" | 107 | icon="terp-stock_symbol-selection" context="context" |
3951 | @@ -125,21 +130,21 @@ | |||
3952 | 125 | <field name="model">account.commitment</field> | 130 | <field name="model">account.commitment</field> |
3953 | 126 | <field name="type">search</field> | 131 | <field name="type">search</field> |
3954 | 127 | <field name="arch" type="xml"> | 132 | <field name="arch" type="xml"> |
3956 | 128 | <search string="Search Commitment Voucher"> | 133 | <search string="Supplier Commitment Vouchers"> |
3957 | 129 | <group col='6' colspan='4'> | 134 | <group col='6' colspan='4'> |
3963 | 130 | <filter icon="terp-tools" string="Manual" domain="[('type','=','manual')]" help="Manual Commitment Voucher"/> | 135 | <filter icon="terp-tools" string="Manual" domain="[('type','=','manual')]" help="Manual Commitment Vouchers"/> |
3964 | 131 | <filter icon="gtk-quit" string="External" domain="[('type','=','external')]" help="External Commitment Voucher"/> | 136 | <filter icon="gtk-quit" string="External" domain="[('type','=','external')]" help="External Commitment Vouchers"/> |
3965 | 132 | <filter icon="gtk-refresh" string="Intersection" domain="[('type', '=', 'intersection')]" help="Intersection Commitment Voucher"/> | 137 | <filter icon="gtk-refresh" string="Intersection" domain="[('type', '=', 'intersection')]" help="Intersection Commitment Vouchers"/> |
3966 | 133 | <filter icon="gtk-ok" string="Intermission" domain="[('type', '=', 'intermission')]" help="Intermission Commitment Voucher"/> | 138 | <filter icon="gtk-ok" string="Intermission" domain="[('type', '=', 'intermission')]" help="Intermission Commitment Vouchers"/> |
3967 | 134 | <filter icon="terp-partner" string="ESC" domain="[('type','=','esc')]" help="ESC Commitment Voucher"/> | 139 | <filter icon="terp-partner" string="ESC" domain="[('type','=','esc')]" help="ESC Commitment Vouchers"/> |
3968 | 135 | <separator orientation="vertical"/> | 140 | <separator orientation="vertical"/> |
3972 | 136 | <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Commitment Voucher in Draft state" name="draft"/> | 141 | <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Commitment Vouchers in Draft state" name="draft"/> |
3973 | 137 | <filter icon="terp-camera_test" string="Validated" domain="[('state','=','open')]" help="Commitment Voucher in Validated state" name="validated"/> | 142 | <filter icon="terp-camera_test" string="Validated" domain="[('state','=','open')]" help="Commitment Vouchers in Validated state" name="validated"/> |
3974 | 138 | <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" help="Commitment Voucher in Done state" name="done"/> | 143 | <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]" help="Commitment Vouchers in Done state" name="done"/> |
3975 | 139 | <newline/> | 144 | <newline/> |
3976 | 140 | <field name="currency_id" select="1"/> | 145 | <field name="currency_id" select="1"/> |
3977 | 141 | <field name="date" select='1'/> | 146 | <field name="date" select='1'/> |
3979 | 142 | <field name="partner_id" select='1'/> | 147 | <field name="partner_id" select="1" string="Supplier" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/> |
3980 | 143 | <field name="name" select="1"/> | 148 | <field name="name" select="1"/> |
3981 | 144 | <field name="purchase_id"/> | 149 | <field name="purchase_id"/> |
3982 | 145 | </group> | 150 | </group> |
3983 | @@ -148,6 +153,95 @@ | |||
3984 | 148 | </field> | 153 | </field> |
3985 | 149 | </record> | 154 | </record> |
3986 | 150 | 155 | ||
3987 | 156 | <!-- Dedicated from FO views: duplicate CV from PO view and replace fields --> | ||
3988 | 157 | <record model="ir.ui.view" id="account_commitment_fo_tree_copy"> | ||
3989 | 158 | <field name="name">account.commitment.fo.tree.copy</field> | ||
3990 | 159 | <field name="model">account.commitment</field> | ||
3991 | 160 | <field name="type">tree</field> | ||
3992 | 161 | <field name="priority" eval="150" /> | ||
3993 | 162 | <field name="duplicate_view_id" ref="account_commitment_tree" /> | ||
3994 | 163 | <field name="arch" type="xml"> | ||
3995 | 164 | <tree /> | ||
3996 | 165 | </field> | ||
3997 | 166 | </record> | ||
3998 | 167 | <record model="ir.ui.view" id="account_commitment_fo_tree"> | ||
3999 | 168 | <field name="name">account.commitment.fo.tree.copy.inherit</field> | ||
4000 | 169 | <field name="model">account.commitment</field> | ||
4001 | 170 | <field name="type">tree</field> | ||
4002 | 171 | <field name="priority" eval="160" /> | ||
4003 | 172 | <field name="inherit_id" ref="account_commitment_fo_tree_copy" /> | ||
4004 | 173 | <field name="arch" type="xml"> | ||
4005 | 174 | <xpath expr="/tree" position="attributes"> | ||
4006 | 175 | <attribute name="string">Customer Commitment Vouchers</attribute> | ||
4007 | 176 | </xpath> | ||
4008 | 177 | <xpath expr="//field[@name='purchase_id']" position="replace"> | ||
4009 | 178 | <field name="sale_id" /> | ||
4010 | 179 | </xpath> | ||
4011 | 180 | <xpath expr="//field[@name='partner_id']" position="attributes"> | ||
4012 | 181 | <attribute name="string">Customer</attribute> | ||
4013 | 182 | </xpath> | ||
4014 | 183 | </field> | ||
4015 | 184 | </record> | ||
4016 | 185 | |||
4017 | 186 | <record model="ir.ui.view" id="account_commitment_fo_search_copy"> | ||
4018 | 187 | <field name="name">account.commitment.fo.search.copy</field> | ||
4019 | 188 | <field name="model">account.commitment</field> | ||
4020 | 189 | <field name="type">search</field> | ||
4021 | 190 | <field name="priority" eval="150" /> | ||
4022 | 191 | <field name="duplicate_view_id" ref="account_commitment_search" /> | ||
4023 | 192 | <field name="arch" type="xml"> | ||
4024 | 193 | <search /> | ||
4025 | 194 | </field> | ||
4026 | 195 | </record> | ||
4027 | 196 | <record model="ir.ui.view" id="account_commitment_fo_search"> | ||
4028 | 197 | <field name="name">account.commitment.fo.seach.copy.inherit</field> | ||
4029 | 198 | <field name="model">account.commitment</field> | ||
4030 | 199 | <field name="type">tree</field> | ||
4031 | 200 | <field name="priority" eval="160" /> | ||
4032 | 201 | <field name="inherit_id" ref="account_commitment_fo_search_copy" /> | ||
4033 | 202 | <field name="arch" type="xml"> | ||
4034 | 203 | <xpath expr="/search" position="attributes"> | ||
4035 | 204 | <attribute name="string">Customer Commitment Vouchers</attribute> | ||
4036 | 205 | </xpath> | ||
4037 | 206 | <xpath expr="//field[@name='purchase_id']" position="replace"> | ||
4038 | 207 | <field name="sale_id" /> | ||
4039 | 208 | </xpath> | ||
4040 | 209 | <xpath expr="//field[@name='partner_id']" position="attributes"> | ||
4041 | 210 | <attribute name="context">{'default_customer': 1, 'search_default_customer': 1, 'default_supplier': 0}</attribute> | ||
4042 | 211 | <attribute name="string">Customer</attribute> | ||
4043 | 212 | </xpath> | ||
4044 | 213 | <xpath expr="//filter[@string='External']" position="replace" /> | ||
4045 | 214 | <xpath expr="//filter[@string='ESC']" position="replace" /> | ||
4046 | 215 | </field> | ||
4047 | 216 | </record> | ||
4048 | 217 | |||
4049 | 218 | <record model="ir.ui.view" id="account_commitment_fo_form_copy"> | ||
4050 | 219 | <field name="name">account.commitment.fo.form.copy</field> | ||
4051 | 220 | <field name="model">account.commitment</field> | ||
4052 | 221 | <field name="type">form</field> | ||
4053 | 222 | <field name="priority" eval="160" /> | ||
4054 | 223 | <field name="duplicate_view_id" ref="account_commitment_form" /> | ||
4055 | 224 | <field name="arch" type="xml"> | ||
4056 | 225 | <form /> | ||
4057 | 226 | </field> | ||
4058 | 227 | </record> | ||
4059 | 228 | <record model="ir.ui.view" id="account_commitment_fo_form"> | ||
4060 | 229 | <field name="name">account.commitment.fo.form.copy.inherit</field> | ||
4061 | 230 | <field name="model">account.commitment</field> | ||
4062 | 231 | <field name="type">form</field> | ||
4063 | 232 | <field name="priority" eval="160" /> | ||
4064 | 233 | <field name="inherit_id" ref="account_commitment_fo_form_copy" /> | ||
4065 | 234 | <field name="arch" type="xml"> | ||
4066 | 235 | <xpath expr="/form" position="attributes"> | ||
4067 | 236 | <attribute name="string">Customer Commitment Voucher</attribute> | ||
4068 | 237 | </xpath> | ||
4069 | 238 | <xpath expr="//field[@name='partner_id']" position="attributes"> | ||
4070 | 239 | <attribute name="context">{'default_customer': 1, 'search_default_customer': 1, 'default_supplier': 0}</attribute> | ||
4071 | 240 | <attribute name="string">Customer</attribute> | ||
4072 | 241 | </xpath> | ||
4073 | 242 | </field> | ||
4074 | 243 | </record> | ||
4075 | 244 | |||
4076 | 151 | <!-- Commitment Import view --> | 245 | <!-- Commitment Import view --> |
4077 | 152 | <record id="import_commitment_wizard_view" model="ir.ui.view"> | 246 | <record id="import_commitment_wizard_view" model="ir.ui.view"> |
4078 | 153 | <field name="name">Import Intl Commitments</field> | 247 | <field name="name">Import Intl Commitments</field> |
4079 | @@ -252,16 +346,40 @@ | |||
4080 | 252 | </field> | 346 | </field> |
4081 | 253 | </record> | 347 | </record> |
4082 | 254 | 348 | ||
4084 | 255 | <!-- Commitment Voucher Actions --> | 349 | <!-- Commitment Voucher Actions from PO --> |
4085 | 256 | <record model="ir.actions.act_window" id="action_account_commitment_tree"> | 350 | <record model="ir.actions.act_window" id="action_account_commitment_tree"> |
4086 | 257 | <field name="res_model">account.commitment</field> | 351 | <field name="res_model">account.commitment</field> |
4087 | 258 | <field name="view_type">form</field> | 352 | <field name="view_type">form</field> |
4088 | 259 | <field name="view_mode">tree,form</field> | 353 | <field name="view_mode">tree,form</field> |
4089 | 260 | <field name="view_id" ref="account_commitment_tree"/> | 354 | <field name="view_id" ref="account_commitment_tree"/> |
4090 | 261 | <field name="search_view_id" ref="account_commitment_search"/> | 355 | <field name="search_view_id" ref="account_commitment_search"/> |
4091 | 356 | <field name="domain">[('cv_flow_type', '=', 'supplier')]</field> | ||
4092 | 262 | <!-- US-2704 if a domain is added here, do not forget to update the domain of account_board_commitment_voucher in finance/board_account_view.xml --> | 357 | <!-- US-2704 if a domain is added here, do not forget to update the domain of account_board_commitment_voucher in finance/board_account_view.xml --> |
4093 | 263 | <field name="context">{'search_default_draft': 1, 'search_default_validated': 1, 'target_filename_prefix': 'Commitment Vouchers'}</field> | 358 | <field name="context">{'search_default_draft': 1, 'search_default_validated': 1, 'target_filename_prefix': 'Commitment Vouchers'}</field> |
4094 | 264 | </record> | 359 | </record> |
4095 | 360 | |||
4096 | 361 | <!-- Commitment Voucher Actions from FO --> | ||
4097 | 362 | <record model="ir.actions.act_window" id="action_account_commitment_from_fo"> | ||
4098 | 363 | <field name="res_model">account.commitment</field> | ||
4099 | 364 | <field name="view_type">form</field> | ||
4100 | 365 | <field name="view_mode">tree,form</field> | ||
4101 | 366 | <field name="search_view_id" ref="account_commitment_fo_search_copy"/> | ||
4102 | 367 | <field name="domain">[('cv_flow_type', '=', 'customer')]</field> | ||
4103 | 368 | <field name="context">{'search_default_draft': 1, 'search_default_validated': 1, 'target_filename_prefix': 'Commitment Vouchers'}</field> | ||
4104 | 369 | </record> | ||
4105 | 370 | <record model="ir.actions.act_window.view" id="action_account_commitment_from_fo_tree"> | ||
4106 | 371 | <field name="sequence" eval="10"/> | ||
4107 | 372 | <field name="view_mode">tree</field> | ||
4108 | 373 | <field name="view_id" ref="account_commitment_fo_tree_copy"/> | ||
4109 | 374 | <field name="act_window_id" ref="action_account_commitment_from_fo"/> | ||
4110 | 375 | </record> | ||
4111 | 376 | <record model="ir.actions.act_window.view" id="action_account_commitment_from_fo_form"> | ||
4112 | 377 | <field name="sequence" eval="20"/> | ||
4113 | 378 | <field name="view_mode">form</field> | ||
4114 | 379 | <field name="view_id" ref="account_commitment_fo_form_copy"/> | ||
4115 | 380 | <field name="act_window_id" ref="action_account_commitment_from_fo"/> | ||
4116 | 381 | </record> | ||
4117 | 382 | |||
4118 | 265 | 383 | ||
4119 | 266 | <!-- next 2 views: duplicate AJI form/tree for commitment Lines (only used to link dedicated sidebar entries --> | 384 | <!-- next 2 views: duplicate AJI form/tree for commitment Lines (only used to link dedicated sidebar entries --> |
4120 | 267 | <record id="view_account_analytic_line_tree_commline" model="ir.ui.view"> | 385 | <record id="view_account_analytic_line_tree_commline" model="ir.ui.view"> |
4121 | @@ -337,9 +455,10 @@ | |||
4122 | 337 | 455 | ||
4123 | 338 | <!-- Menu --> | 456 | <!-- Menu --> |
4124 | 339 | <menuitem id="menu_commitment" name="Commitments" parent="account.menu_finance" sequence="4"/> | 457 | <menuitem id="menu_commitment" name="Commitments" parent="account.menu_finance" sequence="4"/> |
4128 | 340 | <menuitem name="Commitment Voucher" action="action_account_commitment_tree" id="menu_commitment_entries" parent="menu_commitment" sequence="1"/> | 458 | <menuitem name="Customer Commitment Vouchers" action="action_account_commitment_from_fo" id="menu_account_commitment_from_fo" parent="menu_commitment" sequence="10"/> |
4129 | 341 | <menuitem name="Commitment Lines" action="action_engagement_line_tree" id="menu_engagement_lines" parent="menu_commitment" sequence="2"/> | 459 | <menuitem name="Supplier Commitment Vouchers" action="action_account_commitment_tree" id="menu_commitment_entries" parent="menu_commitment" sequence="20"/> |
4130 | 342 | <menuitem name="Import Intl Commitments" action="action_import_commitment_wizard" id="menu_import_commitment" parent="menu_commitment" sequence="3"/> | 460 | <menuitem name="Commitment Lines" action="action_engagement_line_tree" id="menu_engagement_lines" parent="menu_commitment" sequence="30"/> |
4131 | 461 | <menuitem name="Import Intl Commitments" action="action_import_commitment_wizard" id="menu_import_commitment" parent="menu_commitment" sequence="40"/> | ||
4132 | 343 | 462 | ||
4133 | 344 | </data> | 463 | </data> |
4134 | 345 | 464 | ||
4135 | 346 | 465 | ||
4136 | === modified file 'bin/addons/analytic_distribution/account_invoice_refund.py' | |||
4137 | --- bin/addons/analytic_distribution/account_invoice_refund.py 2019-06-24 14:40:19 +0000 | |||
4138 | +++ bin/addons/analytic_distribution/account_invoice_refund.py 2021-11-03 13:33:55 +0000 | |||
4139 | @@ -33,7 +33,6 @@ | |||
4140 | 33 | """ | 33 | """ |
4141 | 34 | WARNING: This method has been taken from account module from OpenERP | 34 | WARNING: This method has been taken from account module from OpenERP |
4142 | 35 | """ | 35 | """ |
4143 | 36 | # @@@override@account.wizard.account_invoice_refund.py | ||
4144 | 37 | obj_journal = self.pool.get('account.journal') | 36 | obj_journal = self.pool.get('account.journal') |
4145 | 38 | obj_inv = self.pool.get('account.invoice') | 37 | obj_inv = self.pool.get('account.invoice') |
4146 | 39 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) | 38 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) |
4147 | @@ -43,8 +42,16 @@ | |||
4148 | 43 | # in case of a DI refund from a register line use the dir_invoice_id in context | 42 | # in case of a DI refund from a register line use the dir_invoice_id in context |
4149 | 44 | doc_to_refund_id = context.get('dir_invoice_id', False) or (context.get('active_ids') and context['active_ids'][0]) | 43 | doc_to_refund_id = context.get('dir_invoice_id', False) or (context.get('active_ids') and context['active_ids'][0]) |
4150 | 45 | if doc_to_refund_id: | 44 | if doc_to_refund_id: |
4153 | 46 | source = obj_inv.read(cr, uid, doc_to_refund_id, ['type', 'is_intermission'], context=context) | 45 | source = obj_inv.read(cr, uid, doc_to_refund_id, ['type', 'is_intermission', 'doc_type', 'journal_id'], context=context) |
4154 | 47 | if source['is_intermission']: | 46 | if source['doc_type'] == 'stv': |
4155 | 47 | if source['journal_id']: | ||
4156 | 48 | # by default use the same journal for the refund | ||
4157 | 49 | args = [('id', '=', source['journal_id'][0])] | ||
4158 | 50 | else: | ||
4159 | 51 | args = [('type', '=', 'sale')] | ||
4160 | 52 | elif source['doc_type'] == 'isi': | ||
4161 | 53 | args = [('type', '=', 'purchase'), ('code', '=', 'ISI')] | ||
4162 | 54 | elif source['is_intermission']: | ||
4163 | 48 | args = [('type', '=', 'intermission')] | 55 | args = [('type', '=', 'intermission')] |
4164 | 49 | elif source['type'] in ('in_invoice', 'in_refund'): | 56 | elif source['type'] in ('in_invoice', 'in_refund'): |
4165 | 50 | args = [('type', '=', 'purchase_refund')] | 57 | args = [('type', '=', 'purchase_refund')] |
4166 | @@ -69,17 +76,24 @@ | |||
4167 | 69 | context = {} | 76 | context = {} |
4168 | 70 | journal_obj = self.pool.get('account.journal') | 77 | journal_obj = self.pool.get('account.journal') |
4169 | 71 | res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) | 78 | res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) |
4174 | 72 | jtype = 'sale_refund' | 79 | if context.get('doc_type', '') == 'stv': |
4175 | 73 | if context.get('journal_type'): | 80 | jtype = 'sale' |
4176 | 74 | jtype = isinstance(context['journal_type'], list) and context['journal_type'][0] or context['journal_type'] | 81 | elif context.get('doc_type', '') == 'isi': |
4177 | 75 | if jtype in ('sale', 'sale_refund'): | 82 | jtype = 'purchase' |
4178 | 83 | else: | ||
4179 | 76 | jtype = 'sale_refund' | 84 | jtype = 'sale_refund' |
4182 | 77 | elif jtype != 'intermission': # for IVO/IVI keep using the Interm. journal | 85 | if context.get('journal_type'): |
4183 | 78 | jtype = 'purchase_refund' | 86 | jtype = isinstance(context['journal_type'], list) and context['journal_type'][0] or context['journal_type'] |
4184 | 87 | if jtype in ('sale', 'sale_refund'): | ||
4185 | 88 | jtype = 'sale_refund' | ||
4186 | 89 | elif jtype != 'intermission': # for IVO/IVI keep using the Interm. journal | ||
4187 | 90 | jtype = 'purchase_refund' | ||
4188 | 79 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) | 91 | user = self.pool.get('res.users').browse(cr, uid, uid, context=context) |
4189 | 80 | for field in res['fields']: | 92 | for field in res['fields']: |
4190 | 81 | if field == 'journal_id' and user.company_id.instance_id: | 93 | if field == 'journal_id' and user.company_id.instance_id: |
4191 | 82 | journal_domain = [('type', '=', jtype), ('is_current_instance', '=', True)] | 94 | journal_domain = [('type', '=', jtype), ('is_current_instance', '=', True)] |
4192 | 95 | if context.get('doc_type', '') == 'isi': | ||
4193 | 96 | journal_domain.append(('code', '=', 'ISI')) | ||
4194 | 83 | journal_select = journal_obj._name_search(cr, uid, '', journal_domain, context=context, limit=None, name_get_uid=1) | 97 | journal_select = journal_obj._name_search(cr, uid, '', journal_domain, context=context, limit=None, name_get_uid=1) |
4195 | 84 | res['fields'][field]['selection'] = journal_select | 98 | res['fields'][field]['selection'] = journal_select |
4196 | 85 | res['fields'][field]['domain'] = journal_domain | 99 | res['fields'][field]['domain'] = journal_domain |
4197 | @@ -88,7 +102,9 @@ | |||
4198 | 88 | _columns = { | 102 | _columns = { |
4199 | 89 | 'date': fields.date('Posting date'), | 103 | 'date': fields.date('Posting date'), |
4200 | 90 | 'document_date': fields.date('Document Date', required=True), | 104 | 'document_date': fields.date('Document Date', required=True), |
4202 | 91 | 'is_intermission': fields.boolean("Wizard opened from an Intermission Voucher", readonly=True) | 105 | 'is_intermission': fields.boolean("Wizard opened from an Intermission Voucher", readonly=True), |
4203 | 106 | 'is_stv': fields.boolean("Wizard opened from a Stock Transfer Voucher", readonly=True), | ||
4204 | 107 | 'is_isi': fields.boolean("Wizard opened from an Intersection Supplier Invoice", readonly=True), | ||
4205 | 92 | } | 108 | } |
4206 | 93 | 109 | ||
4207 | 94 | def _get_refund(self, cr, uid, context=None): | 110 | def _get_refund(self, cr, uid, context=None): |
4208 | @@ -97,8 +113,10 @@ | |||
4209 | 97 | """ | 113 | """ |
4210 | 98 | if context is None: | 114 | if context is None: |
4211 | 99 | context = {} | 115 | context = {} |
4213 | 100 | if context.get('is_intermission', False): | 116 | if context.get('is_intermission', False) or context.get('doc_type', '') == 'stv': |
4214 | 101 | return 'modify' | 117 | return 'modify' |
4215 | 118 | elif context.get('doc_type', '') == 'isi': | ||
4216 | 119 | return 'cancel' | ||
4217 | 102 | return 'refund' # note that only the "Refund" option is available in DI | 120 | return 'refund' # note that only the "Refund" option is available in DI |
4218 | 103 | 121 | ||
4219 | 104 | def _get_is_intermission(self, cr, uid, context=None): | 122 | def _get_is_intermission(self, cr, uid, context=None): |
4220 | @@ -109,11 +127,29 @@ | |||
4221 | 109 | context = {} | 127 | context = {} |
4222 | 110 | return context.get('is_intermission', False) | 128 | return context.get('is_intermission', False) |
4223 | 111 | 129 | ||
4224 | 130 | def _get_is_stv(self, cr, uid, context=None): | ||
4225 | 131 | """ | ||
4226 | 132 | Returns True if the wizard has been opened from a Stock Transfer Voucher | ||
4227 | 133 | """ | ||
4228 | 134 | if context is None: | ||
4229 | 135 | context = {} | ||
4230 | 136 | return context.get('doc_type', '') == 'stv' | ||
4231 | 137 | |||
4232 | 138 | def _get_is_isi(self, cr, uid, context=None): | ||
4233 | 139 | """ | ||
4234 | 140 | Returns True if the wizard has been opened from an Intersection Supplier Invoice | ||
4235 | 141 | """ | ||
4236 | 142 | if context is None: | ||
4237 | 143 | context = {} | ||
4238 | 144 | return context.get('doc_type', '') == 'isi' | ||
4239 | 145 | |||
4240 | 112 | _defaults = { | 146 | _defaults = { |
4241 | 113 | 'document_date': _get_document_date, | 147 | 'document_date': _get_document_date, |
4242 | 114 | 'filter_refund': _get_refund, | 148 | 'filter_refund': _get_refund, |
4243 | 115 | 'journal_id': _get_journal, # US-193 | 149 | 'journal_id': _get_journal, # US-193 |
4244 | 116 | 'is_intermission': _get_is_intermission, | 150 | 'is_intermission': _get_is_intermission, |
4245 | 151 | 'is_stv': _get_is_stv, | ||
4246 | 152 | 'is_isi': _get_is_isi, | ||
4247 | 117 | } | 153 | } |
4248 | 118 | 154 | ||
4249 | 119 | def _hook_fields_for_modify_refund(self, cr, uid, *args): | 155 | def _hook_fields_for_modify_refund(self, cr, uid, *args): |
4250 | @@ -143,7 +179,7 @@ | |||
4251 | 143 | else: | 179 | else: |
4252 | 144 | return self.pool.get('account.invoice').refund(cr, uid, inv_ids, date, period, description, journal_id, context=context) | 180 | return self.pool.get('account.invoice').refund(cr, uid, inv_ids, date, period, description, journal_id, context=context) |
4253 | 145 | 181 | ||
4255 | 146 | def _hook_create_invoice(self, cr, uid, data, form, *args): | 182 | def _hook_create_invoice(self, cr, uid, data, form, context=None): |
4256 | 147 | """ | 183 | """ |
4257 | 148 | Permits to adapt invoice creation | 184 | Permits to adapt invoice creation |
4258 | 149 | """ | 185 | """ |
4259 | @@ -151,7 +187,7 @@ | |||
4260 | 151 | self.pool.get('finance.tools').check_document_date(cr, uid, | 187 | self.pool.get('finance.tools').check_document_date(cr, uid, |
4261 | 152 | form['document_date'], form['date']) | 188 | form['document_date'], form['date']) |
4262 | 153 | data.update({'document_date': form['document_date']}) | 189 | data.update({'document_date': form['document_date']}) |
4264 | 154 | return super(account_invoice_refund, self)._hook_create_invoice(cr, uid, data, form) | 190 | return super(account_invoice_refund, self)._hook_create_invoice(cr, uid, data, form, context=context) |
4265 | 155 | 191 | ||
4266 | 156 | def _hook_get_period_from_date(self, cr, uid, invoice_id, date=False, period=False): | 192 | def _hook_get_period_from_date(self, cr, uid, invoice_id, date=False, period=False): |
4267 | 157 | """ | 193 | """ |
4268 | 158 | 194 | ||
4269 | === modified file 'bin/addons/analytic_distribution/account_invoice_view.xml' | |||
4270 | --- bin/addons/analytic_distribution/account_invoice_view.xml 2020-01-21 14:01:11 +0000 | |||
4271 | +++ bin/addons/analytic_distribution/account_invoice_view.xml 2021-11-03 13:33:55 +0000 | |||
4272 | @@ -2,70 +2,6 @@ | |||
4273 | 2 | <openerp> | 2 | <openerp> |
4274 | 3 | <data> | 3 | <data> |
4275 | 4 | 4 | ||
4276 | 5 | <!-- Add new analytic distribution button --> | ||
4277 | 6 | <record id="invoice_supplier_form_2" model="ir.ui.view"> | ||
4278 | 7 | <field name="name">account.invoice.supplier.form.2</field> | ||
4279 | 8 | <field name="model">account.invoice</field> | ||
4280 | 9 | <field name="type">form</field> | ||
4281 | 10 | <field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
4282 | 11 | <field name="priority">30</field> | ||
4283 | 12 | <field name="arch" type="xml"> | ||
4284 | 13 | <data> | ||
4285 | 14 | <xpath expr="/form/notebook" position="before"> | ||
4286 | 15 | <newline /> | ||
4287 | 16 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> | ||
4288 | 17 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/> | ||
4289 | 18 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
4290 | 19 | </group> | ||
4291 | 20 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"> | ||
4292 | 21 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/> | ||
4293 | 22 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
4294 | 23 | </group> | ||
4295 | 24 | <field name="analytic_distribution_id" invisible="1"/> | ||
4296 | 25 | <group colspan="3"/> | ||
4297 | 26 | </xpath> | ||
4298 | 27 | <xpath expr="//tree[@string='Invoice lines']/field[@name='account_analytic_id']" position="replace"> | ||
4299 | 28 | <field name="inactive_product" invisible="1" /> | ||
4300 | 29 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/> | ||
4301 | 30 | <field name="analytic_distribution_state_recap"/> | ||
4302 | 31 | <field name="have_analytic_distribution_from_header" invisible="1"/> | ||
4303 | 32 | <field name="analytic_distribution_state" invisible="1"/> | ||
4304 | 33 | <field name="is_allocatable" invisible="1"/> | ||
4305 | 34 | </xpath> | ||
4306 | 35 | <xpath expr="//tree[@string='Invoice lines']" position="attributes"> | ||
4307 | 36 | <attribute name="colors">red:analytic_distribution_state in ('invalid', 'invalid_small_amount') or inactive_product == True;black:analytic_distribution_state in ('none','valid') and inactive_product == False</attribute> | ||
4308 | 37 | </xpath> | ||
4309 | 38 | <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before"> | ||
4310 | 39 | <field name="is_corrected" invisible="1"/> | ||
4311 | 40 | <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/> | ||
4312 | 41 | </xpath> | ||
4313 | 42 | </data> | ||
4314 | 43 | </field> | ||
4315 | 44 | </record> | ||
4316 | 45 | |||
4317 | 46 | <record id="invoice_form_2" model="ir.ui.view"> | ||
4318 | 47 | <field name="name">account.invoice.supplier.form.2</field> | ||
4319 | 48 | <field name="model">account.invoice</field> | ||
4320 | 49 | <field name="type">form</field> | ||
4321 | 50 | <field name="inherit_id" ref="account.invoice_form"/> | ||
4322 | 51 | <field name="priority">35</field> | ||
4323 | 52 | <field name="arch" type="xml"> | ||
4324 | 53 | <data> | ||
4325 | 54 | <xpath expr="/form/notebook" position="before"> | ||
4326 | 55 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"> | ||
4327 | 56 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/> | ||
4328 | 57 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
4329 | 58 | </group> | ||
4330 | 59 | <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"> | ||
4331 | 60 | <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-emblem-important" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}"/> | ||
4332 | 61 | <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/> | ||
4333 | 62 | </group> | ||
4334 | 63 | <field name="analytic_distribution_id" invisible="1"/> | ||
4335 | 64 | <group colspan="3"/> | ||
4336 | 65 | </xpath> | ||
4337 | 66 | </data> | ||
4338 | 67 | </field> | ||
4339 | 68 | </record> | ||
4340 | 69 | 5 | ||
4341 | 70 | <record id="view_invoice_line_tree_2" model="ir.ui.view"> | 6 | <record id="view_invoice_line_tree_2" model="ir.ui.view"> |
4342 | 71 | <field name="name">account.invoice.line.tree.2</field> | 7 | <field name="name">account.invoice.line.tree.2</field> |
4343 | @@ -122,7 +58,11 @@ | |||
4344 | 122 | <xpath expr="//field[@name='invoice_line_tax_id']" position="replace"> | 58 | <xpath expr="//field[@name='invoice_line_tax_id']" position="replace"> |
4345 | 123 | <field name="vat_ok" invisible="1" /> | 59 | <field name="vat_ok" invisible="1" /> |
4346 | 124 | <field name="synced" invisible="1" /> | 60 | <field name="synced" invisible="1" /> |
4348 | 125 | <group colspan="4" col="4" attrs="{'invisible': [('vat_ok', '=', False)]}"> | 61 | <field name="line_doc_type" invisible="1" /> |
4349 | 62 | <!-- note: in STV and STR taxes are hidden even for external partners as these are in fact "false" external partners | ||
4350 | 63 | (e.g. instances for which the deployment of UniField hasn't been finished) --> | ||
4351 | 64 | <group colspan="4" col="4" | ||
4352 | 65 | attrs="{'invisible': ['|', ('vat_ok', '=', False), ('line_doc_type', 'in', ('stv', 'str', 'isi', 'isr'))]}"> | ||
4353 | 126 | <separator colspan="4" string="Taxes"/> | 66 | <separator colspan="4" string="Taxes"/> |
4354 | 127 | <field colspan="4" | 67 | <field colspan="4" |
4355 | 128 | name="invoice_line_tax_id" | 68 | name="invoice_line_tax_id" |
4356 | 129 | 69 | ||
4357 | === modified file 'bin/addons/analytic_distribution/account_view.xml' | |||
4358 | --- bin/addons/analytic_distribution/account_view.xml 2021-09-07 16:24:58 +0000 | |||
4359 | +++ bin/addons/analytic_distribution/account_view.xml 2021-11-03 13:33:55 +0000 | |||
4360 | @@ -42,38 +42,6 @@ | |||
4361 | 42 | </field> | 42 | </field> |
4362 | 43 | </record> | 43 | </record> |
4363 | 44 | 44 | ||
4364 | 45 | <record id="view_account_form" model="ir.ui.view"> | ||
4365 | 46 | <field name="name">account.form</field> | ||
4366 | 47 | <field name="model">account.account</field> | ||
4367 | 48 | <field name="type">form</field> | ||
4368 | 49 | <field name="inherit_id" ref="account.view_account_form"/> | ||
4369 | 50 | <field name="priority">25</field> | ||
4370 | 51 | <field name="arch" type="xml"> | ||
4371 | 52 | <data> | ||
4372 | 53 | <xpath expr="//field[@name='user_type']" position="replace"> | ||
4373 | 54 | <field name="user_type_code" invisible="1"/> | ||
4374 | 55 | <field name="is_analytic_addicted" invisible="1"/> | ||
4375 | 56 | <field name="user_type" on_change="onchange_user_type(user_type, code)"/> | ||
4376 | 57 | </xpath> | ||
4377 | 58 | <xpath expr="/form/notebook/page[@string='General Information']" position="after"> | ||
4378 | 59 | <page string="Analytical Destination"> | ||
4379 | 60 | <field name="default_destination_id" colspan="2" | ||
4380 | 61 | attrs="{'required': [('is_analytic_addicted', '=', True)], 'readonly': [('is_analytic_addicted', '!=', True)]}"/> | ||
4381 | 62 | <label string="" colspan="2"/> | ||
4382 | 63 | <field name="destination_ids" nolabel="1" colspan="4" domain="[('type', '!=', 'view'), ('category', '=', 'DEST')]"> | ||
4383 | 64 | <tree string="Destinations"> | ||
4384 | 65 | <field name="name"/> | ||
4385 | 66 | <field name="description"/> | ||
4386 | 67 | <field name="date_start"/> | ||
4387 | 68 | <field name="date"/> | ||
4388 | 69 | </tree> | ||
4389 | 70 | </field> | ||
4390 | 71 | </page> | ||
4391 | 72 | </xpath> | ||
4392 | 73 | </data> | ||
4393 | 74 | </field> | ||
4394 | 75 | </record> | ||
4395 | 76 | |||
4396 | 77 | <record id="analytic_view_move_form" model="ir.ui.view"> | 45 | <record id="analytic_view_move_form" model="ir.ui.view"> |
4397 | 78 | <field name="name">analytic.view.move.form</field> | 46 | <field name="name">analytic.view.move.form</field> |
4398 | 79 | <field name="model">account.move</field> | 47 | <field name="model">account.move</field> |
4399 | 80 | 48 | ||
4400 | === modified file 'bin/addons/analytic_distribution/analytic_line_view.xml' | |||
4401 | --- bin/addons/analytic_distribution/analytic_line_view.xml 2016-09-28 08:20:24 +0000 | |||
4402 | +++ bin/addons/analytic_distribution/analytic_line_view.xml 2021-11-03 13:33:55 +0000 | |||
4403 | @@ -2,42 +2,6 @@ | |||
4404 | 2 | <openerp> | 2 | <openerp> |
4405 | 3 | <data> | 3 | <data> |
4406 | 4 | 4 | ||
4407 | 5 | <!-- Add icon ahead analytic line to inform if this line have been reallocated or not --> | ||
4408 | 6 | <record id="inherit2_view_account_analytic_line_tree" model="ir.ui.view"> | ||
4409 | 7 | <field name="name">account.analytic.line.tree</field> | ||
4410 | 8 | <field name="model">account.analytic.line</field> | ||
4411 | 9 | <field name="type">tree</field> | ||
4412 | 10 | <field name="inherit_id" ref="account.view_account_analytic_line_tree"/> | ||
4413 | 11 | <field name="priority" eval="11"/> | ||
4414 | 12 | <field name="arch" type="xml"> | ||
4415 | 13 | <data> | ||
4416 | 14 | <xpath expr="/tree/field[@name='move_id']" position='replace'> | ||
4417 | 15 | <field name="entry_sequence"/> | ||
4418 | 16 | </xpath> | ||
4419 | 17 | <xpath expr="/tree/field[@name='functional_currency_id']" position="after"> | ||
4420 | 18 | <field name="output_amount"/> | ||
4421 | 19 | <field name="output_currency"/> | ||
4422 | 20 | </xpath> | ||
4423 | 21 | </data> | ||
4424 | 22 | </field> | ||
4425 | 23 | </record> | ||
4426 | 24 | |||
4427 | 25 | <!-- View for Analytic Journal Items (FUNDING POOL) --> | ||
4428 | 26 | <record id="view_account_analytic_line_tree" model="ir.ui.view"> | ||
4429 | 27 | <field name="name">account.analytic.line.tree</field> | ||
4430 | 28 | <field name="model">account.analytic.line</field> | ||
4431 | 29 | <field name="type">tree</field> | ||
4432 | 30 | <field name="inherit_id" ref="account.view_account_analytic_line_tree"/> | ||
4433 | 31 | <field name="priority" eval="12"/> | ||
4434 | 32 | <field name="arch" type="xml"> | ||
4435 | 33 | <data> | ||
4436 | 34 | <xpath expr="/tree/field[@name='account_id']" position='before'> | ||
4437 | 35 | <field name="destination_id" string="Destination" invisible="not context.get('display_fp', False)"/> | ||
4438 | 36 | <field name="cost_center_id" string="Cost Center" invisible="not context.get('display_fp', False)"/> | ||
4439 | 37 | </xpath> | ||
4440 | 38 | </data> | ||
4441 | 39 | </field> | ||
4442 | 40 | </record> | ||
4443 | 41 | 5 | ||
4444 | 42 | <!-- Action for Analytic Journal Items (FUNDING POOL) --> | 6 | <!-- Action for Analytic Journal Items (FUNDING POOL) --> |
4445 | 43 | <record id="account.action_account_analytic_journal_open_form" model="ir.actions.act_window"> | 7 | <record id="account.action_account_analytic_journal_open_form" model="ir.actions.act_window"> |
4446 | @@ -45,7 +9,7 @@ | |||
4447 | 45 | <field name="res_model">account.analytic.line</field> | 9 | <field name="res_model">account.analytic.line</field> |
4448 | 46 | <field name="view_type">form</field> | 10 | <field name="view_type">form</field> |
4449 | 47 | <field name="view_mode">tree,form</field> | 11 | <field name="view_mode">tree,form</field> |
4451 | 48 | <field name="view_id" ref="view_account_analytic_line_tree"/> | 12 | <field name="view_id" ref="account.view_account_analytic_line_tree"/> |
4452 | 49 | <field name="domain">[('account_id.category', '=', 'FUNDING')]</field> | 13 | <field name="domain">[('account_id.category', '=', 'FUNDING')]</field> |
4453 | 50 | <field name="context">{'display_fp': True, 'target_filename_prefix': 'Analytic Journal Items'}</field> | 14 | <field name="context">{'display_fp': True, 'target_filename_prefix': 'Analytic Journal Items'}</field> |
4454 | 51 | </record> | 15 | </record> |
4455 | @@ -60,7 +24,7 @@ | |||
4456 | 60 | <field name="res_model">account.analytic.line</field> | 24 | <field name="res_model">account.analytic.line</field> |
4457 | 61 | <field name="view_type">form</field> | 25 | <field name="view_type">form</field> |
4458 | 62 | <field name="view_mode">tree,form</field> | 26 | <field name="view_mode">tree,form</field> |
4460 | 63 | <field name="view_id" ref="view_account_analytic_line_tree"/> | 27 | <field name="view_id" ref="account.view_account_analytic_line_tree"/> |
4461 | 64 | <field name="domain">[('account_id.category', '=', 'FREE1')]</field> | 28 | <field name="domain">[('account_id.category', '=', 'FREE1')]</field> |
4462 | 65 | <field name="context">{'display_fp': False, 'categ': 'FREE1'}</field> | 29 | <field name="context">{'display_fp': False, 'categ': 'FREE1'}</field> |
4463 | 66 | </record> | 30 | </record> |
4464 | @@ -75,7 +39,7 @@ | |||
4465 | 75 | <field name="res_model">account.analytic.line</field> | 39 | <field name="res_model">account.analytic.line</field> |
4466 | 76 | <field name="view_type">form</field> | 40 | <field name="view_type">form</field> |
4467 | 77 | <field name="view_mode">tree,form</field> | 41 | <field name="view_mode">tree,form</field> |
4469 | 78 | <field name="view_id" ref="view_account_analytic_line_tree"/> | 42 | <field name="view_id" ref="account.view_account_analytic_line_tree"/> |
4470 | 79 | <field name="domain">[('account_id.category', '=', 'FREE2')]</field> | 43 | <field name="domain">[('account_id.category', '=', 'FREE2')]</field> |
4471 | 80 | <field name="context">{'display_fp': False, 'categ': 'FREE2'}</field> | 44 | <field name="context">{'display_fp': False, 'categ': 'FREE2'}</field> |
4472 | 81 | </record> | 45 | </record> |
4473 | 82 | 46 | ||
4474 | === modified file 'bin/addons/analytic_distribution_supply/__openerp__.py' | |||
4475 | --- bin/addons/analytic_distribution_supply/__openerp__.py 2017-10-04 05:23:42 +0000 | |||
4476 | +++ bin/addons/analytic_distribution_supply/__openerp__.py 2021-11-03 13:33:55 +0000 | |||
4477 | @@ -30,7 +30,6 @@ | |||
4478 | 30 | "depends" : ["base", "account_journal", "analytic_distribution", "purchase_override", "stock", "res_currency_functional"], | 30 | "depends" : ["base", "account_journal", "analytic_distribution", "purchase_override", "stock", "res_currency_functional"], |
4479 | 31 | "init_xml" : [], | 31 | "init_xml" : [], |
4480 | 32 | "update_xml" : [ | 32 | "update_xml" : [ |
4481 | 33 | "account_commitment_view.xml", | ||
4482 | 34 | ], | 33 | ], |
4483 | 35 | "demo_xml" : [], | 34 | "demo_xml" : [], |
4484 | 36 | "test": [ | 35 | "test": [ |
4485 | 37 | 36 | ||
4486 | === removed file 'bin/addons/analytic_distribution_supply/account_commitment_view.xml' | |||
4487 | === modified file 'bin/addons/analytic_distribution_supply/invoice.py' | |||
4488 | --- bin/addons/analytic_distribution_supply/invoice.py 2021-08-11 12:34:27 +0000 | |||
4489 | +++ bin/addons/analytic_distribution_supply/invoice.py 2021-11-03 13:33:55 +0000 | |||
4490 | @@ -27,7 +27,7 @@ | |||
4491 | 27 | from tools.translate import _ | 27 | from tools.translate import _ |
4492 | 28 | from base import currency_date | 28 | from base import currency_date |
4493 | 29 | import netsvc | 29 | import netsvc |
4495 | 30 | 30 | import time | |
4496 | 31 | 31 | ||
4497 | 32 | class account_invoice_line(osv.osv): | 32 | class account_invoice_line(osv.osv): |
4498 | 33 | _name = 'account.invoice.line' | 33 | _name = 'account.invoice.line' |
4499 | @@ -130,38 +130,65 @@ | |||
4500 | 130 | if isinstance(ids, (int, long)): | 130 | if isinstance(ids, (int, long)): |
4501 | 131 | ids = [ids] | 131 | ids = [ids] |
4502 | 132 | 132 | ||
4503 | 133 | cv_obj = self.pool.get('account.commitment') | ||
4504 | 134 | cv_line_obj = self.pool.get('account.commitment.line') | ||
4505 | 135 | curr_obj = self.pool.get('res.currency') | ||
4506 | 136 | check_cv_to_close = {} | ||
4507 | 133 | # Browse invoices | 137 | # Browse invoices |
4508 | 134 | for inv in self.browse(cr, uid, ids, context=context): | 138 | for inv in self.browse(cr, uid, ids, context=context): |
4509 | 135 | grouped_invl_by_acc = {} | 139 | grouped_invl_by_acc = {} |
4510 | 136 | grouped_invl_by_cvl = {} | 140 | grouped_invl_by_cvl = {} |
4514 | 137 | co_ids = self.pool.get('account.commitment').search(cr, uid, [('purchase_id', 'in', [x.id for x in inv.purchase_ids]), ('state', 'in', ['open', 'draft'])], order='date desc', context=context) | 141 | |
4515 | 138 | if not co_ids: | 142 | invoice_curr = inv.currency_id.id |
4516 | 139 | continue | 143 | |
4517 | 144 | |||
4518 | 145 | cv_on_po = cv_obj.search_exists(cr, uid, [('purchase_id', 'in', [x.id for x in inv.purchase_ids]), ('state', 'in', ['open', 'draft'])], context=context) | ||
4519 | 146 | cv_on_fo = False | ||
4520 | 147 | if not cv_on_po: | ||
4521 | 148 | cv_on_fo = cv_obj.search_exists(cr, uid, [('sale_id', 'in', [x.id for x in inv.order_ids]), ('state', 'in', ['open', 'draft'])], context=context) | ||
4522 | 149 | if not cv_on_fo: | ||
4523 | 150 | continue | ||
4524 | 140 | 151 | ||
4525 | 141 | for invl in inv.invoice_line: | 152 | for invl in inv.invoice_line: |
4526 | 142 | # Do not take invoice line that have no order_line_id (so that are not linked to a purchase order line) | 153 | # Do not take invoice line that have no order_line_id (so that are not linked to a purchase order line) |
4533 | 143 | if not invl.order_line_id and not inv.is_merged_by_account: | 154 | if cv_on_po: |
4534 | 144 | continue | 155 | if not invl.order_line_id and not inv.is_merged_by_account: |
4535 | 145 | # exclude push flow | 156 | continue |
4536 | 146 | if invl.order_line_id and (invl.order_line_id.order_id.push_fo or invl.order_line_id.set_as_sourced_n): | 157 | # exclude push flow |
4537 | 147 | continue | 158 | if invl.order_line_id and (invl.order_line_id.order_id.push_fo or invl.order_line_id.set_as_sourced_n): |
4538 | 148 | old_cv_version = True | 159 | continue |
4539 | 160 | old_cv_version = True | ||
4540 | 161 | else: | ||
4541 | 162 | if not invl.sale_order_line_id: | ||
4542 | 163 | continue | ||
4543 | 164 | old_cv_version = False | ||
4544 | 165 | |||
4545 | 149 | # CV STARTING FROM VERSION 2 | 166 | # CV STARTING FROM VERSION 2 |
4546 | 150 | amount_to_subtract = invl.price_subtotal or 0.0 | 167 | amount_to_subtract = invl.price_subtotal or 0.0 |
4547 | 151 | for cv_line in invl.cv_line_ids: | 168 | for cv_line in invl.cv_line_ids: |
4548 | 152 | old_cv_version = False # the field cv_line_ids exist for CVs starting from version 2 | 169 | old_cv_version = False # the field cv_line_ids exist for CVs starting from version 2 |
4549 | 153 | if abs(amount_to_subtract) <= 10**-3: | 170 | if abs(amount_to_subtract) <= 10**-3: |
4550 | 154 | break | 171 | break |
4561 | 155 | cvl_amount_left = cv_line.amount or 0.0 | 172 | if cv_on_fo: |
4562 | 156 | if cvl_amount_left: | 173 | # no group by accounts on IS/IM SI |
4563 | 157 | if cv_line.id not in grouped_invl_by_cvl: | 174 | if invoice_curr != cv_line.commit_id.currency_id.id: |
4564 | 158 | grouped_invl_by_cvl[cv_line.id] = 0 | 175 | curr_date = currency_date.get_date(self, cr, inv.document_date, inv.date_invoice) |
4565 | 159 | if amount_to_subtract >= cvl_amount_left: | 176 | |
4566 | 160 | grouped_invl_by_cvl[cv_line.id] += cvl_amount_left | 177 | amount_to_subtract = curr_obj.compute(cr, uid, invoice_curr, cv_line.commit_id.currency_id.id, amount_to_subtract, round=True, |
4567 | 161 | amount_to_subtract -= cvl_amount_left | 178 | context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}) |
4568 | 162 | else: | 179 | check_cv_to_close[cv_line.commit_id.id] = True |
4569 | 163 | grouped_invl_by_cvl[cv_line.id] += amount_to_subtract | 180 | cv_line_obj._update_so_commitment_line(cr, uid, cv_line.id, amount_to_subtract, from_cancel=False, context=context) |
4570 | 164 | amount_to_subtract = 0 | 181 | else: |
4571 | 182 | cvl_amount_left = cv_line.amount or 0.0 | ||
4572 | 183 | if cvl_amount_left: | ||
4573 | 184 | if cv_line.id not in grouped_invl_by_cvl: | ||
4574 | 185 | grouped_invl_by_cvl[cv_line.id] = 0 | ||
4575 | 186 | if amount_to_subtract >= cvl_amount_left: | ||
4576 | 187 | grouped_invl_by_cvl[cv_line.id] += cvl_amount_left | ||
4577 | 188 | amount_to_subtract -= cvl_amount_left | ||
4578 | 189 | else: | ||
4579 | 190 | grouped_invl_by_cvl[cv_line.id] += amount_to_subtract | ||
4580 | 191 | amount_to_subtract = 0 | ||
4581 | 165 | # CV IN VERSION 1 | 192 | # CV IN VERSION 1 |
4582 | 166 | if old_cv_version: | 193 | if old_cv_version: |
4583 | 167 | # Fetch purchase order line account | 194 | # Fetch purchase order line account |
4584 | @@ -183,9 +210,12 @@ | |||
4585 | 183 | grouped_invl_by_acc[a] = 0 | 210 | grouped_invl_by_acc[a] = 0 |
4586 | 184 | grouped_invl_by_acc[a] += invl.price_subtotal | 211 | grouped_invl_by_acc[a] += invl.price_subtotal |
4587 | 185 | 212 | ||
4591 | 186 | po_ids = [x.id for x in inv.purchase_ids] | 213 | if cv_on_po: |
4592 | 187 | self._update_commitments_lines(cr, uid, po_ids, account_amount_dic=grouped_invl_by_acc, | 214 | po_ids = [x.id for x in inv.purchase_ids] |
4593 | 188 | cvl_amount_dic=grouped_invl_by_cvl, from_cancel=False, context=context) | 215 | self._update_commitments_lines(cr, uid, po_ids, account_amount_dic=grouped_invl_by_acc, |
4594 | 216 | cvl_amount_dic=grouped_invl_by_cvl, from_cancel=False, context=context) | ||
4595 | 217 | if check_cv_to_close: | ||
4596 | 218 | cv_obj.test_and_close_cv_so(cr, uid, check_cv_to_close.keys(), invoice_ids=ids, context=context) | ||
4597 | 189 | 219 | ||
4598 | 190 | return True | 220 | return True |
4599 | 191 | 221 | ||
4600 | @@ -356,17 +386,20 @@ | |||
4601 | 356 | to_process = [] | 386 | to_process = [] |
4602 | 357 | # Verify if all invoice have a po that have a commitment | 387 | # Verify if all invoice have a po that have a commitment |
4603 | 358 | for inv in self.browse(cr, uid, ids, context=context): | 388 | for inv in self.browse(cr, uid, ids, context=context): |
4615 | 359 | for po in inv.purchase_ids: | 389 | if inv.order_ids: |
4616 | 360 | if po.commitment_ids: | 390 | to_process.append(inv.id) |
4617 | 361 | to_process.append(inv.id) | 391 | else: |
4618 | 362 | # UTP-536 : Check if the PO is closed and all SI are draft, then close the CV | 392 | for po in inv.purchase_ids: |
4619 | 363 | po_states = ['done'] | 393 | if po.commitment_ids: |
4620 | 364 | if po.order_type == 'direct' and po.po_version == 1: | 394 | to_process.append(inv.id) |
4621 | 365 | # DPO v1 specific use case: CV and SI are both created at DPO confirmation | 395 | # UTP-536 : Check if the PO is closed and all SI are draft, then close the CV |
4622 | 366 | # ==> close the CVs if the DPO is at least "Confirmed" and no SI is in Draft anymore | 396 | po_states = ['done'] |
4623 | 367 | po_states = ['confirmed', 'confirmed_p', 'done'] | 397 | if po.order_type == 'direct' and po.po_version == 1: |
4624 | 368 | if po.state in po_states and all(x.id in ids or x.state != 'draft' for x in po.invoice_ids): | 398 | # DPO v1 specific use case: CV and SI are both created at DPO confirmation |
4625 | 369 | self.pool.get('purchase.order')._finish_commitment(cr, uid, [po.id], context=context) | 399 | # ==> close the CVs if the DPO is at least "Confirmed" and no SI is in Draft anymore |
4626 | 400 | po_states = ['confirmed', 'confirmed_p', 'done'] | ||
4627 | 401 | if po.state in po_states and all(x.id in ids or x.state != 'draft' for x in po.invoice_ids): | ||
4628 | 402 | self.pool.get('purchase.order')._finish_commitment(cr, uid, [po.id], context=context) | ||
4629 | 370 | 403 | ||
4630 | 371 | # Process invoices | 404 | # Process invoices |
4631 | 372 | self.update_commitments(cr, uid, to_process, context=context) | 405 | self.update_commitments(cr, uid, to_process, context=context) |
4632 | 373 | 406 | ||
4633 | === modified file 'bin/addons/base/__openerp__.py' | |||
4634 | --- bin/addons/base/__openerp__.py 2019-12-12 13:30:26 +0000 | |||
4635 | +++ bin/addons/base/__openerp__.py 2021-11-03 13:33:55 +0000 | |||
4636 | @@ -23,7 +23,7 @@ | |||
4637 | 23 | 23 | ||
4638 | 24 | { | 24 | { |
4639 | 25 | 'name': 'Base', | 25 | 'name': 'Base', |
4641 | 26 | 'version': '1.6', | 26 | 'version': '1.7', |
4642 | 27 | 'category': 'Generic Modules/Base', | 27 | 'category': 'Generic Modules/Base', |
4643 | 28 | 'description': """The kernel of OpenERP, needed for all installation.""", | 28 | 'description': """The kernel of OpenERP, needed for all installation.""", |
4644 | 29 | 'author': 'OpenERP SA', | 29 | 'author': 'OpenERP SA', |
4645 | 30 | 30 | ||
4646 | === modified file 'bin/addons/base/ir/ir_actions.py' | |||
4647 | --- bin/addons/base/ir/ir_actions.py 2020-02-25 14:52:32 +0000 | |||
4648 | +++ bin/addons/base/ir/ir_actions.py 2021-11-03 13:33:55 +0000 | |||
4649 | @@ -284,7 +284,7 @@ | |||
4650 | 284 | 'view_id': fields.many2one('ir.ui.view', 'View Ref.', ondelete='cascade'), | 284 | 'view_id': fields.many2one('ir.ui.view', 'View Ref.', ondelete='cascade'), |
4651 | 285 | 'domain': fields.char('Domain Value', size=250, | 285 | 'domain': fields.char('Domain Value', size=250, |
4652 | 286 | help="Optional domain filtering of the destination data, as a Python expression"), | 286 | help="Optional domain filtering of the destination data, as a Python expression"), |
4654 | 287 | 'context': fields.char('Context Value', size=250, required=True, | 287 | 'context': fields.char('Context Value', size=512, required=True, |
4655 | 288 | help="Context dictionary as Python expression, empty by default (Default: {})"), | 288 | help="Context dictionary as Python expression, empty by default (Default: {})"), |
4656 | 289 | 'res_model': fields.char('Object', size=64, required=True, | 289 | 'res_model': fields.char('Object', size=64, required=True, |
4657 | 290 | help="Model name of the object to open in the view window"), | 290 | help="Model name of the object to open in the view window"), |
4658 | 291 | 291 | ||
4659 | === added directory 'bin/addons/base/migrations/8.0.1.7' | |||
4660 | === added file 'bin/addons/base/migrations/8.0.1.7/pre-update-bar.py' | |||
4661 | --- bin/addons/base/migrations/8.0.1.7/pre-update-bar.py 1970-01-01 00:00:00 +0000 | |||
4662 | +++ bin/addons/base/migrations/8.0.1.7/pre-update-bar.py 2021-11-03 13:33:55 +0000 | |||
4663 | @@ -0,0 +1,22 @@ | |||
4664 | 1 | import os | ||
4665 | 2 | from tools import config | ||
4666 | 3 | import logging | ||
4667 | 4 | |||
4668 | 5 | |||
4669 | 6 | def migrate(cr, version): | ||
4670 | 7 | if not cr.table_exists('ir_model_data'): | ||
4671 | 8 | return | ||
4672 | 9 | |||
4673 | 10 | logger = logging.getLogger('migration') | ||
4674 | 11 | queries = os.path.join(config['root_path'], 'addons/base/migrations/8.0.1.7/update_bar_sdref.sql') | ||
4675 | 12 | if os.path.exists(queries): | ||
4676 | 13 | with open(queries) as lines: | ||
4677 | 14 | for line in lines: | ||
4678 | 15 | if line: | ||
4679 | 16 | cr.execute('SAVEPOINT migration') | ||
4680 | 17 | try: | ||
4681 | 18 | cr.execute(line) | ||
4682 | 19 | except: | ||
4683 | 20 | logger.warn('SQL error %s' % line) | ||
4684 | 21 | cr.execute('ROLLBACK TO SAVEPOINT migration') | ||
4685 | 22 | return True | ||
4686 | 0 | 23 | ||
4687 | === added file 'bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql' | |||
4688 | --- bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql 1970-01-01 00:00:00 +0000 | |||
4689 | +++ bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql 2021-11-03 13:33:55 +0000 | |||
4690 | @@ -0,0 +1,108 @@ | |||
4691 | 1 | delete from msf_button_access_rights_button_access_rule where name='button_split_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4692 | 2 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4693 | 3 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinvoice_supplier_form_3_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4694 | 4 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_button_split_invoice' where name='BAR_account_overrideinvoice_supplier_form_3_button_split_invoice' and module='sd'; | ||
4695 | 5 | delete from msf_button_access_rights_button_access_rule where name='button_split_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4696 | 6 | delete from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4697 | 7 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinvoice_form_3_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4698 | 8 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_button_split_invoice' where name='BAR_account_overrideinvoice_form_3_button_split_invoice' and module='sd'; | ||
4699 | 9 | delete from msf_button_access_rights_button_access_rule where name='invoice_open' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4700 | 10 | delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4701 | 11 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4702 | 12 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_invoice_open' where name='BAR_account_overrideinherit_invoice_form_invoice_open' and module='sd'; | ||
4703 | 13 | delete from msf_button_access_rights_button_access_rule where name='button_analytic_distribution' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4704 | 14 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4705 | 15 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_analytic_distributioninvoice_supplier_form_2_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4706 | 16 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_button_analytic_distribution' where name='BAR_analytic_distributioninvoice_supplier_form_2_button_analytic_distribution' and module='sd'; | ||
4707 | 17 | delete from msf_button_access_rights_button_access_rule where name='button_reset_distribution' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4708 | 18 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4709 | 19 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_analytic_distributioninvoice_supplier_form_2_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4710 | 20 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_button_reset_distribution' where name='BAR_analytic_distributioninvoice_supplier_form_2_button_reset_distribution' and module='sd'; | ||
4711 | 21 | delete from msf_button_access_rights_button_access_rule where name='button_open_analytic_lines' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_button_open_analytic_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4712 | 22 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_button_open_analytic_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4713 | 23 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_analytic_distributioninvoice_supplier_form_2_button_open_analytic_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4714 | 24 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_button_open_analytic_lines' where name='BAR_analytic_distributioninvoice_supplier_form_2_button_open_analytic_lines' and module='sd'; | ||
4715 | 25 | delete from msf_button_access_rights_button_access_rule where name='button_analytic_distribution' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4716 | 26 | delete from ir_model_data where name='BAR_accountinvoice_form_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4717 | 27 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_analytic_distributioninvoice_form_2_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4718 | 28 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_button_analytic_distribution' where name='BAR_analytic_distributioninvoice_form_2_button_analytic_distribution' and module='sd'; | ||
4719 | 29 | delete from msf_button_access_rights_button_access_rule where name='button_reset_distribution' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4720 | 30 | delete from ir_model_data where name='BAR_accountinvoice_form_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4721 | 31 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_analytic_distributioninvoice_form_2_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4722 | 32 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_button_reset_distribution' where name='BAR_analytic_distributioninvoice_form_2_button_reset_distribution' and module='sd'; | ||
4723 | 33 | delete from msf_button_access_rights_button_access_rule where name='invoice_open' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_tree_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4724 | 34 | delete from ir_model_data where name='BAR_accountinvoice_tree_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4725 | 35 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_tree' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_tree_2_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4726 | 36 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_tree_invoice_open' where name='BAR_register_accountinginvoice_tree_2_invoice_open' and module='sd'; | ||
4727 | 37 | delete from msf_button_access_rights_button_access_rule where name='invoice_open' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4728 | 38 | delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4729 | 39 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_form_2_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4730 | 40 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_invoice_open' where name='BAR_register_accountinginvoice_form_2_invoice_open' and module='sd'; | ||
4731 | 41 | delete from msf_button_access_rights_button_access_rule where name='invoice_open' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4732 | 42 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4733 | 43 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_supplier_form_2_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4734 | 44 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_invoice_open' where name='BAR_register_accountinginvoice_supplier_form_2_invoice_open' and module='sd'; | ||
4735 | 45 | delete from msf_button_access_rights_button_access_rule where name='button_merge_lines' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_button_merge_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4736 | 46 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_button_merge_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4737 | 47 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinvoice_supplier_form_3_button_merge_lines' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4738 | 48 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_button_merge_lines' where name='BAR_account_overrideinvoice_supplier_form_3_button_merge_lines' and module='sd'; | ||
4739 | 49 | delete from msf_button_access_rights_button_access_rule where xmlname='account.action_account_invoice_refund' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4740 | 50 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4741 | 51 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_supplier_form_2_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4742 | 52 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_accountaction_account_invoice_refund' where name='BAR_register_accountinginvoice_supplier_form_2_accountaction_account_invoice_refund' and module='sd'; | ||
4743 | 53 | delete from msf_button_access_rights_button_access_rule where xmlname='account.action_account_invoice_refund' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4744 | 54 | delete from ir_model_data where name='BAR_accountinvoice_form_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4745 | 55 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_accountaction_account_invoice_refund' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4746 | 56 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_accountaction_account_invoice_refund' where name='BAR_account_overrideinherit_invoice_form_accountaction_account_invoice_refund' and module='sd'; | ||
4747 | 57 | delete from msf_button_access_rights_button_access_rule where xmlname='account.account_invoices' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_accountaccount_invoices' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4748 | 58 | delete from ir_model_data where name='BAR_accountinvoice_form_accountaccount_invoices' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4749 | 59 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_accountaccount_invoices' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4750 | 60 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_accountaccount_invoices' where name='BAR_account_overrideinherit_invoice_form_accountaccount_invoices' and module='sd'; | ||
4751 | 61 | delete from msf_button_access_rights_button_access_rule where name='wizard_import_si_line' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4752 | 62 | delete from ir_model_data where name='BAR_accountinvoice_form_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4753 | 63 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4754 | 64 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_wizard_import_si_line' where name='BAR_account_overrideinherit_invoice_form_wizard_import_si_line' and module='sd'; | ||
4755 | 65 | delete from msf_button_access_rights_button_access_rule where name='wizard_import_si_line' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4756 | 66 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4757 | 67 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_supplier_form_2_wizard_import_si_line' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4758 | 68 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_wizard_import_si_line' where name='BAR_register_accountinginvoice_supplier_form_2_wizard_import_si_line' and module='sd'; | ||
4759 | 69 | delete from msf_button_access_rights_button_access_rule where name='invoice_open_with_confirmation' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_invoice_open_with_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4760 | 70 | delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open_with_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4761 | 71 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_invoice_open_with_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4762 | 72 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_invoice_open_with_confirmation' where name='BAR_account_overrideinherit_invoice_form_invoice_open_with_confirmation' and module='sd'; | ||
4763 | 73 | delete from msf_button_access_rights_button_access_rule where name='invoice_open_with_sync_confirmation' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_invoice_open_with_sync_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4764 | 74 | delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open_with_sync_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4765 | 75 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_invoice_open_with_sync_confirmation' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4766 | 76 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_invoice_open_with_sync_confirmation' where name='BAR_account_overrideinherit_invoice_form_invoice_open_with_sync_confirmation' and module='sd'; | ||
4767 | 77 | delete from msf_button_access_rights_button_access_rule where name='import_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4768 | 78 | delete from ir_model_data where name='BAR_accountinvoice_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4769 | 79 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4770 | 80 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_import_invoice' where name='BAR_account_overrideinherit_invoice_form_import_invoice' and module='sd'; | ||
4771 | 81 | delete from msf_button_access_rights_button_access_rule where name='export_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4772 | 82 | delete from ir_model_data where name='BAR_accountinvoice_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4773 | 83 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4774 | 84 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_export_invoice' where name='BAR_account_overrideinherit_invoice_form_export_invoice' and module='sd'; | ||
4775 | 85 | delete from msf_button_access_rights_button_access_rule where name='invoice_cancel' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_invoice_cancel' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4776 | 86 | delete from ir_model_data where name='BAR_accountinvoice_form_invoice_cancel' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4777 | 87 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_invoice_cancel' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4778 | 88 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_invoice_cancel' where name='BAR_account_overrideinherit_invoice_form_invoice_cancel' and module='sd'; | ||
4779 | 89 | delete from msf_button_access_rights_button_access_rule where name='button_split_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4780 | 90 | delete from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4781 | 91 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_overrideinherit_invoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4782 | 92 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_form_button_split_invoice' where name='BAR_account_overrideinherit_invoice_form_button_split_invoice' and module='sd'; | ||
4783 | 93 | delete from msf_button_access_rights_button_access_rule where name='import_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4784 | 94 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4785 | 95 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_supplier_form_2_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4786 | 96 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_import_invoice' where name='BAR_register_accountinginvoice_supplier_form_2_import_invoice' and module='sd'; | ||
4787 | 97 | delete from msf_button_access_rights_button_access_rule where name='export_invoice' and id in (select res_id from ir_model_data where name='BAR_accountinvoice_supplier_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4788 | 98 | delete from ir_model_data where name='BAR_accountinvoice_supplier_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4789 | 99 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='invoice_supplier_form' and module='account') where id in (select res_id from ir_model_data where name='BAR_register_accountinginvoice_supplier_form_2_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4790 | 100 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountinvoice_supplier_form_export_invoice' where name='BAR_register_accountinginvoice_supplier_form_2_export_invoice' and module='sd'; | ||
4791 | 101 | delete from msf_button_access_rights_button_access_rule where name='button_corrections' and id in (select res_id from ir_model_data where name='BAR_accountview_account_analytic_line_tree_button_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4792 | 102 | delete from ir_model_data where name='BAR_accountview_account_analytic_line_tree_button_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4793 | 103 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='view_account_analytic_line_tree' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_mcdbaccount_analytic_line_default_button_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4794 | 104 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountview_account_analytic_line_tree_button_corrections' where name='BAR_account_mcdbaccount_analytic_line_default_button_corrections' and module='sd'; | ||
4795 | 105 | delete from msf_button_access_rights_button_access_rule where name='button_open_analytic_corrections' and id in (select res_id from ir_model_data where name='BAR_accountview_account_analytic_line_tree_button_open_analytic_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4796 | 106 | delete from ir_model_data where name='BAR_accountview_account_analytic_line_tree_button_open_analytic_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'; | ||
4797 | 107 | update msf_button_access_rights_button_access_rule set view_id=(select res_id from ir_model_data where model='ir.ui.view' and name='view_account_analytic_line_tree' and module='account') where id in (select res_id from ir_model_data where name='BAR_account_mcdbaccount_analytic_line_default_button_open_analytic_corrections' and module='sd' and model='msf_button_access_rights.button_access_rule'); | ||
4798 | 108 | update ir_model_data set last_modification=NOW(), touched='[''name'']', name='BAR_accountview_account_analytic_line_tree_button_open_analytic_corrections' where name='BAR_account_mcdbaccount_analytic_line_default_button_open_analytic_corrections' and module='sd'; | ||
4799 | 0 | 109 | ||
4800 | === modified file 'bin/addons/base/module/instance_auto_creation.py' | |||
4801 | --- bin/addons/base/module/instance_auto_creation.py 2020-07-16 09:16:26 +0000 | |||
4802 | +++ bin/addons/base/module/instance_auto_creation.py 2021-11-03 13:33:55 +0000 | |||
4803 | @@ -486,6 +486,11 @@ | |||
4804 | 486 | else: | 486 | else: |
4805 | 487 | previous_fy_dates_allowed = False | 487 | previous_fy_dates_allowed = False |
4806 | 488 | 488 | ||
4807 | 489 | if config.has_option('reconfigure', 'customer_commitment'): | ||
4808 | 490 | customer_commitment = config.getboolean('reconfigure', 'customer_commitment') | ||
4809 | 491 | else: | ||
4810 | 492 | customer_commitment = False | ||
4811 | 493 | |||
4812 | 489 | if config.has_option('reconfigure', 'payroll_ok'): | 494 | if config.has_option('reconfigure', 'payroll_ok'): |
4813 | 490 | payroll_ok = config.getboolean('reconfigure', 'payroll_ok') | 495 | payroll_ok = config.getboolean('reconfigure', 'payroll_ok') |
4814 | 491 | else: | 496 | else: |
4815 | @@ -538,6 +543,9 @@ | |||
4816 | 538 | }, | 543 | }, |
4817 | 539 | 'previous.fy.dates.setup': { | 544 | 'previous.fy.dates.setup': { |
4818 | 540 | 'previous_fy_dates_allowed': previous_fy_dates_allowed, | 545 | 'previous_fy_dates_allowed': previous_fy_dates_allowed, |
4819 | 546 | }, | ||
4820 | 547 | 'customer.commitment.setup': { | ||
4821 | 548 | 'customer_commitment': customer_commitment, | ||
4822 | 541 | } | 549 | } |
4823 | 542 | } | 550 | } |
4824 | 543 | if country_id: | 551 | if country_id: |
4825 | 544 | 552 | ||
4826 | === modified file 'bin/addons/finance/account_analytic_line_view.xml' | |||
4827 | --- bin/addons/finance/account_analytic_line_view.xml 2018-11-12 17:20:58 +0000 | |||
4828 | +++ bin/addons/finance/account_analytic_line_view.xml 2021-11-03 13:33:55 +0000 | |||
4829 | @@ -10,19 +10,34 @@ | |||
4830 | 10 | <field name="priority" eval="10"/> | 10 | <field name="priority" eval="10"/> |
4831 | 11 | <field name="arch" type="xml"> | 11 | <field name="arch" type="xml"> |
4832 | 12 | <tree editable="top" noteditable="1" string="Analytic Journal Items" hide_delete_button="1" hide_new_button="1"> | 12 | <tree editable="top" noteditable="1" string="Analytic Journal Items" hide_delete_button="1" hide_new_button="1"> |
4833 | 13 | <field name="instance_id" readonly="1"/> | ||
4834 | 14 | <field name="is_reversal" invisible="1"/> | ||
4835 | 15 | <field name="journal_type" invisible="1"/> | ||
4836 | 16 | <field name="is_corrigible" invisible="1"/> | ||
4837 | 17 | <button name="button_corrections" type="object" string="Accounting info/correction" | ||
4838 | 18 | attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/> | ||
4839 | 19 | <field name="is_reallocated" invisible="1"/> | ||
4840 | 20 | <field name="last_corrected_id" invisible="1"/> | ||
4841 | 21 | <field name="is_engi" invisible="1"/> | ||
4842 | 22 | <button string="Have been reallocated" attrs="{'invisible': [('is_reallocated', '=', False), ('last_corrected_id', '=', False)]}" icon="terp-mail-" colspan="2" name="button_open_analytic_corrections" type="object"/> | ||
4843 | 13 | <field name="journal_id" domain="[('is_current_instance','=',True)]"/> | 23 | <field name="journal_id" domain="[('is_current_instance','=',True)]"/> |
4845 | 14 | <field name="move_id"/> | 24 | <field name="entry_sequence"/> |
4846 | 15 | <field name="name"/> | 25 | <field name="name"/> |
4847 | 16 | <field name="ref"/> | 26 | <field name="ref"/> |
4848 | 17 | <field name="document_date"/> | 27 | <field name="document_date"/> |
4849 | 18 | <field name="date"/> | 28 | <field name="date"/> |
4850 | 19 | <field name="period_id"/> | 29 | <field name="period_id"/> |
4851 | 20 | <field name="general_account_id"/> | 30 | <field name="general_account_id"/> |
4852 | 31 | <field name="destination_id" string="Destination" invisible="not context.get('display_fp', False)"/> | ||
4853 | 32 | <field name="cost_center_id" string="Cost Center" invisible="not context.get('display_fp', False)"/> | ||
4854 | 21 | <field name="account_id"/> | 33 | <field name="account_id"/> |
4855 | 34 | <field name="partner_txt"/> | ||
4856 | 22 | <field name="amount_currency" sum="Sum"/> | 35 | <field name="amount_currency" sum="Sum"/> |
4857 | 23 | <field name="currency_id"/> | 36 | <field name="currency_id"/> |
4858 | 24 | <field name="amount" sum="Sum"/> | 37 | <field name="amount" sum="Sum"/> |
4859 | 25 | <field name="functional_currency_id"/> | 38 | <field name="functional_currency_id"/> |
4860 | 39 | <field name="output_amount"/> | ||
4861 | 40 | <field name="output_currency"/> | ||
4862 | 26 | <field name="reversal_origin_txt"/> | 41 | <field name="reversal_origin_txt"/> |
4863 | 27 | <field name="user_id" invisible="1"/> | 42 | <field name="user_id" invisible="1"/> |
4864 | 28 | </tree> | 43 | </tree> |
4865 | 29 | 44 | ||
4866 | === modified file 'bin/addons/finance/account_view.xml' | |||
4867 | --- bin/addons/finance/account_view.xml 2019-06-18 11:15:45 +0000 | |||
4868 | +++ bin/addons/finance/account_view.xml 2021-11-03 13:33:55 +0000 | |||
4869 | @@ -2,25 +2,6 @@ | |||
4870 | 2 | <openerp> | 2 | <openerp> |
4871 | 3 | <data> | 3 | <data> |
4872 | 4 | 4 | ||
4873 | 5 | <!-- Account View --> | ||
4874 | 6 | <record id="inherit_view_account_tree" model="ir.ui.view"> | ||
4875 | 7 | <field name="name">inherit.view.account.tree</field> | ||
4876 | 8 | <field name="model">account.account</field> | ||
4877 | 9 | <field name="type">tree</field> | ||
4878 | 10 | <field name="field_parent">child_id</field> | ||
4879 | 11 | <field name="inherit_id" ref="account.view_account_tree"/> | ||
4880 | 12 | <field name="priority">19</field> | ||
4881 | 13 | <field name="arch" type="xml"> | ||
4882 | 14 | <xpath expr="//field[@name='type']" position="replace"> | ||
4883 | 15 | </xpath> | ||
4884 | 16 | <xpath expr="//field[@name='user_type']" position="after"> | ||
4885 | 17 | <field name="type" invisible="1"/> | ||
4886 | 18 | <field name="type_for_register" invisible="1"/> | ||
4887 | 19 | <field name="accrual_account" invisible="1"/> | ||
4888 | 20 | </xpath> | ||
4889 | 21 | </field> | ||
4890 | 22 | </record> | ||
4891 | 23 | |||
4892 | 24 | <!-- | 5 | <!-- |
4893 | 25 | Journal Entries | 6 | Journal Entries |
4894 | 26 | --> | 7 | --> |
4895 | @@ -149,21 +130,6 @@ | |||
4896 | 149 | <field name="context">{'from_web_menu': True}</field> | 130 | <field name="context">{'from_web_menu': True}</field> |
4897 | 150 | </record> | 131 | </record> |
4898 | 151 | 132 | ||
4899 | 152 | <!-- Account View --> | ||
4900 | 153 | <record id="inherit_view_account_form" model="ir.ui.view"> | ||
4901 | 154 | <field name='name'>inherit.view.account.form</field> | ||
4902 | 155 | <field name='model'>account.account</field> | ||
4903 | 156 | <field name="type">form</field> | ||
4904 | 157 | <field name="priority">50</field> | ||
4905 | 158 | <field name='inherit_id' ref='account.view_account_form' /> | ||
4906 | 159 | <field name="arch" type="xml"> | ||
4907 | 160 | <xpath expr="//field[@name='user_type']" position="after"> | ||
4908 | 161 | <field name="shrink_entries_for_hq"/> | ||
4909 | 162 | <field name="is_child_of_coa" invisible="1" /> | ||
4910 | 163 | <field name="display_in_reports" attrs="{'invisible': [('is_child_of_coa', '=', False)]}" /> | ||
4911 | 164 | </xpath> | ||
4912 | 165 | </field> | ||
4913 | 166 | </record> | ||
4914 | 167 | 133 | ||
4915 | 168 | <!-- UF-1715 --> | 134 | <!-- UF-1715 --> |
4916 | 169 | <report id="account_partner_balance_tree_xls" | 135 | <report id="account_partner_balance_tree_xls" |
4917 | 170 | 136 | ||
4918 | === modified file 'bin/addons/finance/board_account_view.xml' | |||
4919 | --- bin/addons/finance/board_account_view.xml 2021-08-25 14:50:30 +0000 | |||
4920 | +++ bin/addons/finance/board_account_view.xml 2021-11-03 13:33:55 +0000 | |||
4921 | @@ -64,7 +64,7 @@ | |||
4922 | 64 | <field name="view_type">form</field> | 64 | <field name="view_type">form</field> |
4923 | 65 | <field name="view_mode">tree,form,calendar,graph</field> | 65 | <field name="view_mode">tree,form,calendar,graph</field> |
4924 | 66 | <!-- US-2704 domain is related to action_account_commitment_tree of analytic_distribution/account_commitment_view.xml with state='draft' domain addition --> | 66 | <!-- US-2704 domain is related to action_account_commitment_tree of analytic_distribution/account_commitment_view.xml with state='draft' domain addition --> |
4926 | 67 | <field name="domain">[('state', '=', 'draft')]</field> | 67 | <field name="domain">[('state', '=', 'draft'), ('cv_flow_type', '=', 'supplier')]</field> |
4927 | 68 | <field name="context">{'board_view': True, 'search_default_draft': 1}</field> | 68 | <field name="context">{'board_view': True, 'search_default_draft': 1}</field> |
4928 | 69 | <field ref="account_board_commitment_voucher_view" name="view_id"/> | 69 | <field ref="account_board_commitment_voucher_view" name="view_id"/> |
4929 | 70 | <field name="limit">5</field> | 70 | <field name="limit">5</field> |
4930 | @@ -96,8 +96,8 @@ | |||
4931 | 96 | <field name="view_type">form</field> | 96 | <field name="view_type">form</field> |
4932 | 97 | <field name="view_mode">tree,form,calendar,graph</field> | 97 | <field name="view_mode">tree,form,calendar,graph</field> |
4933 | 98 | <!-- US-2704 domain is related to account.action_invoice_tree2 of account_override/account_invoice_view.xml with state='draft' domain addition --> | 98 | <!-- US-2704 domain is related to account.action_invoice_tree2 of account_override/account_invoice_view.xml with state='draft' domain addition --> |
4936 | 99 | <field name="domain">[('state', '=', 'draft'), ('type','=','in_invoice'), ('is_direct_invoice', '=', False), ('is_inkind_donation', '=', False), ('is_debit_note', "=", False), ('is_intermission', '=', False)]</field> | 99 | <field name="domain">[('state', '=', 'draft'), ('doc_type', '=', 'si')]</field> |
4937 | 100 | <field name="context">{'board_view': True, 'type': 'in_invoice', 'search_default_draft': 1}</field> | 100 | <field name="context">{'doc_type': 'si', 'board_view': True, 'type': 'in_invoice', 'journal_type': 'purchase', 'from_inv_form': True, 'search_default_draft': 1}</field> |
4938 | 101 | <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> | 101 | <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> |
4939 | 102 | <field name="limit">5</field> | 102 | <field name="limit">5</field> |
4940 | 103 | </record> | 103 | </record> |
4941 | @@ -108,8 +108,8 @@ | |||
4942 | 108 | <field name="view_type">form</field> | 108 | <field name="view_type">form</field> |
4943 | 109 | <field name="view_mode">tree,form,calendar,graph</field> | 109 | <field name="view_mode">tree,form,calendar,graph</field> |
4944 | 110 | <!-- US-2704 domain is related to account.action_invoice_tree2 of account_override/account_invoice_view.xml with state='open' domain addition --> | 110 | <!-- US-2704 domain is related to account.action_invoice_tree2 of account_override/account_invoice_view.xml with state='open' domain addition --> |
4947 | 111 | <field name="domain">[('state', '=', 'open'), ('type','=','in_invoice'), ('is_direct_invoice', '=', False), ('is_inkind_donation', '=', False), ('is_debit_note', "=", False), ('is_intermission', '=', False)]</field> | 111 | <field name="domain">[('state', '=', 'open'), ('doc_type', '=', 'si')]</field> |
4948 | 112 | <field name="context">{'board_view': True, 'type': 'in_invoice', 'search_default_unpaid': 1}</field> | 112 | <field name="context">{'doc_type': 'si', 'board_view': True, 'type': 'in_invoice', 'journal_type': 'purchase', 'from_inv_form': True, 'search_default_unpaid': 1}</field> |
4949 | 113 | <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> | 113 | <field ref="account_board_supplier_invoice_draft_view" name="view_id"/> |
4950 | 114 | <field name="limit">5</field> | 114 | <field name="limit">5</field> |
4951 | 115 | </record> | 115 | </record> |
4952 | 116 | 116 | ||
4953 | === modified file 'bin/addons/msf_accrual/__openerp__.py' | |||
4954 | --- bin/addons/msf_accrual/__openerp__.py 2017-10-09 21:06:10 +0000 | |||
4955 | +++ bin/addons/msf_accrual/__openerp__.py 2021-11-03 13:33:55 +0000 | |||
4956 | @@ -31,7 +31,6 @@ | |||
4957 | 31 | "update_xml": [ | 31 | "update_xml": [ |
4958 | 32 | 'security/ir.model.access.csv', | 32 | 'security/ir.model.access.csv', |
4959 | 33 | 'msf_accrual_view.xml', | 33 | 'msf_accrual_view.xml', |
4960 | 34 | 'account_view.xml', | ||
4961 | 35 | 'wizard/wizard_accrual_view.xml', | 34 | 'wizard/wizard_accrual_view.xml', |
4962 | 36 | 'wizard/wizard_accrual_reversal_view.xml' | 35 | 'wizard/wizard_accrual_reversal_view.xml' |
4963 | 37 | ], | 36 | ], |
4964 | 38 | 37 | ||
4965 | === removed file 'bin/addons/msf_accrual/account_view.xml' | |||
4966 | === modified file 'bin/addons/msf_currency_revaluation/__openerp__.py' | |||
4967 | --- bin/addons/msf_currency_revaluation/__openerp__.py 2019-11-04 10:48:48 +0000 | |||
4968 | +++ bin/addons/msf_currency_revaluation/__openerp__.py 2021-11-03 13:33:55 +0000 | |||
4969 | @@ -59,7 +59,6 @@ | |||
4970 | 59 | "account", | 59 | "account", |
4971 | 60 | ], | 60 | ], |
4972 | 61 | "init_xml": [ | 61 | "init_xml": [ |
4973 | 62 | "account_view.xml", | ||
4974 | 63 | "wizard/wizard_currency_revaluation_view.xml"], | 62 | "wizard/wizard_currency_revaluation_view.xml"], |
4975 | 64 | "update_xml": [], | 63 | "update_xml": [], |
4976 | 65 | "demo_xml": [], | 64 | "demo_xml": [], |
4977 | 66 | 65 | ||
4978 | === removed file 'bin/addons/msf_currency_revaluation/account_view.xml' | |||
4979 | === modified file 'bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py' | |||
4980 | --- bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py 2019-10-30 16:33:21 +0000 | |||
4981 | +++ bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py 2021-11-03 13:33:55 +0000 | |||
4982 | @@ -373,105 +373,6 @@ | |||
4983 | 373 | self.write(cr, uid, ids, {'message': _(' Import in progress... \n Please wait that the import is finished before editing %s.') % (invoice_name or _('the object'), )}) | 373 | self.write(cr, uid, ids, {'message': _(' Import in progress... \n Please wait that the import is finished before editing %s.') % (invoice_name or _('the object'), )}) |
4984 | 374 | return False | 374 | return False |
4985 | 375 | 375 | ||
4986 | 376 | def get_invoice_view(self, cr, uid, invoice_id, view_name, domain, context=None): | ||
4987 | 377 | if view_name in ('view_intermission_form'): | ||
4988 | 378 | module = 'account_override' | ||
4989 | 379 | else: | ||
4990 | 380 | module = 'account' | ||
4991 | 381 | if view_name: | ||
4992 | 382 | view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, view_name) | ||
4993 | 383 | view_id = view_id and view_id[1] or False | ||
4994 | 384 | tree_view = self.pool.get('ir.model.data').get_object_reference(cr, | ||
4995 | 385 | uid, 'account', 'invoice_tree') | ||
4996 | 386 | tree_view_id = tree_view and tree_view[1] or False | ||
4997 | 387 | return { | ||
4998 | 388 | 'type': 'ir.actions.act_window', | ||
4999 | 389 | 'res_model': 'account.invoice', | ||
5000 | 390 | 'view_type': 'form', |
The diff has been truncated for viewing.