Merge lp:~jfb-tempo-consulting/unifield-server/US-8839 into lp:unifield-server

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
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+411252@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/account/account.py'
--- bin/addons/account/account.py 2021-01-28 17:59:49 +0000
+++ bin/addons/account/account.py 2021-11-03 13:33:55 +0000
@@ -580,6 +580,43 @@
580class account_journal(osv.osv):580class account_journal(osv.osv):
581 _name = "account.journal"581 _name = "account.journal"
582 _description = "Journal"582 _description = "Journal"
583
584 def _get_false(self, cr, uid, ids, *a, **b):
585 """
586 Returns False for all ids (cf. only the search method is used for the field)
587 """
588 return {}.fromkeys(ids, False)
589
590 def _search_inv_doc_type(self, cr, uid, obj, name, args, context=None):
591 """
592 Returns a domain (based on the context) to get all journals matching with the doc type of the selected invoice
593 """
594 if context is None:
595 context = {}
596 if not args:
597 return []
598 doc_type = context.get('doc_type', '')
599 if doc_type == 'str':
600 journal_types = ['sale']
601 elif doc_type in ('isi', 'isr'):
602 journal_types = ['purchase']
603 elif doc_type == 'donation':
604 journal_types = ['inkind', 'extra']
605 else:
606 journals = {
607 'out_invoice': 'sale',
608 'in_invoice': 'purchase',
609 'out_refund': 'sale_refund',
610 'in_refund': 'purchase_refund',
611 }
612 journal_types = [journals.get(context.get('type', ''), 'purchase')]
613 journal_dom = [('type', 'in', journal_types), ('is_current_instance', '=', True)]
614 if doc_type in ('isi', 'isr'):
615 journal_dom.append(('code', '=', 'ISI'))
616 else:
617 journal_dom.append(('code', '!=', 'ISI'))
618 return journal_dom
619
583 _columns = {620 _columns = {
584 'name': fields.char('Journal Name', size=64, required=True),621 'name': fields.char('Journal Name', size=64, required=True),
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."),
@@ -609,6 +646,8 @@
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),
610 'bank_swift_code': fields.char('Swift Code', size=32, required=False),647 'bank_swift_code': fields.char('Swift Code', size=32, required=False),
611 'bank_address': fields.text('Address', required=False),648 'bank_address': fields.text('Address', required=False),
649 'inv_doc_type': fields.function(_get_false, method=True, type='boolean', string='Document Type', store=False,
650 fnct_search=_search_inv_doc_type),
612 }651 }
613652
614 _defaults = {653 _defaults = {
615654
=== modified file 'bin/addons/account/account_invoice_payment_tab.xml'
--- bin/addons/account/account_invoice_payment_tab.xml 2021-01-29 15:17:52 +0000
+++ bin/addons/account/account_invoice_payment_tab.xml 2021-11-03 13:33:55 +0000
@@ -1,5 +1,5 @@
1<!-- PAYMENT TAB -->1<!-- PAYMENT TAB -->
2<!-- added in SI / SR / IVO / STV -->2<!-- added in SI / SR / ISI / ISR / IVO / STV -->
3<page string="Payments"3<page string="Payments"
4 attrs="{'invisible': [('type', 'not in', ('in_refund', 'out_invoice')),4 attrs="{'invisible': [('type', 'not in', ('in_refund', 'out_invoice')),
5 '|', ('type', '!=', 'in_invoice'), ('is_intermission', '=', True)]}">5 '|', ('type', '!=', 'in_invoice'), ('is_intermission', '=', True)]}">
66
=== modified file 'bin/addons/account/account_invoice_view.xml'
--- bin/addons/account/account_invoice_view.xml 2021-01-29 15:17:52 +0000
+++ bin/addons/account/account_invoice_view.xml 2021-11-03 13:33:55 +0000
@@ -144,6 +144,9 @@
144 <field name="type">tree</field>144 <field name="type">tree</field>
145 <field name="arch" type="xml">145 <field name="arch" type="xml">
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">
147 <field name="document_date"/>
148 <field name="supplier_reference"/>
149
147 <field name="date_invoice"/>150 <field name="date_invoice"/>
148 <field name="number"/>151 <field name="number"/>
149 <field name="partner_id" groups="base.group_user"/>152 <field name="partner_id" groups="base.group_user"/>
@@ -151,17 +154,14 @@
151 <field name="journal_id" invisible="1"/>154 <field name="journal_id" invisible="1"/>
152 <field name="period_id" invisible="1" groups="account.group_account_user"/>155 <field name="period_id" invisible="1" groups="account.group_account_user"/>
153 <field name="company_id" groups="base.group_multi_company" widget="selection"/>156 <field name="company_id" groups="base.group_multi_company" widget="selection"/>
154 <field name="user_id"/>
155 <field name="date_due"/>157 <field name="date_due"/>
156 <field name="origin"/>158 <field name="origin"/>
157 <field name="line_count"/>159 <field name="line_count"/>
158 <field name="currency_id"/>160 <field name="currency_id"/>
159 <field name="residual" sum="Residual Amount"/>161 <field name="residual" />
160 <field name="amount_untaxed" sum="Untaxed Amount"/>162 <field name="amount_total"/>
161 <field name="amount_total" sum="Total Amount"/>
162 <field name="state"/>163 <field name="state"/>
163164 <button name="invoice_open" states="draft,proforma2" type="object" string="Approve" icon="terp-camera_test"/>
164 <button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
165 </tree>165 </tree>
166 </field>166 </field>
167 </record>167 </record>
@@ -174,7 +174,10 @@
174 <field name="arch" type="xml">174 <field name="arch" type="xml">
175 <form string="Supplier Invoice">175 <form string="Supplier Invoice">
176 <group col="8" colspan="4">176 <group col="8" colspan="4">
177 <field name="journal_id" widget="selection"/>177 <field name="journal_id"
178 domain="[('inv_doc_type', '=', True)]"
179 attrs="{'readonly': ['|', ('state', '!=', 'draft'), '&amp;', ('type', '=', 'in_invoice'), ('synced', '=', True)]}"/>
180 <field name="vat_ok" invisible="1" />
178 <field name="number" readonly="1"/>181 <field name="number" readonly="1"/>
179 <field name="type" invisible="1"/>182 <field name="type" invisible="1"/>
180 <field name="is_intermission" invisible="1"/> <!-- for Payment tab -->183 <field name="is_intermission" invisible="1"/> <!-- for Payment tab -->
@@ -186,7 +189,7 @@
186 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/>189 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/>
187 <newline/>190 <newline/>
188 <field string="Supplier" name="partner_id" domain="[('supplier', '=', True)]"191 <field string="Supplier" name="partner_id" domain="[('supplier', '=', True)]"
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)"
190 context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"193 context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"
191 attrs="{'readonly': ['|',194 attrs="{'readonly': ['|',
192 ('state', '!=', 'draft'),195 ('state', '!=', 'draft'),
@@ -195,25 +198,52 @@
195 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>198 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
196 <field name="fiscal_position" groups="base.group_extended" widget="selection"/>199 <field name="fiscal_position" groups="base.group_extended" widget="selection"/>
197 <newline/>200 <newline/>
201 <field name="document_date" />
198 <field name="date_invoice"/>202 <field name="date_invoice"/>
199 <field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>203 <group colspan="2" col="1" />
200 <group colspan="2" col="1" groups="account.group_account_user">204 </group>
201 <label align="0.0" string="(keep empty to use the current period)"/>205 <newline />
202 </group>206 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
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)]}"/>
208 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
209 </group>
210 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
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)]}"/>
212 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
213 </group>
214 <field name="analytic_distribution_id" invisible="1"/>
215 <group colspan="3"/>
216
204 <notebook colspan="4">217 <notebook colspan="4">
205 <page string="Invoice">218 <page string="Invoice">
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" />
207 <field name="reference_type" nolabel="1" size="0"/>220 <field name="reference_type" nolabel="1" size="0"/>
208 <field name="reference" nolabel="1"/>221 <field name="reference" nolabel="1"/>
209 <field name="date_due"/>222 <field name="date_due"/>
210 <field name="check_total" required="2"/>223 <field name="check_total" required="2"/>
224 <field name="supplier_reference"/>
225 <group name="import" string=" Import Lines " colspan="4" col="4"
226 attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'in_invoice')]}">
227 <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object"
228 attrs="{'readonly': [('state', '!=', 'draft')],
229 'invisible': [('type', '!=', 'in_invoice')]}"/>
230 <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object"
231 attrs="{'invisible': [('type', '!=', 'in_invoice')]}"/>
232 <newline/>
233 <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object"
234 attrs="{'invisible': [('state', '!=', 'draft')],
235 'readonly': [('type', '=', 'in_invoice'), ('synced', '=', True)]}"/>
236 </group>
237
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">
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">
213 <field name="from_supply" invisible="1"/>240 <field name="from_supply" invisible="1"/>
214 <field name="line_synced" invisible="1"/>241 <field name="line_synced" invisible="1"/>
215 <field name="invoice_type" invisible="1"/>242 <field name="invoice_type" invisible="1"/>
216 <field name="partner_type" invisible="1"/>243 <field name="partner_type" invisible="1"/>
244 <field name="line_number" displayon="noteditable"/>
245 <field name="is_corrected" invisible="1"/>
246 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
217 <field name="product_id"247 <field name="product_id"
218 attrs="{'readonly': ['|',248 attrs="{'readonly': ['|',
219 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True),249 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True), ('from_supply', '=', True),
@@ -224,7 +254,13 @@
224 domain="[('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]"254 domain="[('journal_id', '=', parent.journal_id), ('restricted_area', '=', 'invoice_lines')]"
225 />255 />
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)]"/>
227 <field domain="[('type','&lt;&gt;','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" />
258 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
259 <field name="analytic_distribution_state_recap"/>
260 <field name="have_analytic_distribution_from_header" invisible="1"/>
261 <field name="analytic_distribution_state" invisible="1"/>
262 <field name="is_allocatable" invisible="1"/>
263
228 <field name="quantity"264 <field name="quantity"
229 attrs="{'readonly': ['|',265 attrs="{'readonly': ['|',
230 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True),('from_supply', '=', True),266 '&amp;', ('invoice_type', '=', 'in_invoice'), '|', ('line_synced', '=', True),('from_supply', '=', True),
@@ -240,7 +276,9 @@
240 </tree>276 </tree>
241 </field>277 </field>
242 <group col="1" colspan="2">278 <group col="1" colspan="2">
243 <field name="tax_line" nolabel="1" attrs="{'invisible': [('vat_ok', '=', False)], 'readonly': ['|', ('state','!=', 'draft'), '&amp;', ('type', '=', 'in_invoice'), ('synced', '=', True)]}">279 <field name="tax_line" nolabel="1"
280 attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))],
281 'readonly': ['|', ('state','!=', 'draft'), '&amp;', ('type', '=', 'in_invoice'), ('synced', '=', True)]}">
244 <tree editable="bottom" string="Taxes">282 <tree editable="bottom" string="Taxes">
245 <field name="invoice_id" invisible="True"/>283 <field name="invoice_id" invisible="True"/>
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)"/>
@@ -265,24 +303,66 @@
265 </field>303 </field>
266 </group>304 </group>
267 <group col="4" colspan="2">305 <group col="4" colspan="2">
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"
269 <field name="amount_untaxed"/>307 type="object" icon="terp-stock_format-scientific"
308 attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))],
309 'readonly': [('state', '!=', 'draft')]}"/>
310 <field name="amount_untaxed" attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))]}"/>
270 <label string="" colspan="2"/>311 <label string="" colspan="2"/>
271 <field name="amount_tax"/>312 <field name="amount_tax" attrs="{'invisible': ['|', ('vat_ok', '=', False), ('doc_type', 'in', ('isi', 'isr'))]}" />
272 <field name="reconciled"/>313 <field name="reconciled"/>
273 <field name="amount_total"/>314 <field name="amount_total"/>
274 <field name="state"/>315 <field name="state"/>
275 <field name="residual"/>316 <field name="residual"/>
276 <group col="6" colspan="4">317 <group col="6" colspan="4">
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"/>
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"
279 <button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>320 attrs="{'invisible': ['|', '|',
321 ('state', '=', 'draft'),
322 ('type', 'in', ['in_refund', 'out_refund']),
323 '&amp;', ('doc_type', '=', 'isi'), ('counterpart_inv_status', '!=', 'inv_close')]}"
324 />
325 <group attrs="{'invisible': [('doc_type', 'in', ('isi', 'isr'))]}">
326 <button name="invoice_open" states="draft,proforma2" type="object" string="Validate" icon="gtk-go-forward"/>
327 <field name="is_direct_invoice" invisible="1"/>
328 <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/>
329 <newline/>
330 <field name="can_merge_lines" invisible="1"/>
331 <button name="button_merge_lines" type="object"
332 colspan="3"
333 string="Merge Lines by Account" icon="gtk-convert"
334 confirm="You are about to merge invoice lines; are you sure you want to proceed? THIS OPERATION CAN NOT BE UNDONE."
335 attrs="{'invisible': [('can_merge_lines', '!=', True)]}"/>
336 </group>
337
280 </group>338 </group>
281 </group>339 </group>
340 <!-- for ISI/STR the display of the buttons takes the whole width -->
341 <group col="8" colspan="6" attrs="{'invisible': [('doc_type', 'not in', ('isi', 'isr'))]}">
342 <button name="button_merge_lines2" type="object"
343 string="Merge Lines by Account"
344 icon="gtk-convert" colspan="2"
345 confirm="You are about to merge invoice lines; are you sure you want to proceed? THIS OPERATION CAN NOT BE UNDONE."
346 attrs="{'invisible': [('can_merge_lines', '!=', True)]}"
347 />
348 <button name="button_split_invoice2" type="object"
349 string="Split Invoice"
350 icon="gtk-cut" colspan="2"
351 states="draft"
352 />
353 <button name="invoice_open2" type="object"
354 string="Validate"
355 icon="gtk-go-forward" colspan="4"
356 states="draft"
357 />
358 </group>
282 </page>359 </page>
283 <page string="Other Info">360 <page string="Other Info">
361 <field name="amount_to_pay"/>
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)"/>
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"
364 on_change="onchange_company_id(company_id, partner_id, type, invoice_line, currency_id, context)"
365 widget="selection" groups="base.group_multi_company"/>
286 <newline/>366 <newline/>
287 <field name="payment_term" widget="selection"/>367 <field name="payment_term" widget="selection"/>
288 <field name="name"368 <field name="name"
@@ -304,6 +384,31 @@
304 <field colspan="4" name="comment" nolabel="1"/>384 <field colspan="4" name="comment" nolabel="1"/>
305 </page>385 </page>
306 &payment_tab;386 &payment_tab;
387 <page string="Down Payments">
388 <field name="down_payment_ids" nolabel="1" colspan="4">
389 <tree string="Down Payment">
390 <field name="move_id"/>
391 <field name="name" string="Description"/>
392 <field name="ref"/>
393 <field name="date"/>
394 <field name="partner_type"/>
395 <field name="reconcile_txt"/>
396 <field name="debit_currency"/>
397 <field name="credit_currency"/>
398 <field name="amount_currency" sum="Total Amount"/>
399 <field name="currency_id"/>
400 </tree>
401 </field>
402 </page>
403 <!-- display the Counterpart Invoice tab in SI, hide it in SR -->
404 <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'in_invoice')]}">
405 <field name="from_supply" invisible="1"/> <!-- make the field exportable -->
406 <field name="synced" readonly="1"/> <!-- SI can never be ticked as "Synced" manually -->
407 <newline/>
408 <field name="counterpart_inv_number"/>
409 <field name="counterpart_inv_status"/>
410 </page>
411
307 </notebook>412 </notebook>
308 </form>413 </form>
309 </field>414 </field>
@@ -314,38 +419,46 @@
314 <field name="model">account.invoice</field>419 <field name="model">account.invoice</field>
315 <field name="type">form</field>420 <field name="type">form</field>
316 <field name="arch" type="xml">421 <field name="arch" type="xml">
317 <form string="Invoice" noteditable="state=='cancel'">422 <form string="Stock Transfer Voucher" noteditable="state=='cancel'">
318 <group colspan="4" col="8">423 <group colspan="4" col="8">
319 <field name="journal_id" groups="base.group_user" widget="selection"/>424 <field name="journal_id" domain="[('inv_doc_type', '=', True)]"/>
320 <field name="journal_type" invisible="1"/>425 <field name="journal_type" invisible="1"/>
321 <field name="number"/>426 <field name="number"/>
322 <field name="type" invisible="1"/>427 <field name="type" invisible="1"/>
323 <field name="is_intermission" invisible="1"/> <!-- for Payment tab -->428 <field name="is_intermission" invisible="1"/> <!-- for Payment tab -->
324 <field name="currency_id" width="50"/>429 <field name="currency_id" width="50"/>
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"/>
326 <newline/>431 <newline/>
327 <field string="Customer" name="partner_id"432 <field string="Customer" name="partner_id"
328 domain="[('customer', '=', True)]"433 domain="[('customer', '=', True)]"
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)"
330 groups="base.group_user" context="{'search_default_customer': 1}"435 groups="base.group_user" context="{'search_default_customer': 1}"
331 attrs="{'readonly': ['|',436 attrs="{'readonly': ['|',
332 ('state', '!=', 'draft'),437 ('state', '!=', 'draft'),
333 '&amp;', '&amp;',438 '&amp;', '&amp;',
334 ('type', '=', 'out_invoice'),439 ('type', '=', 'out_invoice'),
335 ('from_supply', '=', True),440 ('from_supply', '=', True),
336 ('partner_type', 'in', ('intermission', 'section'))]}"/>441 ('partner_type', 'in', ('intermission', 'section'))]}"/>
337 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>442 <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
338 <field name="fiscal_position" groups="base.group_extended" widget="selection"/>443 <newline/>
339 <newline/>444 <field name="document_date"/>
340 <field name="date_invoice"/>445 <field name="date_invoice"/>
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">
342 <group colspan="2" col="1" groups="account.group_account_user">447 </group>
343 <label align="0.0" string="(keep empty to use the current period)"/>448 </group>
344 </group>449 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
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)]}"/>
451 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
452 </group>
453 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
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)]}"/>
455 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
456 </group>
457 <field name="analytic_distribution_id" invisible="1"/>
458 <group colspan="3"/>
346 <notebook colspan="4">459 <notebook colspan="4">
347 <page string="Invoice">460 <page string="Invoice">
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" />
349 <field name="name" attrs="{'readonly': ['|',462 <field name="name" attrs="{'readonly': ['|',
350 ('state', '!=', 'draft'),463 ('state', '!=', 'draft'),
351 '&amp;', '&amp;',464 '&amp;', '&amp;',
@@ -353,6 +466,21 @@
353 ('from_supply', '=', True),466 ('from_supply', '=', True),
354 ('partner_type', 'in', ('intermission', 'section'))]}"/>467 ('partner_type', 'in', ('intermission', 'section'))]}"/>
355 <field name="payment_term" widget="selection"/>468 <field name="payment_term" widget="selection"/>
469 <group name="import" string=" Import Lines " colspan="4" col="4"
470 attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}">
471 <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object"
472 attrs="{'readonly': [('state', '!=', 'draft')],
473 'invisible': [('type', '!=', 'out_invoice')]}"/>
474 <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object"
475 attrs="{'invisible': [('type', '!=', 'out_invoice')]}"
476 force_editable="1"/>
477 <newline/>
478 <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object"
479 attrs="{'invisible': [('state', '!=', 'draft')],
480 'readonly': [('type', '=', 'out_invoice'),
481 ('from_supply', '=', True),
482 ('partner_type', 'in', ('intermission', 'section'))]}"/>
483 </group>
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}">
357 <tree string="Invoice Line"485 <tree string="Invoice Line"
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')"
@@ -397,44 +525,66 @@
397 <field name="name"/>525 <field name="name"/>
398 </tree>526 </tree>
399 </field>527 </field>
400 <group col="1" colspan="2">528 <group col="1" colspan="2" />
401 <field name="tax_line" nolabel="1">529 <group col="8" colspan="4">
402 <tree editable="bottom" string="Taxes">530 <label string="" colspan="3"/>
403 <field name="name"/>
404 <field name="account_id" groups="account.group_account_invoice"/>
405 <field name="base"
406 on_change="base_change(base, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"
407 readonly="1"/>
408 <field name="amount"
409 on_change="amount_change(amount, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"/>
410 <field invisible="True" name="base_amount"/>
411 <field invisible="True" name="tax_amount"/>
412 <field name="factor_base" invisible="True"/>
413 <field name="factor_tax" invisible="True"/>
414 </tree>
415 </field>
416 </group>
417 <group col="4" colspan="2">
418 <button colspan="2" name="button_reset_taxes" states="draft" string="Compute Taxes" type="object" groups="base.group_user" icon="terp-stock_format-scientific"/>
419 <field name="amount_untaxed"/>
420 <label string="" colspan="2"/>
421 <field name="amount_tax"/>
422 <field name="reconciled"/>531 <field name="reconciled"/>
423 <field name="amount_total"/>532 <field name="amount_total"/>
533 <label string="" colspan="3"/>
424 <field name="state"/>534 <field name="state"/>
425 <field name="residual"/>535 <field name="residual"/>
426 <group col="8" colspan="4" groups="base.group_user">536 <field name="is_debit_note" invisible="1"/>
427 <button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>537 </group>
428538 <field name="partner_type" invisible="1"/>
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">
430 <button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>540
431 <button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>541 <field name="doc_type" invisible="1"/>
432 <button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/>542
433 </group>543 <button string="Cancel document" name="invoice_cancel"
544 type="workflow" icon="gtk-cancel"
545 confirm="Do you really want to cancel this document?"
546 attrs="{'invisible': ['|', '|',
547 ('state', '!=', 'draft'),
548 ('type', '!=', 'out_invoice'),
549 ('from_supply', '=', False)]}"/>
550
551 <button name="button_split_invoice" type="object" string="Split Stock Transfer Voucher"
552 icon="gtk-cut"
553 context="{'from_stv': True}"
554 attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('doc_type', '!=', 'stv')]}"/>
555
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'])]}"/>
557 <!-- add a confirmation step only for STV (not for CR/STR)
558 when the partner type is compatible with a synchro but "synced" isn't ticked -->
559 <button name="invoice_open" type="object" string="Validate"
560 icon="gtk-go-forward"
561 attrs="{'invisible': ['|',
562 ('state', '!=', 'draft'),
563 '&amp;',
564 ('doc_type', '=', 'stv'), ('partner_type', 'in', ('intermission', 'section')) ]}"/>
565 <button name="invoice_open_with_confirmation" type="object" string="Validate"
566 icon="gtk-go-forward"
567 confirm="Are you sure you want to validate this invoice without synchronization?"
568 attrs="{'invisible': ['|', '|', '|',
569 ('state', '!=', 'draft'),
570 ('doc_type', '!=', 'stv'),
571 ('synced', '=', True),
572 ('partner_type', 'not in', ('intermission', 'section'))]}"/>
573
574 <button name="invoice_open_with_sync_confirmation" type="object" string="Validate"
575 icon="gtk-go-forward"
576 confirm="This invoice will sync to its counterpart instance."
577 attrs="{'invisible': ['|', '|', '|',
578 ('state', '!=', 'draft'),
579 ('doc_type', '!=', 'stv'),
580 ('synced', '=', False),
581 ('partner_type', 'not in', ('intermission', 'section'))]}"/>
582 <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/>
434 </group>583 </group>
435 </page>584 </page>
436 <page string="Other Info">585 <page string="Other Info">
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)"
587 widget="selection" groups="base.group_multi_company"/>
438 <newline/>588 <newline/>
439 <field name="date_due"/>589 <field name="date_due"/>
440 <field name="user_id" attrs="{'readonly': ['|',590 <field name="user_id" attrs="{'readonly': ['|',
@@ -461,7 +611,7 @@
461 <field colspan="4" name="comment" nolabel="1"/>611 <field colspan="4" name="comment" nolabel="1"/>
462 </page>612 </page>
463 &payment_tab;613 &payment_tab;
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 -->
465 <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'out_invoice')]}">615 <page string="Counterpart Invoice" attrs="{'invisible': [('type', '!=', 'out_invoice')]}">
466 <field name="from_supply" invisible="1"/>616 <field name="from_supply" invisible="1"/>
467 <field name="synced"617 <field name="synced"
@@ -484,16 +634,19 @@
484 <search string="Search Invoice">634 <search string="Search Invoice">
485 <group col="10" colspan="4">635 <group col="10" colspan="4">
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"/>
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"/>
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')]"/>
489 <separator orientation="vertical"/>639 <filter name="closed" icon="terp-dialog-close" string="Closed" domain="[('state', '=', 'inv_close')]" />
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')]"/>
641 <separator orientation="vertical"/>
642 <filter name="not_imported" icon="gtk-cancel" string="Not imported" domain="[('imported_state', '=', 'not')]"/>
643 <filter name="partial" icon="terp-dolar_ok!" string="Partially imported" domain="[('imported_state', '=', 'partial')]"/>
644 <filter name="imported" icon="gtk-apply" string="Imported" domain="[('imported_state', '=', 'imported')]"/>
645 <separator orientation="vertical"/>
646
491 <separator orientation="vertical"/>647 <separator orientation="vertical"/>
492 <field name="number"/>648 <field name="number"/>
493 <field name="partner_id"/>649 <field name="partner_id"/>
494 <field name="user_id" select="1" widget="selection" string="Salesman">
495 <filter domain="[('user_id','=',uid)]" help="My invoices" icon="terp-personal" separator="1"/>
496 </field>
497 <field name="origin"/>650 <field name="origin"/>
498 <field name="amount_total"/>651 <field name="amount_total"/>
499 </group>652 </group>
@@ -501,11 +654,12 @@
501 <group col="10" colspan="4">654 <group col="10" colspan="4">
502 <field name="journal_id" widget="selection" select='1'/>655 <field name="journal_id" widget="selection" select='1'/>
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'])]"/>
657 <field name="supplier_reference"/>
658 <field name="name"/>
504 </group>659 </group>
505 <newline/>660 <newline/>
506 <group expand="0" string="Group By...">661 <group expand="0" string="Group By...">
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'}"/>
508 <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
509 <separator orientation="vertical"/>663 <separator orientation="vertical"/>
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'}"/>
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'}"/>
@@ -552,15 +706,16 @@
552 <field name="act_window_id" ref="action_invoice_tree"/>706 <field name="act_window_id" ref="action_invoice_tree"/>
553 </record>707 </record>
554708
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 -->
556 <field name="name">Customer Invoices</field>710 <record id="account.action_invoice_tree1" model="ir.actions.act_window">
711 <field name="name">Customer Invoices</field> <!-- Stock Transfer Vouchers -->
557 <field name="res_model">account.invoice</field>712 <field name="res_model">account.invoice</field>
558 <field name="view_type">form</field>713 <field name="view_type">form</field>
559 <field name="view_mode">tree,form,calendar,graph</field>714 <field name="view_mode">tree,form,calendar,graph</field>
560 <field eval="False" name="view_id"/>715 <field eval="False" name="view_id"/>
561 <field name="domain">[('type','=','out_invoice')]</field>716 <field name="domain">[('doc_type', '=', 'stv')]</field>
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>
563 <field name="search_view_id" ref="view_account_invoice_filter"/>718 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
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>
565 </record>720 </record>
566721
@@ -578,20 +733,26 @@
578 <field name="act_window_id" ref="action_invoice_tree1"/>733 <field name="act_window_id" ref="action_invoice_tree1"/>
579 </record>734 </record>
580735
581 <menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables"/>736 <!-- STV -->
737 <menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables" sequence="3"/>
582738
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 -->
740 <record id="account.action_invoice_tree2" model="ir.actions.act_window">
584 <field name="name">Supplier Invoices</field>741 <field name="name">Supplier Invoices</field>
585 <field name="res_model">account.invoice</field>742 <field name="res_model">account.invoice</field>
586 <field name="view_type">form</field>743 <field name="view_type">form</field>
587 <field name="view_mode">tree,form,calendar,graph</field>744 <field name="view_mode">tree,form,calendar,graph</field>
588 <field eval="False" name="view_id"/>745 <field eval="False" name="view_id"/>
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 -->
590 <field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field>747 <field name="domain">[('doc_type', '=', 'si')]</field>
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>
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"/>
750 <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers.
751 OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice
752 from your supplier according to what you purchased or received.</field>
593 </record>753 </record>
594 <menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/>754
755 <menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables" sequence="10"/>
595756
596 <record id="action_invoice_tree3" model="ir.actions.act_window">757 <record id="action_invoice_tree3" model="ir.actions.act_window">
597 <field name="name">Customer Refunds</field>758 <field name="name">Customer Refunds</field>
@@ -599,8 +760,8 @@
599 <field name="view_type">form</field>760 <field name="view_type">form</field>
600 <field name="view_mode">tree,form,calendar,graph</field>761 <field name="view_mode">tree,form,calendar,graph</field>
601 <field eval="False" name="view_id"/>762 <field eval="False" name="view_id"/>
602 <field name="domain">[('type','=','out_refund')]</field>763 <field name="domain">[('doc_type', '=', 'cr')]</field>
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>
604 <field name="search_view_id" ref="view_account_invoice_filter"/>765 <field name="search_view_id" ref="view_account_invoice_filter"/>
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>
606 </record>767 </record>
@@ -617,7 +778,8 @@
617 <field name="view_id" ref="invoice_form"/>778 <field name="view_id" ref="invoice_form"/>
618 <field name="act_window_id" ref="action_invoice_tree3"/>779 <field name="act_window_id" ref="action_invoice_tree3"/>
619 </record>780 </record>
620 <menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables"/>781 <!-- Customer Refunds Menu -->
782 <menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables" sequence="6"/>
621783
622 <record id="action_invoice_tree4" model="ir.actions.act_window">784 <record id="action_invoice_tree4" model="ir.actions.act_window">
623 <field name="name">Supplier Refunds</field>785 <field name="name">Supplier Refunds</field>
@@ -625,14 +787,40 @@
625 <field name="view_type">form</field>787 <field name="view_type">form</field>
626 <field name="view_mode">tree,form,calendar,graph</field>788 <field name="view_mode">tree,form,calendar,graph</field>
627 <field eval="False" name="view_id"/>789 <field eval="False" name="view_id"/>
628 <field name="domain">[('type','=','in_refund')]</field>790 <field name="domain">[('doc_type', '=', 'sr')]</field>
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>
630 <field name="search_view_id" ref="view_account_invoice_filter"/>792 <field name="search_view_id" ref="view_account_invoice_filter"/>
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>
632 </record>794 </record>
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"/>
634796
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
798 <record id="generic_invoice_tree" model="ir.ui.view">
799 <field name="name">account.invoice.generic.tree</field>
800 <field name="model">account.invoice</field>
801 <field name="type">tree</field>
802 <field name="priority" eval="100" />
803 <field name="arch" type="xml">
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">
805 <button name="invoice_open_form_view" string="Display Invoice" icon="gtk-go-forward" type="object"/>
806 <field name="doc_type"/>
807 <field name="date_invoice"/>
808 <field name="number"/>
809 <field name="partner_id"/>
810 <field name="name"/>
811 <field name="date_due"/>
812 <field name="origin"/>
813 <field name="line_count"/>
814 <field name="currency_id"/>
815 <field name="residual" sum="Residual Amount"/>
816 <field name="amount_untaxed" sum="Untaxed Amount"/>
817 <field name="amount_total" sum="Total Amount"/>
818 <field name="state"/>
819 </tree>
820 </field>
821 </record>
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"/>
823
636824
637 <act_window825 <act_window
638 id="act_account_journal_2_account_invoice_opened"826 id="act_account_journal_2_account_invoice_opened"
@@ -641,5 +829,80 @@
641 res_model="account.invoice"829 res_model="account.invoice"
642 src_model="account.journal"/>830 src_model="account.journal"/>
643831
832 <!-- STOCK TRANSFER REFUNDS -->
833 <record id="action_str" model="ir.actions.act_window">
834 <field name="name">Stock Transfer Refunds</field>
835 <field name="res_model">account.invoice</field>
836 <field name="view_type">form</field>
837 <field name="view_mode">tree,form,calendar,graph</field>
838 <field eval="False" name="view_id"/>
839 <field name="domain">[('doc_type', '=', 'str')]</field>
840 <field name="context">{'doc_type': 'str', 'type': 'out_refund', 'from_inv_form': True}</field>
841 <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Customer Refunds -->
842 </record>
843 <record id="action_str_tree" model="ir.actions.act_window.view">
844 <field eval="30" name="sequence"/>
845 <field name="view_mode">tree</field>
846 <field name="view_id" ref="invoice_tree"/> <!-- as for Customer Refunds (default tree view) -->
847 <field name="act_window_id" ref="action_str"/>
848 </record>
849 <record id="action_str_form" model="ir.actions.act_window.view">
850 <field eval="35" name="sequence"/>
851 <field name="view_mode">form</field>
852 <field name="view_id" ref="invoice_form"/> <!-- as for Customer Refunds -->
853 <field name="act_window_id" ref="action_str"/>
854 </record>
855 <menuitem action="action_str" id="menu_action_str" parent="menu_finance_receivables" sequence="4"/>
856
857 <!-- INTERSECTION SUPPLIER INVOICES -->
858 <record id="action_isi" model="ir.actions.act_window">
859 <field name="name">Intersection Supplier Invoices</field>
860 <field name="res_model">account.invoice</field>
861 <field name="view_type">form</field>
862 <field name="view_mode">tree,form,calendar,graph</field>
863 <field eval="False" name="view_id"/>
864 <field name="domain">[('doc_type', '=', 'isi')]</field>
865 <field name="context">{'doc_type': 'isi', 'type': 'in_invoice', 'from_inv_form': True}</field>
866 <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Supplier Invoices -->
867 </record>
868 <record id="action_isi_tree" model="ir.actions.act_window.view">
869 <field eval="40" name="sequence"/>
870 <field name="view_mode">tree</field>
871 <field name="view_id" ref="invoice_tree"/> <!-- default tree view -->
872 <field name="act_window_id" ref="action_isi"/>
873 </record>
874 <record id="action_isi_form" model="ir.actions.act_window.view">
875 <field eval="45" name="sequence"/>
876 <field name="view_mode">form</field>
877 <field name="view_id" ref="invoice_supplier_form"/>
878 <field name="act_window_id" ref="action_isi"/>
879 </record>
880 <menuitem action="action_isi" id="menu_action_isi" parent="menu_finance_payables" sequence="20"/>
881
882 <!-- INTERSECTION SUPPLIER REFUNDS -->
883 <record id="action_isr" model="ir.actions.act_window">
884 <field name="name">Intersection Supplier Refunds</field>
885 <field name="res_model">account.invoice</field>
886 <field name="view_type">form</field>
887 <field name="view_mode">tree,form,calendar,graph</field>
888 <field eval="False" name="view_id"/>
889 <field name="domain">[('doc_type', '=', 'isr')]</field>
890 <field name="context">{'doc_type': 'isr', 'type': 'in_refund', 'from_inv_form': True}</field>
891 <field name="search_view_id" ref="view_account_invoice_filter"/> <!-- as for Supplier Refunds -->
892 </record>
893 <record id="action_isr_tree" model="ir.actions.act_window.view">
894 <field eval="50" name="sequence"/>
895 <field name="view_mode">tree</field>
896 <field name="view_id" ref="invoice_tree"/> <!-- default tree view -->
897 <field name="act_window_id" ref="action_isr"/>
898 </record>
899 <record id="action_isr_form" model="ir.actions.act_window.view">
900 <field eval="55" name="sequence"/>
901 <field name="view_mode">form</field>
902 <field name="view_id" ref="invoice_supplier_form"/>
903 <field name="act_window_id" ref="action_isr"/>
904 </record>
905 <menuitem action="action_isr" id="menu_action_isr" parent="menu_finance_payables" sequence="22"/>
906
644 </data>907 </data>
645</openerp>908</openerp>
646909
=== modified file 'bin/addons/account/account_menuitem.xml'
--- bin/addons/account/account_menuitem.xml 2017-04-13 14:08:16 +0000
+++ bin/addons/account/account_menuitem.xml 2021-11-03 13:33:55 +0000
@@ -8,7 +8,7 @@
8 web_icon_hover="images/accounting-hover.png"/>8 web_icon_hover="images/accounting-hover.png"/>
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"/>
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"/>
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" />
12 groups="group_account_user,group_account_manager"/>12 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"/>13 <menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="9" groups="group_account_user,group_account_manager"/>
14 <!-- This menu is used in account_code module -->14 <!-- This menu is used in account_code module -->
1515
=== modified file 'bin/addons/account/account_view.xml'
--- bin/addons/account/account_view.xml 2020-10-28 13:59:22 +0000
+++ bin/addons/account/account_view.xml 2021-11-03 13:33:55 +0000
@@ -167,35 +167,89 @@
167 <field name="arch" type="xml">167 <field name="arch" type="xml">
168 <form string="Account">168 <form string="Account">
169 <group col="6" colspan="4">169 <group col="6" colspan="4">
170 <field name="name" select="1"/>170 <field name="name" select="1"/>
171 <field name="code" select="1"/>171 <field name="code" select="1"/>
172 <field name="company_id" widget="selection" groups="base.group_multi_company"/>172 <newline/>
173 <newline/>173 <field name="parent_id"/>
174 <field name="parent_id"/>174 <field name="type" select="1"/>
175 <field name="type" select="1"/>175 <field name="user_type_code" invisible="1"/>
176 <field name="user_type" select="1"/>176 <field name="is_analytic_addicted" invisible="1"/>
177 <field name="user_type" on_change="onchange_user_type(user_type, code)"/>
178 <field name="shrink_entries_for_hq"/>
179 <field name="is_child_of_coa" invisible="1" />
180 <field name="display_in_reports" attrs="{'invisible': [('is_child_of_coa', '=', False)]}" />
181 <field name="type_for_register"/>
182 <field name="accrual_account" />
183 <field name="is_not_hq_correctible" on_change="onchange_is_not_hq_correctible(is_not_hq_correctible)"/>
184 <newline/>
185 <label string="" colspan="2"/>
186 <field name="is_not_ad_correctable" on_change="onchange_is_not_ad_correctable(is_not_ad_correctable)"/>
177 </group>187 </group>
178 <notebook colspan="4">188 <notebook colspan="4">
179 <page string="General Information">189 <page string="General Information">
180 <field name="active" groups="base.group_extended" />190 <group col="6" colspan="4">
181 <newline/>191 <field name="activation_date"/>
182 <group col="2" colspan="2">192 <field name="inactivation_date"/>
183 <separator string="Currency" colspan="2"/>193 <group col="2" colspan="2">
184 <field name="currency_id"/>194 <field name="reconcile" on_change="onchange_reconcile(reconcile)"/>
185 <field name="currency_mode" attrs="{'readonly': [('currency_id','=',False)]}"/>195 <field name="prevent_multi_curr_rec" attrs="{'readonly': [('reconcile', '=', False)]}"/>
186 </group>196 <field name="reconciliation_debit_account_id"/>
187 <group col="2" colspan="2">197 <field name="reconciliation_credit_account_id"/>
188 <separator string="Reconcile" colspan="2"/>198 </group>
189 <field name="reconcile"/>199 </group>
190 </group>200 </page>
191 <separator string="Default Taxes" colspan="4"/>201 <page string="Analytical Destination">
192 <field colspan="4" name="tax_ids" nolabel="1" domain="[('parent_id','=',False)]"/>202 <field name="default_destination_id" colspan="2"
193 <separator string="Consolidated Children" colspan="4"/>203 attrs="{'required': [('is_analytic_addicted', '=', True)], 'readonly': [('is_analytic_addicted', '!=', True)]}"/>
194 <field name="child_consol_ids" colspan="4" nolabel="1" attrs="{'readonly':[('type','!=','consolidation')]}"/>204 <label string="" colspan="2"/>
205 <field name="destination_ids" nolabel="1" colspan="4" domain="[('type', '!=', 'view'), ('category', '=', 'DEST')]">
206 <tree string="Destinations">
207 <field name="name"/>
208 <field name="description"/>
209 <field name="date_start"/>
210 <field name="date"/>
211 </tree>
212 </field>
213 </page>
214 <page string="Allowed Partner types">
215 <group col="4" colspan="4">
216 <group col="2" colspan="2">
217 <field name="has_partner_type_internal" />
218 <field name="has_partner_type_external" />
219 <field name="has_partner_type_esc" />
220 <newline />
221 <field name="has_partner_type_local" />
222 <field name="has_partner_type_ex" />
223 <field name="has_partner_type_empty" />
224 <newline />
225 <field name="has_partner_type_book" />
226 </group>
227
228 <group col="2" colspan="2">
229 <field name="has_partner_type_intermission" />
230 <field name="has_partner_type_section" />
231
232 <label /><label />
233 <newline />
234 <label /><label />
235 <label /><label />
236 <newline />
237 <label /><label />
238 </group>
239 </group>
195 </page>240 </page>
196 <page string="Notes">241 <page string="Notes">
197 <field colspan="4" name="note" nolabel="1"/>242 <field colspan="4" name="note" nolabel="1"/>
198 </page>243 </page>
244 <page string="Currency Revaluation" attrs="{'invisible': [('instance_level', '=', 'project')]}">
245 <field name="instance_level" invisible="1"/>
246 <field name="currency_revaluation"
247 attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('user_type_code', 'not in', ['receivables', 'payables', 'cash', 'asset', 'stock'])]}"/>
248 </page>
249 <page string="End Year Closing" attrs="{'invisible': [('instance_level', '=', 'project')]}">
250 <field name="include_in_yearly_move"
251 attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('type', 'not in', ['other', ])]}"/>
252 </page>
199 </notebook>253 </notebook>
200 </form>254 </form>
201 </field>255 </field>
@@ -290,26 +344,24 @@
290 </field>344 </field>
291 </record>345 </record>
292346
293 <record id="view_account_list" model="ir.ui.view">347 <!-- Tree view for default tree view of accounts -->
294 <field name="name">account.account.list</field>348 <record id="account.view_account_list" model="ir.ui.view">
349 <field name="name">account.account_activable.list</field>
295 <field name="model">account.account</field>350 <field name="model">account.account</field>
296 <field name="type">tree</field>351 <field name="type">tree</field>
297 <field name="field_parent">child_id</field>352 <field name="field_parent">child_id</field>
353 <field name="priority" eval="10"/>
298 <field name="arch" type="xml">354 <field name="arch" type="xml">
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">
300 <field name="code"/>356 <field name="code"/>
301 <field name="name"/>357 <field name="name"/>
302 <field name="parent_id" invisible="1"/>
303 <field name="user_type" invisible="1"/>
304 <field name="debit"/>
305 <field name="credit"/>
306 <field name="balance"/>
307 <field name="type"/>358 <field name="type"/>
308 <field name="company_id" groups="base.group_multi_company"/>359 <field name="activation_date"/>
309 <field name="company_currency_id"/>360 <field name="inactivation_date"/>
310 </tree>361 </tree>
311 </field>362 </field>
312 </record>363 </record>
364
313 <record id="view_treasory_graph" model="ir.ui.view">365 <record id="view_treasory_graph" model="ir.ui.view">
314 <field name="name">account.treasury.graph</field>366 <field name="name">account.treasury.graph</field>
315 <field name="model">account.account</field>367 <field name="model">account.account</field>
@@ -334,26 +386,29 @@
334 <menuitem id="account_account_menu" name="Accounts" parent="menu_finance_accounting"/>386 <menuitem id="account_account_menu" name="Accounts" parent="menu_finance_accounting"/>
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"/>
336388
337 <record id="view_account_tree" model="ir.ui.view">389 <record model="ir.ui.view" id="account.view_account_tree">
338 <field name="name">account.account.tree</field>390 <field name="name">account.account_activable.tree</field>
339 <field name="model">account.account</field>391 <field name="model">account.account</field>
340 <field name="type">tree</field>392 <field name="type">tree</field>
341 <field name="field_parent">child_id</field>393 <field name="field_parent">child_id</field>
342 <field name="priority" eval="13"/>394 <field name="priority" eval="12"/>
343 <field name="arch" type="xml">395 <field name="arch" type="xml">
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">
345 <field name="code"/>397 <field name="code"/>
346 <field name="name"/>398 <field name="name"/>
347 <field name="debit"/>399 <field name="note"/>
348 <field name="credit"/>400 <field name="type" invisible="1"/>
349 <field name="balance"/>401 <field name="type_for_register" invisible="1"/>
350 <field name="company_currency_id"/>402 <field name="accrual_account" invisible="1"/>
351 <field name="company_id" groups="base.group_multi_company"/>403 <field name="is_not_hq_correctible" invisible="1"/>
352 <field name="type"/>404 <field name="activation_date" invisible="1"/>
405 <field name="inactivation_date" invisible="1"/>
353 <field name="parent_id" invisible="1"/>406 <field name="parent_id" invisible="1"/>
407 <field name="is_analytic_addicted" invisible="1"/>
354 </tree>408 </tree>
355 </field>409 </field>
356 </record>410 </record>
411
357 <record id="action_account_tree" model="ir.actions.act_window">412 <record id="action_account_tree" model="ir.actions.act_window">
358 <field name="name">Chart of Accounts</field>413 <field name="name">Chart of Accounts</field>
359 <field name="res_model">account.account</field>414 <field name="res_model">account.account</field>
@@ -546,52 +601,84 @@
546 </record>601 </record>
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"/>
548603
549 <record id="view_account_bank_statement_filter" model="ir.ui.view">604 <!-- Bank Statement Filter -->
605 <record id="account.view_account_bank_statement_filter" model="ir.ui.view">
550 <field name="name">account.cash.statement.select</field>606 <field name="name">account.cash.statement.select</field>
551 <field name="model">account.bank.statement</field>607 <field name="model">account.bank.statement</field>
552 <field name="type">search</field>608 <field name="type">search</field>
553 <field name="priority" eval="18"/>
554 <field name="arch" type="xml">609 <field name="arch" type="xml">
555 <search string="Search Bank Statements">610 <search string="Search Bank Statements">
556 <group col="8" colspan="4">611 <group col="8" colspan="4">
557 <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>612 <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new" name="draft"/>
558 <filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>613 <filter string="Open" domain="[('state', '=', 'open')]" icon="terp-camera_test" name="open"/>
614 <filter string="Closed" domain="[('state','=','confirm')]" icon="terp-dialog-close" name="confirm"/>
559 <separator orientation="vertical"/>615 <separator orientation="vertical"/>
560 <field name="date"/>616 <field name="instance_id" domain="[('instance_to_display_ids','=',True)]"/>
561 <field name="name"/>617 <field name="name"/>
562 <field name="journal_id" widget='selection' domain="[('type', '=', 'cash')]" />618 <newline/>
619 <field name="period_id" domain="[('state', '!=', 'created')]"/>
620 <field name="journal_id" domain="[('type', '=', 'cash')]" />
563 </group>621 </group>
564 <newline/>622 <newline/>
565 <group expand="0" string="Group By...">623 <group expand="1" string="Group By...">
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"/>
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"/>
568 <separator orientation="vertical"/>626 <separator orientation="vertical"/>
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"/>
628 <filter string="Instance" context="{'group_by': 'instance_id'}" icon="terp-stage"/>
570 </group>629 </group>
571 </search>630 </search>
572 </field>631 </field>
573 </record>632 </record>
574633
575 <record id="view_bank_statement_tree" model="ir.ui.view">634
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 -->
636 <record id="account.view_bank_statement_tree" model="ir.ui.view">
576 <field name="name">account.bank.statement.tree</field>637 <field name="name">account.bank.statement.tree</field>
577 <field name="model">account.bank.statement</field>638 <field name="model">account.bank.statement</field>
578 <field name="type">tree</field>639 <field name="type">tree</field>
579 <field name="priority" eval="19"/>640 <field name="priority" eval="10"/>
580 <field name="arch" type="xml">641 <field name="arch" type="xml">
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">
582 <field name="name"/>643 <field name="name"/>
583 <field name="date"/>644 <field name="date"/>
584 <field name="period_id"/>645 <field name="period_id"/>
585 <field name="journal_id"/>646 <field name="currency"/>
586 <field name="balance_start"/>647 <field name="journal_id"/>
587 <field name="balance_end_real"/>648 <field name="balance_start"/>
588 <field name="balance_end" invisible="1"/>649 <field name="balance_end" />
589 <field name="state"/>650 <field name="balance_end_real"/>
590 <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="gtk-cancel"/>651 <field name="state"/>
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"/>
592 </tree>653 <button name="button_confirm_bank" states="open" string="Close Register" type="object" icon="terp-camera_test"/>
593 </field>654 </tree>
594 </record>655 </field>
656 </record>
657
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() -->
659 <record id="account.view_bank_statement_tree_for_journal" model="ir.ui.view">
660 <field name="name">account.bank.statement.tree.journal</field>
661 <field name="model">account.bank.statement</field>
662 <field name="type">tree</field>
663 <field name="priority" eval="5"/>
664 <field name="arch" type="xml">
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">
666 <field name="name"/>
667 <field name="date"/>
668 <field name="period_id"/>
669 <field name="currency"/>
670 <field name="journal_id"/>
671 <field name="balance_start"/>
672 <field name="balance_end" />
673 <field name="balance_end_real"/>
674 <field name="state"/>
675 </tree>
676 </field>
677 </record>
678
679
680
681
595 <record id="view_bank_statement_search" model="ir.ui.view">682 <record id="view_bank_statement_search" model="ir.ui.view">
596 <field name="name">account.bank.statement.search</field>683 <field name="name">account.bank.statement.search</field>
597 <field name="model">account.bank.statement</field>684 <field name="model">account.bank.statement</field>
@@ -1821,7 +1908,7 @@
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')]"/>
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')]" />
1823 <field name="name"/>1910 <field name="name"/>
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)]"/>
1825 </group>1912 </group>
1826 <newline/>1913 <newline/>
1827 <group expand="0" string="Group By...">1914 <group expand="0" string="Group By...">
18281915
=== modified file 'bin/addons/account/invoice.py'
--- bin/addons/account/invoice.py 2021-04-23 16:43:40 +0000
+++ bin/addons/account/invoice.py 2021-11-03 13:33:55 +0000
@@ -28,7 +28,7 @@
28from tools.translate import _28from tools.translate import _
29from msf_partner import PARTNER_TYPE29from msf_partner import PARTNER_TYPE
30from base import currency_date30from base import currency_date
3131from tools.safe_eval import safe_eval
3232
33class account_invoice(osv.osv):33class account_invoice(osv.osv):
34 def _amount_all(self, cr, uid, ids, name, args, context=None):34 def _amount_all(self, cr, uid, ids, name, args, context=None):
@@ -46,21 +46,6 @@
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']
47 return res47 return res
4848
49 def _get_journal(self, cr, uid, context=None):
50 if context is None:
51 context = {}
52 type_inv = context.get('type', 'out_invoice')
53 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
54 company_id = context.get('company_id', user.company_id.id)
55 type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
56 refund_journal = {'out_invoice': False, 'in_invoice': False, 'out_refund': True, 'in_refund': True}
57 journal_obj = self.pool.get('account.journal')
58 res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'sale')),
59 ('company_id', '=', company_id),
60 ('refund_journal', '=', refund_journal.get(type_inv, False))],
61 limit=1)
62 return res and res[0] or False
63
64 def _get_journal_analytic(self, cr, uid, type_inv, context=None):49 def _get_journal_analytic(self, cr, uid, type_inv, context=None):
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'}
66 tt = type2journal.get(type_inv, 'sale')51 tt = type2journal.get(type_inv, 'sale')
@@ -363,7 +348,6 @@
363 _defaults = {348 _defaults = {
364 'type': _get_type,349 'type': _get_type,
365 'state': 'draft',350 'state': 'draft',
366 'journal_id': _get_journal,
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),
368 'reference_type': 'none',352 'reference_type': 'none',
369 'check_total': 0.0,353 'check_total': 0.0,
@@ -371,52 +355,76 @@
371 'user_id': lambda s, cr, u, c: u,355 'user_id': lambda s, cr, u, c: u,
372 }356 }
373357
358 def _set_invoice_name(self, cr, uid, doc, context=None):
359 """
360 Sets the correct invoice name to be displayed depending on the doc_type
361 """
362 if context is None:
363 context = {}
364 if context.get('doc_type'):
365 for doc_type in self._get_invoice_type_list(cr, uid, context=context):
366 if context['doc_type'] in doc_type:
367 doc.attrib['string'] = doc_type[1]
368 break
369 return True
370
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):
375 journal_obj = self.pool.get('account.journal')
376 if context is None:372 if context is None:
377 context = {}373 context = {}
378
379 if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']:
380 partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
381 if not view_type:
382 view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])
383 view_type = 'tree'
384 if view_type == 'form':
385 if partner['supplier'] and not partner['customer']:
386 view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')])
387 else:
388 view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')])
389 if view_id and isinstance(view_id, (list, tuple)):374 if view_id and isinstance(view_id, (list, tuple)):
390 view_id = view_id[0]375 view_id = view_id[0]
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)
392377 if view_type == 'form':
393 type = context.get('journal_type', 'sale')
394 if 'journal_id' in res['fields']:
395 filter_journal = [('type', '=', type), ('is_current_instance','=',True)]
396 if type == 'inkind' and context.get('is_inkind_donation'):
397 filter_journal = [('is_current_instance','=',True), ('type', 'in', ('inkind', 'extra'))]
398 journal_select = journal_obj._name_search(cr, uid, '', filter_journal, context=context, limit=None, name_get_uid=1)
399 res['fields']['journal_id']['selection'] = journal_select
400
401 if view_type == 'form' and context.get('type', 'out_invoice') == 'in_refund':
402 doc = etree.XML(res['arch'])378 doc = etree.XML(res['arch'])
403 doc.attrib['string'] = _('Supplier Refund')379 if context.get('type', 'out_invoice') == 'in_refund' or context.get('doc_type', '') == 'isr':
404 nodes = doc.xpath("//field[@name='amount_to_pay']")380 nodes = doc.xpath("//field[@name='amount_to_pay']")
405 for node in nodes:381 for node in nodes:
406 node.set('string', _('Amount to be refunded'))382 node.set('string', _('Amount to be refunded'))
383 # adapt the form name depending on the doc_type (used e.g. when clicking on a res.log)
384 self._set_invoice_name(cr, uid, doc, context=context)
385 """
386 Restriction on allowed partners:
387 - for STV/STR: Intersection or External customers only
388 - for ISI/ISR: Intersection suppliers only
389 - for SI/SR: non-Intersection suppliers only
390 """
391 partner_domain = ""
392 if context.get('doc_type', '') in ('stv', 'str') or (
393 context.get('type', False) == 'out_invoice' and context.get('journal_type', False) == 'sale' and
394 not context.get('is_debit_note', False) and not context.get('is_intermission', False)
395 ):
396 partner_domain = "[('partner_type', 'in', ('section', 'external')), ('customer', '=', True)]"
397 elif context.get('doc_type', '') in ('isi', 'isr'):
398 partner_domain = "[('partner_type', '=', 'section'), ('supplier', '=', True)]"
399 elif (context.get('doc_type', '') in ('si', 'sr')) or \
400 (context.get('type') == 'in_invoice' and context.get('journal_type') == 'purchase') or \
401 (context.get('type') == 'in_refund' and context.get('journal_type') == 'purchase_refund'):
402 partner_domain = "[('partner_type', '!=', 'section'), ('supplier', '=', True)]"
403 if partner_domain:
404 partner_nodes = doc.xpath("//field[@name='partner_id']")
405 for node in partner_nodes:
406 node.set('domain', partner_domain)
407 res['arch'] = etree.tostring(doc)407 res['arch'] = etree.tostring(doc)
408408 elif view_type == 'tree':
409 if view_type == 'tree':
410 doc = etree.XML(res['arch'])409 doc = etree.XML(res['arch'])
411 nodes = doc.xpath("//field[@name='partner_id']")
412 # (US-777) Remove the possibility to create new invoices through the "Advance Return" Wizard410 # (US-777) Remove the possibility to create new invoices through the "Advance Return" Wizard
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':
414 doc.set('hide_new_button', 'True')412 doc.set('hide_new_button', 'True')
415 partner_string = _('Customer')413 # adapt the name of the Partner field depending on the view
416 if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'):414 nodes = doc.xpath("//field[@name='partner_id']")
415 if context.get('generic_invoice') or context.get('journal_type') == 'intermission':
416 # for tree views combining Customer and Supplier Invoices, or for IVI/IVO
417 partner_string = _('Partner')
418 elif context.get('journal_type', False) == 'inkind':
419 partner_string = _('Donor')
420 elif context.get('type', 'out_invoice') in ('in_invoice', 'in_refund') or context.get('doc_type', '') in ('isi', 'isr'):
417 partner_string = _('Supplier')421 partner_string = _('Supplier')
422 else:
423 partner_string = _('Customer')
418 for node in nodes:424 for node in nodes:
419 node.set('string', partner_string)425 node.set('string', partner_string)
426 # ensure that the doc name remains consistent even after clicking on a filter in the Search View
427 self._set_invoice_name(cr, uid, doc, context=context)
420 res['arch'] = etree.tostring(doc)428 res['arch'] = etree.tostring(doc)
421 elif view_type == 'search':429 elif view_type == 'search':
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)
@@ -430,20 +438,14 @@
430 if filter_node:438 if filter_node:
431 filter_node[0].getparent().remove(filter_node[0])439 filter_node[0].getparent().remove(filter_node[0])
432 res['arch'] = etree.tostring(doc)440 res['arch'] = etree.tostring(doc)
441 if view_type in ('tree', 'search') and (context.get('type') in ['out_invoice', 'out_refund'] or context.get('doc_type') == 'str'):
442 doc = etree.XML(res['arch'])
443 nodes = doc.xpath("//field[@name='supplier_reference']")
444 for node in nodes:
445 node.getparent().remove(node)
446 res['arch'] = etree.tostring(doc)
433 return res447 return res
434448
435 def get_log_context(self, cr, uid, context=None):
436 if context is None:
437 context = {}
438 is_intermission = context.get('is_intermission', False)
439 if is_intermission:
440 res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_intermission_form')
441 else:
442 res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
443 view_id = res and res[1] or False
444 context.update({'view_id': view_id})
445 return context
446
447 def create(self, cr, uid, vals, context=None):449 def create(self, cr, uid, vals, context=None):
448 if context is None:450 if context is None:
449 context = {}451 context = {}
@@ -453,8 +455,6 @@
453 ctx = context.copy()455 ctx = context.copy()
454 if 'is_intermission' in vals:456 if 'is_intermission' in vals:
455 ctx.update({'is_intermission': vals['is_intermission']})457 ctx.update({'is_intermission': vals['is_intermission']})
456 if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
457 ctx = self.get_log_context(cr, uid, context=ctx)
458 if 'type' in vals:458 if 'type' in vals:
459 ctx.update({'type': vals['type']})459 ctx.update({'type': vals['type']})
460 if '_terp_view_name' in ctx:460 if '_terp_view_name' in ctx:
@@ -633,10 +633,8 @@
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):
634 return {'value': {}}634 return {'value': {}}
635635
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):
637 val = {}637 val = {}
638 dom = {}
639 obj_journal = self.pool.get('account.journal')
640 account_obj = self.pool.get('account.account')638 account_obj = self.pool.get('account.account')
641 inv_line_obj = self.pool.get('account.invoice.line')639 inv_line_obj = self.pool.get('account.invoice.line')
642 if company_id and part_id and type:640 if company_id and part_id and type:
@@ -683,35 +681,13 @@
683 _('Invoice line account company does not match with invoice company.'))681 _('Invoice line account company does not match with invoice company.'))
684 else:682 else:
685 continue683 continue
686 if company_id and type:
687 if type in ('out_invoice'):
688 journal_type = 'sale'
689 elif type in ('out_refund'):
690 journal_type = 'sale_refund'
691 elif type in ('in_refund'):
692 journal_type = 'purchase_refund'
693 else:
694 journal_type = 'purchase'
695 journal_ids = obj_journal.search(cr, uid, [('company_id','=',company_id), ('type', '=', journal_type)])
696 if journal_ids:
697 val['journal_id'] = journal_ids[0]
698 res_journal_default = self.pool.get('ir.values').get(cr, uid, 'default', 'type=%s' % (type), ['account.invoice'])
699 for r in res_journal_default:
700 if r[1] == 'journal_id' and r[2] in journal_ids:
701 val['journal_id'] = r[2]
702 if not val.get('journal_id', False):
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)))
704 dom = {'journal_id': [('id', 'in', journal_ids)]}
705 else:
706 journal_ids = obj_journal.search(cr, uid, [])
707
708 if currency_id and company_id:684 if currency_id and company_id:
709 currency = self.pool.get('res.currency').browse(cr, uid, currency_id)685 currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
710 if currency.company_id and currency.company_id.id != company_id:686 if currency.company_id and currency.company_id.id != company_id:
711 val['currency_id'] = False687 val['currency_id'] = False
712 else:688 else:
713 val['currency_id'] = currency.id689 val['currency_id'] = currency.id
714 return {'value': val, 'domain': dom}690 return {'value': val}
715691
716 def onchange_synced(self, cr, uid, ids, synced, partner_id):692 def onchange_synced(self, cr, uid, ids, synced, partner_id):
717 """693 """
@@ -899,11 +875,12 @@
899 i['currency_id'] = inv.currency_id.id875 i['currency_id'] = inv.currency_id.id
900 i['amount_currency'] = i['price']876 i['amount_currency'] = i['price']
901 i['ref'] = ref877 i['ref'] = ref
902 if inv.type in ('out_invoice','in_refund'):878 # the direction of the amounts depends on the invoice type
879 if inv.doc_type in ('stv', 'ivo', 'dn', 'sr', 'isr'):
903 i['price'] = -i['price']880 i['price'] = -i['price']
904 i['amount_currency'] = - i['amount_currency']881 i['amount_currency'] = - i['amount_currency']
905 i['change_sign'] = True882 i['change_sign'] = True
906 else:883 else: # 'str', 'ivi', 'si', 'di', 'isi', 'cr', 'donation'
907 i['change_sign'] = False884 i['change_sign'] = False
908 total -= i['amount_currency']885 total -= i['amount_currency']
909 return total, invoice_move_lines886 return total, invoice_move_lines
@@ -1008,6 +985,7 @@
1008 # UTP-594: Get ref and name985 # UTP-594: Get ref and name
1009 if inv.type == 'in_invoice':986 if inv.type == 'in_invoice':
1010 is_ivi = inv.is_intermission and not inv.is_debit_note and not inv.is_inkind_donation987 is_ivi = inv.is_intermission and not inv.is_debit_note and not inv.is_inkind_donation
988 # SI or ISI
1011 is_si = not inv.is_direct_invoice and not inv.is_inkind_donation and not inv.is_debit_note and not inv.is_intermission989 is_si = not inv.is_direct_invoice and not inv.is_inkind_donation and not inv.is_debit_note and not inv.is_intermission
1012 intersection = inv.partner_id.partner_type == 'section'990 intersection = inv.partner_id.partner_type == 'section'
1013 external = inv.partner_id.partner_type == 'external'991 external = inv.partner_id.partner_type == 'external'
@@ -1232,8 +1210,6 @@
12321210
1233 for inv_id, name in self.name_get(cr, uid, [id]):1211 for inv_id, name in self.name_get(cr, uid, [id]):
1234 ctx = context.copy()1212 ctx = context.copy()
1235 if obj_inv.type in ('out_invoice', 'out_refund'):
1236 ctx = self.get_log_context(cr, uid, context=ctx)
1237 ctx['type'] = obj_inv.type1213 ctx['type'] = obj_inv.type
1238 message = _('Invoice ') + " '" + name + "' "+ _("is validated.")1214 message = _('Invoice ') + " '" + name + "' "+ _("is validated.")
1239 self.log(cr, uid, inv_id, message, context=ctx)1215 self.log(cr, uid, inv_id, message, context=ctx)
@@ -1243,6 +1219,13 @@
1243 """1219 """
1244 Sets the invoice to Cancelled and not Synchronized1220 Sets the invoice to Cancelled and not Synchronized
1245 """1221 """
1222 if isinstance(ids, (int, long)):
1223 ids = [ids]
1224
1225 draft_invoice_ids = self.search(cr, uid, [('state', '=', 'draft'), ('id', 'in', ids)])
1226 if draft_invoice_ids:
1227 self.update_commitments(cr, uid, draft_invoice_ids)
1228
1246 self.write(cr, uid, ids, {'state': 'cancel', 'synced': False})1229 self.write(cr, uid, ids, {'state': 'cancel', 'synced': False})
1247 return True1230 return True
12481231
@@ -1291,13 +1274,22 @@
1291 def name_get(self, cr, uid, ids, context=None):1274 def name_get(self, cr, uid, ids, context=None):
1292 if not ids:1275 if not ids:
1293 return []1276 return []
1294 types = {1277 doc_types = {
1295 'out_invoice': 'CI: ',1278 'stv': _('STV: '),
1296 'in_invoice': 'SI: ',1279 'str': _('STR: '),
1297 'out_refund': 'OR: ',1280 'cr': _('CR: '),
1298 'in_refund': 'SR: ',1281 'dn': _('DN: '),
1282 'ivo': _('IVO: '),
1283 'si': _('SI: '),
1284 'di': _('DI: '),
1285 'sr': _('SR: '),
1286 'isi': _('ISI: '),
1287 'isr': _('ISR: '),
1288 'donation': _('DON: '),
1289 'ivi': _('IVI: '),
1299 }1290 }
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
1292 self.read(cr, uid, ids, ['doc_type', 'number', 'name'], context, load='_classic_write')]
13011293
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):
1303 if not args:1295 if not args:
@@ -1364,8 +1356,8 @@
1364 """1356 """
1365 res = [1357 res = [
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',
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',
1368 'analytic_distribution_id', 'document_date',1360 'journal_id', 'analytic_distribution_id', 'document_date', 'doc_type',
1369 ]1361 ]
1370 return res1362 return res
13711363
@@ -1441,10 +1433,24 @@
1441 else:1433 else:
1442 refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])1434 refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])
14431435
1436 if invoice.get('doc_type') == 'stv':
1437 doc_type = 'str'
1438 elif invoice.get('doc_type') == 'isi':
1439 doc_type = 'isr'
1440 elif invoice.get('doc_type') in ('si', 'di'):
1441 doc_type = 'sr'
1442 elif invoice.get('doc_type') == 'ivo':
1443 doc_type = 'ivi'
1444 elif invoice.get('doc_type') == 'ivi':
1445 doc_type = 'ivo'
1446 else:
1447 doc_type = ''
1448
1444 if not date:1449 if not date:
1445 date = time.strftime('%Y-%m-%d')1450 date = time.strftime('%Y-%m-%d')
1446 invoice.update({1451 invoice.update({
1447 'type': type_dict[invoice['type']],1452 'type': type_dict[invoice['type']],
1453 'real_doc_type': doc_type,
1448 'date_invoice': date,1454 'date_invoice': date,
1449 'state': 'draft',1455 'state': 'draft',
1450 'number': False,1456 'number': False,
@@ -1474,7 +1480,7 @@
1474 invoice[field] = invoice[field] and invoice[field][0]1480 invoice[field] = invoice[field] and invoice[field][0]
1475 invoice = self._hook_refund_data(cr, uid, invoice) or invoice1481 invoice = self._hook_refund_data(cr, uid, invoice) or invoice
1476 # create the new invoice1482 # create the new invoice
1477 new_ids.append(self.create(cr, uid, invoice))1483 new_ids.append(self.create(cr, uid, invoice, context=context))
14781484
1479 return new_ids1485 return new_ids
14801486
@@ -1584,6 +1590,21 @@
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)
1585 return True1591 return True
15861592
1593 def invoice_open_form_view(self, cr, uid, ids, context=None):
1594 if not ids:
1595 return True
1596 view_data = self._get_invoice_act_window(cr, uid, ids[0], views_order=['form', 'tree'], context=context)
1597 view_data['res_id'] = ids[0]
1598 view_data['target'] = 'current'
1599 view_data['keep_open'] = True
1600 if context.get('search_default_partner_id'):
1601 dom = []
1602 if view_data['domain']:
1603 dom = safe_eval(view_data['domain'])
1604 dom.append(('partner_id', '=', context.get('search_default_partner_id')))
1605 view_data['domain'] = dom
1606 return view_data
1607
1587account_invoice()1608account_invoice()
15881609
1589class account_invoice_line(osv.osv):1610class account_invoice_line(osv.osv):
@@ -2140,7 +2161,7 @@
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):
2141 """2162 """
2142 Hides the reports:2163 Hides the reports:
2143 - "Invoice Excel Export" in the menu of other invoices than IVO/IVI2164 - "Invoice Excel Export" in the menu of other invoices than IVO/IVI/STV
2144 - "FO Follow-up Finance" in the menu of other invoices than IVO/STV2165 - "FO Follow-up Finance" in the menu of other invoices than IVO/STV
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)
2146 """2167 """
@@ -2162,7 +2183,8 @@
2162 elif context_stv:2183 elif context_stv:
2163 v[2]['name'] = _('STV lines follow-up')2184 v[2]['name'] = _('STV lines follow-up')
2164 # display2185 # display
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 \
2187 v[2].get('report_name', '') == 'invoice.excel.export':
2166 continue2188 continue
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'):
2168 continue2190 continue
21692191
=== modified file 'bin/addons/account/report/account_print_invoice.rml'
--- bin/addons/account/report/account_print_invoice.rml 2019-03-22 14:16:36 +0000
+++ bin/addons/account/report/account_print_invoice.rml 2021-11-03 13:33:55 +0000
@@ -139,6 +139,7 @@
139 </stylesheet>139 </stylesheet>
140 <story>140 <story>
141 <pto>141 <pto>
142 <!-- NOTE: this report seems to be overwritten by account_override/report/account_print_invoice.rml -->
142 <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>143 <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
143 <para style="terp_default_8"></para>144 <para style="terp_default_8"></para>
144 <pto_header><!-- Must be after setLang() -->145 <pto_header><!-- Must be after setLang() -->
145146
=== modified file 'bin/addons/account/report/export_invoice.py'
--- bin/addons/account/report/export_invoice.py 2021-04-27 16:09:42 +0000
+++ bin/addons/account/report/export_invoice.py 2021-11-03 13:33:55 +0000
@@ -27,13 +27,13 @@
27 """27 """
28 Returns True if the fields Product and Quantity of the invoice must be readonly = not editable28 Returns True if the fields Product and Quantity of the invoice must be readonly = not editable
29 """29 """
30 if inv.type == 'in_invoice' and not inv.is_direct_invoice and not inv.is_inkind_donation: # IVI or SI30 if inv.doc_type in ('ivi', 'si', 'isi'):
31 is_readonly = inv.from_supply or inv.synced31 is_readonly = inv.from_supply or inv.synced
32 elif inv.type == 'out_invoice' and inv.is_intermission: # IVO32 elif inv.doc_type == 'ivo':
33 is_readonly = inv.from_supply33 is_readonly = inv.from_supply
34 elif inv.type == 'out_invoice' and not inv.is_intermission and not inv.is_debit_note: # STV34 elif inv.doc_type == 'stv':
35 is_readonly = inv.from_supply and inv.partner_type == 'section'35 is_readonly = inv.from_supply and inv.partner_type == 'section'
36 elif inv.type == 'in_invoice' and inv.is_inkind_donation: # Donation36 elif inv.doc_type == 'donation':
37 is_readonly = inv.from_supply37 is_readonly = inv.from_supply
38 else: # other inv. types are not supposed to be handled in this report38 else: # other inv. types are not supposed to be handled in this report
39 is_readonly = True39 is_readonly = True
4040
=== modified file 'bin/addons/account/report/invoice_excel_export.py'
--- bin/addons/account/report/invoice_excel_export.py 2020-04-09 09:06:08 +0000
+++ bin/addons/account/report/invoice_excel_export.py 2021-11-03 13:33:55 +0000
@@ -37,8 +37,10 @@
3737
38 def _get_distribution_lines(self, inv_line):38 def _get_distribution_lines(self, inv_line):
39 """39 """
40 Returns distrib. line data related to the invoice line in parameter, as a list of dicts40 Returns distrib. line data related to the invoice line in parameter, as a list of dicts.
41 Note: it gives a result even for lines without AD: the line subtotal is retrieved in any cases41 Notes:
42 - it gives a result even for lines without AD: the line subtotal is retrieved in any cases
43 - only CC and Dest are retrieved, FP is excluded.
42 """44 """
43 fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line')45 fp_distrib_line_obj = self.pool.get('funding.pool.distribution.line')
44 distrib_lines = []46 distrib_lines = []
@@ -69,18 +71,19 @@
6971
70 def _get_shipment_number(self, inv):72 def _get_shipment_number(self, inv):
71 """73 """
72 Returns the "shipment" or "simple OUT" number having generated the IVO if linked to a supply workflow74 Returns the "shipment" or "simple OUT" number having generated the IVO/STV if linked to a supply workflow
73 Displayed for both the IVO and the IVI.75 Displayed for both the IVO/STV and the IVI.
74 """76 """
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:
76 # process only once per invoice78 # process only once per invoice
77 return self.invoices[inv.id]['shipment']79 return self.invoices[inv.id]['shipment']
78 ship_or_out_ref = ''80 ship_or_out_ref = ''
79 if inv.from_supply and inv.is_intermission:81 if inv.from_supply:
80 if inv.type == 'out_invoice': # IVO82 inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type']
83 if inv_type in ('ivo', 'stv'):
81 if inv.name:84 if inv.name:
82 ship_or_out_ref = inv.name.split()[-1]85 ship_or_out_ref = inv.name.split()[-1]
83 elif inv.type == 'in_invoice': # IVI86 elif inv_type == 'ivi':
84 if inv.picking_id:87 if inv.picking_id:
85 ship_or_out_ref = inv.picking_id.shipment_ref or ''88 ship_or_out_ref = inv.picking_id.shipment_ref or ''
86 self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref})89 self.invoices.setdefault(inv.id, {}).update({'shipment': ship_or_out_ref})
@@ -88,20 +91,21 @@
8891
89 def _get_fo_number(self, inv):92 def _get_fo_number(self, inv):
90 """93 """
91 Returns the FO number related to the IVO if any.94 Returns the FO number related to the IVO/STV if any.
92 Displayed for both the IVO and the IVI.95 Displayed for both the IVO/STV and the IVI.
93 """96 """
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:
95 # process only once per invoice98 # process only once per invoice
96 return self.invoices[inv.id]['fo']99 return self.invoices[inv.id]['fo']
97 fo_number = ''100 fo_number = ''
98 if inv.from_supply and inv.is_intermission:101 if inv.from_supply:
99 if inv.type == 'out_invoice': # IVO102 inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type']
103 if inv_type in ('ivo', 'stv'):
100 if inv.origin:104 if inv.origin:
101 inv_source_doc_split = inv.origin.split(':')105 inv_source_doc_split = inv.origin.split(':')
102 if inv_source_doc_split:106 if inv_source_doc_split:
103 fo_number = inv_source_doc_split[-1]107 fo_number = inv_source_doc_split[-1]
104 elif inv.type == 'in_invoice': # IVI108 elif inv_type == 'ivi':
105 if inv.main_purchase_id:109 if inv.main_purchase_id:
106 fo_number = inv.main_purchase_id.short_partner_ref or ''110 fo_number = inv.main_purchase_id.short_partner_ref or ''
107 self.invoices.setdefault(inv.id, {}).update({'fo': fo_number})111 self.invoices.setdefault(inv.id, {}).update({'fo': fo_number})
@@ -109,25 +113,26 @@
109113
110 def _get_po_number(self, inv_line):114 def _get_po_number(self, inv_line):
111 """115 """
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.
113 For the IVO: PO to the external partner in order to buy the goods117 For the IVO/STV: PO to the external partner in order to buy the goods
114 For the IVI: PO to the intermission partner which triggered the creation of the FO118 For the IVI: PO to the intermission partner which triggered the creation of the FO
115 """119 """
116 inv = inv_line.invoice_id120 inv = inv_line.invoice_id
117 ivo_from_supply = inv.is_intermission and inv.type == 'out_invoice' and inv.from_supply121 inv_type = self.pool.get('account.invoice').read(self.cr, self.uid, inv.id, ['doc_type'])['doc_type']
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
119 # process only once per invoice except for IVO from Supply where the check must be done line by line123 if not out_inv_from_supply and self.invoices.get(inv.id, {}).get('po', None) is not None:
124 # process only once per invoice except for IVO/STV from Supply where the check must be done line by line
120 return self.invoices[inv.id]['po']125 return self.invoices[inv.id]['po']
121 po_number = ''126 po_number = ''
122 po_line_obj = self.pool.get('purchase.order.line')127 po_line_obj = self.pool.get('purchase.order.line')
123 if inv.from_supply and inv.is_intermission:128 if inv.from_supply:
124 if inv.type == 'out_invoice': # IVO129 if inv_type in ('ivo', 'stv'):
125 fo_line = inv_line.sale_order_line_id130 fo_line = inv_line.sale_order_line_id
126 if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO131 if fo_line and fo_line.type == 'make_to_order': # the line is sourced on a PO
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)])
128 if pol_ids:133 if pol_ids:
129 po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name134 po_number = po_line_obj.browse(self.cr, self.uid, pol_ids[0], fields_to_fetch=['order_id']).order_id.name
130 elif inv.type == 'in_invoice': # IVI135 elif inv_type == 'ivi':
131 if inv.main_purchase_id:136 if inv.main_purchase_id:
132 po_number = inv.main_purchase_id.name137 po_number = inv.main_purchase_id.name
133 self.invoices.setdefault(inv.id, {}).update({'po': po_number})138 self.invoices.setdefault(inv.id, {}).update({'po': po_number})
134139
=== modified file 'bin/addons/account/wizard/account_invoice_import.py'
--- bin/addons/account/wizard/account_invoice_import.py 2021-04-28 15:14:26 +0000
+++ bin/addons/account/wizard/account_invoice_import.py 2021-11-03 13:33:55 +0000
@@ -200,7 +200,7 @@
200 elif invoice.is_inkind_donation: # for Donations200 elif invoice.is_inkind_donation: # for Donations
201 restricted_area = 'donation_lines'201 restricted_area = 'donation_lines'
202 else:202 else:
203 restricted_area = 'invoice_lines' # for SI / STV203 restricted_area = 'invoice_lines' # for SI / STV / ISI
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)],
205 context=context):205 context=context):
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))
207207
=== modified file 'bin/addons/account/wizard/account_invoice_refund.py'
--- bin/addons/account/wizard/account_invoice_refund.py 2020-02-10 13:07:40 +0000
+++ bin/addons/account/wizard/account_invoice_refund.py 2021-11-03 13:33:55 +0000
@@ -32,13 +32,17 @@
3232
33 def _get_filter_refund(self, cr, uid, context=None):33 def _get_filter_refund(self, cr, uid, context=None):
34 """34 """
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)
36 """36 """
37 if context is None:37 if context is None:
38 context = {}38 context = {}
39 if context.get('is_intermission', False):39 refund_types = [('modify', 'Modify'), ('refund', 'Refund'), ('cancel', 'Cancel')]
40 return [('modify', 'Modify'), ('cancel', 'Cancel')]40 if context.get('is_intermission', False) or context.get('doc_type', '') == 'stv':
41 return [('modify', 'Modify'), ('refund', 'Refund'), ('cancel', 'Cancel')]41 refund_types = [('modify', 'Modify'), ('cancel', 'Cancel')]
42 elif context.get('doc_type', '') == 'isi':
43 # note: Refund Cancel is allowed only if the counterpart invoice is closed (handled directly in ISI form)
44 refund_types = [('cancel', 'Cancel')]
45 return refund_types
4246
43 _columns = {47 _columns = {
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!'),
@@ -49,35 +53,10 @@
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'),
50 }54 }
5155
52 def _get_journal(self, cr, uid, context=None):
53 obj_journal = self.pool.get('account.journal')
54 if context is None:
55 context = {}
56 journal = obj_journal.search(cr, uid, [('type', '=', 'sale_refund')])
57 if context.get('type', False):
58 if context['type'] in ('in_invoice', 'in_refund'):
59 journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_refund')])
60 return journal and journal[0] or False
61
62 _defaults = {56 _defaults = {
63 'journal_id': _get_journal,
64 'filter_refund': 'modify',57 'filter_refund': 'modify',
65 }58 }
6659
67 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
68 journal_obj = self.pool.get('account.journal')
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)
70 type = context.get('journal_type', 'sale_refund')
71 if type in ('sale', 'sale_refund'):
72 type = 'sale_refund'
73 else:
74 type = 'purchase_refund'
75 for field in res['fields']:
76 if field == 'journal_id':
77 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
78 res['fields'][field]['selection'] = journal_select
79 return res
80
81 def _hook_fields_for_modify_refund(self, cr, uid, *args):60 def _hook_fields_for_modify_refund(self, cr, uid, *args):
82 """61 """
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)
@@ -94,11 +73,24 @@
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']
95 return res74 return res
9675
97 def _hook_create_invoice(self, cr, uid, data, form, *args):76 def _get_invoice_context(self, context):
77 """
78 Gets the context to be used in _hook_create_invoice
79
80 US-8585: for now only "from_refund_button" is handled, the context is otherwise empty in order not to break the current behavior.
81 """
82 if context and context.get('from_refund_button'):
83 inv_context = {'from_refund_button': True}
84 else:
85 inv_context = {}
86 return inv_context
87
88 def _hook_create_invoice(self, cr, uid, data, form, context=None):
98 """89 """
99 Permits to adapt invoice creation90 Permits to adapt invoice creation
100 """91 """
101 res = self.pool.get('account.invoice').create(cr, uid, data, {})92 inv_context = self._get_invoice_context(context)
93 res = self.pool.get('account.invoice').create(cr, uid, data, context=inv_context)
102 return res94 return res
10395
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):
@@ -134,7 +126,6 @@
134 inv_obj = self.pool.get('account.invoice')126 inv_obj = self.pool.get('account.invoice')
135 reconcile_obj = self.pool.get('account.move.reconcile')127 reconcile_obj = self.pool.get('account.move.reconcile')
136 account_m_line_obj = self.pool.get('account.move.line')128 account_m_line_obj = self.pool.get('account.move.line')
137 mod_obj = self.pool.get('ir.model.data')
138 act_obj = self.pool.get('ir.actions.act_window')129 act_obj = self.pool.get('ir.actions.act_window')
139 wf_service = netsvc.LocalService('workflow')130 wf_service = netsvc.LocalService('workflow')
140 inv_tax_obj = self.pool.get('account.invoice.tax')131 inv_tax_obj = self.pool.get('account.invoice.tax')
@@ -158,14 +149,13 @@
158 if mode in ('cancel', 'modify') and not inv.account_id.reconcile:149 if mode in ('cancel', 'modify') and not inv.account_id.reconcile:
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."))
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):
161 if inv.is_intermission:152 if inv.state == 'inv_close' or inv.is_intermission or inv.doc_type in ('stv', 'isi'):
162 # error specific to IVO/IVI for which there is no simple refund option153 # error msg specific to UC where there is no simple refund option
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, '
164 if inv.state == 'inv_close':155 'it should be unreconciled first.') % _(mode))
165 raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first.') % (mode))
166 else:156 else:
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, '
168158 'it should be unreconciled first. You can only Refund this invoice.') % _(mode))
169 if mode == 'refund' and inv.state == 'inv_close':159 if mode == 'refund' and inv.state == 'inv_close':
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'))
171161
@@ -252,6 +242,7 @@
252 source_doc = invoice.get('number', False)242 source_doc = invoice.get('number', False)
253 invoice.update({243 invoice.update({
254 'type': inv.type,244 'type': inv.type,
245 'real_doc_type': inv.doc_type or '',
255 'date_invoice': date,246 'date_invoice': date,
256 'state': 'draft',247 'state': 'draft',
257 'number': False,248 'number': False,
@@ -264,7 +255,7 @@
264 })255 })
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):
266 invoice[field] = invoice[field] and invoice[field][0]257 invoice[field] = invoice[field] and invoice[field][0]
267 inv_id = self._hook_create_invoice(cr, uid, invoice, form)258 inv_id = self._hook_create_invoice(cr, uid, invoice, form, context=context)
268 if inv.payment_term.id:259 if inv.payment_term.id:
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)
270 if 'value' in data and data['value']:261 if 'value' in data and data['value']:
@@ -283,28 +274,29 @@
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])
284 # write on JIs without recreating AJIs275 # write on JIs without recreating AJIs
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)
286277 # return to a tree view containing the refund generated
287 if context.get('is_intermission', False):278 from_doc_type = context.get('doc_type', '')
288 module = 'account_override'279 if from_doc_type == 'stv':
289 if inv.type == 'in_invoice':280 return_doc_type = 'str'
290 xml_id = 'action_intermission_out'281 elif from_doc_type == 'ivo':
291 else:282 return_doc_type = 'ivi'
292 xml_id = 'action_intermission_in'283 elif from_doc_type == 'ivi':
293 else:284 return_doc_type = 'ivo'
294 module = 'account'285 elif from_doc_type == 'isi':
295 if inv.type in ('out_invoice', 'out_refund'):286 return_doc_type = 'isr'
296 xml_id = 'action_invoice_tree3'287 else: # i.e. si, di
297 else:288 return_doc_type = 'sr'
298 xml_id = 'action_invoice_tree4'289 action_act_window = inv_obj._invoice_action_act_window[return_doc_type]
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)
300 id = result and result[1] or False
301 result = act_obj.read(cr, uid, id, context=context)
302 invoice_domain = eval(result['domain'])291 invoice_domain = eval(result['domain'])
303 invoice_domain.append(('id', 'in', created_inv))292 invoice_domain.append(('id', 'in', created_inv))
304 result['domain'] = invoice_domain293 result['domain'] = invoice_domain
305 return result294 return result
306295
307 def invoice_refund(self, cr, uid, ids, context=None):296 def invoice_refund(self, cr, uid, ids, context=None):
297 if context is None:
298 context = {}
299 context.update({'from_refund_button': True})
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']
309 return self.compute_refund(cr, uid, ids, data_refund, context=context)301 return self.compute_refund(cr, uid, ids, data_refund, context=context)
310302
311303
=== modified file 'bin/addons/account/wizard/account_invoice_refund_view.xml'
--- bin/addons/account/wizard/account_invoice_refund_view.xml 2019-06-24 14:40:19 +0000
+++ bin/addons/account/wizard/account_invoice_refund_view.xml 2021-11-03 13:33:55 +0000
@@ -14,13 +14,17 @@
14 <field name="journal_id" required="1"/>14 <field name="journal_id" required="1"/>
15 <field name="date" required="1"/>15 <field name="date" required="1"/>
16 <field name="period"/>16 <field name="period"/>
17 <field name="filter_refund"/>17 <field name="filter_refund" attrs="{'readonly': [('is_isi', '=', True)]}"/>
18 <field name="is_intermission" invisible="1"/>18 <field name="is_intermission" invisible="1"/>
19 <field name="is_stv" invisible="1"/>
20 <field name="is_isi" invisible="1"/>
19 </group>21 </group>
20 <separator colspan="4"/>22 <separator colspan="4"/>
21 <group col="4" colspan="4" fill="1">23 <group col="4" colspan="4" fill="1">
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)]}">
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."/>
26 </group>
27 <group attrs="{'invisible': ['|', '|', ('is_intermission', '=', True), ('is_stv', '=', True), ('is_isi', '=', True)]}">
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."/>
25 </group>29 </group>
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."/>
2731
=== modified file 'bin/addons/account_hq_entries/account_view.xml'
--- bin/addons/account_hq_entries/account_view.xml 2019-01-10 13:48:23 +0000
+++ bin/addons/account_hq_entries/account_view.xml 2021-11-03 13:33:55 +0000
@@ -192,40 +192,6 @@
192 </field>192 </field>
193 </record>193 </record>
194194
195 <!--
196 New account attribute for HQ entries corrections
197 -->
198
199 <record id="inherit_view_account_form2" model="ir.ui.view">
200 <field name='name'>inherit.view.account.form2</field>
201 <field name='model'>account.account</field>
202 <field name="type">form</field>
203 <field name='inherit_id' ref='account.view_account_form'/>
204 <field name="priority">30</field>
205 <field name="arch" type="xml">
206 <xpath expr="//field[@name='user_type']" position="after">
207 <field name="is_not_hq_correctible" on_change="onchange_is_not_hq_correctible(is_not_hq_correctible)"/>
208 <newline/>
209 <label string="" colspan="2"/>
210 <field name="is_not_ad_correctable" on_change="onchange_is_not_ad_correctable(is_not_ad_correctable)"/>
211 </xpath>
212 </field>
213 </record>
214
215 <record id="inherit_view_account_tree2" model="ir.ui.view">
216 <field name='name'>inherit.view.account.tree2</field>
217 <field name='model'>account.account</field>
218 <field name="type">tree</field>
219 <field name='inherit_id' ref='account.view_account_tree'/>
220 <field name="priority" eval="20"/>
221 <field name="arch" type="xml">
222 <xpath expr="//field[@name='activation_date']" position="before">
223 <field name="is_not_hq_correctible" invisible="1"/>
224 </xpath>
225 </field>
226 </record>
227
228
229 <!-- Actions: Menu actions -->195 <!-- Actions: Menu actions -->
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">
231 <field name="name">Import HQ Entries</field>197 <field name="name">Import HQ Entries</field>
232198
=== modified file 'bin/addons/account_mcdb/account_view.xml'
--- bin/addons/account_mcdb/account_view.xml 2020-08-06 16:10:07 +0000
+++ bin/addons/account_mcdb/account_view.xml 2021-11-03 13:33:55 +0000
@@ -87,30 +87,6 @@
87 </field>87 </field>
88 </record>88 </record>
8989
90 <!-- Account analytic line tree view -->
91 <record model="ir.ui.view" id="account_analytic_line_default">
92 <field name="name">account.analytic.line.default</field>
93 <field name="model">account.analytic.line</field>
94 <field name="type">tree</field>
95 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
96 <field name="priority" eval="40"/>
97 <field name="arch" type="xml">
98 <data>
99 <xpath expr="/tree/field[@name='journal_id']" position="before">
100 <field name="is_reversal" invisible="1"/>
101 <field name="journal_type" invisible="1"/>
102 <field name="is_corrigible" invisible="1"/>
103 <button name="button_corrections" type="object" string="Accounting info/correction"
104 attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
105 <field name="is_reallocated" invisible="1"/>
106 <field name="last_corrected_id" invisible="1"/>
107 <field name="is_engi" invisible="1"/>
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"/>
109 </xpath>
110 </data>
111 </field>
112 </record>
113
114 <!-- Actions -->90 <!-- Actions -->
115 <act_window id="analytic_distribution.action_mass_reallocation"91 <act_window id="analytic_distribution.action_mass_reallocation"
116 name="Mass reallocation"92 name="Mass reallocation"
11793
=== modified file 'bin/addons/account_override/__init__.py'
--- bin/addons/account_override/__init__.py 2019-06-13 16:16:46 +0000
+++ bin/addons/account_override/__init__.py 2021-11-03 13:33:55 +0000
@@ -51,6 +51,8 @@
51 #+ Supplier Invoice51 #+ Supplier Invoice
52 #+ Direct Invoice52 #+ Direct Invoice
53 #+ Supplier refund53 #+ Supplier refund
54 #+ Intersection Supplier Invoice
55 #+ Intersection Supplier Refund
54 'in_invoice': [56 'in_invoice': [
55 ('type', '!=', 'view'),57 ('type', '!=', 'view'),
56 # Either Payable/Payables or Payable/Tax or Regular/Debt or Regular/Cash or Regular/Income accounts58 # Either Payable/Payables or Payable/Tax or Regular/Debt or Regular/Cash or Regular/Income accounts
@@ -61,6 +63,7 @@
61 ],63 ],
62 # HEADER OF:64 # HEADER OF:
63 #+ Stock Transfer Voucher65 #+ Stock Transfer Voucher
66 #+ Stock Transfer Refund
64 #+ Customer Refund67 #+ Customer Refund
65 #+ Debit Notes68 #+ Debit Notes
66 'out_invoice': [69 'out_invoice': [
@@ -81,7 +84,10 @@
81 #+ Supplier invoice84 #+ Supplier invoice
82 #+ Direct invoice85 #+ Direct invoice
83 #+ Supplier refund86 #+ Supplier refund
87 #+ Intersection supplier invoice
88 #+ Intersection supplier refund
84 #+ Stock transfer voucher89 #+ Stock transfer voucher
90 #+ Stock transfer refund
85 #+ Customer refund91 #+ Customer refund
86 #+ Debit notes92 #+ Debit notes
87 'invoice_lines': [93 'invoice_lines': [
8894
=== modified file 'bin/addons/account_override/account.py'
--- bin/addons/account_override/account.py 2021-04-23 12:31:26 +0000
+++ bin/addons/account_override/account.py 2021-11-03 13:33:55 +0000
@@ -974,6 +974,7 @@
974 required=True, states={'posted':[('readonly',True)]},974 required=True, states={'posted':[('readonly',True)]},
975 domain="[('type', 'not in', "975 domain="[('type', 'not in', "
976 " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq']),"976 " ['accrual', 'hq', 'inkind', 'cur_adj', 'system', 'extra', 'correction', 'correction_hq']),"
977 "('code', '!=', 'ISI'), "
977 "('instance_filter', '=', True)]",978 "('instance_filter', '=', True)]",
978 hide_default_menu=True),979 hide_default_menu=True),
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"),
980981
=== modified file 'bin/addons/account_override/account_invoice_sync.py'
--- bin/addons/account_override/account_invoice_sync.py 2021-08-05 15:24:04 +0000
+++ bin/addons/account_override/account_invoice_sync.py 2021-11-03 13:33:55 +0000
@@ -174,7 +174,7 @@
174 """174 """
175 Creates automatic counterpart invoice at synchro time.175 Creates automatic counterpart invoice at synchro time.
176 Intermission workflow: an IVO sent generates an IVI176 Intermission workflow: an IVO sent generates an IVI
177 Intersection workflow: an STV sent generates an SI177 Intersection workflow: an STV sent generates an ISI
178 """178 """
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))
180 if context is None:180 if context is None:
@@ -213,21 +213,24 @@
213 inv_lines = invoice_dict.get('invoice_line', [])213 inv_lines = invoice_dict.get('invoice_line', [])
214 po = False214 po = False
215 vals = {}215 vals = {}
216 # STV in sending instance: generates an SI in the receiving instance216 # STV in sending instance: generates an ISI in the receiving instance
217 if journal_type == 'sale':217 if journal_type == 'sale':
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,
219 if not pur_journal_ids:219 [('type', '=', 'purchase'), ('code', '=', 'ISI'), ('is_current_instance', '=', True)],
220 raise osv.except_osv(_('Error'), _("No Purchase journal found for the current instance."))220 limit=1, context=context)
221 # for the SI use the Account Payable of the partner221 if not isi_journal_ids:
222 si_account = partner.property_account_payable222 raise osv.except_osv(_('Error'), _("No Intersection Supplier Invoice journal found for the current instance."))
223 if not si_account or posting_date < si_account.activation_date or \223 # for the ISI use the Account Payable of the partner
224 (si_account.inactivation_date and posting_date >= si_account.inactivation_date):224 isi_account = partner.property_account_payable
225 if not isi_account or posting_date < isi_account.activation_date or \
226 (isi_account.inactivation_date and posting_date >= isi_account.inactivation_date):
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)
226 vals.update(228 vals.update(
227 {229 {
228 'journal_id': pur_journal_ids[0],230 'journal_id': isi_journal_ids[0],
229 'account_id': si_account.id,231 'account_id': isi_account.id,
230 'type': 'in_invoice',232 'type': 'in_invoice',
233 'real_doc_type': 'isi',
231 'is_direct_invoice': False,234 'is_direct_invoice': False,
232 'is_inkind_donation': False,235 'is_inkind_donation': False,
233 'is_debit_note': False,236 'is_debit_note': False,
@@ -249,6 +252,7 @@
249 'journal_id': int_journal_ids[0],252 'journal_id': int_journal_ids[0],
250 'account_id': ivi_account.id,253 'account_id': ivi_account.id,
251 'type': 'in_invoice',254 'type': 'in_invoice',
255 'real_doc_type': 'ivi',
252 'is_inkind_donation': False,256 'is_inkind_donation': False,
253 'is_debit_note': False,257 'is_debit_note': False,
254 'is_intermission': True,258 'is_intermission': True,
@@ -321,7 +325,7 @@
321 if inv_id:325 if inv_id:
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)
323 if journal_type == 'sale':327 if journal_type == 'sale':
324 msg = "SI No. %s created successfully." % inv_id328 msg = "ISI No. %s created successfully." % inv_id
325 elif journal_type == 'intermission':329 elif journal_type == 'intermission':
326 msg = "IVI No. %s created successfully." % inv_id330 msg = "IVI No. %s created successfully." % inv_id
327 self._logger.info(msg)331 self._logger.info(msg)
@@ -352,7 +356,7 @@
352 if counterpart_inv_number:356 if counterpart_inv_number:
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)
354 elif not counterpart_inv_number and number:358 elif not counterpart_inv_number and number:
355 # use case where the state of the IVO/STV is updated before the related IVI/SI has been opened359 # use case where the state of the IVO/STV is updated before the related IVI/ISI has been opened
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)
357 if inv_ids:361 if inv_ids:
358 self.write(cr, uid, inv_ids[0], vals, context=context)362 self.write(cr, uid, inv_ids[0], vals, context=context)
359363
=== modified file 'bin/addons/account_override/account_invoice_view.xml'
--- bin/addons/account_override/account_invoice_view.xml 2021-04-29 10:12:12 +0000
+++ bin/addons/account_override/account_invoice_view.xml 2021-11-03 13:33:55 +0000
@@ -27,46 +27,6 @@
27 </field>27 </field>
28 </record>28 </record>
2929
30 <!--
31 Supplier Invoice
32 -->
33 <record id="invoice_supplier_form_3" model="ir.ui.view">
34 <field name="name">account.invoice.supplier.form.3</field>
35 <field name="model">account.invoice</field>
36 <field name="type">form</field>
37 <field name="inherit_id" ref="account.invoice_supplier_form"/>
38 <field name="priority">20</field>
39 <field name="arch" type="xml">
40 <data>
41 <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes">
42 <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'in_invoice')]</attribute>
43 </xpath>
44 <xpath expr="/form/group[1]/field[@name='partner_id']" position="attributes">
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>
46 </xpath>
47 <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before">
48 <field name="line_number" displayon="noteditable"/>
49 </xpath>
50 <xpath expr="//field[@name='date_invoice']" position="before">
51 <field name="document_date" />
52 </xpath>
53 <xpath expr="//field[@name='period_id']" position="replace">
54 </xpath>
55 <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace">
56 </xpath>
57 <xpath expr="//button[@name='invoice_open']" position="after" >
58 <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/>
59 <newline/>
60 <field name="can_merge_lines" invisible="1"/>
61 <button name="button_merge_lines" type="object"
62 colspan="3"
63 string="Merge Lines by Account" icon="gtk-convert"
64 confirm="You are about to merge invoice lines; are you sure you want to proceed ? THIS OPERATION CAN NOT BE UNDONE"
65 attrs="{'invisible': [('can_merge_lines', '!=', True)]}"/>
66 </xpath>
67 </data>
68 </field>
69 </record>
7030
71 <!-- Change account_id domain -->31 <!-- Change account_id domain -->
72 <record id="invoice_line_form3" model="ir.ui.view">32 <record id="invoice_line_form3" model="ir.ui.view">
@@ -82,131 +42,6 @@
82 </field>42 </field>
83 </record>43 </record>
8444
85 <!--
86 Delete some field from account_invoice tree:
87 - Salesman or User (user_id)
88 - Total amount (amount_total)
89 - Untaxed (amount_untaxed)
90 Add some elements:
91 - Document date
92 -->
93 <record id="inherit_invoice_tree" model="ir.ui.view">
94 <field name="name">inherit.invoice.tree</field>
95 <field name="model">account.invoice</field>
96 <field name="type">tree</field>
97 <field name="inherit_id" ref="account.invoice_tree"/>
98 <field name="priority">17</field>
99 <field name="arch" type="xml">
100 <data>
101 <xpath expr="/tree/field[@name='date_invoice']" position="before">
102 <field name="document_date"/>
103 <field name="supplier_reference"/>
104 </xpath>
105 <xpath expr="/tree/field[@name='user_id']" position="replace">
106 </xpath>
107 <xpath expr="/tree/field[@name='amount_untaxed']" position="replace">
108 </xpath>
109 <xpath expr="/tree/field[@name='residual']" position="attributes">
110 <attribute name="sum"></attribute>
111 </xpath>
112 <xpath expr="/tree/field[@name='amount_total']" position="attributes">
113 <attribute name="sum"></attribute>
114 </xpath>
115 </data>
116 </field>
117 </record>
118
119 <!--
120 Delete some element from Search views:
121 - Salesman or user (user_id)
122 - Total (amount_total)
123 - Responsible button (group by)
124 - Proforma button
125 - Invoices button
126 - Unpaid button
127 And add some ones:
128 - Open button
129 - Paid button
130 -->
131 <record id="inherit_view_account_invoice_filter" model="ir.ui.view">
132 <field name="name">inherit.view.account.invoice.filter</field>
133 <field name="model">account.invoice</field>
134 <field name="type">search</field>
135 <field name="inherit_id" ref="account.view_account_invoice_filter"/>
136 <field name="priority">17</field>
137 <field name="arch" type="xml">
138 <data>
139 <xpath expr="/search/group[1]/filter[@name='proforma']" position="replace">
140 </xpath>
141 <xpath expr="/search/group[1]/filter[@name='invoices']" position="replace">
142 </xpath>
143 <xpath expr="/search/group[1]/filter[@name='unpaid']" position="attributes">
144 <attribute name="string">Open</attribute>
145 <attribute name="help">Open Invoices</attribute>
146 </xpath>
147 <xpath expr="/search/group[1]/field[@name='user_id']" position="replace">
148 </xpath>
149 <xpath expr="/search/group[3]/filter[@string='Responsible']" position="replace">
150 </xpath>
151 <xpath expr="/search/group[2]/field[@name='period_id']" position="after">
152 <field name="supplier_reference"/>
153 <field name="name"/>
154 </xpath>
155 <xpath expr="/search/group[1]/separator[1]" position="replace">
156 </xpath>
157 <xpath expr="/search/group[1]/filter[@name='unpaid']" position="after">
158 <filter name="paid" icon="terp-dolar" string="Paid" domain="[('state', '=', 'paid')]"/>
159 <filter name="closed" icon="terp-dialog-close" string="Closed" domain="[('state', '=', 'inv_close')]" />
160 <filter name="cancel_state" icon="terp-gtk-stop" string="Cancelled" domain="[('state', '=', 'cancel')]"/>
161 <separator orientation="vertical"/>
162 <filter name="not_imported" icon="gtk-cancel" string="Not imported" domain="[('imported_state', '=', 'not')]"/>
163 <filter name="partial" icon="terp-dolar_ok!" string="Partially imported" domain="[('imported_state', '=', 'partial')]"/>
164 <filter name="imported" icon="gtk-apply" string="Imported" domain="[('imported_state', '=', 'imported')]"/>
165 <separator orientation="vertical"/>
166 </xpath>
167 </data>
168 </field>
169 </record>
170
171 <!--
172 Delete some elements from Stock transfer voucher (customer invoices):
173 - period_id
174 - label with "keep empty…"
175 Add some others elements:
176 - document_date
177 -->
178 <record id="invoice_form_4" model="ir.ui.view">
179 <field name="name">account.invoice.supplier.form.4</field>
180 <field name="model">account.invoice</field>
181 <field name="type">form</field>
182 <field name="inherit_id" ref="account.invoice_form"/>
183 <field name="priority">22</field>
184 <field name="arch" type="xml">
185 <data>
186 <xpath expr="//field[@name='date_invoice']" position="before">
187 <field name="document_date"/>
188 </xpath>
189 <xpath expr="//field[@name='period_id']" position="replace">
190 </xpath>
191 <xpath expr="//label[@string='(keep empty to use the current period)']" position="replace">
192 </xpath>
193 </data>
194 </field>
195 </record>
196
197 <!-- Add Split Invoice Button on invoices -->
198 <record id="invoice_form_3" model="ir.ui.view">
199 <field name="name">account.invoice.form.3</field>
200 <field name="model">account.invoice</field>
201 <field name="type">form</field>
202 <field name="inherit_id" ref="account.invoice_form"/>
203 <field name="priority">40</field>
204 <field name="arch" type="xml">
205 <button name='invoice_open' position="after">
206 <button name="button_split_invoice" states="draft,proforma2" type="object" string="Split Invoice" icon="gtk-cut"/>
207 </button>
208 </field>
209 </record>
21045
211 <!--46 <!--
212 Debit Note views47 Debit Note views
@@ -245,7 +80,7 @@
245 <field name="arch" type="xml">80 <field name="arch" type="xml">
246 <form string="Debit Note" hide_duplicate_button="1">81 <form string="Debit Note" hide_duplicate_button="1">
247 <group colspan="4" col="8">82 <group colspan="4" col="8">
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)]"/>
249 <field name="number"/>84 <field name="number"/>
250 <field name="type" invisible="1"/>85 <field name="type" invisible="1"/>
251 <field name="currency_id" width="50"/>86 <field name="currency_id" width="50"/>
@@ -345,7 +180,7 @@
345 <field name="arch" type="xml">180 <field name="arch" type="xml">
346 <form string="In-kind Donation" noteditable="state=='cancel'">181 <form string="In-kind Donation" noteditable="state=='cancel'">
347 <group colspan="4" col="8">182 <group colspan="4" col="8">
348 <field name="journal_id" domain="[('is_current_instance','=',True), ('type', 'in', ('inkind', 'extra'))]"/>183 <field name="journal_id" domain="[('inv_doc_type', '=', True)]"/>
349 <field name="number"/>184 <field name="number"/>
350 <field name="type" invisible="1"/>185 <field name="type" invisible="1"/>
351 <field name="is_inkind_donation" invisible="1"/>186 <field name="is_inkind_donation" invisible="1"/>
@@ -508,7 +343,7 @@
508 <field name="arch" type="xml">343 <field name="arch" type="xml">
509 <form string="Intermission Voucher" noteditable="state=='cancel'">344 <form string="Intermission Voucher" noteditable="state=='cancel'">
510 <group colspan="4" col="8">345 <group colspan="4" col="8">
511 <field name="fake_journal_id" domain="[('is_current_instance','=',True)]" />346 <field name="fake_journal_id"/> <!-- readonly -->
512 <field name="journal_type" invisible="1"/>347 <field name="journal_type" invisible="1"/>
513 <field name="number"/>348 <field name="number"/>
514 <field name="type" invisible="1"/>349 <field name="type" invisible="1"/>
@@ -747,113 +582,6 @@
747 </record>582 </record>
748583
749 <!--584 <!--
750 Delete some elements on customer invoices:
751 - fiscal_position field
752 - proforma button (invoice_proforma2)
753 - payment_term field
754 - tax frame
755 - compute tax button (button_reset_taxes)
756 - amount untaxed field
757 - amount tax field
758 Update some other ones:
759 - account_id field to add a domain on accounts regarding "ACCOUNT_RESTRICTED_AREA" variable
760 -->
761 <record id="inherit_invoice_form" model="ir.ui.view">
762 <field name="name">inherit.invoice.form</field>
763 <field name="model">account.invoice</field>
764 <field name="type">form</field>
765 <field name="inherit_id" ref="account.invoice_form"/>
766 <field name="priority">61</field>
767 <field name="arch" type="xml">
768 <data>
769 <xpath expr="/form" position="attributes">
770 <attribute name="string">Stock Transfer Voucher</attribute>
771 </xpath>
772 <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='account_id']" position="attributes">
773 <attribute name="domain">[('company_id', '=', company_id), ('restricted_area', '=', 'out_invoice')]</attribute>
774 </xpath>
775 <field name="fiscal_position" position="replace"/>
776 <field name="payment_term" position="replace"/>
777 <field name="tax_line" position="replace"/>
778 <button name="button_reset_taxes" position="replace"/>
779 <button name="invoice_proforma2" position="replace"/>
780 <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='invoice_line']" position="before" >
781 <group name="import" string=" Import Lines " colspan="4" col="4"
782 attrs="{'invisible': [('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}">
783 <button name="import_invoice" string="Import Invoice Line" icon="gtk-execute" colspan="2" type="object"
784 attrs="{'readonly': [('state', '!=', 'draft')],
785 'invisible': [('type', '!=', 'out_invoice')]}"/>
786 <button name="export_invoice" string="Export Invoice Line" icon="gtk-execute" colspan="2" type="object"
787 attrs="{'invisible': [('type', '!=', 'out_invoice')]}"
788 force_editable="1"/>
789 <newline/>
790 <button name="wizard_import_si_line" string="Import lines" icon="gtk-dnd" colspan="4" type="object"
791 attrs="{'invisible': [('state', '!=', 'draft')],
792 'readonly': [('type', '=', 'out_invoice'),
793 ('from_supply', '=', True),
794 ('partner_type', 'in', ('intermission', 'section'))]}"/>
795 </group>
796 </xpath>
797 <xpath expr="/form/notebook/page[@string='Invoice']/group[3]" position="replace">
798 <group col="8" colspan="4">
799 <label string="" colspan="3"/>
800 <field name="reconciled"/>
801 <field name="amount_total"/>
802 <label string="" colspan="3"/>
803 <field name="state"/>
804 <field name="residual"/>
805 <field name="is_debit_note" invisible="1"/>
806 </group>
807 <field name="partner_type" invisible="1"/>
808 <group col="8" colspan="4">
809
810 <button string="Cancel document" name="invoice_cancel"
811 type="workflow" icon="gtk-cancel"
812 confirm="Do you really want to cancel this document?"
813 attrs="{'invisible': ['|', '|',
814 ('state', '!=', 'draft'),
815 ('type', '!=', 'out_invoice'),
816 ('from_supply', '=', False)]}"/>
817
818 <button name="button_split_invoice" type="object" string="Split Stock Transfer Voucher"
819 icon="gtk-cut"
820 context="{'from_stv': True}"
821 attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('type', '!=', 'out_invoice')]}"/>
822
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'])]}"/>
824 <!-- add a confirmation step only for STV (not for Customer Refunds)
825 when the partner type is compatible with a synchro but "synced" isn't ticked -->
826 <button name="invoice_open" type="object" string="Validate"
827 icon="gtk-go-forward"
828 attrs="{'invisible': ['|',
829 ('state', '!=', 'draft'),
830 '&amp;',
831 ('type', '=', 'out_invoice'), ('partner_type', 'in', ('intermission', 'section')) ]}"/>
832 <button name="invoice_open_with_confirmation" type="object" string="Validate"
833 icon="gtk-go-forward"
834 confirm="Are you sure you want to validate this invoice without synchronization?"
835 attrs="{'invisible': ['|', '|', '|',
836 ('state', '!=', 'draft'),
837 ('type', '!=', 'out_invoice'),
838 ('synced', '=', True),
839 ('partner_type', 'not in', ('intermission', 'section'))]}"/>
840
841 <button name="invoice_open_with_sync_confirmation" type="object" string="Validate"
842 icon="gtk-go-forward"
843 confirm="This invoice will sync to its counterpart instance."
844 attrs="{'invisible': ['|', '|', '|',
845 ('state', '!=', 'draft'),
846 ('type', '!=', 'out_invoice'),
847 ('synced', '=', False),
848 ('partner_type', 'not in', ('intermission', 'section'))]}"/>
849 <button name="%(account.account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,inv_close,proforma,sale,proforma2"/>
850 </group>
851 </xpath>
852 </data>
853 </field>
854 </record>
855
856 <!--
857 Debit note actions585 Debit note actions
858 -->586 -->
859587
@@ -864,8 +592,8 @@
864 <field name="view_type">form</field>592 <field name="view_type">form</field>
865 <field name="view_mode">tree,form,calendar,graph</field>593 <field name="view_mode">tree,form,calendar,graph</field>
866 <field eval="False" name="view_id"/>594 <field eval="False" name="view_id"/>
867 <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '!=', False), ('is_inkind_donation', '=', False)]</field>595 <field name="domain">[('doc_type', '=', 'dn')]</field>
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>
869 <field name="search_view_id" ref="account.view_account_invoice_filter"/>597 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
870 </record>598 </record>
871599
@@ -931,8 +659,8 @@
931 <field name="view_type">form</field>659 <field name="view_type">form</field>
932 <field name="view_mode">tree,form,calendar,graph</field>660 <field name="view_mode">tree,form,calendar,graph</field>
933 <field eval="False" name="view_id"/>661 <field eval="False" name="view_id"/>
934 <field name="domain">[('type','=','in_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', True)]</field>662 <field name="domain">[('doc_type', '=', 'donation')]</field>
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>
936 <field name="search_view_id" ref="view_account_invoice_filter_donation"/>664 <field name="search_view_id" ref="view_account_invoice_filter_donation"/>
937 </record>665 </record>
938666
@@ -959,8 +687,8 @@
959 <field name="view_type">form</field>687 <field name="view_type">form</field>
960 <field name="view_mode">tree,form,calendar,graph</field>688 <field name="view_mode">tree,form,calendar,graph</field>
961 <field eval="False" name="view_id"/>689 <field eval="False" name="view_id"/>
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>
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>
964 <field name="search_view_id" ref="account.view_account_invoice_filter"/>692 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
965 </record>693 </record>
966694
@@ -987,8 +715,8 @@
987 <field name="view_type">form</field>715 <field name="view_type">form</field>
988 <field name="view_mode">tree,form,calendar,graph</field>716 <field name="view_mode">tree,form,calendar,graph</field>
989 <field name="view_id" ref="view_intermission_form"/>717 <field name="view_id" ref="view_intermission_form"/>
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>
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>
992 <field name="search_view_id" ref="account.view_account_invoice_filter"/>720 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
993 </record>721 </record>
994722
@@ -1008,34 +736,6 @@
1008 <field name="act_window_id" ref="action_intermission_in"/>736 <field name="act_window_id" ref="action_intermission_in"/>
1009 </record>737 </record>
1010738
1011 <!-- Fix customer invoice display with a bypass on 'is_debit_note' set to True -->
1012 <record id="account.action_invoice_tree1" model="ir.actions.act_window">
1013 <field name="name">Customer Invoices</field> <!-- Stock Transfer Vouchers -->
1014 <field name="res_model">account.invoice</field>
1015 <field name="view_type">form</field>
1016 <field name="view_mode">tree,form,calendar,graph</field>
1017 <field eval="False" name="view_id"/>
1018 <field name="domain">[('type','=','out_invoice'), ('is_debit_note', '=', False), ('is_inkind_donation', '=', False), ('is_intermission', '=', False)]</field>
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>
1020 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
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>
1022 </record>
1023
1024 <!-- Fix supplier invoice display with a bypass on 'is_inkind_donation' set to True -->
1025 <record id="account.action_invoice_tree2" model="ir.actions.act_window">
1026 <field name="name">Supplier Invoices</field>
1027 <field name="res_model">account.invoice</field>
1028 <field name="view_type">form</field>
1029 <field name="view_mode">tree,form,calendar,graph</field>
1030 <field eval="False" name="view_id"/>
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 -->
1032 <field name="domain">[('type','=','in_invoice'), ('is_direct_invoice', '=', False), ('is_inkind_donation', '=', False), ('is_debit_note', "=", False), ('is_intermission', '=', False)]</field>
1033 <field name="context">{'type': 'in_invoice', 'journal_type': 'purchase', 'from_inv_form': True}</field>
1034 <field name="search_view_id" ref="account.view_account_invoice_filter"/>
1035 <field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers.
1036 OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice
1037 from your supplier according to what you purchased or received.</field>
1038 </record>
1039739
1040 <!--740 <!--
1041 Debit Note Menu741 Debit Note Menu
@@ -1045,13 +745,13 @@
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"/>
1046746
1047 <!-- In-kind Donation Menu in "Supplier Invoices" -->747 <!-- In-kind Donation Menu in "Supplier Invoices" -->
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"/>
1049749
1050 <!-- Intermission Voucher OUT in "Customer Invoices" -->750 <!-- Intermission Voucher OUT in "Customer Invoices" -->
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"/>
1052752
1053 <!-- Intermission Voucher IN in "Supplier Invoices" -->753 <!-- Intermission Voucher IN in "Supplier Invoices" -->
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"/>
1055755
1056 <!--756 <!--
1057 Account invoice report redefinition757 Account invoice report redefinition
1058758
=== modified file 'bin/addons/account_override/account_view.xml'
--- bin/addons/account_override/account_view.xml 2019-06-18 11:15:45 +0000
+++ bin/addons/account_override/account_view.xml 2021-11-03 13:33:55 +0000
@@ -2,61 +2,6 @@
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <record model="ir.ui.view" id="view_account_activable_form">
6 <field name="name">account.account_activable.form</field>
7 <field name="model">account.account</field>
8 <field name="type">form</field>
9 <field name="inherit_id" ref="account.view_account_form"/>
10 <field name="priority">20</field>
11 <field name="arch" type="xml">
12 <field name="company_id" position="replace"/>
13 <page string="General Information" position="replace">
14 <page string="General Information">
15 <group col="6" colspan="4">
16 <field name="activation_date"/>
17 <field name="inactivation_date"/>
18 <group col="2" colspan="2">
19 <field name="reconcile" on_change="onchange_reconcile(reconcile)"/>
20 <field name="prevent_multi_curr_rec" attrs="{'readonly': [('reconcile', '=', False)]}"/>
21 <field name="reconciliation_debit_account_id"/>
22 <field name="reconciliation_credit_account_id"/>
23 </group>
24 </group>
25 </page>
26 </page>
27
28 <page string="Notes" position="before">
29 <page string="Allowed Partner types">
30 <group col="4" colspan="4">
31 <group col="2" colspan="2">
32 <field name="has_partner_type_internal" />
33 <field name="has_partner_type_external" />
34 <field name="has_partner_type_esc" />
35 <newline />
36 <field name="has_partner_type_local" />
37 <field name="has_partner_type_ex" />
38 <field name="has_partner_type_empty" />
39 <newline />
40 <field name="has_partner_type_book" />
41 </group>
42
43 <group col="2" colspan="2">
44 <field name="has_partner_type_intermission" />
45 <field name="has_partner_type_section" />
46
47 <label /><label />
48 <newline />
49 <label /><label />
50 <label /><label />
51 <newline />
52 <label /><label />
53 </group>
54 </group>
55 </page>
56 </page>
57 </field>
58 </record>
59
60 <!-- Tree view for Balance by Account result: granularity by parent account -->5 <!-- Tree view for Balance by Account result: granularity by parent account -->
61 <record model="ir.ui.view" id="balance_account_tree">6 <record model="ir.ui.view" id="balance_account_tree">
62 <field name="name">balance.account.tree</field>7 <field name="name">balance.account.tree</field>
@@ -99,46 +44,6 @@
99 </field>44 </field>
100 </record>45 </record>
10146
102 <!-- Tree view for chart of account result -->
103 <record model="ir.ui.view" id="account.view_account_tree">
104 <field name="name">account.account_activable.tree</field>
105 <field name="model">account.account</field>
106 <field name="type">tree</field>
107 <field name="field_parent">child_id</field>
108 <field name="priority" eval="12"/>
109 <field name="arch" type="xml">
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">
111 <field name="code"/>
112 <field name="name"/>
113 <field name="note"/>
114 <field name="type" invisible="1"/>
115 <field name="user_type" invisible="1"/>
116 <field name="activation_date" invisible="1"/>
117 <field name="inactivation_date" invisible="1"/>
118 <field name="parent_id" invisible="1"/>
119 <field name="is_analytic_addicted" invisible="1"/>
120 </tree>
121 </field>
122 </record>
123
124 <!-- Tree view for default tree view of accounts -->
125 <record id="account.view_account_list" model="ir.ui.view">
126 <field name="name">account.account_activable.list</field>
127 <field name="model">account.account</field>
128 <field name="type">tree</field>
129 <field name="field_parent">child_id</field>
130 <field name="priority" eval="10"/>
131 <field name="arch" type="xml">
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">
133 <field name="code"/>
134 <field name="name"/>
135 <field name="type"/>
136 <field name="activation_date"/>
137 <field name="inactivation_date"/>
138 </tree>
139 </field>
140 </record>
141
142 <record id="action_account_activable_form" model="ir.actions.act_window">47 <record id="action_account_activable_form" model="ir.actions.act_window">
143 <field name="name">Accounts</field>48 <field name="name">Accounts</field>
144 <field name="res_model">account.account</field>49 <field name="res_model">account.account</field>
14550
=== modified file 'bin/addons/account_override/invoice.py'
--- bin/addons/account_override/invoice.py 2021-08-11 15:37:51 +0000
+++ bin/addons/account_override/invoice.py 2021-11-03 13:33:55 +0000
@@ -26,7 +26,6 @@
26from osv import fields26from osv import fields
27from time import strftime27from time import strftime
28from tools.translate import _28from tools.translate import _
29from lxml import etree
30from datetime import datetime29from datetime import datetime
31from msf_partner import PARTNER_TYPE30from msf_partner import PARTNER_TYPE
32import re31import re
@@ -51,55 +50,40 @@
51 inv_name = inv.number or inv.name or 'No_description'50 inv_name = inv.number or inv.name or 'No_description'
52 prefix = 'STV_'51 prefix = 'STV_'
5352
54 if inv.type == 'out_refund': # Customer refund53 if inv.doc_type == 'cr':
55 prefix = 'CR_'54 prefix = 'CR_'
56 elif inv.type == 'in_refund': # Supplier refund55 elif inv.doc_type == 'sr':
57 prefix = 'SR_'56 prefix = 'SR_'
58 elif inv.type == 'out_invoice':57 elif inv.doc_type == 'stv':
59 # Stock transfer voucher
60 prefix = 'STV_'58 prefix = 'STV_'
61 # Debit note59 elif inv.doc_type == 'dn':
62 if inv.is_debit_note and not inv.is_inkind_donation and not inv.is_intermission:60 prefix = 'DN_'
63 prefix = 'DN_'61 elif inv.doc_type == 'ivo':
64 # Intermission voucher OUT62 prefix = 'IVO_'
65 elif not inv.is_debit_note and not inv.is_inkind_donation and inv.is_intermission:63 elif inv.doc_type == 'si':
66 prefix = 'IVO_'
67 elif inv.type == 'in_invoice':
68 # Supplier invoice
69 prefix = 'SI_'64 prefix = 'SI_'
70 # Intermission voucher IN65 elif inv.doc_type == 'ivi':
71 if not inv.is_debit_note and not inv.is_inkind_donation and inv.is_intermission:66 prefix = 'IVI_'
72 prefix = 'IVI_'67 elif inv.doc_type == 'di':
73 # Direct invoice68 prefix = 'DI_'
74 elif inv.is_direct_invoice:69 elif inv.doc_type == 'donation':
75 prefix = 'DI_'70 prefix = 'DON_'
76 # In-kind donation71 elif inv.doc_type == 'str':
77 elif not inv.is_debit_note and inv.is_inkind_donation:72 prefix = 'STR_'
78 prefix = 'DON_'73 elif inv.doc_type == 'isi':
74 prefix = 'ISI_'
75 elif inv.doc_type == 'isr':
76 prefix = 'ISR_'
79 return '%s%s' % (prefix, inv_name)77 return '%s%s' % (prefix, inv_name)
8078
81 def _get_journal(self, cr, uid, context=None):79 def _get_journal(self, cr, uid, context=None):
82 """80 """
83 WARNING: This method has been taken from account module from OpenERP81 Returns the journal to be used by default, depending on the doc type of the selected invoice
84 """82 """
85 # @@@override@account.invoice.py
86 if context is None:83 if context is None:
87 context = {}84 context = {}
88 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
89 if context.get('is_inkind_donation'):
90 args = [('type', 'in', ['inkind', 'extra'])]
91 else:
92 type_inv = context.get('type', 'out_invoice')
93 company_id = context.get('company_id', user.company_id.id)
94 type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'}
95 refund_journal = {'out_invoice': False, 'in_invoice': False, 'out_refund': True, 'in_refund': True}
96 args = [('type', '=', type2journal.get(type_inv, 'sale')),
97 ('company_id', '=', company_id),
98 ('refund_journal', '=', refund_journal.get(type_inv, False))]
99 if user.company_id.instance_id:
100 args.append(('is_current_instance','=',True))
101 journal_obj = self.pool.get('account.journal')85 journal_obj = self.pool.get('account.journal')
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)
103 return res and res[0] or False87 return res and res[0] or False
10488
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):
@@ -209,14 +193,10 @@
209 ids = [ids]193 ids = [ids]
210194
211 for inv_br in self.browse(cr, uid, ids, context=context):195 for inv_br in self.browse(cr, uid, ids, context=context):
212 # US-357: allow merge of line only for draft SI196 # allow to merge lines only for draft SI/ISI
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' \
214 and inv_br.invoice_line \198 and inv_br.invoice_line \
215 and inv_br.type == 'in_invoice' \199 and inv_br.doc_type in ('si', 'isi') \
216 and not inv_br.is_direct_invoice \
217 and not inv_br.is_inkind_donation \
218 and not inv_br.is_debit_note \
219 and not inv_br.is_intermission \
220 or False200 or False
221201
222 return res202 return res
@@ -234,6 +214,158 @@
234 res[inv.id] = len(inv.invoice_line)214 res[inv.id] = len(inv.invoice_line)
235 return res215 return res
236216
217 def _get_invoice_type_list(self, cr, uid, context=None):
218 """
219 Returns the list of possible types for the account.invoice document.
220 """
221 return [('dn', _('Debit Note')),
222 ('donation', _('Donation')),
223 ('ivi', _('Intermission Voucher IN')),
224 ('ivo', _('Intermission Voucher OUT')),
225 ('di', _('Direct Invoice')),
226 ('si', _('Supplier Invoice')),
227 ('sr', _('Supplier Refund')),
228 ('stv', _('Stock Transfer Voucher')),
229 ('cr', _('Customer Refund')),
230 ('str', _('Stock Transfer Refund')),
231 ('isi', _('Intersection Supplier Invoice')),
232 ('isr', _('Intersection Supplier Refund')),
233 ('unknown', _('Unknown')),
234 ]
235
236 _invoice_action_act_window = {
237 'dn': 'account_override.action_debit_note',
238 'donation': 'account_override.action_inkind_donation',
239 'ivi': 'account_override.action_intermission_in',
240 'ivo': 'account_override.action_intermission_out',
241 'di': 'register_accounting.action_direct_invoice',
242 'si': 'account.action_invoice_tree2',
243 'sr': 'account.action_invoice_tree4',
244 'stv': 'account.action_invoice_tree1',
245 'cr': 'account.action_invoice_tree3',
246 'str': 'account.action_str',
247 'isi': 'account.action_isi',
248 'isr': 'account.action_isr',
249 }
250
251 def _get_invoice_act_window(self, cr, uid, invoice_id, views_order=None, context=None):
252 inv_doc_type = self.read(cr, uid, invoice_id, ['doc_type'], context=context)['doc_type']
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)
254
255 def _get_doc_type(self, cr, uid, ids, field_name=None, arg=None, context=None):
256 """
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).
258 If a "real_doc_type" exists: it is used. Otherwise: the doc type is deduced from the other fields.
259 """
260 res = {}
261 fields = ['real_doc_type', 'type', 'is_debit_note', 'is_inkind_donation', 'is_intermission', 'is_direct_invoice']
262 for inv in self.browse(cr, uid, ids, fields_to_fetch=fields, context=context):
263 inv_type = 'unknown'
264 if inv.real_doc_type: # str, isi, isr...
265 inv_type = inv.real_doc_type
266 elif inv.is_debit_note:
267 if inv.type == 'out_invoice':
268 inv_type = 'dn' # Debit Note
269 elif inv.is_inkind_donation:
270 if inv.type == 'in_invoice':
271 inv_type = 'donation'
272 elif inv.is_intermission:
273 if inv.type == 'in_invoice':
274 inv_type = 'ivi' # Intermission Voucher In
275 elif inv.type == 'out_invoice':
276 inv_type = 'ivo' # Intermission Voucher Out
277 elif inv.type == 'in_invoice':
278 if inv.is_direct_invoice:
279 inv_type = 'di' # Direct Invoice
280 else:
281 inv_type = 'si' # Supplier Invoice
282 elif inv.type == 'in_refund':
283 inv_type = 'sr' # Supplier Refund
284 elif inv.type == 'out_invoice':
285 inv_type = 'stv' # Stock Transfer Voucher
286 elif inv.type == 'out_refund':
287 inv_type = 'cr' # Customer Refund
288 res[inv.id] = inv_type
289 return res
290
291 def _get_dom_by_doc_type(self, doc_type):
292 """
293 Returns the domain matching with the doc type (see the list of types in _get_invoice_type_list).
294 """
295 if doc_type in ('str', 'isi', 'isr'):
296 dom = [('real_doc_type', '=', doc_type)]
297 elif doc_type == 'dn': # Debit Note
298 dom = ['|',
299 ('real_doc_type', '=', doc_type),
300 '&', '&', '&',
301 ('real_doc_type', '=', False), ('type', '=', 'out_invoice'),
302 ('is_debit_note', '!=', False), ('is_inkind_donation', '=', False)]
303 elif doc_type == 'donation':
304 dom = ['|',
305 ('real_doc_type', '=', doc_type),
306 '&', '&', '&',
307 ('real_doc_type', '=', False), ('type', '=', 'in_invoice'),
308 ('is_debit_note', '=', False), ('is_inkind_donation', '=', True)]
309 elif doc_type == 'ivi': # Intermission Voucher In
310 dom = ['|',
311 ('real_doc_type', '=', doc_type),
312 '&', '&', '&', '&',
313 ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_debit_note', '=', False),
314 ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]
315 elif doc_type == 'ivo': # Intermission Voucher Out
316 dom = ['|',
317 ('real_doc_type', '=', doc_type),
318 '&', '&', '&', '&',
319 ('real_doc_type', '=', False), ('type', '=', 'out_invoice'), ('is_debit_note', '=', False),
320 ('is_inkind_donation', '=', False), ('is_intermission', '=', True)]
321 elif doc_type == 'di': # Direct Invoice
322 dom = ['|',
323 ('real_doc_type', '=', doc_type),
324 '&', '&', ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_direct_invoice', '!=', False)]
325 elif doc_type == 'si': # Supplier Invoice
326 dom = ['|',
327 ('real_doc_type', '=', doc_type),
328 '&', '&', '&', '&', '&',
329 ('real_doc_type', '=', False), ('type', '=', 'in_invoice'), ('is_direct_invoice', '=', False),
330 ('is_inkind_donation', '=', False), ('is_debit_note', '=', False), ('is_intermission', '=', False)]
331 elif doc_type == 'sr': # Supplier Refund
332 dom = ['|',
333 ('real_doc_type', '=', doc_type),
334 '&', ('real_doc_type', '=', False), ('type', '=', 'in_refund')]
335 elif doc_type == 'stv': # Stock Transfer Voucher
336 dom = ['|',
337 ('real_doc_type', '=', doc_type),
338 '&', '&', '&', '&',
339 ('real_doc_type', '=', False), ('type', '=', 'out_invoice'), ('is_debit_note', '=', False),
340 ('is_inkind_donation', '=', False), ('is_intermission', '=', False)]
341 elif doc_type == 'cr': # Customer Refund
342 dom = ['|',
343 ('real_doc_type', '=', doc_type),
344 '&', ('real_doc_type', '=', False), ('type', '=', 'out_refund')]
345 else: # "unknown" or any undefined type
346 dom = [('id', '=', 0)]
347 return dom
348
349 def _search_doc_type(self, cr, uid, obj, name, args, context=None):
350 """
351 Returns a domain to get all invoices matching the selected doc types (see the list of types in _get_invoice_type_list).
352 """
353 if not args:
354 return []
355 dom = [('id', '=', 0)]
356 if not args[0] or len(args[0]) < 3 or args[0][1] not in ('=', 'in'):
357 raise osv.except_osv(_('Error'), _('Filter not implemented yet.'))
358 if args[0][1] == '=' and args[0][2]:
359 doc_type = args[0][2]
360 dom = self._get_dom_by_doc_type(doc_type)
361 if args[0][1] == 'in' and args[0][2] and isinstance(args[0][2], (list, tuple)):
362 dom = []
363 for i in range(len(args[0][2]) - 1):
364 dom.append('|')
365 for doc_type in args[0][2]:
366 dom.extend(self._get_dom_by_doc_type(doc_type))
367 return dom
368
237 _columns = {369 _columns = {
238 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade',370 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade',
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."),
@@ -271,6 +403,9 @@
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,
272 help='The refunded invoice which has generated this document'), # 2 inv types for Refund Modify404 help='The refunded invoice which has generated this document'), # 2 inv types for Refund Modify
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),
406 'real_doc_type': fields.selection(_get_invoice_type_list, 'Real Document Type', readonly=True),
407 'doc_type': fields.function(_get_doc_type, method=True, type='selection', selection=_get_invoice_type_list,
408 string='Document Type', store=False, fnct_search=_search_doc_type),
274 }409 }
275410
276 _defaults = {411 _defaults = {
@@ -283,6 +418,8 @@
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,
284 'can_merge_lines': lambda *a: False,419 'can_merge_lines': lambda *a: False,
285 'is_merged_by_account': lambda *a: False,420 'is_merged_by_account': lambda *a: False,
421 # set a default value on doc type so that the restrictions on fields apply even before the form is saved
422 'doc_type': lambda obj, cr, uid, c: c and c.get('doc_type') or False,
286 }423 }
287424
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,
@@ -420,30 +557,6 @@
420 noupdate=noupdate, context=context, filename=filename,557 noupdate=noupdate, context=context, filename=filename,
421 display_all_errors=display_all_errors, has_header=has_header)558 display_all_errors=display_all_errors, has_header=has_header)
422559
423 def onchange_company_id(self, cr, uid, ids, company_id, part_id, ctype, invoice_line, currency_id):
424 """
425 This is a method to redefine the journal_id domain with the current_instance taken into account
426 """
427 res = super(account_invoice, self).onchange_company_id(cr, uid, ids, company_id, part_id, ctype, invoice_line, currency_id)
428 if company_id and ctype:
429 res.setdefault('domain', {})
430 res.setdefault('value', {})
431 ass = {
432 'out_invoice': 'sale',
433 'in_invoice': 'purchase',
434 'out_refund': 'sale_refund',
435 'in_refund': 'purchase_refund',
436 }
437 journal_ids = self.pool.get('account.journal').search(cr, uid, [
438 ('company_id','=',company_id), ('type', '=', ass.get(ctype, 'purchase')), ('is_current_instance', '=', True)
439 ], order='id')
440 if not journal_ids:
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'), ))
442 res['value']['journal_id'] = journal_ids[0]
443 # TODO: it's very bad to set a domain by onchange method, no time to rewrite UniField !
444 res['domain']['journal_id'] = [('id', 'in', journal_ids)]
445 return res
446
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,
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,
449 account_id=False):562 account_id=False):
@@ -522,58 +635,27 @@
522635
523 def check_po_link(self, cr, uid, ids, context=None):636 def check_po_link(self, cr, uid, ids, context=None):
524 """637 """
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).
526 """639 """
527 if not context:640 if not context:
528 context = {}641 context = {}
529 if isinstance(ids, (int, long)):642 if isinstance(ids, (int, long)):
530 ids = [ids]643 ids = [ids]
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']):
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'):
533 if inv.get('purchase_ids', False):646 if inv.get('purchase_ids', False):
534 if inv.get('is_intermission'):647 if inv['doc_type'] == 'ivi':
535 if inv.get('state', '') != 'draft': # only draft IVIs can be deleted648 if inv.get('state', '') != 'draft': # only draft IVIs can be deleted
536 raise osv.except_osv(_('Warning'),649 raise osv.except_osv(_('Warning'),
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.'))
651 elif inv['doc_type'] == 'isi':
652 raise osv.except_osv(_('Warning'),
653 _('You cannot cancel or delete an Intersection Supplier Invoice linked to a PO.'))
538 else:654 else:
539 # US-1702 Do not allow at all the deletion of SI coming from PO655 # US-1702 Do not allow at all the deletion of SI coming from PO
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.'))
541 return True657 return True
542658
543
544 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
545 """
546 Rename Supplier/Customer to "Donor" if view_type == tree
547 """
548 if not context:
549 context = {}
550 res = super(account_invoice, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
551 if view_type == 'tree' and (context.get('journal_type', False) == 'inkind' or context.get('journal_type', False) == 'intermission'):
552 doc = etree.XML(res['arch'])
553 nodes = doc.xpath("//field[@name='partner_id']")
554 name = _('Donor')
555 if context.get('journal_type') == 'intermission':
556 name = _('Partner')
557 for node in nodes:
558 node.set('string', name)
559 res['arch'] = etree.tostring(doc)
560 elif view_type in ('tree', 'search') and context.get('type') in ['out_invoice', 'out_refund']:
561 doc = etree.XML(res['arch'])
562 nodes = doc.xpath("//field[@name='supplier_reference']")
563 for node in nodes:
564 node.getparent().remove(node)
565 res['arch'] = etree.tostring(doc)
566 elif view_type == 'form' and context.get('type', False) == 'out_invoice' and context.get('journal_type', False) == 'sale' \
567 and not context.get('is_debit_note', False) and not context.get('is_intermission', False):
568 # Restriction on allowed partners for STV: Inter-section or External type, customers only
569 doc = etree.XML(res['arch'])
570 partner_nodes = doc.xpath("//field[@name='partner_id']")
571 partner_domain_stv = "[('partner_type', 'in', ('section', 'external')), ('customer', '=', True)]"
572 for node in partner_nodes:
573 node.set('domain', partner_domain_stv)
574 res['arch'] = etree.tostring(doc)
575 return res
576
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):
578 """660 """
579 Fill in account and journal for intermission invoice661 Fill in account and journal for intermission invoice
@@ -704,6 +786,9 @@
704 context=context):786 context=context):
705 vals['supplier_reference'] = partner['ref']787 vals['supplier_reference'] = partner['ref']
706788
789 if not vals.get('real_doc_type') and context.get('doc_type') and not context.get('from_refund_button'):
790 vals.update({'real_doc_type': context['doc_type']})
791
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'])
708793
709 return super(account_invoice, self).create(cr, uid, vals, context)794 return super(account_invoice, self).create(cr, uid, vals, context)
@@ -742,7 +827,7 @@
742 def unlink(self, cr, uid, ids, context=None):827 def unlink(self, cr, uid, ids, context=None):
743 """828 """
744 Delete register line if this invoice is a Direct Invoice.829 Delete register line if this invoice is a Direct Invoice.
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.
746 """831 """
747 if not context:832 if not context:
748 context = {}833 context = {}
@@ -783,65 +868,20 @@
783868
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):
785 """870 """
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
787 Change it to "In-kind donation" if this invoice is an In-kind donation.
788 """872 """
789 if not context:873 if context is None:
790 context = {}874 context = {}
791 local_ctx = context.copy()875 # update the message
792 # Prepare some values
793 # Search donation view and return it
794 try:
795 # try / except for runbot
796 debit_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_debit_note_form')
797 inkind_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_inkind_donation_form')
798 intermission_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_intermission_form')
799 supplier_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
800 customer_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
801 supplier_direct_invoice_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'register_accounting', 'direct_supplier_invoice_form')
802 except ValueError:
803 return super(account_invoice, self).log(cr, uid, inv_id, message, secondary, action_xmlid, context)
804 debit_view_id = debit_res and debit_res[1] or False
805 debit_note_ctx = {'view_id': debit_view_id, 'type':'out_invoice', 'journal_type': 'sale', 'is_debit_note': True}
806 # Search donation view and return it
807 inkind_view_id = inkind_res and inkind_res[1] or False
808 inkind_ctx = {'view_id': inkind_view_id, 'type':'in_invoice', 'journal_type': 'inkind', 'is_inkind_donation': True}
809 # Search intermission view
810 intermission_view_id = intermission_res and intermission_res[1] or False
811 intermission_ctx = {'view_id': intermission_view_id, 'journal_type': 'intermission', 'is_intermission': True}
812 customer_view_id = customer_invoice_res[1] or False
813 customer_ctx = {'view_id': customer_view_id, 'type': 'out_invoice', 'journal_type': 'sale'}
814 message_changed = False
815 pattern = re.compile('^(Invoice)')876 pattern = re.compile('^(Invoice)')
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 ''
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
818 m = re.match(pattern, message)879 doc_name = dict(self.fields_get(cr, uid, context=context)['doc_type']['selection']).get(doc_type)
819 if m and m.groups():880 if doc_name:
820 message = re.sub(pattern, el[1], message, 1)881 m = re.match(pattern, message)
821 message_changed = True882 if m and m.groups():
822 local_ctx.update(el[2])883 message = re.sub(pattern, doc_name, message, 1)
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)
824 if not message_changed and self.read(cr, uid, inv_id, ['type']).get('type', False) == 'out_invoice':
825 if local_ctx.get('is_intermission', False):
826 message = re.sub(pattern, 'Intermission Voucher', message, 1)
827 local_ctx.update(intermission_ctx)
828 else:
829 message = re.sub(pattern, 'Stock Transfer Voucher', message, 1)
830 local_ctx.update(customer_ctx)
831
832 # UF-1307: for supplier invoice log (from the incoming shipment), the context was not
833 # filled with all the information; this leaded to having a "Sale" journal in the supplier
834 # invoice if it was saved after coming from this link. Here's the fix.
835 if local_ctx.get('type', False) == 'in_invoice':
836 if not local_ctx.get('journal_type', False):
837 supplier_view_id = supplier_invoice_res and supplier_invoice_res[1] or False
838 local_ctx.update({'journal_type': 'purchase',
839 'view_id': supplier_view_id})
840 elif local_ctx.get('direct_invoice_view', False): # UFTP-166: The wrong context saved in log
841 supplier_view_id = supplier_direct_invoice_res and supplier_direct_invoice_res[1] or False
842 local_ctx = {'journal_type': 'purchase',
843 'view_id': supplier_view_id}
844 return super(account_invoice, self).log(cr, uid, inv_id, message, secondary, action_xmlid, local_ctx)
845885
846 def _check_tax_allowed(self, cr, uid, ids, context=None):886 def _check_tax_allowed(self, cr, uid, ids, context=None):
847 """887 """
@@ -931,6 +971,12 @@
931971
932 return True972 return True
933973
974 def invoice_open2(self, cr, uid, ids, context=None):
975 """
976 Alias for invoice_open (used to handle different characteristics on both buttons)
977 """
978 return self.invoice_open(cr, uid, ids, context=context)
979
934 def invoice_open_with_confirmation(self, cr, uid, ids, context=None):980 def invoice_open_with_confirmation(self, cr, uid, ids, context=None):
935 """981 """
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)
@@ -996,7 +1042,7 @@
996 def action_cancel(self, cr, uid, ids, *args):1042 def action_cancel(self, cr, uid, ids, *args):
997 """1043 """
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.
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.
1000 """1046 """
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?)
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)
@@ -1041,43 +1087,6 @@
1041 self._check_document_date(cr, uid, ids)1087 self._check_document_date(cr, uid, ids)
1042 return res1088 return res
10431089
1044 def get_account_invoice_type(self, cr, uid, inv_id, context=None):
1045 """
1046 Returns the type of the account.invoice document as a string
1047 It can be: 'si', 'sr', 'di', 'ivi', 'ivo', 'stv', 'dn', 'cr', 'donation'
1048 Raises an error if the type is not recognized.
1049 """
1050 if context is None:
1051 context = {}
1052 inv_type = False
1053 fields = ['type', 'is_debit_note', 'is_inkind_donation', 'is_intermission', 'is_direct_invoice', 'internal_number']
1054 inv = self.browse(cr, uid, inv_id, fields_to_fetch=fields, context=context)
1055 if inv.is_debit_note:
1056 if inv.type == 'out_invoice':
1057 inv_type = 'dn' # Debit Note
1058 elif inv.is_inkind_donation:
1059 if inv.type == 'in_invoice':
1060 inv_type = 'donation'
1061 elif inv.is_intermission:
1062 if inv.type == 'in_invoice':
1063 inv_type = 'ivi' # Intermission Voucher In
1064 elif inv.type == 'out_invoice':
1065 inv_type = 'ivo' # Intermission Voucher Out
1066 elif inv.type == 'in_invoice':
1067 if inv.is_direct_invoice:
1068 inv_type = 'di' # Direct Invoice
1069 else:
1070 inv_type = 'si' # Supplier Invoice
1071 elif inv.type == 'in_refund':
1072 inv_type = 'sr' # Supplier Refund
1073 elif inv.type == 'out_invoice':
1074 inv_type = 'stv' # Stock Transfer Voucher'
1075 elif inv.type == 'out_refund':
1076 inv_type = 'cr' # Customer Refund'
1077 if not inv_type:
1078 raise osv.except_osv(_('Error'), _('The type of the document %s is unknown.') % inv.internal_number or '')
1079 return inv_type
1080
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):
1082 """1091 """
1083 Raises an error if the type of the account.invoice and the journal used are not compatible1092 Raises an error if the type of the account.invoice and the journal used are not compatible
@@ -1087,10 +1096,11 @@
1087 journal = self.browse(cr, uid, inv_id, fields_to_fetch=['journal_id'], context=context).journal_id1096 journal = self.browse(cr, uid, inv_id, fields_to_fetch=['journal_id'], context=context).journal_id
1088 j_type = journal.type1097 j_type = journal.type
1089 if inv_type is None:1098 if inv_type is None:
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']
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 \
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 \
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 \
1103 inv_type in ('isi', 'isr') and journal.code != 'ISI' or inv_type not in ('isi', 'isr') and journal.code == 'ISI':
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)
10951105
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):
@@ -1102,13 +1112,15 @@
1102 partner = self.browse(cr, uid, inv_id, fields_to_fetch=['partner_id'], context=context).partner_id1112 partner = self.browse(cr, uid, inv_id, fields_to_fetch=['partner_id'], context=context).partner_id
1103 p_type = partner.partner_type1113 p_type = partner.partner_type
1104 if inv_type is None:1114 if inv_type is None:
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']
1106 # if a supplier/customer is expected for the doc: check that the partner used has the right flag1116 # if a supplier/customer is expected for the doc: check that the partner used has the right flag
1107 supplier_ko = inv_type in ('si', 'di', 'sr', 'ivi', 'donation') and not partner.supplier1117 # note: SI/SR on Intersection partners are blocked only at form level (the validation of old docs should still be possible)
1108 customer_ko = inv_type in ('ivo', 'stv', 'dn', 'cr') and not partner.customer1118 supplier_ko = inv_type in ('si', 'di', 'sr', 'ivi', 'donation', 'isi', 'isr') and not partner.supplier
1119 customer_ko = inv_type in ('ivo', 'stv', 'dn', 'cr', 'str') and not partner.customer
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 \
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 \
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 \
1123 inv_type in ('isi', 'isr') and p_type != 'section':
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)
11131125
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):
@@ -1120,11 +1132,11 @@
1120 account_obj = self.pool.get('account.account')1132 account_obj = self.pool.get('account.account')
1121 account = self.browse(cr, uid, inv_id, fields_to_fetch=['account_id'], context=context).account_id1133 account = self.browse(cr, uid, inv_id, fields_to_fetch=['account_id'], context=context).account_id
1122 if inv_type is None:1134 if inv_type is None:
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']
1124 account_domain = []1136 account_domain = []
1125 if inv_type in ('si', 'di', 'sr'):1137 if inv_type in ('si', 'di', 'sr', 'isi', 'isr'):
1126 account_domain.append(('restricted_area', '=', 'in_invoice'))1138 account_domain.append(('restricted_area', '=', 'in_invoice'))
1127 elif inv_type in ('stv', 'cr'):1139 elif inv_type in ('stv', 'cr', 'str'):
1128 account_domain.append(('restricted_area', '=', 'out_invoice'))1140 account_domain.append(('restricted_area', '=', 'out_invoice'))
1129 elif inv_type == 'dn':1141 elif inv_type == 'dn':
1130 account_domain.append(('restricted_area', '=', 'out_invoice'))1142 account_domain.append(('restricted_area', '=', 'out_invoice'))
@@ -1152,9 +1164,9 @@
1152 inv_line_obj = self.pool.get('account.invoice.line')1164 inv_line_obj = self.pool.get('account.invoice.line')
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')
1154 if inv_type is None:1166 if inv_type is None:
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']
1156 account_domain = []1168 account_domain = []
1157 if inv_type in ('si', 'di', 'sr', 'cr'):1169 if inv_type in ('si', 'di', 'sr', 'cr', 'isi', 'isr', 'str'):
1158 account_domain.append(('restricted_area', '=', 'invoice_lines'))1170 account_domain.append(('restricted_area', '=', 'invoice_lines'))
1159 elif inv_type == 'stv':1171 elif inv_type == 'stv':
1160 context.update(({'check_line_stv': True, }))1172 context.update(({'check_line_stv': True, }))
@@ -1175,7 +1187,7 @@
1175 if context is None:1187 if context is None:
1176 context = {}1188 context = {}
1177 for inv_id in ids:1189 for inv_id in ids:
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']
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)
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)
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)
@@ -1298,6 +1310,12 @@
1298 }1310 }
1299 return False1311 return False
13001312
1313 def button_split_invoice2(self, cr, uid, ids, context=None):
1314 """
1315 Alias for button_split_invoice (used to handle different characteristics on both buttons)
1316 """
1317 return self.button_split_invoice(cr, uid, ids, context=context)
1318
1301 def button_donation_certificate(self, cr, uid, ids, context=None):1319 def button_donation_certificate(self, cr, uid, ids, context=None):
1302 """1320 """
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.
@@ -1578,6 +1596,12 @@
15781596
1579 return res1597 return res
15801598
1599 def button_merge_lines2(self, cr, uid, ids, context=None):
1600 """
1601 Alias for button_merge_lines (used to handle different characteristics on both buttons)
1602 """
1603 return self.button_merge_lines(cr, uid, ids, context=context)
1604
1581 def check_accounts_for_partner(self, cr, uid, ids, context=None,1605 def check_accounts_for_partner(self, cr, uid, ids, context=None,
1582 header_obj=False, lines_field='invoice_line',1606 header_obj=False, lines_field='invoice_line',
1583 line_level_partner_type=False):1607 line_level_partner_type=False):
@@ -1766,6 +1790,12 @@
1766 res[i] = False1790 res[i] = False
1767 return res1791 return res
17681792
1793 def _get_line_doc_type(self, cr, uid, context=None):
1794 """
1795 Gets the list of possible invoice types
1796 """
1797 return self.pool.get('account.invoice')._get_invoice_type_list(cr, uid, context=context)
1798
1769 _columns = {1799 _columns = {
1770 'line_number': fields.integer(string='Line Number'),1800 'line_number': fields.integer(string='Line Number'),
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')),
@@ -1798,6 +1828,8 @@
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)
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,
1800 help='Technical field, similar to "synced"'),1830 help='Technical field, similar to "synced"'),
1831 'line_doc_type': fields.related('invoice_id', 'doc_type', type='selection', selection=_get_line_doc_type,
1832 string='Document Type', store=False),
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,
1802 selection=[('out_invoice', 'Customer Invoice'),1834 selection=[('out_invoice', 'Customer Invoice'),
1803 ('in_invoice', 'Supplier Invoice'),1835 ('in_invoice', 'Supplier Invoice'),
@@ -1856,14 +1888,14 @@
1856 inv_fields = ['from_supply', 'synced', 'type', 'is_inkind_donation', 'partner_type']1888 inv_fields = ['from_supply', 'synced', 'type', 'is_inkind_donation', 'partner_type']
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)
1858 if not inv.is_inkind_donation: # never block manual line creation in Donations whatever the workflow and partner type1890 if not inv.is_inkind_donation: # never block manual line creation in Donations whatever the workflow and partner type
1859 ivi_or_si_synced = inv.type == 'in_invoice' and inv.synced1891 ivi_or_isi_synced = inv.type == 'in_invoice' and inv.synced
1860 intermission_or_section_from_supply = inv.partner_type in ('intermission', 'section') and inv.from_supply1892 intermission_or_section_from_supply = inv.partner_type in ('intermission', 'section') and inv.from_supply
1861 from_split = context.get('from_split')1893 from_split = context.get('from_split')
1862 if context.get('from_inv_form'):1894 if context.get('from_inv_form'):
1863 if from_split and ivi_or_si_synced:1895 if from_split and ivi_or_isi_synced:
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. '
1865 'You can\'t split its lines.'))1897 'You can\'t split its lines.'))
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):
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. '
1868 'You can\'t add lines manually.'))1900 'You can\'t add lines manually.'))
18691901
18701902
=== modified file 'bin/addons/account_override/report/account_print_invoice.rml'
--- bin/addons/account_override/report/account_print_invoice.rml 2021-04-26 10:34:04 +0000
+++ bin/addons/account_override/report/account_print_invoice.rml 2021-11-03 13:33:55 +0000
@@ -227,9 +227,10 @@
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>
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 '' ]]
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>
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>
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>
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>
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 ]]
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>
234 <para style="terp_default_8">235 <para style="terp_default_8">
235 <font color="white"> </font>236 <font color="white"> </font>
236237
=== modified file 'bin/addons/account_override/report/open_invoices_xls.mako'
--- bin/addons/account_override/report/open_invoices_xls.mako 2017-08-04 15:15:29 +0000
+++ bin/addons/account_override/report/open_invoices_xls.mako 2021-11-03 13:33:55 +0000
@@ -302,10 +302,12 @@
302 <Row><Cell><Data ss:Type="String"></Data></Cell></Row>302 <Row><Cell><Data ss:Type="String"></Data></Cell></Row>
303303
304<% inv = invoices(data) %>304<% inv = invoices(data) %>
305<% doc_type_list = [('si_di', _('Supplier Invoices')), ('sr', _('Supplier Refunds')), ('donation', _('Donations')),305<% doc_type_list = [('si_di', _('Supplier Invoices')), ('sr', _('Supplier Refunds')),
306 ('ivi', _('Intermission Vouchers IN')), ('stv', _('Stock Transfer Vouchers')), ('cr', _('Customer Refunds')),306 ('isi', _('Intersection Supplier Invoices')), ('isr', _('Intersection Supplier Refunds')),
307 ('donation', _('Donations')), ('ivi', _('Intermission Vouchers IN')),
308 ('stv', _('Stock Transfer Vouchers')), ('str', _('Stock Transfer Refunds')), ('cr', _('Customer Refunds')),
307 ('dn', _('Debit Notes')), ('ivo', _('Intermission Vouchers OUT'))] %>309 ('dn', _('Debit Notes')), ('ivo', _('Intermission Vouchers OUT'))] %>
308% for (type, title) in doc_type_list:310% for (doc_type, title) in doc_type_list:
309 <Row >311 <Row >
310 <Cell ss:StyleID="s23"><Data ss:Type="String">${title}</Data></Cell>312 <Cell ss:StyleID="s23"><Data ss:Type="String">${title}</Data></Cell>
311 <Cell ss:StyleID="s24"/>313 <Cell ss:StyleID="s24"/>
@@ -329,9 +331,9 @@
329 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Number')}</Data></Cell>331 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Number')}</Data></Cell>
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>
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>
332% if type in ['stv', 'ivo', 'dn', 'cr']:334% if doc_type in ['stv', 'ivo', 'dn', 'cr', 'str']:
333 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Customer')}</Data></Cell>335 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Customer')}</Data></Cell>
334% elif type in ['si_di', 'ivi', 'donation', 'sr']:336% elif doc_type in ['si_di', 'ivi', 'donation', 'sr', 'isi', 'isr']:
335 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Supplier')}</Data></Cell>337 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Supplier')}</Data></Cell>
336% else:338% else:
337 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Partner')}</Data></Cell>339 <Cell ss:StyleID="s27"><Data ss:Type="String">${_('Partner')}</Data></Cell>
@@ -357,8 +359,8 @@
357359
358<% nb_line = 0 %>360<% nb_line = 0 %>
359361
360% if type in inv:362% if doc_type in inv:
361% for o in inv[type]:363% for o in inv[doc_type]:
362 <Row>364 <Row>
363 <% nb_line += 1 %>365 <% nb_line += 1 %>
364 <% update_percent(nb_line, context) %>366 <% update_percent(nb_line, context) %>
365367
=== modified file 'bin/addons/account_override/report/report_open_invoices.py'
--- bin/addons/account_override/report/report_open_invoices.py 2019-07-25 14:01:42 +0000
+++ bin/addons/account_override/report/report_open_invoices.py 2021-11-03 13:33:55 +0000
@@ -72,48 +72,20 @@
72 self.percent = 0.05 # 5% of the process72 self.percent = 0.05 # 5% of the process
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)
74 states = context.get('paid_invoice') and ['paid', 'inv_close'] or ['open']74 states = context.get('paid_invoice') and ['paid', 'inv_close'] or ['open']
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']:
76 # determine the domain to use according to the report type and the doc type76 # determine the domain to use according to the report type and the doc type
77 domain = [('state', 'in', states)]77 domain = [('state', 'in', states)]
78 if context.get('paid_invoice') and beginning_date and ending_date:78 if context.get('paid_invoice') and beginning_date and ending_date:
79 domain += [('date_invoice', '>=', beginning_date), ('date_invoice', '<=', ending_date)]79 domain += [('date_invoice', '>=', beginning_date), ('date_invoice', '<=', ending_date)]
80 if type == 'si_di':80 if doc_type == 'si_di':
81 domain += [('type', '=', 'in_invoice'),81 domain += [('doc_type', 'in', ['si', 'di'])]
82 ('is_inkind_donation', '=', False),82 elif doc_type in ('sr', 'isi', 'isr', 'donation', 'ivi', 'stv', 'str', 'cr', 'dn', 'ivo'):
83 ('is_debit_note', '=', False),83 domain += [('doc_type', '=', doc_type)]
84 ('is_intermission', '=', False)]
85 elif type == 'sr':
86 domain += [('type', '=', 'in_refund')]
87 elif type == 'donation':
88 domain += [('type', '=', 'in_invoice'),
89 ('is_debit_note', '=', False),
90 ('is_inkind_donation', '=', True)]
91 elif type == 'ivi':
92 domain += [('type', '=', 'in_invoice'),
93 ('is_debit_note', '=', False),
94 ('is_inkind_donation', '=', False),
95 ('is_intermission', '=', True)]
96 elif type == 'stv':
97 domain += [('type', '=', 'out_invoice'),
98 ('is_debit_note', '=', False),
99 ('is_inkind_donation', '=', False),
100 ('is_intermission', '=', False)]
101 elif type == 'cr':
102 domain += [('type', '=', 'out_refund')]
103 elif type == 'dn':
104 domain += [('type', '=', 'out_invoice'),
105 ('is_debit_note', '!=', False),
106 ('is_inkind_donation', '=', False)]
107 elif type == 'ivo':
108 domain += [('type','=','out_invoice'),
109 ('is_debit_note', '=', False),
110 ('is_inkind_donation', '=', False),
111 ('is_intermission', '=', True)]
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')
113 if isinstance(type_ids, (int, long)):85 if isinstance(type_ids, (int, long)):
114 type_ids = [type_ids]86 type_ids = [type_ids]
115 self.nb_lines += len(type_ids)87 self.nb_lines += len(type_ids)
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)})
117 if bg_id:89 if bg_id:
118 self.percent += 0.20 # 25% of the process90 self.percent += 0.20 # 25% of the process
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)
12092
=== modified file 'bin/addons/account_payment/__openerp__.py'
--- bin/addons/account_payment/__openerp__.py 2019-10-10 15:06:49 +0000
+++ bin/addons/account_payment/__openerp__.py 2021-11-03 13:33:55 +0000
@@ -33,7 +33,6 @@
33 'author': 'OpenERP SA',33 'author': 'OpenERP SA',
34 'depends': ['account'],34 'depends': ['account'],
35 'update_xml': [35 'update_xml': [
36 'account_invoice_view.xml',
37 ],36 ],
38 'demo_xml': [],37 'demo_xml': [],
39 'test': [38 'test': [
4039
=== removed file 'bin/addons/account_payment/account_invoice_view.xml'
=== modified file 'bin/addons/account_period_closing_level/account_period.py'
--- bin/addons/account_period_closing_level/account_period.py 2021-08-25 14:50:30 +0000
+++ bin/addons/account_period_closing_level/account_period.py 2021-11-03 13:33:55 +0000
@@ -501,7 +501,7 @@
501 context = {}501 context = {}
502 return self.register_view(cr, uid, ids, 'cash', context=context)502 return self.register_view(cr, uid, ids, 'cash', context=context)
503503
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):
505 """505 """
506 Open an invoice tree view with the given domain for the period in ids506 Open an invoice tree view with the given domain for the period in ids
507 """507 """
@@ -510,17 +510,11 @@
510 context = {}510 context = {}
511 if isinstance(ids, (int, long)):511 if isinstance(ids, (int, long)):
512 ids = [ids]512 ids = [ids]
513513 if not action_xmlid and doc_type:
514 # to get action_xmlid:514 action_xmlid = self.pool.get('account.invoice')._invoice_action_act_window.get(doc_type)
515 # 1/ on the web interface get id of ir.ui.menu menu515 if not action_xmlid:
516 # 2/ get id of ir.actions.act_window:516 raise osv.except_osv(_('Warning'), _('Impossible to retrieve the view to display.'))
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)
518 # 3/ get xmlid:
519 # select module||'.'||name from ir_model_data where res_id=<act_id> and module!='sd' and model='ir.actions.act_window';
520 module, xmlid = action_xmlid.split('.', 1)
521 act_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, xmlid)[1]
522 keys = ['display_menu_tip', 'help', 'type', 'domain', 'res_model', 'view_id', 'search_view_id', 'view_mode', 'view_ids', 'context', 'name', 'views', 'view_type']
523 act = self.pool.get('ir.actions.act_window').read(cr, uid, act_id, keys, context=context)
524 act_domain = act.get('domain', "[]") or "[]"518 act_domain = act.get('domain', "[]") or "[]"
525 act_context = act.get('context', "{}") or "{}"519 act_context = act.get('context', "{}") or "{}"
526 globals_dict = {'uid': uid}520 globals_dict = {'uid': uid}
@@ -535,7 +529,22 @@
535 eval_domain += [('date_invoice', '<=', period['date_stop']), ('state', 'in', ['draft', 'open'])]529 eval_domain += [('date_invoice', '<=', period['date_stop']), ('state', 'in', ['draft', 'open'])]
536530
537 eval_context = safe_eval(act_context, globals_dict)531 eval_context = safe_eval(act_context, globals_dict)
538 eval_context['search_default_draft'] = 0532
533 model_name = hasattr(model_obj, '_name') and getattr(model_obj, '_name')
534 model_inherit_name = hasattr(model_obj, '_inherit') and getattr(model_obj, '_inherit')
535 if model_name == 'account.invoice' or model_inherit_name == 'account.invoice':
536 # activate the Draft and Open filters
537 eval_context['search_default_draft'] = 1
538 if eval_context.get('doc_type') == 'donation':
539 eval_context['search_default_open'] = 1
540 eval_context['search_cancel_state_donation'] = 0
541 else:
542 eval_context['search_default_unpaid'] = 1 # Open
543 eval_context['search_default_paid'] = 0
544 eval_context['search_default_closed'] = 0
545 if eval_context.get('doc_type') in ('ivo', 'stv'):
546 eval_context['search_default_cancel_state'] = 0
547
539 act['context'] = eval_context548 act['context'] = eval_context
540 act['domain'] = eval_domain549 act['domain'] = eval_domain
541 act['target'] = 'current'550 act['target'] = 'current'
@@ -546,68 +555,76 @@
546 """555 """
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.
548 """557 """
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)
550559
551 def button_customer_refunds(self, cr, uid, ids, context=None):560 def button_customer_refunds(self, cr, uid, ids, context=None):
552 """561 """
553 Create a new tab with Customer refunds from given period.562 Create a new tab with Customer refunds from given period.
554 """563 """
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)
556565
557 # Debit note566 # Debit note
558 def button_debit_note(self, cr, uid, ids, context=None):567 def button_debit_note(self, cr, uid, ids, context=None):
559 return self.invoice_view(cr, uid, ids,568 return self.invoice_view(cr, uid, ids, doc_type='dn', context=context)
560 action_xmlid='account_override.action_debit_note',
561 context=context)
562569
563 # Intermission voucher OUT570 # Intermission voucher OUT
564 def button_intermission_out(self, cr, uid, ids, context=None):571 def button_intermission_out(self, cr, uid, ids, context=None):
565 return self.invoice_view(cr, uid, ids,572 return self.invoice_view(cr, uid, ids, doc_type='ivo', context=context)
566 action_xmlid='account_override.action_intermission_out',
567 context=context)
568573
569 def button_supplier_refunds(self, cr, uid, ids, context=None):574 def button_supplier_refunds(self, cr, uid, ids, context=None):
570 """575 """
571 Open a view that display Supplier invoices for given period576 Open a view that displays Supplier Refunds for given period
572 """577 """
573 return self.invoice_view(cr, uid, ids,578 return self.invoice_view(cr, uid, ids, doc_type='sr', context=context)
574 action_xmlid='account.action_invoice_tree4', context=context)
575579
576 # Supplier direct invoices580 # Supplier direct invoices
577 def button_supplier_direct_invoices(self, cr, uid, ids, context=None):581 def button_supplier_direct_invoices(self, cr, uid, ids, context=None):
578 """582 """
579 Open a view that display Direct invoices for this period583 Open a view that display Direct invoices for this period
580 """584 """
581 return self.invoice_view(cr, uid, ids,585 return self.invoice_view(cr, uid, ids, doc_type='di', context=context)
582 action_xmlid='register_accounting.action_direct_invoice',
583 context=context)
584586
585 # In-kind donation587 # In-kind donation
586 def button_donation(self, cr, uid, ids, context=None):588 def button_donation(self, cr, uid, ids, context=None):
587 """589 """
588 Open a view that display Inkind donation for this period590 Open a view that display Inkind donation for this period
589 """591 """
590 return self.invoice_view(cr, uid, ids,592 return self.invoice_view(cr, uid, ids, doc_type='donation', context=context)
591 action_xmlid='account_override.action_inkind_donation',
592 context=context)
593593
594 # Intermission voucher IN594 # Intermission voucher IN
595 def button_intermission_in(self, cr, uid, ids, context=None):595 def button_intermission_in(self, cr, uid, ids, context=None):
596 """596 """
597 Open a view that display intermission voucher in for this period597 Open a view that display intermission voucher in for this period
598 """598 """
599 return self.invoice_view(cr, uid, ids,599 return self.invoice_view(cr, uid, ids, doc_type='ivi', context=context)
600 action_xmlid='account_override.action_intermission_in',
601 context=context)
602600
603 # Supplier invoice601 # Supplier invoice
604 def button_supplier_invoices(self, cr, uid, ids, context=None):602 def button_supplier_invoices(self, cr, uid, ids, context=None):
605 """603 """
606 Open a view that display supplier invoices for this period604 Open a view that display supplier invoices for this period
607 """605 """
608 return self.invoice_view(cr, uid, ids,606 return self.invoice_view(cr, uid, ids, doc_type='si', context=context)
609 action_xmlid='account.action_invoice_tree2',607
610 context=context)608 # Intersection Supplier Invoice
609 def button_intersection_supplier_invoices(self, cr, uid, ids, context=None):
610 """
611 Opens a view with the ISI to check before closing the period
612 """
613 return self.invoice_view(cr, uid, ids, doc_type='isi', context=context)
614
615 # Intersection Supplier Refund
616 def button_intersection_supplier_refunds(self, cr, uid, ids, context=None):
617 """
618 Opens a view with the ISR to check before closing the period
619 """
620 return self.invoice_view(cr, uid, ids, doc_type='isr', context=context)
621
622 # Stock Transfer Refund
623 def button_stock_transfer_refunds(self, cr, uid, ids, context=None):
624 """
625 Opens a view with the STR to check before closing the period
626 """
627 return self.invoice_view(cr, uid, ids, doc_type='str', context=context)
611628
612 def button_close_field_period(self, cr, uid, ids, context=None):629 def button_close_field_period(self, cr, uid, ids, context=None):
613 if not context:630 if not context:
614631
=== modified file 'bin/addons/account_period_closing_level/account_period_closing_level_view.xml'
--- bin/addons/account_period_closing_level/account_period_closing_level_view.xml 2019-10-29 14:39:06 +0000
+++ bin/addons/account_period_closing_level/account_period_closing_level_view.xml 2021-11-03 13:33:55 +0000
@@ -152,15 +152,18 @@
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"/>
153 <group colspan="6" col="6">153 <group colspan="6" col="6">
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"/>
155 <button string="Stock Transfer Refunds" name="button_stock_transfer_refunds" type="object" icon="gtk-dnd" colspan="2"/>
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"/>
157 <button string="Intermission Voucher OUT" name="button_intermission_out" type="object" icon="gtk-dnd" colspan="2"/>
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"/>
157 <button string="Intermission Voucher OUT" name="button_intermission_out" type="object" icon="gtk-dnd" colspan="2"/>
158 </group>159 </group>
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"/>
160 <group colspan="6" col="6">161 <group colspan="6" col="6">
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"/>
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"/>
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"/>
165 <button string="Intersection Supplier Invoices" name="button_intersection_supplier_invoices" type="object" icon="gtk-dnd" colspan="2"/>
166 <button string="Intersection Supplier Refunds" name="button_intersection_supplier_refunds" type="object" icon="gtk-dnd" colspan="2"/>
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"/>
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"/>
166 </group>169 </group>
167170
=== modified file 'bin/addons/account_period_closing_level/account_year_end_closing.xml'
--- bin/addons/account_period_closing_level/account_year_end_closing.xml 2016-11-04 12:57:37 +0000
+++ bin/addons/account_period_closing_level/account_year_end_closing.xml 2021-11-03 13:33:55 +0000
@@ -2,21 +2,6 @@
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <record id="view_account_form_inherit" model="ir.ui.view">
6 <field name="name">account.account.form</field>
7 <field name="model">account.account</field>
8 <field name="type">form</field>
9 <field name="priority">55</field>
10 <field name="inherit_id" ref="account.view_account_form"/>
11 <field name="arch" type="xml">
12 <xpath expr="//notebook" position="inside">
13 <page string="End Year Closing" attrs="{'invisible': [('instance_level', '=', 'project')]}">
14 <field name="include_in_yearly_move"
15 attrs="{'readonly': ['|', ('instance_level', '!=', 'section'), ('type', 'not in', ['other', ])]}"/>
16 </page>
17 </xpath>
18 </field>
19 </record>
205
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">
22 <field name="name">Fiscal Years</field>7 <field name="name">Fiscal Years</field>
@@ -37,4 +22,4 @@
37 </record>22 </record>
3823
39 </data>24 </data>
40</openerp>
41\ No newline at end of file25\ No newline at end of file
26</openerp>
4227
=== modified file 'bin/addons/account_subscription/account_model_view.xml'
--- bin/addons/account_subscription/account_model_view.xml 2020-08-17 16:32:14 +0000
+++ bin/addons/account_subscription/account_model_view.xml 2021-11-03 13:33:55 +0000
@@ -26,7 +26,7 @@
26 <group col="6" colspan="4">26 <group col="6" colspan="4">
27 <group attrs="{'readonly': [('state', '=', 'done')]}" colspan="6" col="6">27 <group attrs="{'readonly': [('state', '=', 'done')]}" colspan="6" col="6">
28 <field name="name"/>28 <field name="name"/>
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)]"/>
30 <field name="currency_id"/>30 <field name="currency_id"/>
31 </group>31 </group>
32 <group colspan="6" col="6" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">32 <group colspan="6" col="6" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
3333
=== modified file 'bin/addons/analytic_distribution/account_commitment.py'
--- bin/addons/analytic_distribution/account_commitment.py 2021-08-17 13:24:42 +0000
+++ bin/addons/analytic_distribution/account_commitment.py 2021-11-03 13:33:55 +0000
@@ -29,7 +29,7 @@
29import decimal_precision as dp29import decimal_precision as dp
30from account_override.period import get_period_from_date30from account_override.period import get_period_from_date
31from tools.misc import flatten31from tools.misc import flatten
3232import netsvc
3333
34class account_commitment(osv.osv):34class account_commitment(osv.osv):
35 _name = 'account.commitment'35 _name = 'account.commitment'
@@ -48,11 +48,23 @@
48 ids = [ids]48 ids = [ids]
49 # Prepare some values49 # Prepare some values
50 res = {}50 res = {}
51 for _id in ids:
52 res[_id] = 0
51 # Browse commitments53 # Browse commitments
52 for co in self.browse(cr, uid, ids, context=context):54 if ids:
53 res[co.id] = 0.055 cr.execute('''
54 for line in co.line_ids:56 select
55 res[co.id] += line.amount57 commit_id, sum(amount)
58 from
59 account_commitment_line
60 where
61 commit_id in %s
62 group by
63 commit_id
64 ''', (tuple(ids),))
65 for x in cr.fetchall():
66 res[x[0]] = round(x[1], 2)
67
56 return res68 return res
5769
58 def _get_cv(self, cr, uid, ids, context=None):70 def _get_cv(self, cr, uid, ids, context=None):
@@ -86,8 +98,9 @@
8698
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):
88 """100 """
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:
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.
103 - only for some "admin" users (the restriction is made by User Rights).
91 """104 """
92 if context is None:105 if context is None:
93 context = {}106 context = {}
@@ -96,14 +109,14 @@
96 res = {}109 res = {}
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):
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')
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'
100 return res113 return res
101114
102 _columns = {115 _columns = {
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),
104 'name': fields.char(string="Number", size=64, readonly=True, required=True),117 'name': fields.char(string="Number", size=64, readonly=True, required=True),
105 'currency_id': fields.many2one('res.currency', string="Currency", required=True),118 'currency_id': fields.many2one('res.currency', string="Currency", required=True),
106 'partner_id': fields.many2one('res.partner', string="Supplier", required=True),119 'partner_id': fields.many2one('res.partner', string="Partner", required=True),
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),
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),
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)]}),
@@ -115,7 +128,9 @@
115 'analytic_distribution_id': fields.many2one('analytic.distribution', string="Analytic distribution"),128 'analytic_distribution_id': fields.many2one('analytic.distribution', string="Analytic distribution"),
116 'type': fields.selection(get_cv_type, string="Type", readonly=True),129 'type': fields.selection(get_cv_type, string="Type", readonly=True),
117 'notes': fields.text(string="Comment"),130 'notes': fields.text(string="Comment"),
131 'cv_flow_type': fields.selection([('customer', 'Customer'), ('supplier', 'Supplier')], string="Type of CV"),
118 'purchase_id': fields.many2one('purchase.order', string="Source document", readonly=True),132 'purchase_id': fields.many2one('purchase.order', string="Source document", readonly=True),
133 'sale_id': fields.many2one('sale.order', string="Source document", readonly=True),
119 'description': fields.char(string="Description", size=256),134 'description': fields.char(string="Description", size=256),
120 'version': fields.integer('Version', required=True,135 'version': fields.integer('Version', required=True,
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."),
@@ -155,6 +170,10 @@
155 partner = self.pool.get('res.partner').browse(cr, uid, [partner_id])170 partner = self.pool.get('res.partner').browse(cr, uid, [partner_id])
156 if partner and partner[0] and not partner[0].active:171 if partner and partner[0] and not partner[0].active:
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 '',))
173 if vals.get('sale_id'):
174 vals['cv_flow_type'] = 'customer'
175 elif vals.get('purchase_id'):
176 vals['cv_flow_type'] = 'supplier'
158 # Add sequence177 # Add sequence
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)
160 instance = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id179 instance = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.instance_id
@@ -441,6 +460,9 @@
441 ids = [ids]460 ids = [ids]
442 # Browse commitments461 # Browse commitments
443 for c in self.browse(cr, uid, ids, context=context):462 for c in self.browse(cr, uid, ids, context=context):
463 sign = 1
464 if c.cv_flow_type == 'customer':
465 sign = -1
444 for cl in c.line_ids:466 for cl in c.line_ids:
445 # Verify that analytic distribution is present467 # Verify that analytic distribution is present
446 if cl.analytic_distribution_state != 'valid':468 if cl.analytic_distribution_state != 'valid':
@@ -456,10 +478,10 @@
456 if not al_ids:478 if not al_ids:
457 # Create engagement journal lines479 # Create engagement journal lines
458 self.pool.get('analytic.distribution').\480 self.pool.get('analytic.distribution').\
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,
460 c.journal_id and c.journal_id.id,482 c.journal_id and c.journal_id.id,
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,
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,
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)
464 return True486 return True
465487
@@ -500,12 +522,56 @@
500 self.write(cr, uid, [c.id], {'state':'done'}, context=context)522 self.write(cr, uid, [c.id], {'state':'done'}, context=context)
501 return True523 return True
502524
525 def test_and_close_cv_so(self, cr, uid, ids, invoice_ids=None, context=None):
526 """
527 set amout=0 on CV lines linked to closed, cancelled(-r) FO line (no more invoices expected)
528 and with no draft invoice
529
530
531 invoice_ids: list of draft invoices to ignore (state will be changed later in the code)
532 """
533
534 if invoice_ids is None:
535 invoice_ids = []
536
537 iv_ids = invoice_ids[:]
538 if not iv_ids:
539 iv_ids.append(0)
540
541 cv_line_obj = self.pool.get('account.commitment.line')
542 cr.execute('''
543 select
544 line.id, line.amount
545 from
546 account_commitment_line line
547 left join
548 sale_order_line sol on sol.id = line.so_line_id
549 left join
550 account_invoice_line inv_line on inv_line.sale_order_line_id = sol.id and inv_line.invoice_id not in %s
551 left join
552 account_invoice inv on inv_line.invoice_id = inv.id and inv.type = 'out_invoice' and inv.from_supply = 't'
553 where
554 sol.state in ('done', 'cancel', 'cancel_r') and
555 line.amount != 0 and
556 line.commit_id in %s
557 group by
558 line.id, line.amount
559 having (count(inv.state='draft' or NULL) = 0)
560 ''', (tuple(iv_ids), tuple(ids)))
561 # from_supply + out_invoice : to ignore draft refund
562
563 for x in cr.fetchall():
564 cv_line_obj._update_so_commitment_line(cr, uid, x[0], x[1], from_cancel=True, context=context)
565
566 return True
567
568
503account_commitment()569account_commitment()
504570
505class account_commitment_line(osv.osv):571class account_commitment_line(osv.osv):
506 _name = 'account.commitment.line'572 _name = 'account.commitment.line'
507 _description = "Account Commitment Voucher Line"573 _description = "Account Commitment Voucher Line"
508 _order = "po_line_id, id desc"574 _order = "line_number, id desc"
509 _rec_name = 'account_id'575 _rec_name = 'account_id'
510 _trace = True576 _trace = True
511577
@@ -574,10 +640,9 @@
574 string="Purchase Order Lines (deprecated)", readonly=True),640 string="Purchase Order Lines (deprecated)", readonly=True),
575 # for CV starting from version 2641 # for CV starting from version 2
576 'po_line_id': fields.many2one('purchase.order.line', "PO Line"),642 'po_line_id': fields.many2one('purchase.order.line', "PO Line"),
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"),
578 string="Product", readonly=True, store=True, write_relate=False),644 'line_product_id': fields.many2one('product.product', string="Product", readonly=True),
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),
580 store=True, write_relate=False, _fnct_migrate=lambda *a: True),
581 }646 }
582647
583 _defaults = {648 _defaults = {
@@ -608,20 +673,23 @@
608 # Prepare some values673 # Prepare some values
609 for cl in self.browse(cr, uid, ids, context=context):674 for cl in self.browse(cr, uid, ids, context=context):
610 # Browse distribution675 # Browse distribution
676 sign = 1
677 if cl.commit_id.cv_flow_type == 'customer':
678 sign = -1
611 distrib_id = cl.analytic_distribution_id and cl.analytic_distribution_id.id or False679 distrib_id = cl.analytic_distribution_id and cl.analytic_distribution_id.id or False
612 if not distrib_id:680 if not distrib_id:
613 distrib_id = cl.commit_id and cl.commit_id.analytic_distribution_id and cl.commit_id.analytic_distribution_id.id or False681 distrib_id = cl.commit_id and cl.commit_id.analytic_distribution_id and cl.commit_id.analytic_distribution_id.id or False
614 if distrib_id:682 if distrib_id:
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)
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)
617 ref = cl.commit_id and cl.commit_id.purchase_id and cl.commit_id.purchase_id.name or False685 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
618 if cl.commit_id:686 if cl.commit_id:
619 desc = cl.commit_id.description or cl.commit_id.name687 desc = cl.commit_id.description or cl.commit_id.name
620 else:688 else:
621 desc = 'Commitment voucher line'689 desc = 'Commitment voucher line'
622 self.pool.get('analytic.distribution').\690 self.pool.get('analytic.distribution').\
623 create_account_analytic_lines(cr, uid, [distrib_id], desc,691 create_account_analytic_lines(cr, uid, [distrib_id], desc,
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,
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,
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,
627 commitment_line_id=cl.id, context=context)695 commitment_line_id=cl.id, context=context)
@@ -678,15 +746,16 @@
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]
679 if account.type in ['view']:747 if account.type in ['view']:
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!"))
681 # Verify amount validity
682 if 'amount' in vals and vals.get('amount', 0.0) < 0.0:
683 raise osv.except_osv(_('Warning'), _('Amount Left should be equal or superior to 0!'))
684 if 'initial_amount' in vals and vals.get('initial_amount', 0.0) <= 0.0:
685 raise osv.except_osv(_('Warning'), _('Initial Amount should be superior to 0!'))
686 # Update analytic distribution if needed and initial_amount749 # Update analytic distribution if needed and initial_amount
687 for line in self.browse(cr, uid, ids, context=context):750 for line in self.browse(cr, uid, ids, context=context):
751 # Verify amount validity
752 if 'amount' in vals and vals.get('amount', 0.0) < 0.0:
753 raise osv.except_osv(_('Warning'), _('Amount Left should be equal or superior to 0!'))
754 if 'initial_amount' in vals and vals.get('initial_amount', 0.0) <= 0.0:
755 raise osv.except_osv(_('Warning'), _('Initial Amount should be superior to 0!'))
756 message = _('Initial Amount should be superior to Amount Left')
757
688 # verify that initial amount is superior to amount left758 # verify that initial amount is superior to amount left
689 message = _('Initial Amount should be superior to Amount Left')
690 if 'amount' in vals and 'initial_amount' in vals:759 if 'amount' in vals and 'initial_amount' in vals:
691 if vals.get('initial_amount') < vals.get('amount'):760 if vals.get('initial_amount') < vals.get('amount'):
692 raise osv.except_osv(_('Warning'), message)761 raise osv.except_osv(_('Warning'), message)
@@ -783,5 +852,32 @@
783 'context': context,852 'context': context,
784 }853 }
785854
855 def _update_so_commitment_line(self, cr, uid, id, amount, from_cancel=True, context=None):
856 """
857 reduce amount on CV line from SO
858 called when:
859 * FO line is canceled(-r)
860 * SI is opened or canceled
861 """
862 if context is None:
863 context = {}
864 wf_service = netsvc.LocalService("workflow")
865 cv_obj = self.pool.get('account.commitment')
866
867 cv_line = self.browse(cr, uid, id, context=context)
868 if not from_cancel and cv_line.commit_id.state == 'draft':
869 wf_service.trg_validate(uid, 'account.commitment', cv_line.commit_id.id, 'commitment_open', cr)
870
871 amount_left = max(round(cv_line.amount - amount, 2), 0)
872 # this will trigger AJIs update
873 self.write(cr, uid, [id], {'amount': amount_left}, context=context)
874
875 cv = cv_obj.read(cr, uid, cv_line.commit_id.id, ['total'], context=context)
876 if abs(cv['total']) < 0.001:
877 cv_obj.action_commitment_done(cr, uid, [cv_line.commit_id.id], context=context)
878
879 return True
880
881
786account_commitment_line()882account_commitment_line()
787# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:883# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
788884
=== modified file 'bin/addons/analytic_distribution/account_commitment_view.xml'
--- bin/addons/analytic_distribution/account_commitment_view.xml 2021-08-25 14:50:30 +0000
+++ bin/addons/analytic_distribution/account_commitment_view.xml 2021-11-03 13:33:55 +0000
@@ -8,12 +8,15 @@
8 <field name="model">account.commitment</field>8 <field name="model">account.commitment</field>
9 <field name="type">form</field>9 <field name="type">form</field>
10 <field name="arch" type="xml">10 <field name="arch" type="xml">
11 <form string="Commitment Voucher" hide_duplicate_button="1">11 <form string="Supplier Commitment Voucher" hide_duplicate_button="1">
12 <group col="6" colspan="4">12 <group col="6" colspan="4">
13 <field name="journal_id" domain="[('is_current_instance','=',True)]"/>13 <field name="journal_id" domain="[('is_current_instance','=',True)]"/>
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"/>
15 <newline/>15 <newline/>
16 <field name="name"/>16 <field name="name"/>
17 <field name="cv_flow_type" invisible="1" />
18 <field name="purchase_id" attrs="{'invisible': [('cv_flow_type', '!=', 'supplier')]}"/>
19 <field name="sale_id" attrs="{'invisible': [('cv_flow_type', '!=', 'customer')]}"/>
17 <newline/>20 <newline/>
18 <field name="date" on_change="onchange_date(date, period_id)"/>21 <field name="date" on_change="onchange_date(date, period_id)"/>
19 <field name="period_id"/>22 <field name="period_id"/>
@@ -54,7 +57,7 @@
54 'readonly': [('type', 'in', ['external', 'intermission', 'intersection'])]}"57 'readonly': [('type', 'in', ['external', 'intermission', 'intersection'])]}"
55 />58 />
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) -->
57 <button name="commitment_always_validate" string="Done (for Administrator only)"60 <button name="commitment_always_validate" string="Force Done"
58 icon="terp-gtk-go-back-rtl" colspan="6"61 icon="terp-gtk-go-back-rtl" colspan="6"
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?'
60 attrs="{'invisible': [('display_super_done_button', '=', False)]}"/>63 attrs="{'invisible': [('display_super_done_button', '=', False)]}"/>
@@ -70,10 +73,11 @@
70 <field name="model">account.commitment</field>73 <field name="model">account.commitment</field>
71 <field name="type">tree</field>74 <field name="type">tree</field>
72 <field name="arch" type="xml">75 <field name="arch" type="xml">
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'">
74 <field name="date"/>77 <field name="date"/>
75 <field name="name"/>78 <field name="name"/>
76 <field name="partner_id"/>79 <field name="partner_id" string="Supplier"/>
80 <field name="purchase_id" />
77 <field name="currency_id"/>81 <field name="currency_id"/>
78 <field name="total" digits="(16,2)"/>82 <field name="total" digits="(16,2)"/>
79 <field name="type"/>83 <field name="type"/>
@@ -83,6 +87,7 @@
83 </field>87 </field>
84 </record>88 </record>
8589
90
86 <!-- Commitment Lines -->91 <!-- Commitment Lines -->
87 <record model="ir.ui.view" id="account_commitment_line_tree">92 <record model="ir.ui.view" id="account_commitment_line_tree">
88 <field name="name">account.commitment.line.tree</field>93 <field name="name">account.commitment.line.tree</field>
@@ -95,8 +100,8 @@
95 hide_delete_button="1"100 hide_delete_button="1"
96 >101 >
97 <field name="commit_type"/>102 <field name="commit_type"/>
98 <field name="po_line_product_id"/>103 <field name="line_product_id"/>
99 <field name="po_line_number"/>104 <field name="line_number"/>
100 <field name="account_id" domain="[('restricted_area', '=', 'commitment_lines')]"/>105 <field name="account_id" domain="[('restricted_area', '=', 'commitment_lines')]"/>
101 <button name="button_analytic_distribution" string="Analytical Distribution" type="object"106 <button name="button_analytic_distribution" string="Analytical Distribution" type="object"
102 icon="terp-stock_symbol-selection" context="context"107 icon="terp-stock_symbol-selection" context="context"
@@ -125,21 +130,21 @@
125 <field name="model">account.commitment</field>130 <field name="model">account.commitment</field>
126 <field name="type">search</field>131 <field name="type">search</field>
127 <field name="arch" type="xml">132 <field name="arch" type="xml">
128 <search string="Search Commitment Voucher">133 <search string="Supplier Commitment Vouchers">
129 <group col='6' colspan='4'>134 <group col='6' colspan='4'>
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"/>
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"/>
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"/>
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"/>
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"/>
135 <separator orientation="vertical"/>140 <separator orientation="vertical"/>
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"/>
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"/>
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"/>
139 <newline/>144 <newline/>
140 <field name="currency_id" select="1"/>145 <field name="currency_id" select="1"/>
141 <field name="date" select='1'/>146 <field name="date" select='1'/>
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}"/>
143 <field name="name" select="1"/>148 <field name="name" select="1"/>
144 <field name="purchase_id"/>149 <field name="purchase_id"/>
145 </group>150 </group>
@@ -148,6 +153,95 @@
148 </field>153 </field>
149 </record>154 </record>
150155
156 <!-- Dedicated from FO views: duplicate CV from PO view and replace fields -->
157 <record model="ir.ui.view" id="account_commitment_fo_tree_copy">
158 <field name="name">account.commitment.fo.tree.copy</field>
159 <field name="model">account.commitment</field>
160 <field name="type">tree</field>
161 <field name="priority" eval="150" />
162 <field name="duplicate_view_id" ref="account_commitment_tree" />
163 <field name="arch" type="xml">
164 <tree />
165 </field>
166 </record>
167 <record model="ir.ui.view" id="account_commitment_fo_tree">
168 <field name="name">account.commitment.fo.tree.copy.inherit</field>
169 <field name="model">account.commitment</field>
170 <field name="type">tree</field>
171 <field name="priority" eval="160" />
172 <field name="inherit_id" ref="account_commitment_fo_tree_copy" />
173 <field name="arch" type="xml">
174 <xpath expr="/tree" position="attributes">
175 <attribute name="string">Customer Commitment Vouchers</attribute>
176 </xpath>
177 <xpath expr="//field[@name='purchase_id']" position="replace">
178 <field name="sale_id" />
179 </xpath>
180 <xpath expr="//field[@name='partner_id']" position="attributes">
181 <attribute name="string">Customer</attribute>
182 </xpath>
183 </field>
184 </record>
185
186 <record model="ir.ui.view" id="account_commitment_fo_search_copy">
187 <field name="name">account.commitment.fo.search.copy</field>
188 <field name="model">account.commitment</field>
189 <field name="type">search</field>
190 <field name="priority" eval="150" />
191 <field name="duplicate_view_id" ref="account_commitment_search" />
192 <field name="arch" type="xml">
193 <search />
194 </field>
195 </record>
196 <record model="ir.ui.view" id="account_commitment_fo_search">
197 <field name="name">account.commitment.fo.seach.copy.inherit</field>
198 <field name="model">account.commitment</field>
199 <field name="type">tree</field>
200 <field name="priority" eval="160" />
201 <field name="inherit_id" ref="account_commitment_fo_search_copy" />
202 <field name="arch" type="xml">
203 <xpath expr="/search" position="attributes">
204 <attribute name="string">Customer Commitment Vouchers</attribute>
205 </xpath>
206 <xpath expr="//field[@name='purchase_id']" position="replace">
207 <field name="sale_id" />
208 </xpath>
209 <xpath expr="//field[@name='partner_id']" position="attributes">
210 <attribute name="context">{'default_customer': 1, 'search_default_customer': 1, 'default_supplier': 0}</attribute>
211 <attribute name="string">Customer</attribute>
212 </xpath>
213 <xpath expr="//filter[@string='External']" position="replace" />
214 <xpath expr="//filter[@string='ESC']" position="replace" />
215 </field>
216 </record>
217
218 <record model="ir.ui.view" id="account_commitment_fo_form_copy">
219 <field name="name">account.commitment.fo.form.copy</field>
220 <field name="model">account.commitment</field>
221 <field name="type">form</field>
222 <field name="priority" eval="160" />
223 <field name="duplicate_view_id" ref="account_commitment_form" />
224 <field name="arch" type="xml">
225 <form />
226 </field>
227 </record>
228 <record model="ir.ui.view" id="account_commitment_fo_form">
229 <field name="name">account.commitment.fo.form.copy.inherit</field>
230 <field name="model">account.commitment</field>
231 <field name="type">form</field>
232 <field name="priority" eval="160" />
233 <field name="inherit_id" ref="account_commitment_fo_form_copy" />
234 <field name="arch" type="xml">
235 <xpath expr="/form" position="attributes">
236 <attribute name="string">Customer Commitment Voucher</attribute>
237 </xpath>
238 <xpath expr="//field[@name='partner_id']" position="attributes">
239 <attribute name="context">{'default_customer': 1, 'search_default_customer': 1, 'default_supplier': 0}</attribute>
240 <attribute name="string">Customer</attribute>
241 </xpath>
242 </field>
243 </record>
244
151 <!-- Commitment Import view -->245 <!-- Commitment Import view -->
152 <record id="import_commitment_wizard_view" model="ir.ui.view">246 <record id="import_commitment_wizard_view" model="ir.ui.view">
153 <field name="name">Import Intl Commitments</field>247 <field name="name">Import Intl Commitments</field>
@@ -252,16 +346,40 @@
252 </field>346 </field>
253 </record>347 </record>
254348
255 <!-- Commitment Voucher Actions -->349 <!-- Commitment Voucher Actions from PO -->
256 <record model="ir.actions.act_window" id="action_account_commitment_tree">350 <record model="ir.actions.act_window" id="action_account_commitment_tree">
257 <field name="res_model">account.commitment</field>351 <field name="res_model">account.commitment</field>
258 <field name="view_type">form</field>352 <field name="view_type">form</field>
259 <field name="view_mode">tree,form</field>353 <field name="view_mode">tree,form</field>
260 <field name="view_id" ref="account_commitment_tree"/>354 <field name="view_id" ref="account_commitment_tree"/>
261 <field name="search_view_id" ref="account_commitment_search"/>355 <field name="search_view_id" ref="account_commitment_search"/>
356 <field name="domain">[('cv_flow_type', '=', 'supplier')]</field>
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 -->
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>
264 </record>359 </record>
360
361 <!-- Commitment Voucher Actions from FO -->
362 <record model="ir.actions.act_window" id="action_account_commitment_from_fo">
363 <field name="res_model">account.commitment</field>
364 <field name="view_type">form</field>
365 <field name="view_mode">tree,form</field>
366 <field name="search_view_id" ref="account_commitment_fo_search_copy"/>
367 <field name="domain">[('cv_flow_type', '=', 'customer')]</field>
368 <field name="context">{'search_default_draft': 1, 'search_default_validated': 1, 'target_filename_prefix': 'Commitment Vouchers'}</field>
369 </record>
370 <record model="ir.actions.act_window.view" id="action_account_commitment_from_fo_tree">
371 <field name="sequence" eval="10"/>
372 <field name="view_mode">tree</field>
373 <field name="view_id" ref="account_commitment_fo_tree_copy"/>
374 <field name="act_window_id" ref="action_account_commitment_from_fo"/>
375 </record>
376 <record model="ir.actions.act_window.view" id="action_account_commitment_from_fo_form">
377 <field name="sequence" eval="20"/>
378 <field name="view_mode">form</field>
379 <field name="view_id" ref="account_commitment_fo_form_copy"/>
380 <field name="act_window_id" ref="action_account_commitment_from_fo"/>
381 </record>
382
265383
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 -->
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">
@@ -337,9 +455,10 @@
337455
338 <!-- Menu -->456 <!-- Menu -->
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"/>
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"/>
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"/>
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"/>
461 <menuitem name="Import Intl Commitments" action="action_import_commitment_wizard" id="menu_import_commitment" parent="menu_commitment" sequence="40"/>
343462
344 </data>463 </data>
345464
346465
=== modified file 'bin/addons/analytic_distribution/account_invoice_refund.py'
--- bin/addons/analytic_distribution/account_invoice_refund.py 2019-06-24 14:40:19 +0000
+++ bin/addons/analytic_distribution/account_invoice_refund.py 2021-11-03 13:33:55 +0000
@@ -33,7 +33,6 @@
33 """33 """
34 WARNING: This method has been taken from account module from OpenERP34 WARNING: This method has been taken from account module from OpenERP
35 """35 """
36 # @@@override@account.wizard.account_invoice_refund.py
37 obj_journal = self.pool.get('account.journal')36 obj_journal = self.pool.get('account.journal')
38 obj_inv = self.pool.get('account.invoice')37 obj_inv = self.pool.get('account.invoice')
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)
@@ -43,8 +42,16 @@
43 # in case of a DI refund from a register line use the dir_invoice_id in context42 # in case of a DI refund from a register line use the dir_invoice_id in context
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])
45 if doc_to_refund_id:44 if doc_to_refund_id:
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)
47 if source['is_intermission']:46 if source['doc_type'] == 'stv':
47 if source['journal_id']:
48 # by default use the same journal for the refund
49 args = [('id', '=', source['journal_id'][0])]
50 else:
51 args = [('type', '=', 'sale')]
52 elif source['doc_type'] == 'isi':
53 args = [('type', '=', 'purchase'), ('code', '=', 'ISI')]
54 elif source['is_intermission']:
48 args = [('type', '=', 'intermission')]55 args = [('type', '=', 'intermission')]
49 elif source['type'] in ('in_invoice', 'in_refund'):56 elif source['type'] in ('in_invoice', 'in_refund'):
50 args = [('type', '=', 'purchase_refund')]57 args = [('type', '=', 'purchase_refund')]
@@ -69,17 +76,24 @@
69 context = {}76 context = {}
70 journal_obj = self.pool.get('account.journal')77 journal_obj = self.pool.get('account.journal')
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)
72 jtype = 'sale_refund'79 if context.get('doc_type', '') == 'stv':
73 if context.get('journal_type'):80 jtype = 'sale'
74 jtype = isinstance(context['journal_type'], list) and context['journal_type'][0] or context['journal_type']81 elif context.get('doc_type', '') == 'isi':
75 if jtype in ('sale', 'sale_refund'):82 jtype = 'purchase'
83 else:
76 jtype = 'sale_refund'84 jtype = 'sale_refund'
77 elif jtype != 'intermission': # for IVO/IVI keep using the Interm. journal85 if context.get('journal_type'):
78 jtype = 'purchase_refund'86 jtype = isinstance(context['journal_type'], list) and context['journal_type'][0] or context['journal_type']
87 if jtype in ('sale', 'sale_refund'):
88 jtype = 'sale_refund'
89 elif jtype != 'intermission': # for IVO/IVI keep using the Interm. journal
90 jtype = 'purchase_refund'
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)
80 for field in res['fields']:92 for field in res['fields']:
81 if field == 'journal_id' and user.company_id.instance_id:93 if field == 'journal_id' and user.company_id.instance_id:
82 journal_domain = [('type', '=', jtype), ('is_current_instance', '=', True)]94 journal_domain = [('type', '=', jtype), ('is_current_instance', '=', True)]
95 if context.get('doc_type', '') == 'isi':
96 journal_domain.append(('code', '=', 'ISI'))
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)
84 res['fields'][field]['selection'] = journal_select98 res['fields'][field]['selection'] = journal_select
85 res['fields'][field]['domain'] = journal_domain99 res['fields'][field]['domain'] = journal_domain
@@ -88,7 +102,9 @@
88 _columns = {102 _columns = {
89 'date': fields.date('Posting date'),103 'date': fields.date('Posting date'),
90 'document_date': fields.date('Document Date', required=True),104 'document_date': fields.date('Document Date', required=True),
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),
106 'is_stv': fields.boolean("Wizard opened from a Stock Transfer Voucher", readonly=True),
107 'is_isi': fields.boolean("Wizard opened from an Intersection Supplier Invoice", readonly=True),
92 }108 }
93109
94 def _get_refund(self, cr, uid, context=None):110 def _get_refund(self, cr, uid, context=None):
@@ -97,8 +113,10 @@
97 """113 """
98 if context is None:114 if context is None:
99 context = {}115 context = {}
100 if context.get('is_intermission', False):116 if context.get('is_intermission', False) or context.get('doc_type', '') == 'stv':
101 return 'modify'117 return 'modify'
118 elif context.get('doc_type', '') == 'isi':
119 return 'cancel'
102 return 'refund' # note that only the "Refund" option is available in DI120 return 'refund' # note that only the "Refund" option is available in DI
103121
104 def _get_is_intermission(self, cr, uid, context=None):122 def _get_is_intermission(self, cr, uid, context=None):
@@ -109,11 +127,29 @@
109 context = {}127 context = {}
110 return context.get('is_intermission', False)128 return context.get('is_intermission', False)
111129
130 def _get_is_stv(self, cr, uid, context=None):
131 """
132 Returns True if the wizard has been opened from a Stock Transfer Voucher
133 """
134 if context is None:
135 context = {}
136 return context.get('doc_type', '') == 'stv'
137
138 def _get_is_isi(self, cr, uid, context=None):
139 """
140 Returns True if the wizard has been opened from an Intersection Supplier Invoice
141 """
142 if context is None:
143 context = {}
144 return context.get('doc_type', '') == 'isi'
145
112 _defaults = {146 _defaults = {
113 'document_date': _get_document_date,147 'document_date': _get_document_date,
114 'filter_refund': _get_refund,148 'filter_refund': _get_refund,
115 'journal_id': _get_journal, # US-193149 'journal_id': _get_journal, # US-193
116 'is_intermission': _get_is_intermission,150 'is_intermission': _get_is_intermission,
151 'is_stv': _get_is_stv,
152 'is_isi': _get_is_isi,
117 }153 }
118154
119 def _hook_fields_for_modify_refund(self, cr, uid, *args):155 def _hook_fields_for_modify_refund(self, cr, uid, *args):
@@ -143,7 +179,7 @@
143 else:179 else:
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)
145181
146 def _hook_create_invoice(self, cr, uid, data, form, *args):182 def _hook_create_invoice(self, cr, uid, data, form, context=None):
147 """183 """
148 Permits to adapt invoice creation184 Permits to adapt invoice creation
149 """185 """
@@ -151,7 +187,7 @@
151 self.pool.get('finance.tools').check_document_date(cr, uid,187 self.pool.get('finance.tools').check_document_date(cr, uid,
152 form['document_date'], form['date'])188 form['document_date'], form['date'])
153 data.update({'document_date': form['document_date']})189 data.update({'document_date': form['document_date']})
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)
155191
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):
157 """193 """
158194
=== modified file 'bin/addons/analytic_distribution/account_invoice_view.xml'
--- bin/addons/analytic_distribution/account_invoice_view.xml 2020-01-21 14:01:11 +0000
+++ bin/addons/analytic_distribution/account_invoice_view.xml 2021-11-03 13:33:55 +0000
@@ -2,70 +2,6 @@
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <!-- Add new analytic distribution button -->
6 <record id="invoice_supplier_form_2" model="ir.ui.view">
7 <field name="name">account.invoice.supplier.form.2</field>
8 <field name="model">account.invoice</field>
9 <field name="type">form</field>
10 <field name="inherit_id" ref="account.invoice_supplier_form"/>
11 <field name="priority">30</field>
12 <field name="arch" type="xml">
13 <data>
14 <xpath expr="/form/notebook" position="before">
15 <newline />
16 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
17 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
18 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
19 </group>
20 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
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)]}"/>
22 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
23 </group>
24 <field name="analytic_distribution_id" invisible="1"/>
25 <group colspan="3"/>
26 </xpath>
27 <xpath expr="//tree[@string='Invoice lines']/field[@name='account_analytic_id']" position="replace">
28 <field name="inactive_product" invisible="1" />
29 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-stock_symbol-selection" context="context" attrs="{'invisible': [('is_allocatable', '=', False)]}"/>
30 <field name="analytic_distribution_state_recap"/>
31 <field name="have_analytic_distribution_from_header" invisible="1"/>
32 <field name="analytic_distribution_state" invisible="1"/>
33 <field name="is_allocatable" invisible="1"/>
34 </xpath>
35 <xpath expr="//tree[@string='Invoice lines']" position="attributes">
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>
37 </xpath>
38 <xpath expr="//tree[@string='Invoice lines']/field[@name='product_id']" position="before">
39 <field name="is_corrected" invisible="1"/>
40 <button name="button_open_analytic_lines" string="Have been corrected" type="object" icon="terp-mail-" attrs="{'invisible': [('is_corrected', '=', False)]}"/>
41 </xpath>
42 </data>
43 </field>
44 </record>
45
46 <record id="invoice_form_2" model="ir.ui.view">
47 <field name="name">account.invoice.supplier.form.2</field>
48 <field name="model">account.invoice</field>
49 <field name="type">form</field>
50 <field name="inherit_id" ref="account.invoice_form"/>
51 <field name="priority">35</field>
52 <field name="arch" type="xml">
53 <data>
54 <xpath expr="/form/notebook" position="before">
55 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}">
56 <button name="button_analytic_distribution" string="Analytical Distribution" type="object" icon="terp-check" context="context" colspan="4" attrs="{'invisible': [('analytic_distribution_id', '=', False)]}"/>
57 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
58 </group>
59 <group colspan="4" col="8" attrs="{'invisible': [('analytic_distribution_id', '!=', False)]}">
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)]}"/>
61 <button name="button_reset_distribution" string="Reset AD at line level" type="object" icon="gtk-undelete" colspan="4" states="draft"/>
62 </group>
63 <field name="analytic_distribution_id" invisible="1"/>
64 <group colspan="3"/>
65 </xpath>
66 </data>
67 </field>
68 </record>
695
70 <record id="view_invoice_line_tree_2" model="ir.ui.view">6 <record id="view_invoice_line_tree_2" model="ir.ui.view">
71 <field name="name">account.invoice.line.tree.2</field>7 <field name="name">account.invoice.line.tree.2</field>
@@ -122,7 +58,11 @@
122 <xpath expr="//field[@name='invoice_line_tax_id']" position="replace">58 <xpath expr="//field[@name='invoice_line_tax_id']" position="replace">
123 <field name="vat_ok" invisible="1" />59 <field name="vat_ok" invisible="1" />
124 <field name="synced" invisible="1" />60 <field name="synced" invisible="1" />
125 <group colspan="4" col="4" attrs="{'invisible': [('vat_ok', '=', False)]}">61 <field name="line_doc_type" invisible="1" />
62 <!-- note: in STV and STR taxes are hidden even for external partners as these are in fact "false" external partners
63 (e.g. instances for which the deployment of UniField hasn't been finished) -->
64 <group colspan="4" col="4"
65 attrs="{'invisible': ['|', ('vat_ok', '=', False), ('line_doc_type', 'in', ('stv', 'str', 'isi', 'isr'))]}">
126 <separator colspan="4" string="Taxes"/>66 <separator colspan="4" string="Taxes"/>
127 <field colspan="4"67 <field colspan="4"
128 name="invoice_line_tax_id"68 name="invoice_line_tax_id"
12969
=== modified file 'bin/addons/analytic_distribution/account_view.xml'
--- bin/addons/analytic_distribution/account_view.xml 2021-09-07 16:24:58 +0000
+++ bin/addons/analytic_distribution/account_view.xml 2021-11-03 13:33:55 +0000
@@ -42,38 +42,6 @@
42 </field>42 </field>
43 </record>43 </record>
4444
45 <record id="view_account_form" model="ir.ui.view">
46 <field name="name">account.form</field>
47 <field name="model">account.account</field>
48 <field name="type">form</field>
49 <field name="inherit_id" ref="account.view_account_form"/>
50 <field name="priority">25</field>
51 <field name="arch" type="xml">
52 <data>
53 <xpath expr="//field[@name='user_type']" position="replace">
54 <field name="user_type_code" invisible="1"/>
55 <field name="is_analytic_addicted" invisible="1"/>
56 <field name="user_type" on_change="onchange_user_type(user_type, code)"/>
57 </xpath>
58 <xpath expr="/form/notebook/page[@string='General Information']" position="after">
59 <page string="Analytical Destination">
60 <field name="default_destination_id" colspan="2"
61 attrs="{'required': [('is_analytic_addicted', '=', True)], 'readonly': [('is_analytic_addicted', '!=', True)]}"/>
62 <label string="" colspan="2"/>
63 <field name="destination_ids" nolabel="1" colspan="4" domain="[('type', '!=', 'view'), ('category', '=', 'DEST')]">
64 <tree string="Destinations">
65 <field name="name"/>
66 <field name="description"/>
67 <field name="date_start"/>
68 <field name="date"/>
69 </tree>
70 </field>
71 </page>
72 </xpath>
73 </data>
74 </field>
75 </record>
76
77 <record id="analytic_view_move_form" model="ir.ui.view">45 <record id="analytic_view_move_form" model="ir.ui.view">
78 <field name="name">analytic.view.move.form</field>46 <field name="name">analytic.view.move.form</field>
79 <field name="model">account.move</field>47 <field name="model">account.move</field>
8048
=== modified file 'bin/addons/analytic_distribution/analytic_line_view.xml'
--- bin/addons/analytic_distribution/analytic_line_view.xml 2016-09-28 08:20:24 +0000
+++ bin/addons/analytic_distribution/analytic_line_view.xml 2021-11-03 13:33:55 +0000
@@ -2,42 +2,6 @@
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <!-- Add icon ahead analytic line to inform if this line have been reallocated or not -->
6 <record id="inherit2_view_account_analytic_line_tree" model="ir.ui.view">
7 <field name="name">account.analytic.line.tree</field>
8 <field name="model">account.analytic.line</field>
9 <field name="type">tree</field>
10 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
11 <field name="priority" eval="11"/>
12 <field name="arch" type="xml">
13 <data>
14 <xpath expr="/tree/field[@name='move_id']" position='replace'>
15 <field name="entry_sequence"/>
16 </xpath>
17 <xpath expr="/tree/field[@name='functional_currency_id']" position="after">
18 <field name="output_amount"/>
19 <field name="output_currency"/>
20 </xpath>
21 </data>
22 </field>
23 </record>
24
25 <!-- View for Analytic Journal Items (FUNDING POOL) -->
26 <record id="view_account_analytic_line_tree" model="ir.ui.view">
27 <field name="name">account.analytic.line.tree</field>
28 <field name="model">account.analytic.line</field>
29 <field name="type">tree</field>
30 <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
31 <field name="priority" eval="12"/>
32 <field name="arch" type="xml">
33 <data>
34 <xpath expr="/tree/field[@name='account_id']" position='before'>
35 <field name="destination_id" string="Destination" invisible="not context.get('display_fp', False)"/>
36 <field name="cost_center_id" string="Cost Center" invisible="not context.get('display_fp', False)"/>
37 </xpath>
38 </data>
39 </field>
40 </record>
415
42 <!-- Action for Analytic Journal Items (FUNDING POOL) -->6 <!-- Action for Analytic Journal Items (FUNDING POOL) -->
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">
@@ -45,7 +9,7 @@
45 <field name="res_model">account.analytic.line</field>9 <field name="res_model">account.analytic.line</field>
46 <field name="view_type">form</field>10 <field name="view_type">form</field>
47 <field name="view_mode">tree,form</field>11 <field name="view_mode">tree,form</field>
48 <field name="view_id" ref="view_account_analytic_line_tree"/>12 <field name="view_id" ref="account.view_account_analytic_line_tree"/>
49 <field name="domain">[('account_id.category', '=', 'FUNDING')]</field>13 <field name="domain">[('account_id.category', '=', 'FUNDING')]</field>
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>
51 </record>15 </record>
@@ -60,7 +24,7 @@
60 <field name="res_model">account.analytic.line</field>24 <field name="res_model">account.analytic.line</field>
61 <field name="view_type">form</field>25 <field name="view_type">form</field>
62 <field name="view_mode">tree,form</field>26 <field name="view_mode">tree,form</field>
63 <field name="view_id" ref="view_account_analytic_line_tree"/>27 <field name="view_id" ref="account.view_account_analytic_line_tree"/>
64 <field name="domain">[('account_id.category', '=', 'FREE1')]</field>28 <field name="domain">[('account_id.category', '=', 'FREE1')]</field>
65 <field name="context">{'display_fp': False, 'categ': 'FREE1'}</field>29 <field name="context">{'display_fp': False, 'categ': 'FREE1'}</field>
66 </record>30 </record>
@@ -75,7 +39,7 @@
75 <field name="res_model">account.analytic.line</field>39 <field name="res_model">account.analytic.line</field>
76 <field name="view_type">form</field>40 <field name="view_type">form</field>
77 <field name="view_mode">tree,form</field>41 <field name="view_mode">tree,form</field>
78 <field name="view_id" ref="view_account_analytic_line_tree"/>42 <field name="view_id" ref="account.view_account_analytic_line_tree"/>
79 <field name="domain">[('account_id.category', '=', 'FREE2')]</field>43 <field name="domain">[('account_id.category', '=', 'FREE2')]</field>
80 <field name="context">{'display_fp': False, 'categ': 'FREE2'}</field>44 <field name="context">{'display_fp': False, 'categ': 'FREE2'}</field>
81 </record>45 </record>
8246
=== modified file 'bin/addons/analytic_distribution_supply/__openerp__.py'
--- bin/addons/analytic_distribution_supply/__openerp__.py 2017-10-04 05:23:42 +0000
+++ bin/addons/analytic_distribution_supply/__openerp__.py 2021-11-03 13:33:55 +0000
@@ -30,7 +30,6 @@
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"],
31 "init_xml" : [],31 "init_xml" : [],
32 "update_xml" : [32 "update_xml" : [
33 "account_commitment_view.xml",
34 ],33 ],
35 "demo_xml" : [],34 "demo_xml" : [],
36 "test": [35 "test": [
3736
=== removed file 'bin/addons/analytic_distribution_supply/account_commitment_view.xml'
=== modified file 'bin/addons/analytic_distribution_supply/invoice.py'
--- bin/addons/analytic_distribution_supply/invoice.py 2021-08-11 12:34:27 +0000
+++ bin/addons/analytic_distribution_supply/invoice.py 2021-11-03 13:33:55 +0000
@@ -27,7 +27,7 @@
27from tools.translate import _27from tools.translate import _
28from base import currency_date28from base import currency_date
29import netsvc29import netsvc
3030import time
3131
32class account_invoice_line(osv.osv):32class account_invoice_line(osv.osv):
33 _name = 'account.invoice.line'33 _name = 'account.invoice.line'
@@ -130,38 +130,65 @@
130 if isinstance(ids, (int, long)):130 if isinstance(ids, (int, long)):
131 ids = [ids]131 ids = [ids]
132132
133 cv_obj = self.pool.get('account.commitment')
134 cv_line_obj = self.pool.get('account.commitment.line')
135 curr_obj = self.pool.get('res.currency')
136 check_cv_to_close = {}
133 # Browse invoices137 # Browse invoices
134 for inv in self.browse(cr, uid, ids, context=context):138 for inv in self.browse(cr, uid, ids, context=context):
135 grouped_invl_by_acc = {}139 grouped_invl_by_acc = {}
136 grouped_invl_by_cvl = {}140 grouped_invl_by_cvl = {}
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
138 if not co_ids:142 invoice_curr = inv.currency_id.id
139 continue143
144
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)
146 cv_on_fo = False
147 if not cv_on_po:
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)
149 if not cv_on_fo:
150 continue
140151
141 for invl in inv.invoice_line:152 for invl in inv.invoice_line:
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)
143 if not invl.order_line_id and not inv.is_merged_by_account:154 if cv_on_po:
144 continue155 if not invl.order_line_id and not inv.is_merged_by_account:
145 # exclude push flow156 continue
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
147 continue158 if invl.order_line_id and (invl.order_line_id.order_id.push_fo or invl.order_line_id.set_as_sourced_n):
148 old_cv_version = True159 continue
160 old_cv_version = True
161 else:
162 if not invl.sale_order_line_id:
163 continue
164 old_cv_version = False
165
149 # CV STARTING FROM VERSION 2166 # CV STARTING FROM VERSION 2
150 amount_to_subtract = invl.price_subtotal or 0.0167 amount_to_subtract = invl.price_subtotal or 0.0
151 for cv_line in invl.cv_line_ids:168 for cv_line in invl.cv_line_ids:
152 old_cv_version = False # the field cv_line_ids exist for CVs starting from version 2169 old_cv_version = False # the field cv_line_ids exist for CVs starting from version 2
153 if abs(amount_to_subtract) <= 10**-3:170 if abs(amount_to_subtract) <= 10**-3:
154 break171 break
155 cvl_amount_left = cv_line.amount or 0.0172 if cv_on_fo:
156 if cvl_amount_left:173 # no group by accounts on IS/IM SI
157 if cv_line.id not in grouped_invl_by_cvl:174 if invoice_curr != cv_line.commit_id.currency_id.id:
158 grouped_invl_by_cvl[cv_line.id] = 0175 curr_date = currency_date.get_date(self, cr, inv.document_date, inv.date_invoice)
159 if amount_to_subtract >= cvl_amount_left:176
160 grouped_invl_by_cvl[cv_line.id] += cvl_amount_left177 amount_to_subtract = curr_obj.compute(cr, uid, invoice_curr, cv_line.commit_id.currency_id.id, amount_to_subtract, round=True,
161 amount_to_subtract -= cvl_amount_left178 context={'currency_date': curr_date or time.strftime('%Y-%m-%d')})
162 else:179 check_cv_to_close[cv_line.commit_id.id] = True
163 grouped_invl_by_cvl[cv_line.id] += amount_to_subtract180 cv_line_obj._update_so_commitment_line(cr, uid, cv_line.id, amount_to_subtract, from_cancel=False, context=context)
164 amount_to_subtract = 0181 else:
182 cvl_amount_left = cv_line.amount or 0.0
183 if cvl_amount_left:
184 if cv_line.id not in grouped_invl_by_cvl:
185 grouped_invl_by_cvl[cv_line.id] = 0
186 if amount_to_subtract >= cvl_amount_left:
187 grouped_invl_by_cvl[cv_line.id] += cvl_amount_left
188 amount_to_subtract -= cvl_amount_left
189 else:
190 grouped_invl_by_cvl[cv_line.id] += amount_to_subtract
191 amount_to_subtract = 0
165 # CV IN VERSION 1192 # CV IN VERSION 1
166 if old_cv_version:193 if old_cv_version:
167 # Fetch purchase order line account194 # Fetch purchase order line account
@@ -183,9 +210,12 @@
183 grouped_invl_by_acc[a] = 0210 grouped_invl_by_acc[a] = 0
184 grouped_invl_by_acc[a] += invl.price_subtotal211 grouped_invl_by_acc[a] += invl.price_subtotal
185212
186 po_ids = [x.id for x in inv.purchase_ids]213 if cv_on_po:
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]
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,
216 cvl_amount_dic=grouped_invl_by_cvl, from_cancel=False, context=context)
217 if check_cv_to_close:
218 cv_obj.test_and_close_cv_so(cr, uid, check_cv_to_close.keys(), invoice_ids=ids, context=context)
189219
190 return True220 return True
191221
@@ -356,17 +386,20 @@
356 to_process = []386 to_process = []
357 # Verify if all invoice have a po that have a commitment387 # Verify if all invoice have a po that have a commitment
358 for inv in self.browse(cr, uid, ids, context=context):388 for inv in self.browse(cr, uid, ids, context=context):
359 for po in inv.purchase_ids:389 if inv.order_ids:
360 if po.commitment_ids:390 to_process.append(inv.id)
361 to_process.append(inv.id)391 else:
362 # UTP-536 : Check if the PO is closed and all SI are draft, then close the CV392 for po in inv.purchase_ids:
363 po_states = ['done']393 if po.commitment_ids:
364 if po.order_type == 'direct' and po.po_version == 1:394 to_process.append(inv.id)
365 # DPO v1 specific use case: CV and SI are both created at DPO confirmation395 # UTP-536 : Check if the PO is closed and all SI are draft, then close the CV
366 # ==> close the CVs if the DPO is at least "Confirmed" and no SI is in Draft anymore396 po_states = ['done']
367 po_states = ['confirmed', 'confirmed_p', 'done']397 if po.order_type == 'direct' and po.po_version == 1:
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
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
400 po_states = ['confirmed', 'confirmed_p', 'done']
401 if po.state in po_states and all(x.id in ids or x.state != 'draft' for x in po.invoice_ids):
402 self.pool.get('purchase.order')._finish_commitment(cr, uid, [po.id], context=context)
370403
371 # Process invoices404 # Process invoices
372 self.update_commitments(cr, uid, to_process, context=context)405 self.update_commitments(cr, uid, to_process, context=context)
373406
=== modified file 'bin/addons/base/__openerp__.py'
--- bin/addons/base/__openerp__.py 2019-12-12 13:30:26 +0000
+++ bin/addons/base/__openerp__.py 2021-11-03 13:33:55 +0000
@@ -23,7 +23,7 @@
2323
24{24{
25 'name': 'Base',25 'name': 'Base',
26 'version': '1.6',26 'version': '1.7',
27 'category': 'Generic Modules/Base',27 'category': 'Generic Modules/Base',
28 'description': """The kernel of OpenERP, needed for all installation.""",28 'description': """The kernel of OpenERP, needed for all installation.""",
29 'author': 'OpenERP SA',29 'author': 'OpenERP SA',
3030
=== modified file 'bin/addons/base/ir/ir_actions.py'
--- bin/addons/base/ir/ir_actions.py 2020-02-25 14:52:32 +0000
+++ bin/addons/base/ir/ir_actions.py 2021-11-03 13:33:55 +0000
@@ -284,7 +284,7 @@
284 'view_id': fields.many2one('ir.ui.view', 'View Ref.', ondelete='cascade'),284 'view_id': fields.many2one('ir.ui.view', 'View Ref.', ondelete='cascade'),
285 'domain': fields.char('Domain Value', size=250,285 'domain': fields.char('Domain Value', size=250,
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"),
287 'context': fields.char('Context Value', size=250, required=True,287 'context': fields.char('Context Value', size=512, required=True,
288 help="Context dictionary as Python expression, empty by default (Default: {})"),288 help="Context dictionary as Python expression, empty by default (Default: {})"),
289 'res_model': fields.char('Object', size=64, required=True,289 'res_model': fields.char('Object', size=64, required=True,
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"),
291291
=== added directory 'bin/addons/base/migrations/8.0.1.7'
=== added file 'bin/addons/base/migrations/8.0.1.7/pre-update-bar.py'
--- bin/addons/base/migrations/8.0.1.7/pre-update-bar.py 1970-01-01 00:00:00 +0000
+++ bin/addons/base/migrations/8.0.1.7/pre-update-bar.py 2021-11-03 13:33:55 +0000
@@ -0,0 +1,22 @@
1import os
2from tools import config
3import logging
4
5
6def migrate(cr, version):
7 if not cr.table_exists('ir_model_data'):
8 return
9
10 logger = logging.getLogger('migration')
11 queries = os.path.join(config['root_path'], 'addons/base/migrations/8.0.1.7/update_bar_sdref.sql')
12 if os.path.exists(queries):
13 with open(queries) as lines:
14 for line in lines:
15 if line:
16 cr.execute('SAVEPOINT migration')
17 try:
18 cr.execute(line)
19 except:
20 logger.warn('SQL error %s' % line)
21 cr.execute('ROLLBACK TO SAVEPOINT migration')
22 return True
023
=== added file 'bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql'
--- bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql 1970-01-01 00:00:00 +0000
+++ bin/addons/base/migrations/8.0.1.7/update_bar_sdref.sql 2021-11-03 13:33:55 +0000
@@ -0,0 +1,108 @@
1delete 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');
2delete 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';
3update 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');
4update 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';
5delete 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');
6delete from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
7update 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');
8update 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';
9delete 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');
10delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule';
11update 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');
12update 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';
13delete 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');
14delete 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';
15update 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');
16update 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';
17delete 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');
18delete 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';
19update 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');
20update 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';
21delete 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');
22delete 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';
23update 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');
24update 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';
25delete 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');
26delete from ir_model_data where name='BAR_accountinvoice_form_button_analytic_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule';
27update 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');
28update 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';
29delete 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');
30delete from ir_model_data where name='BAR_accountinvoice_form_button_reset_distribution' and module='sd' and model='msf_button_access_rights.button_access_rule';
31update 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');
32update 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';
33delete 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');
34delete from ir_model_data where name='BAR_accountinvoice_tree_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule';
35update 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');
36update 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';
37delete 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');
38delete from ir_model_data where name='BAR_accountinvoice_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule';
39update 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');
40update 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';
41delete 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');
42delete from ir_model_data where name='BAR_accountinvoice_supplier_form_invoice_open' and module='sd' and model='msf_button_access_rights.button_access_rule';
43update 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');
44update 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';
45delete 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');
46delete 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';
47update 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');
48update 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';
49delete 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');
50delete 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';
51update 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');
52update 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';
53delete 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');
54delete 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';
55update 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');
56update 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';
57delete 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');
58delete from ir_model_data where name='BAR_accountinvoice_form_accountaccount_invoices' and module='sd' and model='msf_button_access_rights.button_access_rule';
59update 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');
60update 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';
61delete 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');
62delete 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';
63update 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');
64update 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';
65delete 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');
66delete 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';
67update 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');
68update 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';
69delete 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');
70delete 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';
71update 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');
72update 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';
73delete 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');
74delete 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';
75update 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');
76update 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';
77delete 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');
78delete from ir_model_data where name='BAR_accountinvoice_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
79update 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');
80update 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';
81delete 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');
82delete from ir_model_data where name='BAR_accountinvoice_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
83update 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');
84update 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';
85delete 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');
86delete from ir_model_data where name='BAR_accountinvoice_form_invoice_cancel' and module='sd' and model='msf_button_access_rights.button_access_rule';
87update 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');
88update 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';
89delete 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');
90delete from ir_model_data where name='BAR_accountinvoice_form_button_split_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
91update 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');
92update 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';
93delete 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');
94delete from ir_model_data where name='BAR_accountinvoice_supplier_form_import_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
95update 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');
96update 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';
97delete 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');
98delete from ir_model_data where name='BAR_accountinvoice_supplier_form_export_invoice' and module='sd' and model='msf_button_access_rights.button_access_rule';
99update 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');
100update 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';
101delete 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');
102delete 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';
103update 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');
104update 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';
105delete 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');
106delete 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';
107update 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');
108update 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';
0109
=== modified file 'bin/addons/base/module/instance_auto_creation.py'
--- bin/addons/base/module/instance_auto_creation.py 2020-07-16 09:16:26 +0000
+++ bin/addons/base/module/instance_auto_creation.py 2021-11-03 13:33:55 +0000
@@ -486,6 +486,11 @@
486 else:486 else:
487 previous_fy_dates_allowed = False487 previous_fy_dates_allowed = False
488488
489 if config.has_option('reconfigure', 'customer_commitment'):
490 customer_commitment = config.getboolean('reconfigure', 'customer_commitment')
491 else:
492 customer_commitment = False
493
489 if config.has_option('reconfigure', 'payroll_ok'):494 if config.has_option('reconfigure', 'payroll_ok'):
490 payroll_ok = config.getboolean('reconfigure', 'payroll_ok')495 payroll_ok = config.getboolean('reconfigure', 'payroll_ok')
491 else:496 else:
@@ -538,6 +543,9 @@
538 },543 },
539 'previous.fy.dates.setup': {544 'previous.fy.dates.setup': {
540 'previous_fy_dates_allowed': previous_fy_dates_allowed,545 'previous_fy_dates_allowed': previous_fy_dates_allowed,
546 },
547 'customer.commitment.setup': {
548 'customer_commitment': customer_commitment,
541 }549 }
542 }550 }
543 if country_id:551 if country_id:
544552
=== modified file 'bin/addons/finance/account_analytic_line_view.xml'
--- bin/addons/finance/account_analytic_line_view.xml 2018-11-12 17:20:58 +0000
+++ bin/addons/finance/account_analytic_line_view.xml 2021-11-03 13:33:55 +0000
@@ -10,19 +10,34 @@
10 <field name="priority" eval="10"/>10 <field name="priority" eval="10"/>
11 <field name="arch" type="xml">11 <field name="arch" type="xml">
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">
13 <field name="instance_id" readonly="1"/>
14 <field name="is_reversal" invisible="1"/>
15 <field name="journal_type" invisible="1"/>
16 <field name="is_corrigible" invisible="1"/>
17 <button name="button_corrections" type="object" string="Accounting info/correction"
18 attrs="{'invisible': [('is_corrigible', '=', False)]}" icon="terp-mail-message-new"/>
19 <field name="is_reallocated" invisible="1"/>
20 <field name="last_corrected_id" invisible="1"/>
21 <field name="is_engi" invisible="1"/>
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"/>
13 <field name="journal_id" domain="[('is_current_instance','=',True)]"/>23 <field name="journal_id" domain="[('is_current_instance','=',True)]"/>
14 <field name="move_id"/>24 <field name="entry_sequence"/>
15 <field name="name"/>25 <field name="name"/>
16 <field name="ref"/>26 <field name="ref"/>
17 <field name="document_date"/>27 <field name="document_date"/>
18 <field name="date"/>28 <field name="date"/>
19 <field name="period_id"/>29 <field name="period_id"/>
20 <field name="general_account_id"/>30 <field name="general_account_id"/>
31 <field name="destination_id" string="Destination" invisible="not context.get('display_fp', False)"/>
32 <field name="cost_center_id" string="Cost Center" invisible="not context.get('display_fp', False)"/>
21 <field name="account_id"/>33 <field name="account_id"/>
34 <field name="partner_txt"/>
22 <field name="amount_currency" sum="Sum"/>35 <field name="amount_currency" sum="Sum"/>
23 <field name="currency_id"/>36 <field name="currency_id"/>
24 <field name="amount" sum="Sum"/>37 <field name="amount" sum="Sum"/>
25 <field name="functional_currency_id"/>38 <field name="functional_currency_id"/>
39 <field name="output_amount"/>
40 <field name="output_currency"/>
26 <field name="reversal_origin_txt"/>41 <field name="reversal_origin_txt"/>
27 <field name="user_id" invisible="1"/>42 <field name="user_id" invisible="1"/>
28 </tree>43 </tree>
2944
=== modified file 'bin/addons/finance/account_view.xml'
--- bin/addons/finance/account_view.xml 2019-06-18 11:15:45 +0000
+++ bin/addons/finance/account_view.xml 2021-11-03 13:33:55 +0000
@@ -2,25 +2,6 @@
2<openerp>2<openerp>
3 <data>3 <data>
44
5 <!-- Account View -->
6 <record id="inherit_view_account_tree" model="ir.ui.view">
7 <field name="name">inherit.view.account.tree</field>
8 <field name="model">account.account</field>
9 <field name="type">tree</field>
10 <field name="field_parent">child_id</field>
11 <field name="inherit_id" ref="account.view_account_tree"/>
12 <field name="priority">19</field>
13 <field name="arch" type="xml">
14 <xpath expr="//field[@name='type']" position="replace">
15 </xpath>
16 <xpath expr="//field[@name='user_type']" position="after">
17 <field name="type" invisible="1"/>
18 <field name="type_for_register" invisible="1"/>
19 <field name="accrual_account" invisible="1"/>
20 </xpath>
21 </field>
22 </record>
23
24 <!--5 <!--
25 Journal Entries6 Journal Entries
26 -->7 -->
@@ -149,21 +130,6 @@
149 <field name="context">{'from_web_menu': True}</field>130 <field name="context">{'from_web_menu': True}</field>
150 </record>131 </record>
151132
152 <!-- Account View -->
153 <record id="inherit_view_account_form" model="ir.ui.view">
154 <field name='name'>inherit.view.account.form</field>
155 <field name='model'>account.account</field>
156 <field name="type">form</field>
157 <field name="priority">50</field>
158 <field name='inherit_id' ref='account.view_account_form' />
159 <field name="arch" type="xml">
160 <xpath expr="//field[@name='user_type']" position="after">
161 <field name="shrink_entries_for_hq"/>
162 <field name="is_child_of_coa" invisible="1" />
163 <field name="display_in_reports" attrs="{'invisible': [('is_child_of_coa', '=', False)]}" />
164 </xpath>
165 </field>
166 </record>
167133
168 <!-- UF-1715 -->134 <!-- UF-1715 -->
169 <report id="account_partner_balance_tree_xls"135 <report id="account_partner_balance_tree_xls"
170136
=== modified file 'bin/addons/finance/board_account_view.xml'
--- bin/addons/finance/board_account_view.xml 2021-08-25 14:50:30 +0000
+++ bin/addons/finance/board_account_view.xml 2021-11-03 13:33:55 +0000
@@ -64,7 +64,7 @@
64 <field name="view_type">form</field>64 <field name="view_type">form</field>
65 <field name="view_mode">tree,form,calendar,graph</field>65 <field name="view_mode">tree,form,calendar,graph</field>
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 -->
67 <field name="domain">[('state', '=', 'draft')]</field>67 <field name="domain">[('state', '=', 'draft'), ('cv_flow_type', '=', 'supplier')]</field>
68 <field name="context">{'board_view': True, 'search_default_draft': 1}</field>68 <field name="context">{'board_view': True, 'search_default_draft': 1}</field>
69 <field ref="account_board_commitment_voucher_view" name="view_id"/>69 <field ref="account_board_commitment_voucher_view" name="view_id"/>
70 <field name="limit">5</field>70 <field name="limit">5</field>
@@ -96,8 +96,8 @@
96 <field name="view_type">form</field>96 <field name="view_type">form</field>
97 <field name="view_mode">tree,form,calendar,graph</field>97 <field name="view_mode">tree,form,calendar,graph</field>
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 -->
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>
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>
101 <field ref="account_board_supplier_invoice_draft_view" name="view_id"/>101 <field ref="account_board_supplier_invoice_draft_view" name="view_id"/>
102 <field name="limit">5</field>102 <field name="limit">5</field>
103 </record>103 </record>
@@ -108,8 +108,8 @@
108 <field name="view_type">form</field>108 <field name="view_type">form</field>
109 <field name="view_mode">tree,form,calendar,graph</field>109 <field name="view_mode">tree,form,calendar,graph</field>
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 -->
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>
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>
113 <field ref="account_board_supplier_invoice_draft_view" name="view_id"/>113 <field ref="account_board_supplier_invoice_draft_view" name="view_id"/>
114 <field name="limit">5</field>114 <field name="limit">5</field>
115 </record>115 </record>
116116
=== modified file 'bin/addons/msf_accrual/__openerp__.py'
--- bin/addons/msf_accrual/__openerp__.py 2017-10-09 21:06:10 +0000
+++ bin/addons/msf_accrual/__openerp__.py 2021-11-03 13:33:55 +0000
@@ -31,7 +31,6 @@
31 "update_xml": [31 "update_xml": [
32 'security/ir.model.access.csv',32 'security/ir.model.access.csv',
33 'msf_accrual_view.xml',33 'msf_accrual_view.xml',
34 'account_view.xml',
35 'wizard/wizard_accrual_view.xml',34 'wizard/wizard_accrual_view.xml',
36 'wizard/wizard_accrual_reversal_view.xml'35 'wizard/wizard_accrual_reversal_view.xml'
37 ],36 ],
3837
=== removed file 'bin/addons/msf_accrual/account_view.xml'
=== modified file 'bin/addons/msf_currency_revaluation/__openerp__.py'
--- bin/addons/msf_currency_revaluation/__openerp__.py 2019-11-04 10:48:48 +0000
+++ bin/addons/msf_currency_revaluation/__openerp__.py 2021-11-03 13:33:55 +0000
@@ -59,7 +59,6 @@
59 "account",59 "account",
60 ],60 ],
61 "init_xml": [61 "init_xml": [
62 "account_view.xml",
63 "wizard/wizard_currency_revaluation_view.xml"],62 "wizard/wizard_currency_revaluation_view.xml"],
64 "update_xml": [],63 "update_xml": [],
65 "demo_xml": [],64 "demo_xml": [],
6665
=== removed file 'bin/addons/msf_currency_revaluation/account_view.xml'
=== modified file 'bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py'
--- bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py 2019-10-30 16:33:21 +0000
+++ bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py 2021-11-03 13:33:55 +0000
@@ -373,105 +373,6 @@
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'), )})
374 return False374 return False
375375
376 def get_invoice_view(self, cr, uid, invoice_id, view_name, domain, context=None):
377 if view_name in ('view_intermission_form'):
378 module = 'account_override'
379 else:
380 module = 'account'
381 if view_name:
382 view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, module, view_name)
383 view_id = view_id and view_id[1] or False
384 tree_view = self.pool.get('ir.model.data').get_object_reference(cr,
385 uid, 'account', 'invoice_tree')
386 tree_view_id = tree_view and tree_view[1] or False
387 return {
388 'type': 'ir.actions.act_window',
389 'res_model': 'account.invoice',
390 'view_type': 'form',
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches