Nimesh Contractor(Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-addons21_account-nco into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons21_account-nco/+merge/137840
Hello,
When create a new cash register, it set default values in
opening_details_ids.
Set overall total at the bottom.
After click on "Open Cash-box", it filled total in Opening Cash Control
field.
Thanks,
NCO.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons21_account-nco/+merge/137840
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-addons21_account-nco.
=== modified file 'account/account_bank_statement.py'
--- account/account_bank_statement.py 2012-11-29 22:26:45 +0000
+++ account/account_bank_statement.py 2012-12-04 13:30:36 +0000
@@ -398,7 +398,6 @@
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
continue
- self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error!'),
@@ -430,6 +429,7 @@
'name': st_number,
'balance_end_real': st.balance_end
}, context=context)
+ self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st_number,), context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
=== modified file 'account/account_cash_statement.py'
--- account/account_cash_statement.py 2012-11-29 22:26:45 +0000
+++ account/account_cash_statement.py 2012-12-04 13:30:36 +0000
@@ -26,6 +26,8 @@
from tools.translate import _
import decimal_precision as dp
+coins = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500]
+
class account_cashbox_line(osv.osv):
""" Cash Box Details """
@@ -33,7 +35,7 @@
_name = 'account.cashbox.line'
_description = 'CashBox Line'
_rec_name = 'pieces'
-
+
def _sub_total(self, cr, uid, ids, name, arg, context=None):
""" Calculates Sub total
@@ -167,7 +169,27 @@
result.setdefault('value', {}).update({'last_closing_balance' : st.balance_end_real})
return result
-
+ def _total(self, cr, uid, ids, name, arg, context=None):
+ """ Calculates total
+ @param name: Names of fields.
+ @return: Dictionary of values.
+ """
+ res = {}
+ for statement in self.browse(cr, uid, ids, context=context):
+ start = 0
+ for line in statement.details_ids:
+ start += line.subtotal_opening
+ res[statement.id] = start
+ return res
+ def _get_open_box_lines(self, cr, uid, context=None):
+ res = []
+ for rs in coins:
+ dct = {
+ 'pieces': rs,
+ 'number': 0
+ }
+ res.append(dct)
+ return res
_columns = {
'total_entry_encoding': fields.function(_get_sum_entry_encoding, string="Total Transactions",
store = {
@@ -181,11 +203,13 @@
'user_id': fields.many2one('res.users', 'Responsible', required=False),
'difference' : fields.function(_compute_difference, method=True, string="Difference", type="float"),
'last_closing_balance' : fields.function(_compute_last_closing_balance, method=True, string='Last Closing Balance', type='float'),
+ 'total': fields.function(_total, string='Opening total', type='float', digits_compute=dp.get_precision('Account')),
}
_defaults = {
'state': 'draft',
'date': lambda self, cr, uid, context={}: context.get('date', time.strftime("%Y-%m-%d %H:%M:%S")),
'user_id': lambda self, cr, uid, context=None: uid,
+ 'opening_details_ids': _get_open_box_lines,
}
def create(self, cr, uid, vals, context=None):
@@ -267,6 +291,7 @@
vals.update({
'state': 'open',
+ 'balance_start': statement.total
})
self.write(cr, uid, [statement.id], vals, context=context)
return True
@@ -324,7 +349,7 @@
def _default_cashbox_line_ids(self, cr, uid, context=None):
# Return a list of coins in Euros.
result = [
- dict(pieces=value) for value in [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500]
+ dict(pieces=value) for value in coins
]
return result
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2012-12-04 10:31:46 +0000
+++ account/account_view.xml 2012-12-04 13:30:36 +0000
@@ -2329,6 +2329,9 @@
</tree>
</field>
</group>
+ <group class="oe_subtotal_footer oe_right">
+ <field name="total" widget="monetary" string="Total Amount" options="{'currency_field': 'currency_id'}"/>
+ </group>
</page>
<page string="Journal Entries" attrs="{'invisible': [('state','!=','confirm')]}">
<field name="move_line_ids" string="Journal Entries"/>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp