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

Proposed by jftempo
Status: Merged
Merged at revision: 6330
Proposed branch: lp:~mukunde/unifield-server/US-10105
Merge into: lp:unifield-server
Diff against target: 160 lines (+45/-2) (has conflicts)
6 files modified
bin/addons/account/account_invoice_view.xml (+1/-0)
bin/addons/account/invoice.py (+28/-2)
bin/addons/account_override/account_invoice_view.xml (+3/-0)
bin/addons/msf_profile/data/patches.xml (+7/-0)
bin/addons/msf_profile/msf_profile.py (+5/-0)
bin/addons/register_accounting/account_invoice_view.xml (+1/-0)
Text conflict in bin/addons/msf_profile/data/patches.xml
To merge this branch: bzr merge lp:~mukunde/unifield-server/US-10105
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+428377@code.launchpad.net
To post a comment you must log in.
lp:~mukunde/unifield-server/US-10105 updated
6279. By Gaël Mukunde

US-10105 [IMP] Fix Direct Invoice blocking pop up

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/account/account_invoice_view.xml'
2--- bin/addons/account/account_invoice_view.xml 2022-04-27 14:25:25 +0000
3+++ bin/addons/account/account_invoice_view.xml 2022-08-17 15:43:09 +0000
4@@ -164,6 +164,7 @@
5 <field name="residual" />
6 <field name="amount_total"/>
7 <field name="state"/>
8+ <field name="order_val" invisible="1"/>
9 <button name="invoice_open" states="draft,proforma2" type="object" string="Approve" icon="terp-camera_test"/>
10 </tree>
11 </field>
12
13=== modified file 'bin/addons/account/invoice.py'
14--- bin/addons/account/invoice.py 2022-07-12 16:11:39 +0000
15+++ bin/addons/account/invoice.py 2022-08-17 15:43:09 +0000
16@@ -30,6 +30,8 @@
17 from base import currency_date
18 from tools.safe_eval import safe_eval
19
20+from datetime import datetime
21+
22 class account_invoice(osv.osv):
23 def _amount_all(self, cr, uid, ids, name, args, context=None):
24 res = {}
25@@ -243,7 +245,7 @@
26
27 _name = "account.invoice"
28 _description = 'Invoice'
29- _order = "id desc"
30+ _order = 'order_val desc, date_invoice desc, number desc'
31
32 _columns = {
33 'name': fields.char('Description', size=256, select=True, readonly=True, states={'draft': [('readonly', False)]}),
34@@ -343,7 +345,8 @@
35 type='many2many', string='Payments', store=False),
36 'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
37 'user_id': fields.many2one('res.users', 'Salesman', readonly=True, states={'draft':[('readonly',False)]}),
38- 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]})
39+ 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}),
40+ 'order_val': fields.date("Custom sort field"), # US-10105
41 }
42 _defaults = {
43 'type': _get_type,
44@@ -456,6 +459,9 @@
45 def create(self, cr, uid, vals, context=None):
46 if context is None:
47 context = {}
48+ date_invoice = 'date_invoice' in vals and vals['date_invoice'] or datetime.today()
49+ if date_invoice:
50+ vals.update({'order_val': date_invoice, }) # US-10105 At creation of draft invoice
51 try:
52 res = super(account_invoice, self).create(cr, uid, vals, context)
53 for inv_id, name in self.name_get(cr, uid, [res], context=context):
54@@ -480,6 +486,26 @@
55 else:
56 raise orm.except_orm(_('Unknown Error'), str(e))
57
58+ def write(self, cr, uid, ids, vals, context=None):
59+ """
60+ Check document_date
61+ """
62+ if not ids:
63+ return True
64+ if context is None:
65+ context = {}
66+ if isinstance(ids, (int, long)):
67+ ids = [ids]
68+ current_values = self.read(cr, uid, ids, ['date_invoice'], context=context)[0]
69+ date_invoice = 'date_invoice' in vals and vals['date_invoice'] or current_values['date_invoice']
70+ if date_invoice:
71+ if 'state' in vals and vals['state'] == 'draft':
72+ vals.update({'order_val': date_invoice }) # US-10105 At creation of draft invoice
73+ elif 'state' in vals and vals['state'] != 'draft':
74+ vals.update({'order_val': '1901-01-01'})
75+ res = super(account_invoice, self).write(cr, uid, ids, vals, context=context)
76+ return res
77+
78 def confirm_paid(self, cr, uid, ids, context=None):
79 if context is None:
80 context = {}
81
82=== modified file 'bin/addons/account_override/account_invoice_view.xml'
83--- bin/addons/account_override/account_invoice_view.xml 2022-03-18 10:34:15 +0000
84+++ bin/addons/account_override/account_invoice_view.xml 2022-08-17 15:43:09 +0000
85@@ -52,6 +52,7 @@
86 <field name="residual"/>
87 <field name="amount_total"/>
88 <field name="state"/>
89+ <field name="order_val" invisible="1"/>
90 </tree>
91 </field>
92 </record>
93@@ -151,6 +152,7 @@
94 <field name="currency_id"/>
95 <field name="amount_total"/>
96 <field name="state"/>
97+ <field name="order_val" invisible="1"/>
98 </tree>
99 </field>
100 </record>
101@@ -314,6 +316,7 @@
102 <field name="currency_id"/>
103 <field name="amount_total"/>
104 <field name="state"/>
105+ <field name="order_val" invisible="1"/>
106 </tree>
107 </field>
108 </record>
109
110=== modified file 'bin/addons/msf_profile/data/patches.xml'
111--- bin/addons/msf_profile/data/patches.xml 2022-08-05 15:36:47 +0000
112+++ bin/addons/msf_profile/data/patches.xml 2022-08-17 15:43:09 +0000
113@@ -803,6 +803,7 @@
114 <record id="fix_us_10163_ocbhq_funct_amount" model="patch.scripts">
115 <field name="method">fix_us_10163_ocbhq_funct_amount</field>
116 </record>
117+<<<<<<< TREE
118
119 <record id="us_8428_pi_type_migration" model="patch.scripts">
120 <field name="method">us_8428_pi_type_migration</field>
121@@ -811,5 +812,11 @@
122 <record id="us_9229_fix_rt" model="patch.scripts">
123 <field name="method">us_9229_fix_rt</field>
124 </record>
125+=======
126+
127+ <record id="us_10105_custom_order" model="patch.scripts">
128+ <field name="method">us_10105_custom_order</field>
129+ </record>
130+>>>>>>> MERGE-SOURCE
131 </data>
132 </openerp>
133
134=== modified file 'bin/addons/msf_profile/msf_profile.py'
135--- bin/addons/msf_profile/msf_profile.py 2022-08-05 15:36:47 +0000
136+++ bin/addons/msf_profile/msf_profile.py 2022-08-17 15:43:09 +0000
137@@ -56,6 +56,11 @@
138 'model': lambda *a: 'patch.scripts',
139 }
140
141+ def us_10105_custom_order(self, cr, uid, *a, **b):
142+ cr.execute("update account_invoice set order_val='1901-01-01' where state != 'draft'")
143+ cr.execute("update account_invoice set order_val=date_invoice where state = 'draft'")
144+ return True
145+
146 # UF26.0
147 def fix_us_10163_ocbhq_funct_amount(self, cr, uid, *a, **b):
148 ''' OCBHQ: fix amounts on EOY-2021-14020-OCBVE101-VES'''
149
150=== modified file 'bin/addons/register_accounting/account_invoice_view.xml'
151--- bin/addons/register_accounting/account_invoice_view.xml 2022-02-04 17:27:59 +0000
152+++ bin/addons/register_accounting/account_invoice_view.xml 2022-08-17 15:43:09 +0000
153@@ -258,6 +258,7 @@
154 <field name="amount_untaxed" sum="Untaxed Amount" invisible="1"/>
155 <field name="amount_total" sum="Total Amount"/>
156 <field name="state"/>
157+ <field name="order_val" invisible="1"/>
158 </tree>
159 </field>
160 </record>

Subscribers

People subscribed via source and target branches