[IMP]:code cleaning
bzr revid: pap@tinyerp.co.in-20100706145803-tf7v1pukh03sdals
This commit is contained in:
parent
2c604372f7
commit
fffc508eb9
|
@ -200,7 +200,7 @@ class account_analytic_account(osv.osv):
|
||||||
res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2)
|
res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context = None):
|
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||||
if parent_ids:
|
if parent_ids:
|
||||||
|
@ -384,6 +384,7 @@ class account_analytic_account(osv.osv):
|
||||||
'month_ids': fields.function(_month, method=True, type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
|
'month_ids': fields.function(_month, method=True, type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
|
||||||
'user_ids': fields.function(_user, method=True, type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
|
'user_ids': fields.function(_user, method=True, type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_analytic_account()
|
account_analytic_account()
|
||||||
|
|
||||||
class account_analytic_account_summary_user(osv.osv):
|
class account_analytic_account_summary_user(osv.osv):
|
||||||
|
@ -507,11 +508,11 @@ class account_analytic_account_summary_user(osv.osv):
|
||||||
res.extend(cr.dictfetchall())
|
res.extend(cr.dictfetchall())
|
||||||
else:
|
else:
|
||||||
res = map(lambda x: {'id': x}, ids)
|
res = map(lambda x: {'id': x}, ids)
|
||||||
|
res_trans_obj = self.pool.get('ir.translation')
|
||||||
for f in fields_pre:
|
for f in fields_pre:
|
||||||
if self._columns[f].translate:
|
if self._columns[f].translate:
|
||||||
ids = map(lambda x: x['id'], res)
|
ids = map(lambda x: x['id'], res)
|
||||||
res_trans = self.pool.get('ir.translation')._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
res_trans = res_trans_obj._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||||
for r in res:
|
for r in res:
|
||||||
r[f] = res_trans.get(r['id'], False) or r[f]
|
r[f] = res_trans.get(r['id'], False) or r[f]
|
||||||
|
|
||||||
|
@ -683,11 +684,12 @@ class account_analytic_account_summary_month(osv.osv):
|
||||||
res.extend(cr.dictfetchall())
|
res.extend(cr.dictfetchall())
|
||||||
else:
|
else:
|
||||||
res = map(lambda x: {'id': x}, ids)
|
res = map(lambda x: {'id': x}, ids)
|
||||||
|
|
||||||
|
res_trans_obj = self.pool.get('ir.translation')
|
||||||
for f in fields_pre:
|
for f in fields_pre:
|
||||||
if self._columns[f].translate:
|
if self._columns[f].translate:
|
||||||
ids = map(lambda x: x['id'], res)
|
ids = map(lambda x: x['id'], res)
|
||||||
res_trans = self.pool.get('ir.translation')._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
res_trans = res_trans_obj._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||||
for r in res:
|
for r in res:
|
||||||
r[f] = res_trans.get(r['id'], False) or r[f]
|
r[f] = res_trans.get(r['id'], False) or r[f]
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ Allows to automatically select analytic accounts based on criterions:
|
||||||
""",
|
""",
|
||||||
'author' : 'Tiny',
|
'author' : 'Tiny',
|
||||||
'website' : 'http://www.openerp.com',
|
'website' : 'http://www.openerp.com',
|
||||||
'depends' : ['account', 'sale'],
|
'depends' : ['sale'],
|
||||||
'init_xml' : [],
|
'init_xml' : [],
|
||||||
'update_xml': ['security/ir.model.access.csv', 'account_analytic_default_view.xml'],
|
'update_xml': ['security/ir.model.access.csv', 'account_analytic_default_view.xml'],
|
||||||
'demo_xml' : [],
|
'demo_xml' : [],
|
||||||
|
|
|
@ -38,6 +38,7 @@ class account_analytic_default(osv.osv):
|
||||||
'date_start': fields.date('Start Date'),
|
'date_start': fields.date('Start Date'),
|
||||||
'date_stop': fields.date('End Date'),
|
'date_stop': fields.date('End Date'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):
|
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):
|
||||||
domain = []
|
domain = []
|
||||||
if product_id:
|
if product_id:
|
||||||
|
@ -65,6 +66,7 @@ class account_analytic_default(osv.osv):
|
||||||
res = rec
|
res = rec
|
||||||
best_index = index
|
best_index = index
|
||||||
return res
|
return res
|
||||||
|
|
||||||
account_analytic_default()
|
account_analytic_default()
|
||||||
|
|
||||||
class account_invoice_line(osv.osv):
|
class account_invoice_line(osv.osv):
|
||||||
|
@ -79,6 +81,7 @@ class account_invoice_line(osv.osv):
|
||||||
else:
|
else:
|
||||||
res_prod['value'].update({'account_analytic_id':False})
|
res_prod['value'].update({'account_analytic_id':False})
|
||||||
return res_prod
|
return res_prod
|
||||||
|
|
||||||
account_invoice_line()
|
account_invoice_line()
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,14 +108,14 @@ class sale_order_line(osv.osv):
|
||||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||||
if not ids:
|
if not ids:
|
||||||
return create_ids
|
return create_ids
|
||||||
sale_line_obj = self.browse(cr, uid, ids[0], context)
|
sale_line = self.browse(cr, uid, ids[0], context)
|
||||||
pool_inv_line = self.pool.get('account.invoice.line')
|
inv_line_obj = self.pool.get('account.invoice.line')
|
||||||
|
anal_def_obj = self.pool.get('account.analytic.default')
|
||||||
for line in pool_inv_line.browse(cr, uid, create_ids, context):
|
for line in inv_line_obj.browse(cr, uid, create_ids, context):
|
||||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||||
|
|
||||||
if rec:
|
if rec:
|
||||||
pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context)
|
inv_line_obj.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context)
|
||||||
return create_ids
|
return create_ids
|
||||||
|
|
||||||
sale_order_line()
|
sale_order_line()
|
||||||
|
|
|
@ -53,6 +53,7 @@ class account_analytic_plan(osv.osv):
|
||||||
'name': fields.char('Analytic Plan', size=64, required=True, select=True,),
|
'name': fields.char('Analytic Plan', size=64, required=True, select=True,),
|
||||||
'plan_ids': fields.one2many('account.analytic.plan.line','plan_id','Analytic Plans'),
|
'plan_ids': fields.one2many('account.analytic.plan.line','plan_id','Analytic Plans'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_analytic_plan()
|
account_analytic_plan()
|
||||||
|
|
||||||
class account_analytic_plan_line(osv.osv):
|
class account_analytic_plan_line(osv.osv):
|
||||||
|
@ -71,6 +72,7 @@ class account_analytic_plan_line(osv.osv):
|
||||||
'min_required': 100.0,
|
'min_required': 100.0,
|
||||||
'max_required': 100.0,
|
'max_required': 100.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
account_analytic_plan_line()
|
account_analytic_plan_line()
|
||||||
|
|
||||||
class account_analytic_plan_instance(osv.osv):
|
class account_analytic_plan_instance(osv.osv):
|
||||||
|
@ -187,16 +189,18 @@ class account_analytic_plan_instance(osv.osv):
|
||||||
pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)])
|
pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)])
|
||||||
if pids:
|
if pids:
|
||||||
raise osv.except_osv(_('Error'), _('A model having this name and code already exists !'))
|
raise osv.except_osv(_('Error'), _('A model having this name and code already exists !'))
|
||||||
|
|
||||||
res = self.pool.get('account.analytic.plan.line').search(cr, uid, [('plan_id','=',journal.plan_id.id)])
|
acct_anal_acct = self.pool.get('account.analytic.account')
|
||||||
|
acct_anal_plan_line_obj = self.pool.get('account.analytic.plan.line')
|
||||||
|
res = acct_anal_plan_line_obj.search(cr, uid, [('plan_id','=',journal.plan_id.id)])
|
||||||
for i in res:
|
for i in res:
|
||||||
total_per_plan = 0
|
total_per_plan = 0
|
||||||
item = self.pool.get('account.analytic.plan.line').browse(cr, uid, i)
|
item = acct_anal_plan_line_obj.browse(cr, uid, i)
|
||||||
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
||||||
for l in temp_list:
|
for l in temp_list:
|
||||||
if vals.has_key(l):
|
if vals.has_key(l):
|
||||||
for tempo in vals[l]:
|
for tempo in vals[l]:
|
||||||
if self.pool.get('account.analytic.account').search(cr, uid, [('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
if acct_anal_acct.search(cr, uid, [('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||||
total_per_plan += tempo[2]['rate']
|
total_per_plan += tempo[2]['rate']
|
||||||
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||||
raise osv.except_osv(_('Value Error') ,_('The Total Should be Between %s and %s') % (str(item.min_required), str(item.max_required)))
|
raise osv.except_osv(_('Value Error') ,_('The Total Should be Between %s and %s') % (str(item.min_required), str(item.max_required)))
|
||||||
|
@ -252,6 +256,7 @@ class account_journal(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'plan_id':fields.many2one('account.analytic.plan', 'Analytic Plans'),
|
'plan_id':fields.many2one('account.analytic.plan', 'Analytic Plans'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_journal()
|
account_journal()
|
||||||
|
|
||||||
class account_invoice_line(osv.osv):
|
class account_invoice_line(osv.osv):
|
||||||
|
@ -277,6 +282,7 @@ class account_invoice_line(osv.osv):
|
||||||
if rec and rec.analytics_id:
|
if rec and rec.analytics_id:
|
||||||
res_prod['value'].update({'analytics_id':rec.analytics_id.id})
|
res_prod['value'].update({'analytics_id':rec.analytics_id.id})
|
||||||
return res_prod
|
return res_prod
|
||||||
|
|
||||||
account_invoice_line()
|
account_invoice_line()
|
||||||
|
|
||||||
class account_move_line(osv.osv):
|
class account_move_line(osv.osv):
|
||||||
|
@ -345,6 +351,7 @@ class account_invoice(osv.osv):
|
||||||
sign = -1
|
sign = -1
|
||||||
|
|
||||||
iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id)
|
iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id)
|
||||||
|
acct_ins_obj = self.pool.get('account.analytic.plan.instance')
|
||||||
|
|
||||||
for il in iml:
|
for il in iml:
|
||||||
if il['analytics_id']:
|
if il['analytics_id']:
|
||||||
|
@ -353,14 +360,14 @@ class account_invoice(osv.osv):
|
||||||
ref = inv.reference
|
ref = inv.reference
|
||||||
else:
|
else:
|
||||||
ref = self._convert_ref(cr, uid, inv.number)
|
ref = self._convert_ref(cr, uid, inv.number)
|
||||||
obj_move_line=self.pool.get('account.analytic.plan.instance').browse(cr, uid, il['analytics_id'])
|
obj_move_line = acct_ins_obj.browse(cr, uid, il['analytics_id'])
|
||||||
amount_calc=cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
amount_calc = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
||||||
qty=il['quantity']
|
qty = il['quantity']
|
||||||
il['analytic_lines']=[]
|
il['analytic_lines']=[]
|
||||||
for line2 in obj_move_line.account_ids:
|
for line2 in obj_move_line.account_ids:
|
||||||
amt=amount_calc * (line2.rate/100)
|
amt = amount_calc * (line2.rate/100)
|
||||||
qtty=qty* (line2.rate/100)
|
qtty = qty* (line2.rate/100)
|
||||||
al_vals={
|
al_vals = {
|
||||||
'name': il['name'],
|
'name': il['name'],
|
||||||
'date': inv['date_invoice'],
|
'date': inv['date_invoice'],
|
||||||
'unit_amount':qtty,
|
'unit_amount':qtty,
|
||||||
|
@ -389,6 +396,7 @@ class analytic_default(osv.osv):
|
||||||
_columns = {
|
_columns = {
|
||||||
'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
||||||
}
|
}
|
||||||
|
|
||||||
analytic_default()
|
analytic_default()
|
||||||
|
|
||||||
class sale_order_line(osv.osv):
|
class sale_order_line(osv.osv):
|
||||||
|
@ -398,14 +406,15 @@ class sale_order_line(osv.osv):
|
||||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||||
if ids:
|
if ids:
|
||||||
sale_line_obj = self.browse(cr, uid, ids[0], context)
|
sale_line = self.browse(cr, uid, ids[0], context)
|
||||||
pool_inv_line = self.pool.get('account.invoice.line')
|
inv_line_obj = self.pool.get('account.invoice.line')
|
||||||
|
acct_anal_def_obj = self.pool.get('account.analytic.default')
|
||||||
for line in pool_inv_line.browse(cr, uid, create_ids, context):
|
|
||||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
for line in inv_line_obj.browse(cr, uid, create_ids, context):
|
||||||
|
rec = acct_anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||||
|
|
||||||
if rec:
|
if rec:
|
||||||
pool_inv_line.write(cr, uid, [line.id], {'analytics_id':rec.analytics_id.id}, context=context)
|
inv_line_obj.write(cr, uid, [line.id], {'analytics_id':rec.analytics_id.id}, context=context)
|
||||||
return create_ids
|
return create_ids
|
||||||
|
|
||||||
sale_order_line()
|
sale_order_line()
|
||||||
|
|
|
@ -22,4 +22,5 @@ import product
|
||||||
import stock
|
import stock
|
||||||
import purchase
|
import purchase
|
||||||
import invoice
|
import invoice
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -17,11 +17,12 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" : "Stock Accounting for Anglo Saxon countries",
|
"name" : "Stock Accounting for Anglo Saxon countries",
|
||||||
"version" : "1.2",
|
"version" : "1.2",
|
||||||
"author" : "Tiny, Veritos",
|
"author" : "Tiny, Veritos",
|
||||||
"website" : "http://tinyerp.com - http://veritos.nl",
|
"website" : "http://tinyerp.com - http://veritos.nl",
|
||||||
"description" : """This module will support the Anglo-Saxons accounting methodology by
|
"description" : """This module will support the Anglo-Saxons accounting methodology by
|
||||||
changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries
|
changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries
|
||||||
and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales.
|
and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales.
|
||||||
|
@ -29,12 +30,13 @@
|
||||||
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account
|
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account
|
||||||
when the invoice is created to transfer this amount to the debtor or creditor account.
|
when the invoice is created to transfer this amount to the debtor or creditor account.
|
||||||
Secondly, price differences between actual purchase price and fixed product standard price are booked on a seperate account""",
|
Secondly, price differences between actual purchase price and fixed product standard price are booked on a seperate account""",
|
||||||
"depends" : ["product", "account", "sale", "purchase", "stock"],
|
"depends" : ["product", "purchase"],
|
||||||
"category" : "Generic Modules/Inventory Control",
|
"category" : "Generic Modules/Inventory Control",
|
||||||
"init_xml" : [],
|
"init_xml" : [],
|
||||||
"demo_xml" : [],
|
"demo_xml" : [],
|
||||||
"update_xml" : ["product_view.xml",],
|
"update_xml" : ["product_view.xml",],
|
||||||
"active": False,
|
"active" : False,
|
||||||
"installable": True
|
"installable": True
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -5,13 +5,11 @@
|
||||||
<field name="name">product.normal.form.inherit.stock</field>
|
<field name="name">product.normal.form.inherit.stock</field>
|
||||||
<field name="model">product.product</field>
|
<field name="model">product.product</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
<field name="inherit_id" ref="account.product_normal_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
||||||
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||||
<newline/>
|
<newline/>
|
||||||
<!-- <field name="property_account_sending_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
|
||||||
<!-- <field name="property_account_received_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -20,13 +18,11 @@
|
||||||
<field name="name">product.template.product.form.inherit</field>
|
<field name="name">product.template.product.form.inherit</field>
|
||||||
<field name="model">product.template</field>
|
<field name="model">product.template</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
<field name="inherit_id" ref="account.product_template_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
||||||
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||||
<newline/>
|
<newline/>
|
||||||
<!-- <field name="property_account_sending_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
|
||||||
<!-- <field name="property_account_received_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -41,8 +37,6 @@
|
||||||
<group col="2" colspan="2">
|
<group col="2" colspan="2">
|
||||||
<separator string=" Accounting Property" colspan="2"/>
|
<separator string=" Accounting Property" colspan="2"/>
|
||||||
<field name="property_account_creditor_price_difference_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
<field name="property_account_creditor_price_difference_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||||
<!-- <field name="property_account_sending_goods_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
|
||||||
<!-- <field name="property_account_received_goods_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
# -*- encoding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
from osv import fields, osv
|
|
||||||
|
|
||||||
#class sale_order_line(osv.osv):
|
|
||||||
# _name = 'sale.order.line'
|
|
||||||
# _description = 'Sale Order line'
|
|
||||||
# _inherit = 'sale.order.line'
|
|
||||||
#
|
|
||||||
# def invoice_line_create(self, cr, uid, ids, context={}):
|
|
||||||
# line_ids = super('sale_order_line',self).invoice_line_create(cr, uid, ids, context)
|
|
||||||
# invoice_line_obj = self.pool.get('account.invoice.line')
|
|
||||||
# for line in invoice_line_obj.browse(cr, uid, line_ids):
|
|
||||||
# if line.product_id:
|
|
||||||
# a = line.product_id.product_tmpl_id.property_stock_account_output and line.product_id.product_tmpl_id.property_stock_account_output.id
|
|
||||||
# if not a:
|
|
||||||
# a = line.product_id.categ_id.property_stock_account_output_categ and line.product_id.categ_id.property_stock_account_output_categ.id
|
|
||||||
# if a:
|
|
||||||
# a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
|
|
||||||
# invoice_line_obj.write(cr, uid, line.id, {'account_id':a})
|
|
||||||
#
|
|
||||||
#sale_order_line()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
@ -22,5 +22,6 @@
|
||||||
import crossovered_budget
|
import crossovered_budget
|
||||||
import report
|
import report
|
||||||
import wizard
|
import wizard
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,9 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import osv,fields
|
from osv import osv,fields
|
||||||
import tools
|
|
||||||
import netsvc
|
|
||||||
from mx import DateTime
|
|
||||||
import time
|
|
||||||
import datetime
|
import datetime
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
|
|
||||||
|
|
||||||
def strToDate(dt):
|
def strToDate(dt):
|
||||||
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
|
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
|
||||||
return dt_date
|
return dt_date
|
||||||
|
@ -127,13 +122,6 @@ class crossovered_budget(osv.osv):
|
||||||
'creating_user_id': lambda self,cr,uid,context: uid,
|
'creating_user_id': lambda self,cr,uid,context: uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
# def action_set_to_draft(self, cr, uid, ids, *args):
|
|
||||||
# self.write(cr, uid, ids, {'state': 'draft'})
|
|
||||||
# wf_service = netsvc.LocalService('workflow')
|
|
||||||
# for id in ids:
|
|
||||||
# wf_service.trg_create(uid, self._name, id, cr)
|
|
||||||
# return True
|
|
||||||
|
|
||||||
def budget_confirm(self, cr, uid, ids, *args):
|
def budget_confirm(self, cr, uid, ids, *args):
|
||||||
self.write(cr, uid, ids, {
|
self.write(cr, uid, ids, {
|
||||||
'state':'confirm'
|
'state':'confirm'
|
||||||
|
|
|
@ -19,17 +19,16 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" : "Account Cancel",
|
"name" : "Account Cancel",
|
||||||
"version" : "1.1",
|
"version" : "1.1",
|
||||||
"depends" : ["account"],
|
|
||||||
"author" : "Tiny",
|
"author" : "Tiny",
|
||||||
"category": 'Generic Modules/Accounting',
|
"category": 'Generic Modules/Accounting',
|
||||||
"description": """
|
"description": """
|
||||||
Module Add Allow cancelling entries field on form view of account journal if it set to true it allows user to cancel entries & invoices.
|
Module adds 'Allow cancelling entries' field on form view of account journal. If set to true it allows user to cancel entries & invoices.
|
||||||
""",
|
""",
|
||||||
'website': 'http://www.openerp.com',
|
'website': 'http://www.openerp.com',
|
||||||
|
"depends" : ["account"],
|
||||||
'init_xml': [],
|
'init_xml': [],
|
||||||
'update_xml': ['account_cancel_view.xml' ],
|
'update_xml': ['account_cancel_view.xml' ],
|
||||||
'demo_xml': [],
|
'demo_xml': [],
|
||||||
|
@ -37,4 +36,5 @@
|
||||||
'active': False,
|
'active': False,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -21,5 +21,6 @@
|
||||||
|
|
||||||
import account_coda
|
import account_coda
|
||||||
import wizard
|
import wizard
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -20,23 +20,24 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
{
|
{
|
||||||
"name":"Account CODA - import bank statements from coda file",
|
"name" : "Account CODA - import bank statements from coda file",
|
||||||
"version":"1.0",
|
"version" : "1.0",
|
||||||
"author":"Tiny",
|
"author" : "Tiny",
|
||||||
"category":"Account CODA",
|
"category" : "Account CODA",
|
||||||
"description":"""
|
"description": """
|
||||||
Module provides functionality to import
|
Module provides functionality to import
|
||||||
bank statements from coda files.
|
bank statements from coda files.
|
||||||
""",
|
""",
|
||||||
"depends":["base", "account"],
|
"depends" : ["account"],
|
||||||
"demo_xml":["account_coda_demo.xml"],
|
"demo_xml" : [],
|
||||||
"init_xml":[],
|
"init_xml" : [],
|
||||||
"update_xml" : ["security/ir.model.access.csv",
|
"update_xml": ["security/ir.model.access.csv",
|
||||||
"wizard/account_coda_import.xml",
|
"wizard/account_coda_import.xml",
|
||||||
"account_coda_view.xml"],
|
"account_coda_view.xml"],
|
||||||
"active":False,
|
"active" : False,
|
||||||
"installable":True,
|
"installable" : True,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -26,25 +26,26 @@ class account_coda(osv.osv):
|
||||||
_name = "account.coda"
|
_name = "account.coda"
|
||||||
_description = "coda for an Account"
|
_description = "coda for an Account"
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.binary('Coda file', readonly=True ,help="Store the detail of bank statements"),
|
'name': fields.binary('Coda file', readonly=True, help="Store the detail of bank statements"),
|
||||||
'statement_ids': fields.one2many('account.bank.statement','coda_id','Generated Bank Statements', readonly=True),
|
'statement_ids': fields.one2many('account.bank.statement', 'coda_id', 'Generated Bank Statements', readonly=True),
|
||||||
'note': fields.text('Import log', readonly=True),
|
'note': fields.text('Import log', readonly=True),
|
||||||
'journal_id': fields.many2one('account.journal','Journal', readonly=True, select=True,help="Bank Journal"),
|
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True, select=True, help="Bank Journal"),
|
||||||
'date': fields.date('Date', readonly=True, select=True, help="Import Date"),
|
'date': fields.date('Date', readonly=True, select=True, help="Import Date"),
|
||||||
'user_id': fields.many2one('res.users','User', readonly=True, select=True),
|
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date': time.strftime('%Y-%m-%d'),
|
'date': time.strftime('%Y-%m-%d'),
|
||||||
'user_id': lambda self,cr,uid,context: uid,
|
'user_id': lambda self,cr,uid,context: uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
account_coda()
|
account_coda()
|
||||||
|
|
||||||
class account_bank_statement(osv.osv):
|
class account_bank_statement(osv.osv):
|
||||||
_inherit = "account.bank.statement"
|
_inherit = "account.bank.statement"
|
||||||
_columns = {
|
_columns = {
|
||||||
'coda_id':fields.many2one('account.coda','Coda'),
|
'coda_id':fields.many2one('account.coda', 'Coda'),
|
||||||
}
|
}
|
||||||
|
|
||||||
account_bank_statement()
|
account_bank_statement()
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from mx import DateTime
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from osv import fields
|
from osv import fields
|
||||||
|
@ -54,7 +53,8 @@ class account_coda_import(osv.osv_memory):
|
||||||
'coda': fields.binary('Coda File', required=True),
|
'coda': fields.binary('Coda File', required=True),
|
||||||
'note':fields.text('Log'),
|
'note':fields.text('Log'),
|
||||||
}
|
}
|
||||||
def coda_parsing(self, cr, uid, ids, context):
|
|
||||||
|
def coda_parsing(self, cr, uid, ids, context=None):
|
||||||
|
|
||||||
journal_obj=self.pool.get('account.journal')
|
journal_obj=self.pool.get('account.journal')
|
||||||
account_period_obj = self.pool.get('account.period')
|
account_period_obj = self.pool.get('account.period')
|
||||||
|
@ -65,10 +65,12 @@ class account_coda_import(osv.osv_memory):
|
||||||
statement_reconcile_obj = self.pool.get('account.bank.statement.reconcile')
|
statement_reconcile_obj = self.pool.get('account.bank.statement.reconcile')
|
||||||
account_coda_obj = self.pool.get('account.coda')
|
account_coda_obj = self.pool.get('account.coda')
|
||||||
mod_obj = self.pool.get('ir.model.data')
|
mod_obj = self.pool.get('ir.model.data')
|
||||||
|
|
||||||
|
if not context:
|
||||||
|
context = {}
|
||||||
|
|
||||||
data = self.read(cr, uid, ids)[0]
|
data = self.read(cr, uid, ids)[0]
|
||||||
|
|
||||||
|
|
||||||
codafile = data['coda']
|
codafile = data['coda']
|
||||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code
|
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code
|
||||||
|
|
||||||
|
@ -265,6 +267,7 @@ class account_coda_import(osv.osv_memory):
|
||||||
context.update({ 'statment_ids':bkst_list})
|
context.update({ 'statment_ids':bkst_list})
|
||||||
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'account_coda_note_view')], context=context)
|
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'account_coda_note_view')], context=context)
|
||||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'name': _('Result'),
|
'name': _('Result'),
|
||||||
'res_id': ids[0],
|
'res_id': ids[0],
|
||||||
|
@ -277,7 +280,10 @@ class account_coda_import(osv.osv_memory):
|
||||||
'context': context,
|
'context': context,
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
}
|
}
|
||||||
def action_open_window(self, cr, uid, data, context):
|
|
||||||
|
def action_open_window(self, cr, uid, data, context=None):
|
||||||
|
if not context:
|
||||||
|
cotext = {}
|
||||||
return {
|
return {
|
||||||
'domain':"[('id','in',%s)]"%(context.get('statment_ids', False)),
|
'domain':"[('id','in',%s)]"%(context.get('statment_ids', False)),
|
||||||
'name': 'Statement',
|
'name': 'Statement',
|
||||||
|
@ -287,6 +293,7 @@ class account_coda_import(osv.osv_memory):
|
||||||
'view_id': False,
|
'view_id': False,
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
}
|
}
|
||||||
|
|
||||||
account_coda_import()
|
account_coda_import()
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -40,4 +40,5 @@ This module implement the modification on the invoice form.
|
||||||
'active': False,
|
'active': False,
|
||||||
'certificate': '0070514190381',
|
'certificate': '0070514190381',
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from osv import fields, osv
|
from osv import fields, osv
|
||||||
import decimal_precision as dp
|
|
||||||
|
|
||||||
class account_invoice(osv.osv):
|
class account_invoice(osv.osv):
|
||||||
_inherit = "account.invoice"
|
_inherit = "account.invoice"
|
||||||
|
@ -117,7 +116,7 @@ class account_invoice_line(osv.osv):
|
||||||
return super(account_invoice_line, self)._price_unit_default(cr, uid, context)
|
return super(account_invoice_line, self)._price_unit_default(cr, uid, context)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def _get_invoice(self, cr, uid, ids, context):
|
def _get_invoice(self, cr, uid, ids, context=None):
|
||||||
result = {}
|
result = {}
|
||||||
for inv in self.pool.get('account.invoice').browse(cr, uid, ids, context=context):
|
for inv in self.pool.get('account.invoice').browse(cr, uid, ids, context=context):
|
||||||
for line in inv.invoice_line:
|
for line in inv.invoice_line:
|
||||||
|
@ -126,9 +125,9 @@ class account_invoice_line(osv.osv):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
||||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
store={'account.invoice':(_get_invoice,['price_type'], 10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||||
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
|
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
|
||||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
store={'account.invoice':(_get_invoice,['price_type'], 10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -31,15 +31,10 @@
|
||||||
""",
|
""",
|
||||||
"category" : "Generic Modules/Accounting",
|
"category" : "Generic Modules/Accounting",
|
||||||
"website" : "http://tinyerp.com",
|
"website" : "http://tinyerp.com",
|
||||||
"depends" : [
|
"depends" : ["account"],
|
||||||
"base",
|
"init_xml" : [],
|
||||||
"account"
|
|
||||||
],
|
|
||||||
"init_xml" : [
|
|
||||||
],
|
|
||||||
|
|
||||||
"demo_xml" : [
|
"demo_xml" : [],
|
||||||
],
|
|
||||||
|
|
||||||
"update_xml" : [
|
"update_xml" : [
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
|
|
Loading…
Reference in New Issue