bzr revid: olt@tinyerp.com-20090227122625-yuyk0wv1xujvnwx0
This commit is contained in:
Olivier Laurent
2009-02-27 13:26:25 +01:00
10 changed files with 54 additions and 28 deletions
+7 -4
View File
@@ -178,6 +178,7 @@ class account_invoice(osv.osv):
move[line.move_id.id] = True
for line in r.line_id:
move[line.move_id.id] = True
invoice_ids = []
if move:
invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('move_id','in',move.keys())], context=context)
@@ -1127,14 +1128,14 @@ class account_invoice_tax(osv.osv):
if inv.type in ('out_invoice','in_invoice'):
val['base_code_id'] = tax['base_code_id']
val['tax_code_id'] = tax['tax_code_id']
val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['account_id'] = tax['account_collected_id'] or line.account_id.id
else:
val['base_code_id'] = tax['ref_base_code_id']
val['tax_code_id'] = tax['ref_tax_code_id']
val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['account_id'] = tax['account_paid_id'] or line.account_id.id
key = (val['tax_code_id'], val['base_code_id'], val['account_id'])
@@ -1148,6 +1149,8 @@ class account_invoice_tax(osv.osv):
for t in tax_grouped.values():
t['amount'] = cur_obj.round(cr, uid, cur, t['amount'])
t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount'])
t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
return tax_grouped
def move_line_get(self, cr, uid, invoice_id):
+6 -6
View File
@@ -11,8 +11,8 @@
<page string="Accounting">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchase Properties" colspan="2"/>
<field name="property_account_income" attrs="{'readonly':[('sale_ok','=',0)]}" />
<field name="property_account_expense" attrs="{'readonly':[('purchase_ok','=',0)]}" />
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
<separator string="Sale Taxes" colspan="2"/>
<separator string="Purchase Taxes" colspan="2"/>
@@ -33,8 +33,8 @@
<page string="Accounting">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchase Properties" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="supplier_taxes_id"/>
<field name="taxes_id"/>
</page>
@@ -53,8 +53,8 @@
<form position="inside">
<group col="2" colspan="2">
<separator string="Accounting Properties" colspan="2"/>
<field name="property_account_income_categ"/>
<field name="property_account_expense_categ"/>
<field name="property_account_income_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_account_expense_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</group>
</form>
</field>
+1 -1
View File
@@ -41,7 +41,7 @@ import tools
def random_name():
random.seed()
d = [random.choice(string.letters) for x in xrange(10) ]
d = [random.choice(string.ascii_letters) for x in xrange(10) ]
name = "".join(d)
return name
+4 -4
View File
@@ -4,15 +4,15 @@
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="40"/>
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet"/>
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
<menuitem id="next_id_48" name="Timesheet" parent="hr.menu_hr_reporting"/><menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"/>
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print my timesheet"/>
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
<menuitem action="wizard_hr_timesheet_my" id="menu_wizard_hr_timesheet_my" parent="hr_timesheet.next_id_48" type="wizard"/>
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees timesheet"/>
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet"/>
<menuitem action="wizard_hr_timesheet_users" id="menu_wizard_hr_timesheet_users" parent="hr_timesheet.next_id_48" type="wizard"/>
</data>
@@ -20,7 +20,7 @@
menu="False"
model="account.analytic.line"
name="account.analytic.profit"
string="Timesheet profit"
string="Timesheet Profit"
groups="account.group_account_manager"/>
<menuitem action="account_analytic_profit" id="print_account_analytic_profit" parent="hr.menu_hr_reporting" type="wizard"/>
@@ -22,6 +22,7 @@
import wizard
import datetime
import pooler
form='''<?xml version="1.0"?>
<form string="Choose">
@@ -34,8 +35,26 @@ form='''<?xml version="1.0"?>
class wizard_report(wizard.interface):
def _date_from(*a):
return datetime.datetime.today().strftime('%Y-%m-1')
def _date_to(*a):
return datetime.datetime.today().strftime('%Y-%m-%d')
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
line_obj = pool.get('account.analytic.line')
product_obj = pool.get('product.product')
price_obj = pool.get('product.pricelist')
ids = line_obj.search(cr, uid, [
('date', '>=', data['form']['date_from']),
('date', '<=', data['form']['date_to']),
('journal_id', 'in', data['form']['journal_ids'][0][2]),
('user_id', 'in', data['form']['employee_ids'][0][2]),
])
if not ids:
raise wizard.except_wizard(_('Data Insufficient!'), _('No Records Found for Report!'))
return data['form']
fields={
'date_from':{
@@ -70,7 +89,7 @@ class wizard_report(wizard.interface):
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel'), ('report', 'Print')]}
},
'report':{
'actions':[],
'actions':[_check],
'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'}
}
}
@@ -135,7 +135,7 @@ class invoice_create(wizard.interface):
" AND id IN (%s)"
" AND product_id=%%s"
" AND to_invoice=%%s" % ','.join(['%s']*len(data['ids'])),
(account.id, data['ids'], product_id, factor_id))
tuple([account.id]+ data['ids']+[ product_id, factor_id]))
line_ids = cr.dictfetchall()
note = []
for line in line_ids:
+2 -2
View File
@@ -399,8 +399,8 @@ class mrp_production(osv.osv):
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','<>','service')]),
'product_qty': fields.float('Product Qty', required=True),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_uos_qty': fields.float('Product Qty'),
'product_uos': fields.many2one('product.uom', 'Product UOM'),
'product_uos_qty': fields.float('Product UoS Qty'),
'product_uos': fields.many2one('product.uom', 'Product UoS'),
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=True,
help="Location where the system will look for products used in raw materials."),
+6 -6
View File
@@ -11,8 +11,8 @@
<form position="inside">
<group col="2" colspan="2">
<separator string="Accounting Stock Properties" colspan="2"/>
<field name="property_stock_account_input_categ"/>
<field name="property_stock_account_output_categ"/>
<field name="property_stock_account_input_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_output_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_journal"/>
</group>
</form>
@@ -34,8 +34,8 @@
<field name="property_stock_production"/>
<field name="property_stock_inventory"/>
<separator string="Accounting Entries" colspan="4"/>
<field name="property_stock_account_input"/>
<field name="property_stock_account_output"/>
<field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</page>
</page>
</field>
@@ -50,8 +50,8 @@
<field name="priority">26</field>
<field name="arch" type="xml">
<field name="property_account_expense" position="after">
<field name="property_stock_account_output"/>
<field name="property_stock_account_input"/>
<field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</field>
</field>
</record>
+6 -2
View File
@@ -395,6 +395,10 @@ class stock_picking(osv.osv):
res[pick]['max_date'] = dt2
return res
def create(self, cr, user, vals, context=None):
if 'name' not in vals:
vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'stock.picking')
return super(stock_picking, self).create(cr, user, vals, context)
_columns = {
'name': fields.char('Reference', size=64, select=True),
@@ -432,7 +436,7 @@ class stock_picking(osv.osv):
select=True, required=True, readonly=True, states={'draft':[('readonly',False)]}),
}
_defaults = {
'name': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'stock.picking'),
'name': lambda self,cr,uid,context: '/',
'active': lambda *a: 1,
'state': lambda *a: 'draft',
'move_type': lambda *a: 'direct',
@@ -673,7 +677,7 @@ class stock_picking(osv.osv):
else:
invoice_vals = {
'name': picking.name,
'origin': str(picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'type': type,
'account_id': account_id,
'partner_id': partner.id,