Merge lp:~mukunde/unifield-server/US-9357 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6306
Proposed branch: lp:~mukunde/unifield-server/US-9357
Merge into: lp:unifield-server
Diff against target: 77 lines (+32/-3)
2 files modified
bin/addons/account_override/account_invoice_view.xml (+3/-3)
bin/addons/account_override/invoice.py (+29/-0)
To merge this branch: bzr merge lp:~mukunde/unifield-server/US-9357
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+426206@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_override/account_invoice_view.xml'
--- bin/addons/account_override/account_invoice_view.xml 2022-03-18 10:34:15 +0000
+++ bin/addons/account_override/account_invoice_view.xml 2022-07-04 14:56:21 +0000
@@ -164,7 +164,7 @@
164 <field name="arch" type="xml">164 <field name="arch" type="xml">
165 <form string="In-kind Donation" noteditable="state=='cancel'">165 <form string="In-kind Donation" noteditable="state=='cancel'">
166 <group colspan="4" col="8">166 <group colspan="4" col="8">
167 <field name="journal_id" domain="[('inv_doc_type', '=', True), ('is_active', '=', True)]"/>167 <field name="journal_id" domain="[('inv_doc_type', '=', True), ('is_active', '=', True), ('code', '=', 'IKD')]"/>
168 <field name="number"/>168 <field name="number"/>
169 <field name="type" invisible="1"/>169 <field name="type" invisible="1"/>
170 <field name="is_inkind_donation" invisible="1"/>170 <field name="is_inkind_donation" invisible="1"/>
@@ -618,7 +618,7 @@
618 </group>618 </group>
619 <newline/>619 <newline/>
620 <group col="8" colspan="4">620 <group col="8" colspan="4">
621 <field name="journal_id" select='1' context="{'search_default_filter_is_active': 1}"/>621 <field name="fiscalyear_id" select='1'/>
622 <field name="period_id" select='1' string="Period" domain="[('state', 'not in', ['done', 'created'])]"/>622 <field name="period_id" select='1' string="Period" domain="[('state', 'not in', ['done', 'created'])]"/>
623 <field name="name"/>623 <field name="name"/>
624 <field name="amount_total"/>624 <field name="amount_total"/>
@@ -646,7 +646,7 @@
646 <field name="view_mode">tree,form,calendar,graph</field>646 <field name="view_mode">tree,form,calendar,graph</field>
647 <field eval="False" name="view_id"/>647 <field eval="False" name="view_id"/>
648 <field name="domain">[('doc_type', '=', 'donation')]</field>648 <field name="domain">[('doc_type', '=', 'donation')]</field>
649 <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>649 <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': 0}</field>
650 <field name="search_view_id" ref="view_account_invoice_filter_donation"/>650 <field name="search_view_id" ref="view_account_invoice_filter_donation"/>
651 </record>651 </record>
652652
653653
=== modified file 'bin/addons/account_override/invoice.py'
--- bin/addons/account_override/invoice.py 2022-06-01 07:23:33 +0000
+++ bin/addons/account_override/invoice.py 2022-07-04 14:56:21 +0000
@@ -395,6 +395,34 @@
395 dom = ['|', ('state', '=', 'draft'), '&', ('state', '=', 'cancel'), ('date_invoice', '=', False)]395 dom = ['|', ('state', '=', 'draft'), '&', ('state', '=', 'cancel'), ('date_invoice', '=', False)]
396 return dom396 return dom
397397
398 def _get_fiscalyear(self, cr, uid, ids, field_name=None, arg=None, context=None):
399 if context is None:
400 context = {}
401 if isinstance(ids, (int, long)):
402 ids = [ids]
403 res = {}
404 fy_obj = self.pool.get('account.fiscalyear')
405 for inv in self.browse(cr, uid, ids, fields_to_fetch=['date_invoice'], context=context):
406 fy_id = fy_obj.search(cr, uid, [('date_start', '<=', inv.date_invoice), ('date_stop', '>=', inv.date_invoice)], context=context)[0]
407 if fy_id:
408 res[inv.id] = fy_id
409 return res
410
411 def _get_search_by_fiscalyear(self, cr, uid, obj=None, name=None, args=None, context=None):
412 if not args:
413 return []
414 if not args[0] or len(args[0]) < 3 or args[0][1] != '=':
415 raise osv.except_osv(_('Error'), _('Filter not implemented yet.'))
416 if context is None:
417 context = {}
418 fy_obj = self.pool.get('account.fiscalyear')
419 dom = []
420 if args[0][1] == '=' and args[0][2]:
421 fy_id = args[0][2]
422 fy = fy_obj.browse(cr, uid, fy_id, fields_to_fetch=['date_start', 'date_stop'], context=context)
423 dom = [('date_invoice', '>=', fy.date_start), ('date_invoice', '<=', fy.date_stop)]
424 return dom
425
398 _columns = {426 _columns = {
399 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade',427 'sequence_id': fields.many2one('ir.sequence', string='Lines Sequence', ondelete='cascade',
400 help="This field contains the information related to the numbering of the lines of this order."),428 help="This field contains the information related to the numbering of the lines of this order."),
@@ -436,6 +464,7 @@
436 string='Document Type', store=False, fnct_search=_search_doc_type),464 string='Document Type', store=False, fnct_search=_search_doc_type),
437 'open_fy': fields.function(_get_fake, method=True, type='boolean', string='Open Fiscal Year', store=False,465 'open_fy': fields.function(_get_fake, method=True, type='boolean', string='Open Fiscal Year', store=False,
438 fnct_search=_search_open_fy),466 fnct_search=_search_open_fy),
467 'fiscalyear_id': fields.function(_get_fiscalyear, fnct_search=_get_search_by_fiscalyear, type='many2one', obj='account.fiscalyear', method=True, store=False, string='Fiscal year', readonly=True),
439 }468 }
440469
441 _defaults = {470 _defaults = {

Subscribers

People subscribed via source and target branches