diff options
| author | Jigar Amin <jam@tinyerp.com> | 2010-10-13 10:18:24 +0530 |
|---|---|---|
| committer | Jigar Amin <jam@tinyerp.com> | 2010-10-13 10:18:24 +0530 |
| commit | f8a7a9cdb1cb1390d5cbeff5b062c7a15fc3c778 (patch) | |
| tree | db9280b5da76a539df600917508bdb47d8752ac8 | |
| parent | ae2056a2c87c3da7f78d2393d44c3248aa503e04 (diff) | |
| parent | e2467286958d97b07feefc4fb1267f930271d852 (diff) | |
[MERGE]
bzr revid: jam@tinyerp.com-20101013044824-e7j8xdylxnxvepuw
215 files changed, 1637 insertions, 2095 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index b0271a4fee1..bf5e25a6f69 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -278,7 +278,7 @@ class account_account(osv.osv): # ON l.account_id = tmp.id # or make _get_children_and_consol return a query and join on that request = ("SELECT l.account_id as id, " +\ - ' , '.join(map(mapping.__getitem__, field_names)) + + ', '.join(map(mapping.__getitem__, field_names)) + " FROM account_move_line l" \ " WHERE l.account_id IN %s " \ + filters + @@ -838,7 +838,7 @@ class account_period(osv.osv): 'date_start': fields.date('Start of Period', required=True, states={'done':[('readonly',True)]}), 'date_stop': fields.date('End of Period', required=True, states={'done':[('readonly',True)]}), 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True), - 'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True, + 'state': fields.selection([('draft','Open'), ('done','Closed')], 'State', readonly=True, help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'), 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } @@ -1538,7 +1538,7 @@ class account_tax_code(osv.osv): if context is None: context = {} move_state = ('posted', ) - if context.get('state', False) == 'all': + if context.get('state', 'all') == 'all': move_state = ('draft', 'posted', ) if context.get('fiscalyear_id', False): fiscalyear_id = context['fiscalyear_id'] diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index e579f76f0ed..a982ca51182 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -31,12 +31,12 @@ class account_analytic_line(osv.osv): _inherit = 'account.analytic.line' _description = 'Analytic Line' _columns = { - 'product_uom_id' : fields.many2one('product.uom', 'UoM'), - 'product_id' : fields.many2one('product.product', 'Product'), - 'general_account_id' : fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'), - 'move_id' : fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True), - 'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True), - 'code' : fields.char('Code', size=8), + 'product_uom_id': fields.many2one('product.uom', 'UoM'), + 'product_id': fields.many2one('product.product', 'Product'), + 'general_account_id': fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'), + 'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True), + 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True), + 'code': fields.char('Code', size=8), 'ref': fields.char('Ref.', size=64), 'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account currency', store=True, help="The related account currency if not equal to the company one.", readonly=True), 'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True), @@ -88,7 +88,7 @@ class account_analytic_line(osv.osv): company_id = j_id.company_id.id result = 0.0 is_purchase = False - + if j_id.type <> 'sale': a = prod.product_tmpl_id.property_account_expense.id if not a: diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a7b6b66d2c1..0b240663943 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -21,9 +21,7 @@ import time -import netsvc from osv import fields, osv -from tools.misc import currency from tools.translate import _ import decimal_precision as dp diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 86690b204b9..6431454b715 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -151,15 +151,14 @@ class account_cash_statement(osv.osv): res[r] = round(res[r], 2) return res - def _get_company(self, cr, uid, context={}): + def _get_company(self, cr, uid, context=None): user_pool = self.pool.get('res.users') company_pool = self.pool.get('res.company') - user = user_pool.browse(cr, uid, uid, context) - company_id = user.company_id and user.company_id.id + user = user_pool.browse(cr, uid, uid, context=context) + company_id = user.company_id if not company_id: - company_id = company_pool.search(cr, uid, [])[0] - - return company_id + company_id = company_pool.search(cr, uid, []) + return company_id and company_id[0] or False def _get_cash_open_box_lines(self, cr, uid, context={}): res = [] @@ -229,7 +228,7 @@ class account_cash_statement(osv.osv): 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'), - 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then / , its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), + 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), 'user_id':fields.many2one('res.users', 'Responsible', required=False), } _defaults = { diff --git a/addons/account/account_end_fy.xml b/addons/account/account_end_fy.xml index a33544ffacc..76d40bc89dc 100644 --- a/addons/account/account_end_fy.xml +++ b/addons/account/account_end_fy.xml @@ -6,8 +6,8 @@ <field name="name">Close a Period</field> <field name="res_model">account.period</field> <field name="view_type">form</field> - <field name="domain">[('state','=','draft')]</field> <field name="view_id" ref="view_account_period_tree"/> + <field name="context">{'search_default_draft': 1}</field> <field name="help"> After closing a period, you will no longer be able to post entries to the period once it has been closed.</field> </record> <menuitem diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index 2b736a514c3..495b4f4e5ba 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -45,7 +45,7 @@ <field name="account_type"/> <field name="currency_id" widget="selection" groups="base.group_extended"/> </form> - <tree editable="bottom" string=""> + <tree editable="bottom" string="Your bank and cash accounts"> <field name="acc_name"/> <field name="account_type"/> <field name="currency_id" widget="selection" groups="base.group_extended"/> diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index e72bd584f9d..0825aad8831 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -209,8 +209,8 @@ <field name="state"/> <field name="residual"/> <group col="6" colspan="4"> - <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/> <button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/> + <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/> <button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/> <button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/> <button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/> diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index ba6f4110ec1..d9b78795998 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -349,7 +349,7 @@ class account_move_line(osv.osv): return res def name_get(self, cr, uid, ids, context={}): - if not len(ids): + if not ids: return [] result = [] for line in self.browse(cr, uid, ids, context): @@ -363,18 +363,18 @@ class account_move_line(osv.osv): if context is None: context = {} - if not len(args): + if not args: return [] where = ' and '.join(map(lambda x: '(abs(sum(debit-credit))'+x[1]+str(x[2])+')',args)) cursor.execute('select id, sum(debit-credit) from account_move_line \ group by id, debit, credit having '+where) res = cursor.fetchall() - if not len(res): + if not res: return [('id', '=', '0')] return [('id', 'in', [x[0] for x in res])] def _invoice_search(self, cursor, user, obj, name, args, context): - if not len(args): + if not args: return [] invoice_obj = self.pool.get('account.invoice') @@ -407,7 +407,7 @@ class account_move_line(osv.osv): qu2 += x[2] else: qu1.append(' (False)') - if len(qu1): + if qu1: qu1 = ' AND' + ' AND'.join(qu1) else: qu1 = '' @@ -415,7 +415,7 @@ class account_move_line(osv.osv): 'FROM account_move_line l, account_invoice i ' \ 'WHERE l.move_id = i.move_id ' + qu1, qu2) res = cursor.fetchall() - if not len(res): + if not res: return [('id', '=', '0')] return [('id', 'in', [x[0] for x in res])] @@ -989,7 +989,7 @@ class account_move_line(osv.osv): part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs] unlink_ids += rec_ids unlink_ids += part_rec_ids - if len(unlink_ids): + if unlink_ids: obj_move_rec.unlink(cr, uid, unlink_ids) return True diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index ba1bd98fc04..d4e51b7e194 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -129,7 +129,7 @@ <field name="arch" type="xml"> <search string="Search Period"> <group> - <filter string="Draft" name="draft" domain="[('state','=','draft')]" icon="terp-document-new"/> + <filter string="To Close" name="draft" domain="[('state','=','draft')]" icon="terp-document-new"/> <separator orientation="vertical"/> <field name="name"/> <field name="code"/> @@ -482,8 +482,8 @@ <field name="balance_end_real"/> <field name="balance_end" invisible="1"/> <field name="state"/> - <button type="object" string="Confirm" name="button_confirm_bank" states="draft" icon="terp-camera_test"/> <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="gtk-cancel"/> + <button type="object" string="Confirm" name="button_confirm_bank" states="draft" icon="terp-camera_test"/> </tree> </field> </record> @@ -564,9 +564,9 @@ <group col="8" colspan="4"> <field name="state"/> <field name="balance_end"/> + <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> <button name="button_dummy" states="draft" string="Compute" type="object" icon="terp-stock_format-scientific"/> <button name="button_confirm_bank" states="draft" string="Confirm" type="object" icon="terp-camera_test"/> - <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -596,9 +596,9 @@ <group col="8" colspan="4"> <field name="state"/> <field name="balance_end"/> + <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> <button name="button_dummy" states="draft" string="Compute" type="object" icon="terp-stock_format-scientific"/> <button name="button_confirm_bank" states="draft" string="Confirm" type="object" icon="terp-camera_test"/> - <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -1334,8 +1334,8 @@ <field name="narration" colspan="4" nolabel="1" height="50"/> <group col="4" colspan="4"> <field name="state" select="1"/> - <button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/> <button name="button_cancel" states="posted" string="Cancel" type="object" icon="gtk-cancel"/> + <button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/> </group> </page> </notebook> @@ -1481,9 +1481,9 @@ <group col="7" colspan="4"> <field name="state"/> <field name="balance_end"/> + <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> <button name="button_dummy" states="draft" string="Compute" icon="terp-stock_format-scientific"/> <button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-camera_test"/> - <button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -1640,7 +1640,7 @@ <filter string="Purchase" icon="terp-purchase" domain="[('journal_id.type', '=', 'purchase')]"/> <separator orientation="vertical"/> <field name="name"/> - <field name="journal_id"/> + <field name="journal_id" widget="selection"/> <field name="company_id" groups="base.group_multi_company"/> </group> <newline/> @@ -2466,9 +2466,9 @@ <field name="balance_end_real"/> <field name="balance_end"/> <field name="state"/> + <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="gtk-cancel"/> <button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/> <button type="object" string="Confirm" name="button_confirm_bank" states="open" icon="terp-gtk-go-back-rtl"/> - <button type="object" string="Cancel" name="button_cancel" states="confirm" icon="gtk-cancel"/> </tree> </field> </record> @@ -2570,9 +2570,9 @@ </group> <group col="8" colspan="4"> <field name="state" colspan="4"/> + <button name="button_cancel" states="confirm,open" string="Cancel" icon="terp-gtk-stop" type="object" groups="base.group_extended"/> <button name="button_confirm_cash" states="open" string="Close CashBox" icon="terp-dialog-close" type="object"/> <button name="button_open" states="draft" string="Open CashBox" icon="terp-document-new" type="object"/> - <button name="button_cancel" states="confirm,open" string="Cancel" icon="terp-gtk-stop" type="object" groups="base.group_extended"/> </group> </form> </field> @@ -2590,7 +2590,7 @@ </field> </record> <record id="action_view_bank_statement_tree" model="ir.actions.act_window"> - <field name="name">Cash Register</field> + <field name="name">Cash Registers</field> <field name="type">ir.actions.act_window</field> <field name="res_model">account.bank.statement</field> <field name="view_type">form</field> diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 0c83814c15d..4cdaeab9a49 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -302,7 +302,7 @@ class account_invoice(osv.osv): }, help="The Journal Entry of the invoice have been totally reconciled with one or several Journal Entries of payment."), 'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account', help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}), - 'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'), + 'move_lines':fields.function(_get_lines, method=True, type='many2many', relation='account.move.line', string='Entry Lines'), 'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual', store={ 'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50), @@ -585,7 +585,7 @@ class account_invoice(osv.osv): else: val['currency_id'] = company.currency_id.id - return {'value' : val, 'domain': dom } + return {'value': val, 'domain': dom } # go from canceled state to draft state def action_cancel_draft(self, cr, uid, ids, *args): @@ -898,7 +898,7 @@ class account_invoice(osv.osv): 'name': name, 'price': total, 'account_id': acc_id, - 'date_maturity' : inv.date_due or False, + 'date_maturity': inv.date_due or False, 'amount_currency': diff_currency_p \ and total_currency or False, 'currency_id': diff_currency_p \ @@ -909,7 +909,7 @@ class account_invoice(osv.osv): date = inv.date_invoice or time.strftime('%Y-%m-%d') part = inv.partner_id.id - line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml) + line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml) line = self.group_lines(cr, uid, iml, line, inv) @@ -932,7 +932,7 @@ class account_invoice(osv.osv): period_id = inv.period_id and inv.period_id.id or False if not period_id: period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))]) - if len(period_ids): + if period_ids: period_id = period_ids[0] if period_id: move['period_id'] = period_id @@ -1018,7 +1018,7 @@ class account_invoice(osv.osv): account_move_obj.unlink(cr, uid, [i['move_id'][0]]) if i['payment_ids']: account_move_line_obj = self.pool.get('account.move.line') - pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids']) + pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids']) for move_line in pay_ids: if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids: raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!')) @@ -1043,7 +1043,7 @@ class account_invoice(osv.osv): return True def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] types = { 'out_invoice': 'CI: ', @@ -1078,7 +1078,9 @@ class account_invoice(osv.osv): def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None): invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id']) - + obj_invoice_line = self.pool.get('account.invoice.line') + obj_invoice_tax = self.pool.get('account.invoice.tax') + obj_journal = self.pool.get('account.journal') new_ids = [] for invoice in invoices: del invoice['id'] @@ -1090,20 +1092,20 @@ class account_invoice(osv.osv): 'in_refund': 'in_invoice', # Supplier Refund } - invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line']) + invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line']) invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines) - tax_lines = self.pool.get('account.invoice.tax').read(cr, uid, invoice['tax_line']) + tax_lines = obj_invoice_tax.read(cr, uid, invoice['tax_line']) tax_lines = filter(lambda l: l['manual'], tax_lines) tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines) if journal_id: refund_journal_ids = [journal_id] elif invoice['type'] == 'in_invoice': - refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase_refund')]) + refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')]) else: - refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')]) + refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')]) - if not date : + if not date: date = time.strftime('%Y-%m-%d') invoice.update({ 'type': type_dict[invoice['type']], @@ -1114,11 +1116,11 @@ class account_invoice(osv.osv): 'tax_line': tax_lines, 'journal_id': refund_journal_ids }) - if period_id : + if period_id: invoice.update({ 'period_id': period_id, }) - if description : + if description: invoice.update({ 'name': description, }) @@ -1406,7 +1408,7 @@ class account_invoice_line(osv.osv): result['uos_id'] = res.uom_id.id or uom or False if result['uos_id']: res2 = res.uom_id.category_id.id - if res2 : + if res2: domain = {'uos_id':[('category_id','=',res2 )]} result['categ_id'] = res.categ_id.id @@ -1537,8 +1539,8 @@ class account_invoice_tax(osv.osv): 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."), 'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')), 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True), - 'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"), - 'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all") + 'factor_base': fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"), + 'factor_tax': fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all") } def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False): diff --git a/addons/account/partner.py b/addons/account/partner.py index 8b0f1057c52..6b88f759c21 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -51,7 +51,7 @@ class account_fiscal_position(osv.osv): return result def map_account(self, cr, uid, fposition_id, account_id, context={}): - if not fposition_id : + if not fposition_id: return account_id for pos in fposition_id.account_ids: if pos.account_src_id.id == account_id: @@ -111,7 +111,7 @@ class res_partner(osv.osv): return res def _asset_difference_search(self, cr, uid, obj, name, type, args, context=None): - if not len(args): + if not args: return [] having_values = tuple(map(itemgetter(2), args)) where = ' AND '.join( @@ -128,7 +128,7 @@ class res_partner(osv.osv): 'GROUP BY partner_id HAVING '+where), (type,) + having_values) res = cr.fetchall() - if not len(res): + if not res: return [('id','=','0')] return [('id','in',map(itemgetter(0), res))] diff --git a/addons/account/project/analytic_account_demo.xml b/addons/account/project/analytic_account_demo.xml index 3727f7741bf..8f33f70f856 100644 --- a/addons/account/project/analytic_account_demo.xml +++ b/addons/account/project/analytic_account_demo.xml @@ -198,7 +198,7 @@ <field name="parent_id" ref="analytic_project_1"/> </record> <record id="analytic_administratif" model="account.analytic.account"> - <field name="name">Administratif</field> + <field name="name">Administrative</field> <field name="code">1</field> <field name="parent_id" ref="analytic_internal"/> </record> diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index fd52619fb10..809f69673fe 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -182,6 +182,7 @@ <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/> <field domain="[('type','=','normal')]" name="account_id"/> <field name="general_account_id" invisible="context.get('to_invoice', False)"/> + <field name="user_id" invisible="1" /> </tree> </field> </record> @@ -430,13 +431,13 @@ </field> </record> - <act_window + <act_window context="{'search_default_account_id': [active_id], 'search_default_user_id': False}" - id="act_acc_analytic_acc_5_report_hr_timesheet_invoice_journal" - name="All Analytic Entries" - res_model="account.analytic.line" - src_model="account.analytic.account" - view_mode="tree,form" + id="act_acc_analytic_acc_5_report_hr_timesheet_invoice_journal" + name="All Analytic Entries" + res_model="account.analytic.line" + src_model="account.analytic.account" + view_mode="tree,form" view_type="form"/> <record id="view_account_journal_1" model="ir.ui.view"> diff --git a/addons/account/project/report/analytic_balance.py b/addons/account/project/report/analytic_balance.py index 01cefdd03c8..42e36744cb8 100644 --- a/addons/account/project/report/analytic_balance.py +++ b/addons/account/project/report/analytic_balance.py @@ -119,12 +119,12 @@ class account_analytic_balance(report_sxw.rml_parse): return (debit-credit) def _sum_all(self, accounts, date1, date2, option): + account_analytic_obj = self.pool.get('account.analytic.account') ids = map(lambda x: x['id'], accounts) if not ids: return 0.0 if not self.acc_sum_list: - account_analytic_obj = self.pool.get('account.analytic.account') ids2 = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', ids)]) self.acc_sum_list = ids2 else: diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py index c711eeb2b30..225a85d2ee1 100644 --- a/addons/account/project/report/cost_ledger.py +++ b/addons/account/project/report/cost_ledger.py @@ -91,14 +91,14 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): def _sum_debit(self, accounts, date1, date2): ids = map(lambda x: x.id, accounts) - if not len(ids): + if not ids: return 0.0 self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids), date1, date2,)) return self.cr.fetchone()[0] or 0.0 def _sum_credit(self, accounts, date1, date2): ids = map(lambda x: x.id, accounts) - if not len(ids): + if not ids: return 0.0 self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,)) return self.cr.fetchone()[0] or 0.0 diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py index c593d05566e..4d874fe50ee 100644 --- a/addons/account/project/report/quantity_cost_ledger.py +++ b/addons/account/project/report/quantity_cost_ledger.py @@ -102,7 +102,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): def _sum_quantity(self, accounts, date1, date2, journals): ids = map(lambda x: x.id, accounts) - if not len(ids): + if not ids: return 0.0 if not journals: self.cr.execute("SELECT sum(unit_amount) \ diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 5936e29fe29..457ce7bb27f 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -70,7 +70,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND (l.partner_id=res_partner.id)\ AND ' + self.query + ' \ - ORDER BY res_partner.name' , (self.date_from,)) + ORDER BY res_partner.name', (self.date_from,)) partners = self.cr.dictfetchall() ## mise a 0 du total for i in range(7): @@ -96,7 +96,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND ' + self.query + '\ AND account_account.active\ - GROUP BY partner_id ' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from)) + GROUP BY partner_id ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids), self.date_from)) t = self.cr.fetchall() for i in t: totals[i[0]] = i[1] @@ -131,7 +131,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND '+ self.query + '\ AND account_account.active\ - GROUP BY l.partner_id' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from)) + GROUP BY l.partner_id', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, tuple(partner_ids), self.date_from)) t = self.cr.fetchall() for i in t: future_past[i[0]] = i[1] @@ -140,7 +140,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): # Each history will contain : history[1] = {'<partner_id>': <partner_debit-credit>} history = [] for i in range(5): - args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids) ,self.date_from,) + args_list = (tuple(move_state), tuple(self.ACCOUNT_TYPE), tuple(partner_ids),self.date_from,) dates_query = '(COALESCE(l.date_maturity,l.date)' if form[str(i)]['start'] and form[str(i)]['stop']: dates_query += ' BETWEEN %s AND %s)' @@ -153,7 +153,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): args_list += (form[str(i)]['stop'],) self.cr.execute('SELECT l.partner_id, SUM(l.debit-l.credit)\ - FROM account_move_line AS l, account_account , account_move am \ + FROM account_move_line AS l, account_account, account_move am \ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\ AND (am.state IN %s)\ AND (account_account.type IN %s)\ @@ -163,7 +163,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): AND '+ self.query + '\ AND account_account.active\ AND ' + dates_query + '\ - GROUP BY l.partner_id' , args_list) + GROUP BY l.partner_id', args_list) t = self.cr.fetchall() d = {} for i in t: @@ -227,7 +227,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): self.total_account.append(0) totals = {} self.cr.execute('SELECT SUM(l.debit-l.credit) \ - FROM account_move_line AS l, account_account , account_move am \ + FROM account_move_line AS l, account_account, account_move am \ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\ AND (am.state IN %s)\ AND (l.partner_id IS NULL)\ @@ -235,7 +235,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): AND ((l.reconcile_id IS NULL) \ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND ' + self.query + '\ - AND account_account.active ' ,(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from)) + AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from)) t = self.cr.fetchall() for i in t: totals['Unknown Partner'] = i[0] @@ -266,7 +266,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): AND ((l.reconcile_id IS NULL)\ OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ AND '+ self.query + '\ - AND account_account.active ' , (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from)) + AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from)) t = self.cr.fetchall() for i in t: future_past['Unknown Partner'] = i[0] @@ -286,7 +286,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): args_list += (form[str(i)]['stop'],) self.cr.execute('SELECT SUM(l.debit-l.credit)\ - FROM account_move_line AS l, account_account , account_move am \ + FROM account_move_line AS l, account_account, account_move am \ WHERE (l.account_id = account_account.id) AND (l.move_id=am.id)\ AND (am.state IN %s)\ AND (account_account.type IN %s)\ @@ -296,7 +296,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): AND '+ self.query + '\ AND account_account.active\ AND ' + dates_query + '\ - GROUP BY l.partner_id' , args_list) + GROUP BY l.partner_id', args_list) t = self.cr.fetchall() d = {} for i in t: diff --git a/addons/account/report/account_analytic_entries_report.py b/addons/account/report/account_analytic_entries_report.py index aa0c5b3ba99..a53e19721dd 100644 --- a/addons/account/report/account_analytic_entries_report.py +++ b/addons/account/report/account_analytic_entries_report.py @@ -33,7 +33,7 @@ class analytic_entries_report(osv.osv): 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), - 'user_id' : fields.many2one('res.users', 'User',readonly=True), + 'user_id': fields.many2one('res.users', 'User',readonly=True), 'name': fields.char('Description', size=64, readonly=True), 'partner_id': fields.many2one('res.partner', 'Partner'), 'company_id': fields.many2one('res.company', 'Company', required=True), diff --git a/addons/account/report/account_analytic_entries_report_view.xml b/addons/account/report/account_analytic_entries_report_view.xml index 34d23826e80..6e1ba112606 100644 --- a/addons/account/report/account_analytic_entries_report_view.xml +++ b/addons/account/report/account_analytic_entries_report_view.xml @@ -56,21 +56,9 @@ </field> </group> <newline/> - <group expand="0" string="Extended Filters..." groups="base.group_extended"> - <field name="currency_id" widget="selection"/> - <field name="general_account_id" widget="selection"/> - <field name="product_uom_id" widget="selection"/> - <field name="journal_id" widget="selection"/> - <separator orientation="vertical"/> - <field name="name"/> - <field name="account_id" groups="analytic.group_analytic_accounting"/> - <field name="company_id" widget="selection" groups="base.group_multi_company"/> - </group> - <newline/> - <group expand="1" string="Group By..."> + <group expand="0" string="Group By..."> <filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/> - <filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/> - <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> + <filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/> <separator orientation="vertical"/> <filter string="Account" name="Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/> <filter string="General Account" icon="terp-folder-green" context="{'group_by':'general_account_id'}"/> @@ -78,11 +66,24 @@ <separator orientation="vertical"/> <filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/> <filter string="Product UOM" icon="terp-mrp" context="{'group_by':'product_uom_id'}"/> + <separator orientation="vertical" groups="base.group_multi_company"/> + <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> <separator orientation="vertical"/> <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/> <filter string="Month" name="Month" icon="terp-go-month" context="{'group_by':'month'}"/> <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/> </group> + <newline/> + <group expand="0" string="Extended Filters..." groups="base.group_extended"> + <field name="currency_id" widget="selection"/> + <field name="general_account_id" widget="selection"/> + <field name="product_uom_id" widget="selection"/> + <field name="journal_id" widget="selection"/> + <separator orientation="vertical"/> + <field name="name"/> + <field name="account_id" groups="analytic.group_analytic_accounting"/> + <field name="company_id" widget="selection" groups="base.group_multi_company"/> + </group> </search> </field> </record> diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 236433819c5..5a6c7700b9d 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -86,7 +86,7 @@ class account_balance(report_sxw.rml_parse, common_report_header): self.sum_debit += account_rec['debit'] self.sum_credit += account_rec['credit'] if disp_acc == 'bal_movement': - if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 : + if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0: self.result_acc.append(res) elif disp_acc == 'bal_solde': if res['balance'] != 0: diff --git a/addons/account/report/account_balance_landscape.py b/addons/account/report/account_balance_landscape.py index 04f7cc8ec7f..6ec7ec7c10e 100644 --- a/addons/account/report/account_balance_landscape.py +++ b/addons/account/report/account_balance_landscape.py @@ -139,7 +139,7 @@ class account_balance_landscape(rml_parse.rml_parse): ctx['state'] = form['context'].get('state','all') tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy()) - if len(tmp): + if tmp: accounts.append(tmp) merged_accounts=zip(*accounts) @@ -198,7 +198,7 @@ class account_balance_landscape(rml_parse.rml_parse): ctx['state'] = form['context'].get('state','all') tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy()) - if len(tmp1): + if tmp1: accounts.append(tmp1) if level==1: #if parent is called,done is not empty when called again. diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py index bf5164253cc..35f1e666c6f 100644 --- a/addons/account/report/account_central_journal.py +++ b/addons/account/report/account_central_journal.py @@ -71,11 +71,12 @@ class journal_print(report_sxw.rml_parse, common_report_header): move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] - self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code,l.currency_id ,l.amount_currency ,SUM(debit) AS debit, SUM(credit) AS credit \ + + self.cr.execute('SELECT a.currency_id ,a.code, a.name, c.code AS currency_code, l.currency_id, l.amount_currency, SUM(debit) AS debit, SUM(credit) AS credit \ from account_move_line l \ LEFT JOIN account_move am ON (l.move_id=am.id) \ LEFT JOIN account_account a ON (l.account_id=a.id) \ - LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code , a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id)) + LEFT JOIN res_currency c on (l.currency_id=c.id) WHERE am.state IN %s AND l.period_id=%s AND l.journal_id=%s '+self.query_get_clause+' GROUP BY a.id, a.code, a.name,l.amount_currency,c.code, a.currency_id,l.currency_id', (tuple(move_state), period_id, journal_id)) return self.cr.dictfetchall() def _set_get_account_currency_code(self, account_id): @@ -91,12 +92,12 @@ class journal_print(report_sxw.rml_parse, common_report_header): def _get_account(self, data): if data['model'] == 'account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name - return super(journal_print ,self)._get_account(data) + return super(journal_print,self)._get_account(data) def _get_fiscalyear(self, data): if data['model'] == 'account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name - return super(journal_print ,self)._get_fiscalyear(data) + return super(journal_print,self)._get_fiscalyear(data) def _display_currency(self, data): if data['model'] == 'account.journal.period': diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 1f4fe48fa79..28cb68fcce3 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -293,7 +293,7 @@ <td><para style="terp_tblheader_Details_Right">Currency</para></td> </tr> </blockTable> - <blockTable colWidths="50.0,270.0,70.0,70.0,70.0" style="Table_Final_Total">[[ display_currency(data) == False or removeParentNode('blockTable') ]] + <blockTable colWidths="50.0,300.0,70.0,70.0,70.0" style="Table_Final_Total">[[ display_currency(data) == False or removeParentNode('blockTable') ]] <tr> <td><para style="terp_default_Bold_9">Total:</para></td> <td><para style="terp_default_Bold_9"><font color="white"> </font></para></td> @@ -314,7 +314,7 @@ </blockTable> <section> <para style="terp_default_8">[[ repeatIn(lines(o.period_id.id,o.journal_id.id),'line') ]]</para> - <blockTable colWidths="50.0,270.0,70.0,70.0,70.0" style="Table_Journal_Line_Content">[[ display_currency(data) == False or removeParentNode('blockTable') ]] + <blockTable colWidths="50.0,300.0,70.0,70.0,70.0" style="Table_Journal_Line_Content">[[ display_currency(data) == False or removeParentNode('blockTable') ]] <tr> <td><para style="terp_default_9">[[ line['code'] ]]</para></td> <td><para style="terp_default_9">[[ line['name'] ]]</para></td> diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index ae0b3e47b04..942ca8c4fb8 100644 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -55,7 +55,7 @@ class account_entries_report(osv.osv): 'move_line_state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'State of Move Line', readonly=True), 'reconcile_id': fields.many2one('account.move.reconcile', readonly=True), 'partner_id': fields.many2one('res.partner','Partner', readonly=True), - 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), + 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), 'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True), 'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True), 'type': fields.selection([ diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index d35f0603ded..e13604c4219 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -117,15 +117,15 @@ class general_ledger(rml_parse.rml_parse, common_report_header): sold_account = self._sum_balance_account(child_account) self.sold_accounts[child_account.id] = sold_account if self.display_account == 'bal_movement': - if child_account.type != 'view' and num_entry <> 0 : + if child_account.type != 'view' and num_entry <> 0: res.append(child_account) elif self.display_account == 'bal_solde': - if child_account.type != 'view' and num_entry <> 0 : + if child_account.type != 'view' and num_entry <> 0: if ( sold_account <> 0.0): res.append(child_account) else: res.append(child_account) - if not len(res): + if not res: return [account] return res diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 4f6ad99792d..ab7b6211064 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -84,7 +84,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): if self.target_move == 'posted': move_state = ['posted'] - self.cr.execute('SELECT SUM(debit) FROM account_move_line l , account_move am ' + self.cr.execute('SELECT SUM(debit) FROM account_move_line l, account_move am ' 'WHERE l.move_id=am.id AND am.state IN %s AND l.period_id IN %s AND l.journal_id IN %s ' + self.query_get_clause + ' ', (tuple(move_state), tuple(period_id), tuple(journal_id))) return self.cr.fetchone()[0] or 0.0 @@ -121,7 +121,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): if self.target_move == 'posted': move_state = ['posted'] - self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '' ,(tuple(move_state), period_id, tuple(journal_id) )) + self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) )) ids = map(lambda x: x[0], self.cr.fetchall()) return obj_mline.browse(self.cr, self.uid, ids) @@ -138,12 +138,12 @@ class journal_print(report_sxw.rml_parse, common_report_header): def _get_fiscalyear(self, data): if data['model'] == 'account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).fiscalyear_id.name - return super(journal_print ,self)._get_fiscalyear(data) + return super(journal_print, self)._get_fiscalyear(data) def _get_account(self, data): if data['model'] == 'account.journal.period': return self.pool.get('account.journal.period').browse(self.cr, self.uid, data['id']).company_id.name - return super(journal_print ,self)._get_account(data) + return super(journal_print, self)._get_account(data) def _display_currency(self, data): if data['model'] == 'account.journal.period': diff --git a/addons/account/report/account_partner_balance.py b/addons/account/report/account_partner_balance.py index 06baa4639eb..c17de597e1c 100644 --- a/addons/account/report/account_partner_balance.py +++ b/addons/account/report/account_partner_balance.py @@ -83,7 +83,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header): full_account = [] result_tmp = 0.0 self.cr.execute( - "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code ,p.name, sum(debit) AS debit, sum(credit) AS credit, " \ + "SELECT p.ref,l.account_id,ac.name AS account_name,ac.code AS code,p.name, sum(debit) AS debit, sum(credit) AS credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ "THEN sum(debit) - sum(credit) " \ "ELSE 0 " \ @@ -254,7 +254,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header): "JOIN account_move am ON (am.id = l.move_id)" \ "WHERE l.account_id IN %s" \ "AND am.state IN %s" \ - "AND " + self.query + "" , + "AND " + self.query + "", (tuple(self.account_ids), tuple(move_state))) temp_res = float(self.cr.fetchone()[0] or 0.0) return temp_res @@ -273,7 +273,7 @@ class partner_balance(report_sxw.rml_parse, common_report_header): "JOIN account_move am ON (am.id = l.move_id)" \ "WHERE l.account_id IN %s" \ "AND am.state IN %s" \ - "AND " + self.query + "" , + "AND " + self.query + "", (tuple(self.account_ids), tuple(move_state))) temp_res = float(self.cr.fetchone()[0] or 0.0) return temp_res diff --git a/addons/account/report/account_print_overdue.py b/addons/account/report/account_print_overdue.py index c59dd56a02f..3e1f0b54de1 100644 --- a/addons/account/report/account_print_overdue.py +++ b/addons/account/report/account_print_overdue.py @@ -30,11 +30,11 @@ class Overdue(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(Overdue, self).__init__(cr, uid, name, context=context) self.localcontext.update( { - 'time' : time, - 'adr_get' : self._adr_get, - 'getLines' : self._lines_get, - 'tel_get' : self._tel_get, - 'message' : self._message, + 'time': time, + 'adr_get': self._adr_get, + 'getLines': self._lines_get, + 'tel_get': self._tel_get, + 'message': self._message, }) self.context = context def _adr_get(self, partner, type): @@ -47,10 +47,10 @@ class Overdue(report_sxw.rml_parse): 'name': False, 'street': False, 'street2': False, - 'city' : False, - 'zip' : False, + 'city': False, + 'zip': False, 'state_id':False, - 'country_id' : False, + 'country_id': False, } if adr_id: result = res_partner_address.read(self.cr, self.uid, [adr_id], context=self.context.copy()) diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py index 0c7018ae290..1d3cc629cfa 100644 --- a/addons/account/report/rml_parse.py +++ b/addons/account/report/rml_parse.py @@ -34,17 +34,17 @@ class rml_parse(report_sxw.rml_parse): self.localcontext.update({ 'comma_me': self.comma_me, 'format_date': self._get_and_change_date_format_for_swiss, - 'strip_name' : self._strip_name, - 'explode_name' : self._explode_name, + 'strip_name': self._strip_name, + 'explode_name': self._explode_name, }) def comma_me(self,amount): #print "#" + str(amount) + "#" if not amount: amount = 0.0 - if type(amount) is float : + if type(amount) is float: amount = str('%.2f'%amount) - else : + else: amount = str(amount) if (amount == '0'): return ' ' diff --git a/addons/account/sequence.py b/addons/account/sequence.py index b75e7f3e34e..52c1f5df8c4 100644 --- a/addons/account/sequence.py +++ b/addons/account/sequence.py @@ -43,13 +43,13 @@ ir_sequence_fiscalyear() class ir_sequence(osv.osv): _inherit = 'ir.sequence' _columns = { - 'fiscal_ids' : fields.one2many('account.sequence.fiscalyear', + 'fiscal_ids': fields.one2many('account.sequence.fiscalyear', 'sequence_main_id', 'Sequences') } def get_id(self, cr, uid, sequence_id, test='id', context=None): if context is None: context = {} - cr.execute('select id from ir_sequence where ' + cr.execute('select id from ir_sequence where ' + test + '=%s and active=%s', (sequence_id, True,)) res = cr.dictfetchone() if res: diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml index 4bc3b807d28..0aae9dbe3d0 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -67,6 +67,8 @@ import netsvc, tools, os, time import datetime from mx.DateTime import * + import warnings + warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*") start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d"))) start = DateTime(int(start.year), int(start.month), int(start.day)) res = {} diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index 6a1afc45bcf..5939437ce1d 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -170,7 +170,7 @@ class account_automatic_reconcile(osv.osv_memory): "AND reconcile_id IS NULL", (account_id, partner_id)) line_ids = [id for (id,) in cr.fetchall()] - if len(line_ids): + if line_ids: reconciled += len(line_ids) if allow_write_off: move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context) diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index 9355691369e..ebc11e1dabf 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -71,8 +71,8 @@ class account_change_currency(osv.osv_memory): if old_rate <= 0: raise osv.except_osv(_('Error'), _('Current currency is not confirured properly !')) new_price = (line.price_unit / old_rate ) * rate - obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price}) - obj_inv.write(cr, uid, [invoice.id], {'currency_id' : new_currency}, context=context) + obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price}) + obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context) return {} account_change_currency() diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index d6d3b67c10e..e3d115ae30a 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -65,9 +65,9 @@ class account_fiscalyear_close(osv.osv_memory): context = {} fy_id = data[0]['fy_id'] - cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)" , (str(data[0]['fy2_id']),)) + cr.execute("SELECT id FROM account_period WHERE date_stop < (SELECT date_start FROM account_fiscalyear WHERE id = %s)", (str(data[0]['fy2_id']),)) fy_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall())) - cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)" , (str(fy_id),)) + cr.execute("SELECT id FROM account_period WHERE date_start > (SELECT date_stop FROM account_fiscalyear WHERE id = %s)", (str(fy_id),)) fy2_period_set = ','.join(map(lambda id: str(id[0]), cr.fetchall())) period = obj_acc_period.browse(cr, uid, data[0]['period_id'], context=context) diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index c7e75f205f8..29d67859ca5 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -100,7 +100,7 @@ class account_invoice_refund(osv.osv_memory): raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode)) if inv.reconciled and mode in ('cancel', 'modify'): raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode)) - if form['period'] : + if form['period']: period = form['period'] else: period = inv.period_id and inv.period_id.id or False @@ -108,9 +108,9 @@ class account_invoice_refund(osv.osv_memory): if not journal_id: journal_id = inv.journal_id.id - if form['date'] : + if form['date']: date = form['date'] - if not form['period'] : + if not form['period']: cr.execute("select name from ir_model_fields \ where model = 'account.period' \ and name = 'company_id'") @@ -128,7 +128,7 @@ class account_invoice_refund(osv.osv_memory): period = res[0] else: date = inv.date_invoice - if form['description'] : + if form['description']: description = form['description'] else: description = inv.name @@ -147,18 +147,18 @@ class account_invoice_refund(osv.osv_memory): if mode in ('cancel', 'modify'): movelines = inv.move_id.line_id to_reconcile_ids = {} - for line in movelines : - if line.account_id.id == inv.account_id.id : + for line in movelines: + if line.account_id.id == inv.account_id.id: to_reconcile_ids[line.account_id.id] = [line.id] - if type(line.reconcile_id) != osv.orm.browse_null : + if type(line.reconcile_id) != osv.orm.browse_null: reconcile_obj.unlink(cr, uid, line.reconcile_id.id) wf_service.trg_validate(uid, 'account.invoice', \ refund.id, 'invoice_open', cr) refund = inv_obj.browse(cr, uid, refund_id[0], context=context) - for tmpline in refund.move_id.line_id : - if tmpline.account_id.id == inv.account_id.id : + for tmpline in refund.move_id.line_id: + if tmpline.account_id.id == inv.account_id.id: to_reconcile_ids[tmpline.account_id.id].append(tmpline.id) - for account in to_reconcile_ids : + for account in to_reconcile_ids: account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account], writeoff_period_id=period, writeoff_journal_id = inv.journal_id.id, @@ -214,7 +214,7 @@ class account_invoice_refund(osv.osv_memory): return result def invoice_refund(self, cr, uid, ids, context=None): - data_refund = self.read(cr, uid, ids, [] ,context=context)[0]['filter_refund'] + data_refund = self.read(cr, uid, ids, [],context=context)[0]['filter_refund'] return self.compute_refund(cr, uid, ids, data_refund, context=context) account_invoice_refund() diff --git a/addons/account/wizard/account_invoice_state_view.xml b/addons/account/wizard/account_invoice_state_view.xml index 6f6dca22e46..8e9c04b788d 100644 --- a/addons/account/wizard/account_invoice_state_view.xml +++ b/addons/account/wizard/account_invoice_state_view.xml @@ -33,8 +33,8 @@ <form string="Cancel Selected Invoices"> <separator string="Cancel Selected Invoices" colspan="4"/> <group colspan="4" col="6"> - <button icon="terp-dialog-close" special="cancel" string="Close"/> <button icon="gtk-cancel" string="Cancel Invoices" name="invoice_cancel" type="object" default_focus="1"/> + <button icon="terp-dialog-close" special="cancel" string="Close"/> </group> </form> </field> diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index c03176a0536..02cd614ee5d 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -33,7 +33,7 @@ class account_move_journal(osv.osv_memory): """ ids = self.pool.get('account.period').find(cr, uid, context=context) period_id = False - if len(ids): + if ids: period_id = ids[0] return period_id @@ -91,9 +91,9 @@ class account_move_journal(osv.osv_memory): <form string="Standard entries"> <separator string="Open Journal Items !" colspan="4"/> <group colspan="4" > - <label width="300" string="Journal : %s"/> + <label width="300" string="Journal: %s"/> <newline/> - <label width="300" string="Period : %s"/> + <label width="300" string="Period: %s"/> </group> <group colspan="4" col="4"> <label string ="" colspan="2"/> diff --git a/addons/account/wizard/account_move_line_select.py b/addons/account/wizard/account_move_line_select.py index 546bb08c754..86345703f6f 100644 --- a/addons/account/wizard/account_move_line_select.py +++ b/addons/account/wizard/account_move_line_select.py @@ -46,7 +46,7 @@ class account_move_line_select(osv.osv_memory): fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids) period_ids = [] - if fiscalyears : + if fiscalyears: for fiscalyear in fiscalyears: for period in fiscalyear.period_ids: period_ids.append(period.id) @@ -56,7 +56,7 @@ class account_move_line_select(osv.osv_memory): id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] result = act_obj.read(cr, uid, [id])[0] result['context'] = { - 'fiscalyear': False , + 'fiscalyear': False, 'account_id': context['active_id'], 'active_id': context['active_id'], } diff --git a/addons/account/wizard/account_period_close_view.xml b/addons/account/wizard/account_period_close_view.xml index 161a3f424fc..5d3351246a3 100644 --- a/addons/account/wizard/account_period_close_view.xml +++ b/addons/account/wizard/account_period_close_view.xml @@ -34,7 +34,7 @@ <record id="action_idea_post_vote_values" model="ir.values"> <field name="model_id" ref="model_account_period" /> <field name="object" eval="1" /> - <field name="name"></field> + <field name="name">Close a Period</field> <field name="key2">client_action_multi</field> <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_period_close'))"/> <field name="key">action</field> diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py index c1d9854d014..13fea538532 100644 --- a/addons/account/wizard/account_reconcile.py +++ b/addons/account/wizard/account_reconcile.py @@ -83,7 +83,7 @@ class account_move_line_reconcile(osv.osv_memory): data = self.read(cr, uid, ids, context=context) date = time.strftime('%Y-%m-%d') ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context) - if len(ids): + if ids: period_id = ids[0] #stop the reconciliation process by partner (manual reconciliation) only if there is nothing more to reconcile for this partner if 'active_ids' in context and context['active_ids']: @@ -93,10 +93,10 @@ class account_move_line_reconcile(osv.osv_memory): credit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('credit', '>', 0)], context=context) for ml_id in context['active_ids']: if ml_id in debit_ml_ids: - debit_ml_ids.remove(ml_id) + debit_ml_ids.remove(ml_id) if ml_id in credit_ml_ids: credit_ml_ids.remove(ml_id) - if not (len(debit_ml_ids) and len(credit_ml_ids)): + if not debit_ml_ids and credit_ml_ids: context.update({'stop_reconcile': True}) account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id, period_id, journal_id, context=context) @@ -161,7 +161,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory): date = context['date_p'] ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context) - if len(ids): + if ids: period_id = ids[0] context.update({'stop_reconcile': True}) diff --git a/addons/account/wizard/account_unreconcile.py b/addons/account/wizard/account_unreconcile.py index 1e647742f4a..2a77cd8fb66 100644 --- a/addons/account/wizard/account_unreconcile.py +++ b/addons/account/wizard/account_unreconcile.py @@ -44,7 +44,7 @@ class account_unreconcile_reconcile(osv.osv_memory): rec_ids = context['active_ids'] if context is None: context = {} - if len(rec_ids): + if rec_ids: obj_move_reconcile.unlink(cr, uid, rec_ids) return {} diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index d9e9bf3907b..633524e3aaa 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -34,7 +34,7 @@ class account_analytic_account(osv.osv): dp = 2 res = dict([(i, {}) for i in ids]) - parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) + parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) accounts = self.browse(cr, uid, ids, context=context) for f in fields: @@ -62,10 +62,10 @@ class account_analytic_account(osv.osv): for id in ids: res[id][f] = 0.0 if parent_ids: - cr.execute("select account_analytic_line.account_id, max(date) \ - from account_analytic_line \ - where account_id IN %s \ - and invoice_id is not null \ + cr.execute("SELECT account_analytic_line.account_id, MAX(date) \ + FROM account_analytic_line \ + WHERE account_id IN %s \ + AND invoice_id IS NOT NULL \ GROUP BY account_analytic_line.account_id;", (parent_ids,)) for account_id, sum in cr.fetchall(): if account_id not in res: @@ -85,25 +85,25 @@ class account_analytic_account(osv.osv): # This computation doesn't take care of pricelist ! # Just consider list_price cr.execute("""SELECT account_analytic_account.id, \ - COALESCE(sum (product_template.list_price * \ + COALESCE(SUM (product_template.list_price * \ account_analytic_line.unit_amount * \ - ((100-hr_timesheet_invoice_factor.factor)/100)),0.0) \ + ((100-hr_timesheet_invoice_factor.factor)/100)), 0.0) \ AS ca_to_invoice \ FROM product_template \ - join product_product \ - on product_template.id = product_product.product_tmpl_id \ + JOIN product_product \ + ON product_template.id = product_product.product_tmpl_id \ JOIN account_analytic_line \ - on account_analytic_line.product_id = product_product.id \ + ON account_analytic_line.product_id = product_product.id \ JOIN account_analytic_journal \ - on account_analytic_line.journal_id = account_analytic_journal.id \ + ON account_analytic_line.journal_id = account_analytic_journal.id \ JOIN account_analytic_account \ - on account_analytic_account.id = account_analytic_line.account_id \ + ON account_analytic_account.id = account_analytic_line.account_id \ JOIN hr_timesheet_invoice_factor \ - on hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ + ON hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ WHERE account_analytic_account.id IN %s \ - AND account_analytic_line.invoice_id is null \ + AND account_analytic_line.invoice_id IS NULL \ AND account_analytic_line.to_invoice IS NOT NULL \ - and account_analytic_journal.type in ('purchase','general') \ + AND account_analytic_journal.type IN ('purchase','general') \ GROUP BY account_analytic_account.id;""", (parent_ids,)) for account_id, sum in cr.fetchall(): if account_id not in res: @@ -124,13 +124,13 @@ class account_analytic_account(osv.osv): for id in ids: res[id][f] = '' if parent_ids: - cr.execute ("select account_analytic_line.account_id, \ - date(max(account_invoice.date_invoice)) \ - from account_analytic_line \ - join account_invoice \ - on account_analytic_line.invoice_id = account_invoice.id \ - where account_analytic_line.account_id IN %s \ - and account_analytic_line.invoice_id is not null \ + cr.execute ("SELECT account_analytic_line.account_id, \ + DATE(MAX(account_invoice.date_invoice)) \ + FROM account_analytic_line \ + JOIN account_invoice \ + ON account_analytic_line.invoice_id = account_invoice.id \ + WHERE account_analytic_line.account_id IN %s \ + AND account_analytic_line.invoice_id IS NOT NULL \ GROUP BY account_analytic_line.account_id",(parent_ids,)) for account_id, lid in cr.fetchall(): res[account_id][f] = lid @@ -142,10 +142,10 @@ class account_analytic_account(osv.osv): for id in ids: res[id][f] = '' if parent_ids: - cr.execute("select account_analytic_line.account_id, max(date) \ - from account_analytic_line \ - where account_id IN %s \ - and invoice_id is null \ + cr.execute("SELECT account_analytic_line.account_id, MAX(date) \ + FROM account_analytic_line \ + WHERE account_id IN %s \ + AND invoice_id IS NULL \ GROUP BY account_analytic_line.account_id" ,(parent_ids,)) for account_id, lwd in cr.fetchall(): if account_id not in res: @@ -159,13 +159,13 @@ class account_analytic_account(osv.osv): for id in ids: res[id][f] = 0.0 if parent_ids: - cr.execute("select account_analytic_line.account_id, COALESCE(sum(unit_amount),0.0) \ - from account_analytic_line \ - join account_analytic_journal \ - on account_analytic_line.journal_id = account_analytic_journal.id \ - where account_analytic_line.account_id IN %s \ - and account_analytic_journal.type='general' \ - and invoice_id is null \ + cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(unit_amount), 0.0) \ + FROM account_analytic_line \ + JOIN account_analytic_journal \ + ON account_analytic_line.journal_id = account_analytic_journal.id \ + WHERE account_analytic_line.account_id IN %s \ + AND account_analytic_journal.type='general' \ + AND invoice_id IS NULL \ AND to_invoice IS NOT NULL \ GROUP BY account_analytic_line.account_id;",(parent_ids,)) for account_id, sua in cr.fetchall(): @@ -182,12 +182,12 @@ class account_analytic_account(osv.osv): for id in ids: res[id][f] = 0.0 if parent_ids: - cr.execute("select account_analytic_line.account_id,COALESCE(SUM(unit_amount),0.0) \ - from account_analytic_line \ - join account_analytic_journal \ - on account_analytic_line.journal_id = account_analytic_journal.id \ - where account_analytic_line.account_id IN %s \ - and account_analytic_journal.type='general' \ + cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(unit_amount), 0.0) \ + FROM account_analytic_line \ + JOIN account_analytic_journal \ + ON account_analytic_line.journal_id = account_analytic_journal.id \ + WHERE account_analytic_line.account_id IN %s \ + AND account_analytic_journal.type='general' \ GROUP BY account_analytic_line.account_id",(parent_ids,)) ff = cr.fetchall() for account_id, hq in ff: @@ -211,24 +211,24 @@ class account_analytic_account(osv.osv): # This computation doesn't take care of pricelist ! # Just consider list_price if parent_ids: - cr.execute("""select account_analytic_line.account_id as account_id, \ - COALESCE(sum((account_analytic_line.unit_amount * pt.list_price) \ + cr.execute("""SELECT account_analytic_line.account_id AS account_id, \ + COALESCE(SUM((account_analytic_line.unit_amount * pt.list_price) \ - (account_analytic_line.unit_amount * pt.list_price \ - * hr.factor)),0.0) as somme - from account_analytic_line \ - left join account_analytic_journal \ - on (account_analytic_line.journal_id = account_analytic_journal.id) \ - join product_product pp \ - on (account_analytic_line.product_id = pp.id) \ - join product_template pt \ - on (pp.product_tmpl_id = pt.id) \ - join account_analytic_account a \ - on (a.id=account_analytic_line.account_id) \ - join hr_timesheet_invoice_factor hr \ - on (hr.id=a.to_invoice) \ - where account_analytic_line.account_id IN %s \ - and a.to_invoice IS NOT NULL \ - and account_analytic_journal.type IN ('purchase','general') + * hr.factor)), 0.0) AS somme + FROM account_analytic_line \ + LEFT JOIN account_analytic_journal \ + ON (account_analytic_line.journal_id = account_analytic_journal.id) \ + JOIN product_product pp \ + ON (account_analytic_line.product_id = pp.id) \ + JOIN product_template pt \ + ON (pp.product_tmpl_id = pt.id) \ + JOIN account_analytic_account a \ + ON (a.id=account_analytic_line.account_id) \ + JOIN hr_timesheet_invoice_factor hr \ + ON (hr.id=a.to_invoice) \ + WHERE account_analytic_line.account_id IN %s \ + AND a.to_invoice IS NOT NULL \ + AND account_analytic_journal.type IN ('purchase', 'general') GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res2[account_id] = round(sum, dp) @@ -250,53 +250,51 @@ class account_analytic_account(osv.osv): def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): 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)], context=context)) if parent_ids: - cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ - from account_analytic_line \ - join account_analytic_journal \ - on account_analytic_line.journal_id = account_analytic_journal.id \ - where account_analytic_line.account_id IN %s \ - and account_analytic_journal.type = 'sale' \ - group by account_analytic_line.account_id" ,(parent_ids,)) + cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ + FROM account_analytic_line \ + JOIN account_analytic_journal \ + ON account_analytic_line.journal_id = account_analytic_journal.id \ + WHERE account_analytic_line.account_id IN %s \ + AND account_analytic_journal.type = 'sale' \ + GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) - - return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context) + return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context) def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): 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)], context=context)) if parent_ids: - cr.execute("""select account_analytic_line.account_id,COALESCE(sum(amount_currency),0.0) \ - - from account_analytic_line \ - join account_analytic_journal \ - on account_analytic_line.journal_id = account_analytic_journal.id \ - where account_analytic_line.account_id IN %s \ - and amount<0 \ + cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ + FROM account_analytic_line \ + JOIN account_analytic_journal \ + ON account_analytic_line.journal_id = account_analytic_journal.id \ + WHERE account_analytic_line.account_id IN %s \ + AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) - return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context) + return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context) def _remaining_hours_calc(self, cr, uid, ids, name, arg, context=None): res = {} - for account in self.browse(cr, uid, ids): + for account in self.browse(cr, uid, ids, context=context): if account.quantity_max != 0: res[account.id] = account.quantity_max - account.hours_quantity else: - res[account.id]=0.0 + res[account.id] = 0.0 for id in ids: res[id] = round(res.get(id, 0.0),2) return res def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} - for account in self.browse(cr, uid, ids): + for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.hours_quantity - account.hours_qtt_non_invoiced if res[account.id] < 0: - res[account.id]=0.0 + res[account.id] = 0.0 for id in ids: res[id] = round(res.get(id, 0.0),2) return res @@ -414,7 +412,7 @@ class account_analytic_account_summary_user(osv.osv): max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x%max_user == 0 and 1 or 0)) *max_user))) for x in ids] - parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)])) + parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)], context=context)) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_user ' \ @@ -436,7 +434,7 @@ class account_analytic_account_summary_user(osv.osv): 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), 'unit_amount': fields.function(_unit_amount, method=True, type='float', string='Total Time'), - 'user' : fields.many2one('res.users', 'User'), + 'user': fields.many2one('res.users', 'User'), } def init(self, cr): @@ -477,30 +475,30 @@ class account_analytic_account_summary_user(osv.osv): def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if not context: - context={} + context = {} if not ids: return [] - if fields==None: + if fields is None: fields = self._columns.keys() + res_trans_obj = self.pool.get('ir.translation') - # construct a clause for the rules : + # construct a clause for the rules: d1, d2, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name, 'read', context=context) # all inherited fields + all non inherited fields for which the attribute whose name is in load is True fields_pre = filter(lambda x: x in self._columns and getattr(self._columns[x],'_classic_write'), fields) + self._inherits.values() - res = [] cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] - if len(fields_pre) : + if fields_pre: fields_pre2 = map(lambda x: (x in ('create_date', 'write_date')) and ('date_trunc(\'second\', '+x+') as '+x) or '"'+x+'"', fields_pre) for i in range(0, len(ids), cr.IN_MAX): sub_ids = ids[i:i+cr.IN_MAX] if d1: - cr.execute('select %s from \"%s\" where id IN (%s) ' \ - 'and account_id IN (%s) ' \ - 'and "user" IN (%s) and %s order by %s' % \ + cr.execute('SELECT %s FROM \"%s\" WHERE id IN (%s) ' \ + 'AND account_id IN (%s) ' \ + 'AND "user" IN (%s) AND %s ORDER BY %s' % \ (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in sub_ids]), ','.join([str(x/max_user - (x%max_user == 0 and 1 or 0)) for x in sub_ids]), @@ -510,9 +508,9 @@ class account_analytic_account_summary_user(osv.osv): raise except_orm(_('AccessError'), _('You try to bypass an access rule (Document type: %s).') % self._description) else: - cr.execute('select %s from \"%s\" where id IN (%s) ' \ - 'and account_id IN (%s) ' \ - 'and "user" IN (%s) order by %s' % \ + cr.execute('SELECT %s FROM \"%s\" WHERE id IN (%s) ' \ + 'AND account_id IN (%s) ' \ + 'AND "user" IN (%s) ORDER BY %s' % \ (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in sub_ids]), ','.join([str(x/max_user - (x%max_user == 0 and 1 or 0)) for x in sub_ids]), @@ -521,7 +519,6 @@ class account_analytic_account_summary_user(osv.osv): res.extend(cr.dictfetchall()) else: res = map(lambda x: {'id': x}, ids) - res_trans_obj = self.pool.get('ir.translation') for f in fields_pre: if self._columns[f].translate: ids = map(lambda x: x['id'], res) @@ -579,7 +576,7 @@ class account_analytic_account_summary_month(osv.osv): account_obj = self.pool.get('account.analytic.account') account_ids = [int(str(int(x))[:-6]) for x in ids] month_ids = [int(str(int(x))[-6:]) for x in ids] - parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)])) + parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)], context=context)) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_month ' \ @@ -598,11 +595,9 @@ class account_analytic_account_summary_month(osv.osv): return res _columns = { - 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', - readonly=True), - 'unit_amount': fields.function(_unit_amount, method=True, type='float', - string='Total Time'), - 'month': fields.char('Month', size=25, readonly=True), + 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), + 'unit_amount': fields.function(_unit_amount, method=True, type='float', string='Total Time'), + 'month': fields.char('Month', size=32, readonly=True), } def init(self, cr): @@ -654,28 +649,27 @@ class account_analytic_account_summary_month(osv.osv): def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if not context: - context={} + context = {} if not ids: return [] - if fields==None: + if fields is None: fields = self._columns.keys() - + res_trans_obj = self.pool.get('ir.translation') # construct a clause for the rules : - d1, d2, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name) + d1, d2, tables= self.pool.get('ir.rule').domain_get(cr, user, self._name) # all inherited fields + all non inherited fields for which the attribute whose name is in load is True fields_pre = filter(lambda x: x in self._columns and getattr(self._columns[x],'_classic_write'), fields) + self._inherits.values() - res = [] - if len(fields_pre) : + if fields_pre: fields_pre2 = map(lambda x: (x in ('create_date', 'write_date')) and ('date_trunc(\'second\', '+x+') as '+x) or '"'+x+'"', fields_pre) for i in range(0, len(ids), cr.IN_MAX): sub_ids = ids[i:i+cr.IN_MAX] if d1: - cr.execute('select %s from \"%s\" where id IN (%s) ' \ - 'and account_id IN (%s) ' \ - 'and month_id IN (%s) and %s order by %s' % \ + cr.execute('SELECT %s FROM \"%s\" WHERE id IN (%s) ' \ + 'AND account_id IN (%s) ' \ + 'AND month_id IN (%s) AND %s ORDER BY %s' % \ (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in sub_ids]), ','.join([str(x)[:-6] for x in sub_ids]), @@ -685,9 +679,9 @@ class account_analytic_account_summary_month(osv.osv): raise except_orm(_('AccessError'), _('You try to bypass an access rule (Document type: %s).') % self._description) else: - cr.execute('select %s from \"%s\" where id IN (%s) ' \ - 'and account_id IN (%s) ' \ - 'and month_id IN (%s) order by %s' % \ + cr.execute('SELECT %s FROM \"%s\" WHERE id IN (%s) ' \ + 'AND account_id IN (%s) ' \ + 'AND month_id IN (%s) ORDER BY %s' % \ (','.join(fields_pre2 + ['id']), self._table, ','.join([str(x) for x in sub_ids]), ','.join([str(x)[:-6] for x in sub_ids]), @@ -697,7 +691,6 @@ class account_analytic_account_summary_month(osv.osv): else: res = map(lambda x: {'id': x}, ids) - res_trans_obj = self.pool.get('ir.translation') for f in fields_pre: if self._columns[f].translate: ids = map(lambda x: x['id'], res) @@ -739,10 +732,8 @@ class account_analytic_account_summary_month(osv.osv): res2 = self._columns[f].get(cr, self, ids, f, user, context=context, values=res) for record in res: record[f] = res2[record['id']] - return res account_analytic_account_summary_month() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_analytic_default/account_analytic_default.py b/addons/account_analytic_default/account_analytic_default.py index dce86597a4c..ebc78956a93 100644 --- a/addons/account_analytic_default/account_analytic_default.py +++ b/addons/account_analytic_default/account_analytic_default.py @@ -21,13 +21,13 @@ import time -from osv import fields,osv +from osv import fields, osv class account_analytic_default(osv.osv): - _name = 'account.analytic.default' - _description = 'Analytic Distribution' - _rec_name = 'analytic_id' - _order = 'sequence' + _name = "account.analytic.default" + _description = "Analytic Distribution" + _rec_name = "analytic_id" + _order = "sequence" _columns = { 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of analytic distribution."), 'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'), @@ -38,50 +38,50 @@ class account_analytic_default(osv.osv): 'date_start': fields.date('Start 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): domain = [] if product_id: - domain += ['|',('product_id','=',product_id)] - domain += [('product_id','=',False)] + domain += ['|', ('product_id', '=', product_id)] + domain += [('product_id','=', False)] if partner_id: - domain += ['|',('partner_id','=',partner_id)] - domain += [('partner_id','=',False)] + domain += ['|', ('partner_id', '=', partner_id)] + domain += [('partner_id', '=', False)] if user_id: - domain += ['|',('user_id','=',user_id)] - domain += [('user_id','=',False)] + domain += ['|',('user_id', '=', user_id)] + domain += [('user_id','=', False)] if date: - domain += ['|',('date_start','<=',date),('date_start','=',False)] - domain += ['|',('date_stop','>=',date),('date_stop','=',False)] + domain += ['|', ('date_start', '<=', date), ('date_start', '=', False)] + domain += ['|', ('date_stop', '>=', date), ('date_stop', '=', False)] best_index = -1 res = False for rec in self.browse(cr, uid, self.search(cr, uid, domain, context=context), context=context): index = 0 - if rec.product_id: index+=1 - if rec.partner_id: index+=1 - if rec.user_id: index+=1 - if rec.date_start: index+=1 - if rec.date_stop: index+=1 - if index>best_index: + if rec.product_id: index += 1 + if rec.partner_id: index += 1 + if rec.user_id: index += 1 + if rec.date_start: index += 1 + if rec.date_stop: index += 1 + if index > best_index: res = rec best_index = index return res - + account_analytic_default() class account_invoice_line(osv.osv): - _inherit = 'account.invoice.line' - _description = 'Invoice Line' + _inherit = "account.invoice.line" + _description = "Invoice Line" def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): - res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id=currency_id, context=context) - rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) + res_prod = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id=currency_id, context=context) + rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context=context) if rec: - res_prod['value'].update({'account_analytic_id':rec.analytic_id.id}) + res_prod['value'].update({'account_analytic_id': rec.analytic_id.id}) else: - res_prod['value'].update({'account_analytic_id':False}) + res_prod['value'].update({'account_analytic_id': False}) return res_prod - + account_invoice_line() @@ -95,28 +95,27 @@ class stock_picking(osv.osv): if rec: return rec.analytic_id.id - return super(stock_picking, self)._get_account_analytic_invoice(cursor, - user, picking, move_line) + return super(stock_picking, self)._get_account_analytic_invoice(cursor, user, picking, move_line) stock_picking() class sale_order_line(osv.osv): - _inherit = 'sale.order.line' + _inherit = "sale.order.line" # Method overridden to set the analytic account by default on criterion match 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=context) if not ids: return create_ids - sale_line = self.browse(cr, uid, ids[0], context) + sale_line = self.browse(cr, uid, ids[0], context=context) inv_line_obj = self.pool.get('account.invoice.line') anal_def_obj = self.pool.get('account.analytic.default') - for line in inv_line_obj.browse(cr, uid, create_ids, context): - rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, sale_line.order_id.user_id.id, time.strftime('%Y-%m-%d'), context) + for line in inv_line_obj.browse(cr, uid, create_ids, context=context): + rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, sale_line.order_id.user_id.id, time.strftime('%Y-%m-%d'), context=context) if rec: - inv_line_obj.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 sale_order_line() diff --git a/addons/account_analytic_default/account_analytic_default_view.xml b/addons/account_analytic_default/account_analytic_default_view.xml index b9f455d2231..5aad1f3521d 100644 --- a/addons/account_analytic_default/account_analytic_default_view.xml +++ b/addons/account_analytic_default/account_analytic_default_view.xml @@ -48,7 +48,7 @@ <field name="product_id"/> <field name="partner_id"/> <field name="user_id"/> - <field name="company_id"/> + <field name="company_id" widget="selection" groups="base.group_multi_company"/> </search> </field> </record> diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index e85275a9bba..0e3ec4b33ca 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -18,8 +18,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -from lxml import etree + import time +from lxml import etree from osv import fields, osv import tools @@ -34,10 +35,10 @@ class one2many_mod2(fields.one2many): res[id] = [] ids2 = None if 'journal_id' in context: - journal = obj.pool.get('account.journal').browse(cr, user, context['journal_id'], context) + journal = obj.pool.get('account.journal').browse(cr, user, context['journal_id'], context=context) pnum = int(name[7]) -1 plan = journal.plan_id - if plan and len(plan.plan_ids)>pnum: + if plan and len(plan.plan_ids) > pnum: acc_id = plan.plan_ids[pnum].root_analytic_id.id ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids),('analytic_account_id','child_of',[acc_id])], limit=self._limit) if ids2 is None: @@ -50,8 +51,8 @@ class account_analytic_plan(osv.osv): _name = "account.analytic.plan" _description = "Analytic Plan" _columns = { - 'name': fields.char('Analytic Plan', size=64, required=True, select=True,), - 'plan_ids': fields.one2many('account.analytic.plan.line','plan_id','Analytic Plans'), + 'name': fields.char('Analytic Plan', size=64, required=True, select=True), + 'plan_ids': fields.one2many('account.analytic.plan.line', 'plan_id', 'Analytic Plans'), } account_analytic_plan() @@ -61,10 +62,10 @@ class account_analytic_plan_line(osv.osv): _description = "Analytic Plan Line" _order = "sequence, id" _columns = { - 'plan_id':fields.many2one('account.analytic.plan','Analytic Plan'), + 'plan_id': fields.many2one('account.analytic.plan','Analytic Plan'), 'name': fields.char('Plan Name', size=64, required=True, select=True), - 'sequence':fields.integer('Sequence'), - 'root_analytic_id': fields.many2one('account.analytic.account','Root Account',help="Root account of this plan.",required=False), + 'sequence': fields.integer('Sequence'), + 'root_analytic_id': fields.many2one('account.analytic.account', 'Root Account', help="Root account of this plan.", required=False), 'min_required': fields.float('Minimum Allowed (%)'), 'max_required': fields.float('Maximum Allowed (%)'), } @@ -76,27 +77,28 @@ class account_analytic_plan_line(osv.osv): account_analytic_plan_line() class account_analytic_plan_instance(osv.osv): - _name = 'account.analytic.plan.instance' - _description = 'Analytic Plan Instance' + _name = "account.analytic.plan.instance" + _description = "Analytic Plan Instance" _columns = { - 'name':fields.char('Analytic Distribution', size=64), - 'code':fields.char('Distribution Code', size=16), + 'name': fields.char('Analytic Distribution', size=64), + 'code': fields.char('Distribution Code', size=16), 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal' ), - 'account_ids':fields.one2many('account.analytic.plan.instance.line', 'plan_id', 'Account Id'), - 'account1_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account1 Id'), - 'account2_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account2 Id'), - 'account3_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account3 Id'), - 'account4_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account4 Id'), - 'account5_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account5 Id'), - 'account6_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account6 Id'), - 'plan_id':fields.many2one('account.analytic.plan', "Model's Plan"), + 'account_ids': fields.one2many('account.analytic.plan.instance.line', 'plan_id', 'Account Id'), + 'account1_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account1 Id'), + 'account2_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account2 Id'), + 'account3_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account3 Id'), + 'account4_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account4 Id'), + 'account5_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account5 Id'), + 'account6_ids': one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account6 Id'), + 'plan_id': fields.many2one('account.analytic.plan', "Model's Plan"), } def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if context is None: context = {} + journal_obj = self.pool.get('account.journal') if context.get('journal_id', False): - journal = self.pool.get('account.journal').browse(cr, user, [context['journal_id']], context=context)[0] + journal = journal_obj.browse(cr, user, [context['journal_id']], context=context)[0] analytic_journal = journal.analytic_journal_id and journal.analytic_journal_id.id or False args.append('|') args.append(('journal_id', '=', analytic_journal)) @@ -108,15 +110,16 @@ class account_analytic_plan_instance(osv.osv): def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} - default.update({'account1_ids':False, 'account2_ids':False, 'account3_ids':False, + default.update({'account1_ids':False, 'account2_ids':False, 'account3_ids':False, 'account4_ids':False, 'account5_ids':False, 'account6_ids':False}) - return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context) + return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context=context) def _default_journal(self, cr, uid, context=None): if not context: context = {} + journal_obj = self.pool.get('account.journal') if context.has_key('journal_id') and context['journal_id']: - journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id']) + journal = journal_obj.browse(cr, uid, context['journal_id'], context=context) if journal.analytic_journal_id: return journal.analytic_journal_id.id return False @@ -127,7 +130,7 @@ class account_analytic_plan_instance(osv.osv): } def name_get(self, cr, uid, ids, context=None): res = [] - for inst in self.browse(cr, uid, ids, context): + for inst in self.browse(cr, uid, ids, context=context): name = inst.name or '/' if name and inst.code: name=name+' ('+inst.code+')' @@ -135,7 +138,7 @@ class account_analytic_plan_instance(osv.osv): return res def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): - args= args or [] + args = args or [] if name: ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context or {}) if not ids: @@ -145,15 +148,16 @@ class account_analytic_plan_instance(osv.osv): return self.name_get(cr, uid, ids, context or {}) def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): - wiz_id = self.pool.get('ir.actions.act_window').search(cr, uid, [("name","=","analytic.plan.create.model.action")]) + wiz_id = self.pool.get('ir.actions.act_window').search(cr, uid, [("name","=","analytic.plan.create.model.action")], context=context) res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) - + journal_obj = self.pool.get('account.journal') + analytic_plan_obj = self.pool.get('account.analytic.plan') if (res['type']=='form'): plan_id = False - if context.get('journal_id',False): - plan_id = self.pool.get('account.journal').browse(cr, uid, int(context['journal_id']), context).plan_id - elif context.get('plan_id',False): - plan_id = self.pool.get('account.analytic.plan').browse(cr, uid, int(context['plan_id']), context) + if context.get('journal_id', False): + plan_id = journal_obj.browse(cr, uid, int(context['journal_id']), context=context).plan_id + elif context.get('plan_id', False): + plan_id = analytic_plan_obj.browse(cr, uid, int(context['plan_id']), context=context) if plan_id: i=1 @@ -183,40 +187,43 @@ class account_analytic_plan_instance(osv.osv): return res def create(self, cr, uid, vals, context=None): + journal_obj = self.pool.get('account.journal') + ana_plan_instance_obj = self.pool.get('account.analytic.plan.instance') + acct_anal_acct = self.pool.get('account.analytic.account') + acct_anal_plan_line_obj = self.pool.get('account.analytic.plan.line') if context and 'journal_id' in context: - journal= self.pool.get('account.journal').browse(cr, uid, context['journal_id']) + journal = journal_obj.browse(cr, uid, context['journal_id'], context=context) - pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)]) + pids = ana_plan_instance_obj.search(cr, uid, [('name','=',vals['name']), ('code','=',vals['code']), ('plan_id','<>',False)], context=context) if pids: raise osv.except_osv(_('Error'), _('A model having this name and code already exists !')) - 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)]) + res = acct_anal_plan_line_obj.search(cr, uid, [('plan_id','=',journal.plan_id.id)], context=context) for i in res: total_per_plan = 0 - item = acct_anal_plan_line_obj.browse(cr, uid, i) - temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids'] + item = acct_anal_plan_line_obj.browse(cr, uid, i, context=context) + temp_list = ['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids'] for l in temp_list: if vals.has_key(l): for tempo in vals[l]: - if acct_anal_acct.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'])], context=context): total_per_plan += tempo[2]['rate'] 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))) - return super(account_analytic_plan_instance, self).create(cr, uid, vals, context) + return super(account_analytic_plan_instance, self).create(cr, uid, vals, context=context) def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): - this = self.browse(cr, uid, ids[0]) + this = self.browse(cr, uid, ids[0], context=context) + invoice_line_obj = self.pool.get('account.invoice.line') if this.plan_id and not vals.has_key('plan_id'): #this instance is a model, so we have to create a new plan instance instead of modifying it #copy the existing model - temp_id = self.copy(cr, uid, this.id, None, context) + temp_id = self.copy(cr, uid, this.id, None, context=context) #get the list of the invoice line that were linked to the model - list = self.pool.get('account.invoice.line').search(cr, uid, [('analytics_id','=',this.id)]) + lists = invoice_line_obj.search(cr, uid, [('analytics_id','=',this.id)], context=context) #make them link to the copy - self.pool.get('account.invoice.line').write(cr, uid, list, {'analytics_id':temp_id}, context) + invoice_line_obj.write(cr, uid, lists, {'analytics_id':temp_id}, context=context) #and finally modify the old model to be not a model anymore vals['plan_id'] = False @@ -224,25 +231,25 @@ class account_analytic_plan_instance(osv.osv): vals['name'] = this.name and (str(this.name)+'*') or "*" if not vals.has_key('code'): vals['code'] = this.code and (str(this.code)+'*') or "*" - return super(account_analytic_plan_instance, self).write(cr, uid, ids, vals, context) + return super(account_analytic_plan_instance, self).write(cr, uid, ids, vals, context=context) account_analytic_plan_instance() class account_analytic_plan_instance_line(osv.osv): - _name='account.analytic.plan.instance.line' - _description = 'Analytic Instance Line' - _columns={ - 'plan_id':fields.many2one('account.analytic.plan.instance', 'Plan Id'), - 'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=True), - 'rate':fields.float('Rate (%)', required=True), + _name = "account.analytic.plan.instance.line" + _description = "Analytic Instance Line" + _columns = { + 'plan_id': fields.many2one('account.analytic.plan.instance', 'Plan Id'), + 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True), + 'rate': fields.float('Rate (%)', required=True), } _defaults = { 'rate': 100.0 } def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] - reads = self.read(cr, uid, ids, ['analytic_account_id'], context) + reads = self.read(cr, uid, ids, ['analytic_account_id'], context=context) res = [] for record in reads: res.append((record['id'], record['analytic_account_id'])) @@ -251,44 +258,44 @@ class account_analytic_plan_instance_line(osv.osv): account_analytic_plan_instance_line() class account_journal(osv.osv): - _inherit='account.journal' - _name='account.journal' + _inherit = "account.journal" + _name = "account.journal" _columns = { - 'plan_id':fields.many2one('account.analytic.plan', 'Analytic Plans'), + 'plan_id': fields.many2one('account.analytic.plan', 'Analytic Plans'), } account_journal() class account_invoice_line(osv.osv): - _inherit='account.invoice.line' - _name='account.invoice.line' + _inherit = "account.invoice.line" + _name = "account.invoice.line" _columns = { - 'analytics_id':fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'), + 'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'), } def create(self, cr, uid, vals, context=None): - if 'analytics_id' in vals and isinstance(vals['analytics_id'],tuple): + if 'analytics_id' in vals and isinstance(vals['analytics_id'], tuple): vals['analytics_id'] = vals['analytics_id'][0] - return super(account_invoice_line, self).create(cr, uid, vals, context) + return super(account_invoice_line, self).create(cr, uid, vals, context=context) def move_line_get_item(self, cr, uid, line, context=None): - res= super(account_invoice_line,self).move_line_get_item(cr, uid, line, context={}) - res ['analytics_id']=line.analytics_id and line.analytics_id.id or False + res = super(account_invoice_line, self).move_line_get_item(cr, uid, line, context=context) + res ['analytics_id'] = line.analytics_id and line.analytics_id.id or False return res def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None): - res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context=context) - rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context) + res_prod = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context=context) + rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context=context) 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 account_invoice_line() class account_move_line(osv.osv): - _inherit='account.move.line' - _name='account.move.line' + _inherit = "account.move.line" + _name = "account.move.line" _columns = { 'analytics_id':fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'), } @@ -300,9 +307,9 @@ class account_move_line(osv.osv): return data def create_analytic_lines(self, cr, uid, ids, context=None): - super(account_move_line, self).create_analytic_lines(cr, uid, ids, context) + super(account_move_line, self).create_analytic_lines(cr, uid, ids, context=context) analytic_line_obj = self.pool.get('account.analytic.line') - for line in self.browse(cr, uid, ids, context): + for line in self.browse(cr, uid, ids, context=context): if line.analytics_id: if not line.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (line.journal_id.name,)) @@ -333,24 +340,25 @@ account_move_line() class account_invoice(osv.osv): _name = "account.invoice" - _inherit="account.invoice" + _inherit = "account.invoice" def line_get_convert(self, cr, uid, x, part, date, context=None): - res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context) - res['analytics_id']=x.get('analytics_id',False) + res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context=context) + res['analytics_id'] = x.get('analytics_id', False) return res def _get_analytic_lines(self, cr, uid, id): inv = self.browse(cr, uid, [id])[0] cur_obj = self.pool.get('res.currency') + invoice_line_obj = self.pool.get('account.invoice.line') + acct_ins_obj = self.pool.get('account.analytic.plan.instance') company_currency = inv.company_id.currency_id.id if inv.type in ('out_invoice', 'in_refund'): sign = 1 else: sign = -1 - iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id) - acct_ins_obj = self.pool.get('account.analytic.plan.instance') + iml = invoice_line_obj.move_line_get(cr, uid, inv.id) for il in iml: if il.get('analytics_id', False): @@ -369,8 +377,8 @@ class account_invoice(osv.osv): al_vals = { 'name': il['name'], 'date': inv['date_invoice'], - 'unit_amount':qtty, - 'product_id':il['product_id'], + 'unit_amount': qtty, + 'product_id': il['product_id'], 'account_id': line2.analytic_account_id.id, 'amount': amt, 'product_uom_id': il['uos_id'], @@ -378,7 +386,7 @@ class account_invoice(osv.osv): 'journal_id': self._get_journal_analytic(cr, uid, inv.type), 'ref': ref, } - il['analytic_lines'].append((0,0,al_vals)) + il['analytic_lines'].append((0, 0, al_vals)) return iml account_invoice() @@ -391,7 +399,7 @@ class account_analytic_plan(osv.osv): account_analytic_plan() class analytic_default(osv.osv): - _inherit = 'account.analytic.default' + _inherit = "account.analytic.default" _columns = { 'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'), } @@ -399,21 +407,20 @@ class analytic_default(osv.osv): analytic_default() class sale_order_line(osv.osv): - _inherit = 'sale.order.line' + _inherit = "sale.order.line" # Method overridden to set the analytic account by default on criterion match 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=context) + inv_line_obj = self.pool.get('account.invoice.line') + acct_anal_def_obj = self.pool.get('account.analytic.default') if ids: - sale_line = self.browse(cr, uid, ids[0], context) - inv_line_obj = self.pool.get('account.invoice.line') - acct_anal_def_obj = self.pool.get('account.analytic.default') - - for line in inv_line_obj.browse(cr, uid, create_ids, context): + sale_line = self.browse(cr, uid, ids[0], context=context) + for line in inv_line_obj.browse(cr, uid, create_ids, context=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: - inv_line_obj.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 sale_order_line() diff --git a/addons/account_analytic_plans/report/crossovered_analytic.py b/addons/account_analytic_plans/report/crossovered_analytic.py index f8a975a4c25..67b25ae6013 100644 --- a/addons/account_analytic_plans/report/crossovered_analytic.py +++ b/addons/account_analytic_plans/report/crossovered_analytic.py @@ -29,8 +29,8 @@ class crossovered_analytic(report_sxw.rml_parse): self.localcontext.update( { 'time': time, 'lines': self._lines, - 'ref_lines' : self._ref_lines, - 'find_children':self.find_children, + 'ref_lines': self._ref_lines, + 'find_children': self.find_children, }) self.base_amount = 0.00 @@ -39,11 +39,12 @@ class crossovered_analytic(report_sxw.rml_parse): final_list = [] parent_list = [] set_list = [] + analytic_obj = self.pool.get('account.analytic.account') for id in ref_ids: # to avoid duplicate entries if id not in to_return_ids: - to_return_ids.append(self.pool.get('account.analytic.account').search(self.cr,self.uid,[('parent_id','child_of',[id])])) - data_accnt = self.pool.get('account.analytic.account').browse(self.cr,self.uid,to_return_ids[0]) + to_return_ids.append(analytic_obj.search(self.cr,self.uid,[('parent_id','child_of',[id])])) + data_accnt = analytic_obj.browse(self.cr,self.uid,to_return_ids[0]) for data in data_accnt: if data.parent_id and data.parent_id.id == ref_ids[0]: parent_list.append(data.id) @@ -54,7 +55,7 @@ class crossovered_analytic(report_sxw.rml_parse): def set_account(self,cats): lst = [] - category = self.pool.get('account.analytic.account').read(self.cr,self.uid,cats) + category = self.pool.get('account.analytic.account').read(self.cr, self.uid, cats) for cat in category: lst.append(cat['id']) if cat['child_ids']: @@ -75,44 +76,44 @@ class crossovered_analytic(report_sxw.rml_parse): else: journal = 'is not null' - query_general = "select id from account_analytic_line where (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'" + query_general = "SELECT id FROM account_analytic_line WHERE (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'" self.cr.execute(query_general) - l_ids=self.cr.fetchall() + l_ids = self.cr.fetchall() line_ids = [x[0] for x in l_ids] obj_line = line_pool.browse(self.cr,self.uid,line_ids) #this structure will be usefull for easily knowing the account_analytic_line that are related to the reference account. At this purpose, we save the move_id of analytic lines. self.dict_acc_ref[form['ref']] = [] - children_list = self.pool.get('account.analytic.account').search(self.cr,self.uid,[('parent_id','child_of',[form['ref']])]) + children_list = acc_pool.search(self.cr, self.uid, [('parent_id', 'child_of', [form['ref']])]) for obj in obj_line: if obj.account_id.id in children_list: if obj.move_id and obj.move_id.id not in self.dict_acc_ref[form['ref']]: self.dict_acc_ref[form['ref']].append(obj.move_id.id) - res['ref_name'] = acc_pool.name_get(self.cr,self.uid,[form['ref']])[0][1] - res['ref_code'] = acc_pool.browse(self.cr,self.uid,form['ref']).code + res['ref_name'] = acc_pool.name_get(self.cr, self.uid, [form['ref']])[0][1] + res['ref_code'] = acc_pool.browse(self.cr, self.uid, form['ref']).code self.final_list = children_list - selected_ids = line_pool.search(self.cr,self.uid,[('account_id','in',self.final_list)]) + selected_ids = line_pool.search(self.cr, self.uid, [('account_id', 'in' ,self.final_list)]) if selected_ids: - query="SELECT sum(aal.amount) AS amt, sum(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \ - WHERE aal.account_id=aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'" - + query = "SELECT SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \ + WHERE aal.account_id = aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'" + self.cr.execute(query) info=self.cr.dictfetchall() - res['ref_qty']=info[0]['qty'] - res['ref_amt']=info[0]['amt'] - self.base_amount= info[0]['amt'] - res['ref_qty']=0.0 - res['ref_amt']=0.0 - self.base_amount= 0.0 + res['ref_qty'] = info[0]['qty'] + res['ref_amt'] = info[0]['amt'] + self.base_amount = info[0]['amt'] + res['ref_qty'] = 0.0 + res['ref_amt'] = 0.0 + self.base_amount = 0.0 result.append(res) return result - def _lines(self,form,ids={}): + def _lines(self, form, ids={}): if not ids: ids = self.ids @@ -122,43 +123,43 @@ class crossovered_analytic(report_sxw.rml_parse): journal= 'is not null' acc_pool = self.pool.get('account.analytic.account') - line_pool=self.pool.get('account.analytic.line') - acc_id=[] - final=[] - child_ids=[] - self.list_ids=[] + line_pool = self.pool.get('account.analytic.line') + acc_id = [] + final = [] + child_ids = [] + self.list_ids = [] self.final_list = self.find_children(ids) for acc_id in self.final_list: - selected_ids = line_pool.search(self.cr,self.uid,[('account_id','=',acc_id),('move_id','in',self.dict_acc_ref[form['ref']])]) + selected_ids = line_pool.search(self.cr, self.uid, [('account_id','=',acc_id), ('move_id', 'in', self.dict_acc_ref[form['ref']])]) if selected_ids: - query="SELECT aaa.code as code , sum(aal.amount) AS amt, sum(aal.unit_amount) AS qty,aaa.name as acc_name,aal.account_id as id FROM account_analytic_line AS aal, account_analytic_account AS aaa \ + query="SELECT aaa.code AS code, SUM(aal.amount) AS amt, SUM(aal.unit_amount) AS qty, aaa.name AS acc_name, aal.account_id AS id FROM account_analytic_line AS aal, account_analytic_account AS aaa \ WHERE aal.account_id=aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"" GROUP BY aal.account_id,aaa.name,aaa.code ORDER BY aal.account_id" self.cr.execute(query) res = self.cr.dictfetchall() if res: for element in res: - if self.base_amount<>0.00: - element['perc']= (element['amt'] / self.base_amount) * 100.00 + if self.base_amount <> 0.00: + element['perc'] = (element['amt'] / self.base_amount) * 100.00 else: - element['perc']=0.00 + element['perc'] = 0.00 else: - result={} - res=[] - result['id']=acc_id - data_account = acc_pool.browse(self.cr,self.uid,acc_id) - result['acc_name']=data_account.name + result = {} + res = [] + result['id'] = acc_id + data_account = acc_pool.browse(self.cr, self.uid, acc_id) + result['acc_name'] = data_account.name result['code'] = data_account.code - result['amt']=result['qty']=result['perc']=0.00 + result['amt'] = result['qty'] = result['perc'] = 0.00 if not form['empty_line']: res.append(result) else: result = {} res = [] result['id'] = acc_id - data_account = acc_pool.browse(self.cr,self.uid,acc_id) + data_account = acc_pool.browse(self.cr, self.uid, acc_id) result['acc_name'] = data_account.name result['code'] = data_account.code result['amt'] = result['qty'] = result['perc'] = 0.00 diff --git a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py index 97df80e23fc..2b36fec2cc9 100644 --- a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py +++ b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py @@ -18,37 +18,38 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## + import time from osv import osv, fields from tools.translate import _ class account_crossovered_analytic(osv.osv_memory): - _name = 'account.crossovered.analytic' - _description = 'Print Crossovered Analytic' + _name = "account.crossovered.analytic" + _description = "Print Crossovered Analytic" _columns = { 'date1': fields.date('Start Date', required=True), 'date2': fields.date('End Date', required=True), 'journal_ids': fields.many2many('account.analytic.journal', 'crossovered_journal_rel', 'crossover_id', 'journal_id', 'Analytic Journal'), 'ref': fields.many2one('account.analytic.account', 'Analytic Account Reference', required=False), 'empty_line': fields.boolean('Dont show empty lines'), - } + } _defaults = { - 'date1': lambda *a: time.strftime('%Y-01-01'), - 'date2': lambda *a: time.strftime('%Y-%m-%d'), - } + 'date1': time.strftime('%Y-01-01'), + 'date2': time.strftime('%Y-%m-%d'), + } def print_report(self, cr, uid, ids, context=None): - cr.execute('select account_id from account_analytic_line') + cr.execute('SELECT account_id FROM account_analytic_line') res = cr.fetchall() acc_ids = [x[0] for x in res] data = self.read(cr, uid, ids, [], context=context)[0] - obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref']) + obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context) name = obj_acc.name - account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])]) + account_ids = self.pool.get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['ref']])], context=context) flag = True for acc in account_ids: @@ -62,12 +63,12 @@ class account_crossovered_analytic(osv.osv_memory): 'ids': [], 'model': 'account.analytic.account', 'form': data - } + } return { 'type': 'ir.actions.report.xml', 'report_name': 'account.analytic.account.crossovered.analytic', 'datas': datas, - } + } account_crossovered_analytic() diff --git a/addons/account_analytic_plans/wizard/analytic_plan_create_model.py b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py index dc108d1700a..777421798cd 100644 --- a/addons/account_analytic_plans/wizard/analytic_plan_create_model.py +++ b/addons/account_analytic_plans/wizard/analytic_plan_create_model.py @@ -18,24 +18,26 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## + from osv import osv from tools.translate import _ class analytic_plan_create_model(osv.osv_memory): - _name = 'analytic.plan.create.model' - _description = 'analytic.plan.create.model' + _name = "analytic.plan.create.model" + _description = "analytic.plan.create.model" def activate(self, cr, uid, ids, context=None): plan_obj = self.pool.get('account.analytic.plan.instance') mod_obj = self.pool.get('ir.model.data') + anlytic_plan_obj = self.pool.get('account.analytic.plan') if 'active_id' in context and context['active_id']: plan = plan_obj.browse(cr, uid, context['active_id'], context=context) if (not plan.name) or (not plan.code): raise osv.except_osv(_('Error'), _('Please put a name and a code before saving the model !')) - pids = self.pool.get('account.analytic.plan').search(cr, uid, [], context=context) - if (not pids): + pids = anlytic_plan_obj.search(cr, uid, [], context=context) + if not pids: raise osv.except_osv(_('Error'), _('No analytic plan defined !')) - plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]}) + plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]}, context=context) model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml index d6c4b82e960..a1aeb93252c 100644 --- a/addons/account_budget/account_budget_view.xml +++ b/addons/account_budget/account_budget_view.xml @@ -147,10 +147,10 @@ </field> <field name="state" select="1"/> <group col="4" colspan="2"> + <button string="Cancel" name="cancel" states="confirm,validate" type="workflow" icon="gtk-cancel"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-apply" /> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-ok"/> <button string="Done" name="done" states="validate" type="workflow" icon="gtk-jump-to" /> - <button string="Cancel" name="cancel" states="confirm,validate" type="workflow" icon="gtk-cancel"/> <button name="draft" states="cancel" string="Reset to Draft" type="workflow" icon="terp-stock_effects-object-colorize"/> </group> diff --git a/addons/account_budget/report/analytic_account_budget_report.rml b/addons/account_budget/report/analytic_account_budget_report.rml index ea800685470..10b54482ae7 100644 --- a/addons/account_budget/report/analytic_account_budget_report.rml +++ b/addons/account_budget/report/analytic_account_budget_report.rml @@ -128,16 +128,16 @@ <para style="terp_tblheader_Details">Description</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Theoretical Amount </para> + <para style="terp_tblheader_General_Right">Theoretical Amt </para> </td> <td> - <para style="terp_tblheader_Details_Centre">Planned Amount</para> + <para style="terp_tblheader_General_Right">Planned Amt</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Practical Amount</para> + <para style="terp_tblheader_General_Right">Practical Amt</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Perc(%)</para> + <para style="terp_tblheader_General_Right">Perc(%)</para> </td> </tr> </blockTable> @@ -166,7 +166,7 @@ <blockTable colWidths="202.0,75.0,75.0,78.0,52.0" style="Table5"> <tr> <td> - <para style="terp_default_Bold_9">[[ repeatIn(funct_total(data['form']),'b') ]] Total([[ company.currency_id.code ]]) :</para> + <para style="terp_default_Bold_9">[[ repeatIn(funct_total(data['form']),'b') ]] Total:</para> </td> <td> <para style="terp_default_Bold_right_9">[[ formatLang(b['tot_theo']) ]] [[ company.currency_id.symbol ]]</para> diff --git a/addons/account_budget/report/budget_report.rml b/addons/account_budget/report/budget_report.rml index cd12f60108d..577e03af9f4 100644 --- a/addons/account_budget/report/budget_report.rml +++ b/addons/account_budget/report/budget_report.rml @@ -161,13 +161,6 @@ <para style="Standard"> <font color="white"> </font> </para> - <para style="Standard"> - <font color="white"> </font> - </para> - <para style="P10">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para> - <para style="P1"> - <font color="white"> </font> - </para> <para style="P1"> <font color="white"> </font> </para> @@ -180,19 +173,19 @@ <para style="P13">A/c No.</para> </td> <td> - <para style="P13">Budget</para> + <para style="terp_tblheader_Details_Right">Budget</para> </td> <td> - <para style="P13">Period Budget</para> + <para style="terp_tblheader_Details_Right">Period Budget</para> </td> <td> - <para style="P13">Performance</para> + <para style="terp_tblheader_Details_Right">Performance</para> </td> <td> - <para style="P13">Spread</para> + <para style="terp_tblheader_Details_Right">Spread</para> </td> <td> - <para style="P13">% performance</para> + <para style="terp_tblheader_Details_Right">% performance</para> </td> </tr> </blockTable> diff --git a/addons/account_budget/report/crossovered_budget_report.rml b/addons/account_budget/report/crossovered_budget_report.rml index e297c8b3ca2..0533042822a 100644 --- a/addons/account_budget/report/crossovered_budget_report.rml +++ b/addons/account_budget/report/crossovered_budget_report.rml @@ -127,16 +127,16 @@ <para style="terp_tblheader_Details">Description</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Theoretical Amount</para> + <para style="terp_tblheader_Details_Right">Theoretical Amt</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Planned Amount</para> + <para style="terp_tblheader_Details_Right">Planned Amt</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Practical Amount</para> + <para style="terp_tblheader_Details_Right">Practical Amt</para> </td> <td> - <para style="terp_tblheader_Details_Centre">Perc(%)</para> + <para style="terp_tblheader_Details_Right">Perc(%)</para> </td> </tr> </blockTable> diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index 02986acb184..5bbfe80cc24 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -32,7 +32,7 @@ class followup(osv.osv): } _defaults = { 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c), - } + } followup() @@ -46,7 +46,7 @@ class followup_line(osv.osv): 'start': fields.selection([('days','Net Days'),('end_of_month','End of Month')], 'Type of Term', size=64, required=True), 'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"), 'description': fields.text('Printed Message', translate=True), - } + } followup_line() @@ -62,12 +62,12 @@ account_move_line() class res_company(osv.osv): _inherit = "res.company" _columns = { - 'follow_up_msg' : fields.text('Follow-up Message', translate=True), - } + 'follow_up_msg': fields.text('Follow-up Message', translate=True), + } _defaults = { 'overdue_msg': ''' -Date : %(date)s +Date: %(date)s Dear %(partner_name)s, @@ -80,7 +80,7 @@ Thanks, %(user_signature)s %(company_name)s ''' - } + } res_company() diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml index bbc3a8400a4..111870aa33b 100644 --- a/addons/account_followup/account_followup_view.xml +++ b/addons/account_followup/account_followup_view.xml @@ -73,7 +73,8 @@ <search string="Search Followup"> <group col="10" colspan="4"> <field name="name"/> - </group> + <field name="company_id" groups="base.group_multi_company"/> + </group> </search> </field> </record> diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index fe635a080c7..be353220e99 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -61,12 +61,12 @@ class account_followup_print(osv.osv_memory): 'views': [(resource_id,'form')], 'type': 'ir.actions.act_window', 'target': 'new', - } + } _defaults = { 'date': time.strftime('%Y-%m-%d'), 'followup_id': _get_followup, - } + } account_followup_print() @@ -80,7 +80,7 @@ class account_followup_print_all(osv.osv_memory): 'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'), 'email_body': fields.text('Email body'), 'summary': fields.text('Summary', required=True, readonly=True) - } + } def _get_summary(self, cr, uid, context=None): if context is None: context = {} @@ -285,14 +285,14 @@ class account_followup_print_all(osv.osv_memory): 'ids': [], 'model': 'account_followup.followup', 'form': data - } + } return { 'type': 'ir.actions.report.xml', 'report_name': 'account_followup.followup.print', 'datas': datas, - } + } account_followup_print_all() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_invoice_layout/account_invoice_layout_view.xml b/addons/account_invoice_layout/account_invoice_layout_view.xml index fdd4fa0781f..c9d3e32e892 100644 --- a/addons/account_invoice_layout/account_invoice_layout_view.xml +++ b/addons/account_invoice_layout/account_invoice_layout_view.xml @@ -75,7 +75,8 @@ <separator string="Write a notification or a wishful message." colspan="4"/> <field name="name" select="1" colspan="2" /> <newline/> - <field name="msg" select="1" colspan="2"/> + <separator string="Special Message" colspan="4"/> + <field name="msg" select="1" nolabel="1" colspan="2"/> </form> </field> </record> diff --git a/addons/account_payment/__init__.py b/addons/account_payment/__init__.py index 82a05aa73e9..6188de6a9da 100644 --- a/addons/account_payment/__init__.py +++ b/addons/account_payment/__init__.py @@ -29,4 +29,4 @@ import account_move_line import account_invoice import report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index be0ca2a127b..7ccafd90eb4 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -28,9 +28,9 @@ "depends": ["account"], "init_xml": [], "description": """ - This module provides : - * a more efficient way to manage invoice payment. - * a basic mechanism to easily plug various automated payment. +This module provides : +* a more efficient way to manage invoice payment. +* a basic mechanism to easily plug various automated payment. """, 'author': 'OpenERP SA', 'depends': ['account_voucher'], diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py index 3f9b6c4b094..2b9ea22d824 100644 --- a/addons/account_payment/account_move_line.py +++ b/addons/account_payment/account_move_line.py @@ -47,7 +47,7 @@ class account_move_line(osv.osv): return r def _to_pay_search(self, cr, uid, obj, name, args, context): - if not len(args): + if not args: return [] line_obj = self.pool.get('account.move.line') query = line_obj._query_get(cr, uid, context={}) @@ -63,17 +63,17 @@ class account_move_line(osv.osv): ) %(operator)s %%s ''' % {'operator': x[1]}, args)) sql_args = tuple(map(itemgetter(2), args)) - cr.execute(('''select id - from account_move_line l - where account_id in (select id - from account_account - where type=%s and active) - and reconcile_id is null - and credit > 0 - and ''' + where + ' and ' + query), ('payable',)+sql_args ) + cr.execute(('''SELECT id + FROM account_move_line l + WHERE account_id IN (select id + FROM account_account + WHERE type=%s AND active) + AND reconcile_id IS null + AND credit > 0 + AND ''' + where + ' and ' + query), ('payable',)+sql_args ) res = cr.fetchall() - if not len(res): + if not res: return [('id','=','0')] return [('id','in',map(lambda x:x[0], res))] @@ -110,7 +110,7 @@ class account_move_line(osv.osv): return line2bank _columns = { - 'amount_to_pay' : fields.function(amount_to_pay, method=True, + 'amount_to_pay': fields.function(amount_to_pay, method=True, type='float', string='Amount to pay', fnct_search=_to_pay_search), } diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 1c0596ddf96..a70e8fb75c3 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -18,6 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## + import time from osv import osv, fields @@ -118,11 +119,10 @@ class payment_order(osv.osv): self.write(cr, uid, order['id'],{'reference':reference}) return True - def set_done(self, cr, uid, id, *args): - self.write(cr,uid,id,{'date_done': time.strftime('%Y-%m-%d'), - 'state': 'done',}) + def set_done(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'payment.order', id, 'done', cr) + self.write(cr, uid, ids, {'date_done': time.strftime('%Y-%m-%d')}) + wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr) return True def copy(self, cr, uid, id, default={}, context=None): @@ -162,7 +162,6 @@ class payment_line(osv.osv): _name = 'payment.line' _description = 'Payment Line' - def translate(self, orig): return { "due_date": "date_maturity", @@ -330,14 +329,14 @@ class payment_line(osv.osv): 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'), 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'), 'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"), - 'create_date': fields.datetime('Created' , readonly=True), + 'create_date': fields.datetime('Created', readonly=True), 'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True), 'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line') } _defaults = { 'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence' ).get(cursor, user, 'payment.line'), - 'state': lambda *args: 'normal', + 'state': 'normal', 'currency': _get_currency, 'company_currency': _get_currency, 'date': _get_date, @@ -438,5 +437,4 @@ class payment_line(osv.osv): payment_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_payment/account_payment_view.xml b/addons/account_payment/account_payment_view.xml index e9238ec62f9..915da5c0f27 100644 --- a/addons/account_payment/account_payment_view.xml +++ b/addons/account_payment/account_payment_view.xml @@ -40,6 +40,23 @@ <menuitem id="menu_main_payment" name="Payment" parent="account.menu_finance" sequence="6"/> + <record id="view_payment_mode_search" model="ir.ui.view"> + <field name="name">payment.mode.search</field> + <field name="model">payment.mode</field> + <field name="type">search</field> + <field name="arch" type="xml"> + <form string="Payment Mode"> + <field name="name"/> + <field name="journal" widget='selection'/> + <field name="company_id" widget='selection' groups="base.group_multi_company"/> + <newline/> + <group expand="0" string="Group By..."> + <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal'}"/> + </group> + </form> + </field> + </record> + <record id="view_payment_mode_tree" model="ir.ui.view"> <field name="name">payment.mode.tree</field> <field name="model">payment.mode</field> @@ -52,6 +69,7 @@ </tree> </field> </record> + <record id="view_payment_mode_form" model="ir.ui.view"> <field name="name">payment.mode.form</field> <field name="model">payment.mode</field> @@ -69,7 +87,8 @@ <field name="name">Payment Mode</field> <field name="res_model">payment.mode</field> <field name="view_type">form</field> - <field name="view_mode">tree,form</field> + <field name="view_mode">tree,form,search</field> + <field name="search_view_id" ref="view_payment_mode_search"/> </record> <menuitem action="action_payment_mode_form" id="menu_action_payment_mode_form" parent="account.menu_configuration_misc"/> @@ -142,7 +161,7 @@ <group col="4" colspan="2"> <button name="cancel" states="draft,open" string="Cancel" icon="gtk-cancel"/> <button name="open" states="draft" string="Confirm Payments" icon="gtk-apply"/> - <button name="%(action_account_payment_make_payment)d" states="open" string="Make Payments" type="action" icon="gtk-execute"/> + <button name="set_done" states="open" string="Make Payments" type="object" icon="gtk-execute"/> <button name="set_to_draft" states="cancel" string="Set to draft" type="object" icon="gtk-convert"/> </group> </form> @@ -165,7 +184,7 @@ <field name="state"/> <button name="cancel" states="draft,open" string="Cancel" icon="gtk-cancel"/> <button name="open" states="draft" string="Confirm Payments" icon="gtk-apply"/> - <button name="%(action_account_payment_make_payment)d" states="open" string="Make Payments" type="action" icon="gtk-execute"/> + <button name="set_done" states="open" string="Make Payments" type ="object" icon="gtk-execute"/> </tree> </field> </record> @@ -241,7 +260,6 @@ <field name="state"/> </page> <page string="Information"> - <separator colspan="4" string="General Information"/> <group colspan="2"> <field name="amount" select="1"/> diff --git a/addons/account_payment/account_payment_workflow.xml b/addons/account_payment/account_payment_workflow.xml index dd7aa2d4933..06ba7b83f70 100644 --- a/addons/account_payment/account_payment_workflow.xml +++ b/addons/account_payment/account_payment_workflow.xml @@ -24,6 +24,8 @@ write({'state':'open'})</field> <record id="act_done" model="workflow.activity"> <field name="name">done</field> <field name="wkf_id" ref="wkf_payment_order"/> + <field name="action">write({'state':'done'})</field> + <field name="kind">function</field> <field name="flow_stop">True</field> </record> <record id="act_cancel" model="workflow.activity"> @@ -33,14 +35,14 @@ write({'state':'open'})</field> <field name="kind">function</field> <field name="flow_stop">True</field> </record> - + <!-- Transition --> <record id="trans_draft_open" model="workflow.transition"> <field name="act_from" ref="act_draft"/> <field name="act_to" ref="act_open"/> <field name="signal">open</field> </record> - + <record id="trans_open_done" model="workflow.transition"> <field name="act_from" ref="act_open"/> <field name="act_to" ref="act_done"/> @@ -56,6 +58,6 @@ write({'state':'open'})</field> <field name="act_to" ref="act_cancel"/> <field name="signal">cancel</field> </record> - + </data> </openerp> diff --git a/addons/account_payment/report/__init__.py b/addons/account_payment/report/__init__.py index 5a5c1dab1f2..e9d7f4013ac 100644 --- a/addons/account_payment/report/__init__.py +++ b/addons/account_payment/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # @@ -15,9 +15,9 @@ # 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/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import payment_order -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py index a00c7a7871b..e0b0713c614 100644 --- a/addons/account_payment/report/payment_order.py +++ b/addons/account_payment/report/payment_order.py @@ -31,11 +31,11 @@ class payment_order(report_sxw.rml_parse): self.localcontext.update( { 'time': time, 'get_invoice_name': self._get_invoice_name, - 'get_company_currency' : self._get_company_currency, - 'get_company_currency_symbol': self._get_company_currency_symbol, - 'get_amount_total_in_currency' : self._get_amount_total_in_currency, - 'get_amount_total' : self._get_amount_total, - 'get_account_name' : self._get_account_name, + 'get_company_currency': self._get_company_currency, + 'get_company_currency_symbol': self._get_company_currency_symbol, + 'get_amount_total_in_currency': self._get_amount_total_in_currency, + 'get_amount_total': self._get_amount_total, + 'get_account_name': self._get_account_name, }) def _get_invoice_name(self, invoice_id): @@ -87,4 +87,4 @@ class payment_order(report_sxw.rml_parse): report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="external") -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index 97a66e937ca..4a070f05a27 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -28,7 +28,7 @@ class payment_order_create(osv.osv_memory): Create a payment object with lines corresponding to the account move line to pay according to the date and the mode provided by the user. Hypothesis: - - Small number of non-reconcilied move line , payment mode and bank account type, + - Small number of non-reconcilied move line, payment mode and bank account type, - Big number of partner and bank account. If a type is given, unsuitable account Entry lines are ignored. diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py index 49858151670..09ea68e7d30 100644 --- a/addons/account_payment/wizard/account_payment_pay.py +++ b/addons/account_payment/wizard/account_payment_pay.py @@ -21,8 +21,8 @@ from osv import fields, osv class account_payment_make_payment(osv.osv_memory): - _name = 'account.payment.make.payment' - _description = 'Account make payment' + _name = "account.payment.make.payment" + _description = "Account make payment" def launch_wizard(self, cr, uid, ids, context=None): """ @@ -33,10 +33,10 @@ class account_payment_make_payment(osv.osv_memory): # obj_model = self.pool.get('ir.model.data') # obj_act = self.pool.get('ir.actions.act_window') # order = obj_payment_order.browse(cr, uid, context['active_id'], context) - obj_payment_order.set_done(cr, uid, context['active_id'], context) + obj_payment_order.set_done(cr, uid, [context['active_id']], context) return {} # t = order.mode and order.mode.type.code or 'manual' -# if t == 'manual' : +# if t == 'manual': # obj_payment_order.set_done(cr,uid,context['active_id'],context) # return {} # diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 53c9f14b6e8..7697d4eea6d 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -77,13 +77,13 @@ class account_payment_populate_statement(osv.osv_memory): if line.partner_id: # line['partner_id'] = mv.partner_id.id - if amount < 0 : + if amount < 0: account = line.partner_id.property_account_payable.id - else : + else: account = line.partner_id.property_account_receivable.id if line.move_line_id: - voucher_res = { 'type': 'payment' , + voucher_res = { 'type': 'payment', 'name': line.name, 'partner_id': line.partner_id.id, 'journal_id': statement.journal_id.id, diff --git a/addons/account_report/account.py b/addons/account_report/account.py index 6e5fbc94026..d95306403a6 100644 --- a/addons/account_report/account.py +++ b/addons/account_report/account.py @@ -32,18 +32,18 @@ class account_report(osv.osv): _description = "Account Reporting" def _amount_get(self, cr, uid, ids, field_name, arg, context={}): - obj_fy=self.pool.get('account.fiscalyear') - obj_period=self.pool.get('account.period') + obj_fy = self.pool.get('account.fiscalyear') + obj_period = self.pool.get('account.period') - def _calc_context(key,obj): - if key==0: + def _calc_context(key, obj): + if key == 0: return obj.find(cr, uid, exception=False) else: - obj_key=obj.browse(cr, uid, obj.find(cr, uid, exception=False)) - if isinstance(obj_key,list): - obj_key=obj_key[0] - key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)]) - if len(key_ids)<abs(key): + obj_key = obj.browse(cr, uid, obj.find(cr, uid, exception=False)) + if isinstance(obj_key, list): + obj_key = obj_key[0] + key_ids = obj.search(cr, uid, [('date_stop','<',obj_key.date_start)]) + if len(key_ids) < abs(key): return False return key_ids[key] @@ -53,18 +53,18 @@ class account_report(osv.osv): del context['fiscalyear'] acc = self.pool.get('account.account') acc_id = acc.search(cr, uid, [('code','in',code)]) - return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0) + return reduce(lambda y, x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0) - def _calc_debit(code,year=0): - context['fiscalyear']=_calc_context(year, obj_fy) + def _calc_debit(code, year=0): + context['fiscalyear'] = _calc_context(year, obj_fy) if not context['fiscalyear']: del context['fiscalyear'] acc = self.pool.get('account.account') acc_id = acc.search(cr, uid, [('code','in',code)]) - return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0) + return reduce(lambda y, x=0: x.debit+y, acc.browse(cr, uid, acc_id, context), 0.0) - def _calc_balance(code,year=0): - context['fiscalyear']=_calc_context(year, obj_fy) + def _calc_balance(code, year=0): + context['fiscalyear'] = _calc_context(year, obj_fy) if not context['fiscalyear']: del context['fiscalyear'] acc = self.pool.get('account.account') @@ -72,21 +72,21 @@ class account_report(osv.osv): for c in code: for i in c.split('-'): account_ids += acc.search(cr, uid, [('code', 'ilike', i)]) - return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, account_ids, context),0.0) + return reduce(lambda y, x=0: x.balance+y, acc.browse(cr, uid, account_ids, context), 0.0) def _calc_report(*code): acc = self.pool.get('account.report.report') - acc_id = acc.search(cr, uid, [('code','in',code)]) - return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0) + acc_id = acc.search(cr, uid, [('code', 'in', code)]) + return reduce(lambda y, x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0) - def _calc_tax_code(code,period=0): - context['period_id']=_calc_context(period, obj_period) + def _calc_tax_code(code, period=0): + context['period_id'] = _calc_context(period, obj_period) if not context['period_id']: return 0.00 - context['period_id']=context['period_id'][0] + context['period_id'] = context['period_id'][0] acc = self.pool.get('account.tax.code') - acc_id = acc.search(cr, uid, [('code','in',code)]) - return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0.0) + acc_id = acc.search(cr, uid, [('code', 'in', code)]) + return reduce(lambda y, x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context), 0.0) result = {} for rep in self.browse(cr, uid, ids, context): objdict = { @@ -97,18 +97,18 @@ class account_report(osv.osv): 'tax_code': _calc_tax_code, } try: - val = eval(getattr(rep,'expression'), objdict) + val = eval(getattr(rep, 'expression'), objdict) except: val = 0.0 - if field_name=='status': - if val<rep.badness_limit: + if field_name == 'status': + if val < rep.badness_limit: result[rep.id] = 'very bad' - elif val==rep.badness_limit: + elif val == rep.badness_limit: result[rep.id] = 'bad' elif val<rep.goodness_limit: result[rep.id] = 'normal' - elif val==rep.goodness_limit: + elif val == rep.goodness_limit: result[rep.id] = 'good' else: result[rep.id] = 'very good' @@ -117,10 +117,10 @@ class account_report(osv.osv): return result def onchange_parent_id(self, cr, uid, ids, parent_id): - v={} + v = {} if parent_id: - acc=self.pool.get('account.report.report').browse(cr, uid, parent_id) - v['type']=acc.type + acc = self.pool.get('account.report.report').browse(cr, uid, parent_id) + v['type'] = acc.type return {'value': v} _columns = { @@ -135,8 +135,8 @@ class account_report(osv.osv): ('other','Others')], 'Type', required=True), 'expression': fields.char('Expression', size=240, required=True), - 'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2), help='This Value sets the limit of badness.'), - 'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2), help='This Value sets the limit of goodness.'), + 'badness_limit': fields.float('Badness Indicator Limit', digits=(16,2), help='This Value sets the limit of badness.'), + 'goodness_limit': fields.float('Goodness Indicator Limit', digits=(16,2), help='This Value sets the limit of goodness.'), 'parent_id': fields.many2one('account.report.report', 'Parent'), 'child_ids': fields.one2many('account.report.report', 'parent_id', 'Children'), 'note': fields.text('Note'), @@ -152,8 +152,8 @@ class account_report(osv.osv): ('very good', 'Very Good') ], string='Status'), - 'disp_tree':fields.boolean('Display Tree', help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'), - 'disp_graph':fields.boolean('Display As Graph', help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'), + 'disp_tree': fields.boolean('Display Tree', help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'), + 'disp_graph': fields.boolean('Display As Graph', help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'), } _defaults = { 'active': lambda *args: True, @@ -162,9 +162,9 @@ class account_report(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if not args: - args=[] + args = [] if not context: - context={} + context = {} ids = [] if name: ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context) @@ -183,12 +183,12 @@ account_report() class account_report_history(osv.osv): def _calc_value(self, cr, uid, ids, name, args, context): - acc_report_id=self.read(cr, uid, ids, ['tmp','period_id']) - tmp_ids={} + acc_report_id = self.read(cr, uid, ids, ['tmp','period_id']) + tmp_ids = {} for a in acc_report_id: - period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [a['period_id'][0]])[0] - period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr, uid, [('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])]) - tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr, uid, [a['tmp']], context={'periods':period_id})[0]['amount'] + period_val = pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [a['period_id'][0]])[0] + period_id = pooler.get_pool(cr.dbname).get('account.period').search(cr, uid, [('date_start', '<=', period_val['date_start']),('fiscalyear_id', '=', period_val['fiscalyear_id'][0])]) + tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr, uid, [a['tmp']], context={'periods': period_id})[0]['amount'] return tmp_ids _name = "account.report.history" @@ -197,11 +197,11 @@ class account_report_history(osv.osv): _auto = False _order='name' _columns = { - 'period_id': fields.many2one('account.period','Period', readonly=True, select=True), - 'fiscalyear_id': fields.many2one('account.fiscalyear','Fiscal Year', readonly=True, select=True), - 'name': fields.many2one('account.report.report','Indicator', readonly=True, select=True), + 'period_id': fields.many2one('account.period', 'Period', readonly=True, select=True), + 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', readonly=True, select=True), + 'name': fields.many2one('account.report.report', 'Indicator', readonly=True, select=True), 'val': fields.function(_calc_value, method=True, string='Value', readonly=True), - 'tmp' : fields.integer(string='temp',readonly=True) + 'tmp' : fields.integer(string='temp', readonly=True) } def init(self, cr): diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 912a7864862..25997a2e0eb 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -29,8 +29,9 @@ from tools.translate import _ class account_move_line(osv.osv): _inherit = 'account.move.line' + def _unreconciled(self, cr, uid, ids, prop, unknow_none, context): - res={} + res = {} for line in self.browse(cr, uid, ids, context=context): res[line.id] = line.debit - line.credit if line.reconcile_partial_id: @@ -43,9 +44,11 @@ class account_move_line(osv.osv): _columns = { 'amount_unreconciled': fields.function(_unreconciled, method=True, string='Unreconciled Amount'), } + account_move_line() class account_voucher(osv.osv): + def _get_type(self, cr, uid, ids, context={}): return context.get('type', False) @@ -92,7 +95,7 @@ class account_voucher(osv.osv): journal_id = context.get('journal_id', False) if journal_id: journal = journal_pool.browse(cr, uid, journal_id) - currency_id = journal.company_id.currency_id.id +# currency_id = journal.company_id.currency_id.id if journal.currency: return journal.currency.id return False @@ -112,15 +115,15 @@ class account_voucher(osv.osv): return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')] def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): - if not view_id and context.get('invoice_type',False): + if not view_id and context.get('invoice_type', False): mod_obj = self.pool.get('ir.model.data') - if context.get('invoice_type') in ('out_invoice','out_refund'): + if context.get('invoice_type') in ('out_invoice', 'out_refund'): result = mod_obj._get_id(cr, uid, 'account_voucher', 'view_vendor_receipt_form') else: result = mod_obj._get_id(cr, uid, 'account_voucher', 'view_vendor_payment_form') result = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id'] view_id = result - res = super(account_voucher,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) + res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) nodes = doc.xpath("//field[@name='partner_id']") if context.get('type', 'sale') in ('purchase', 'payment'): @@ -223,7 +226,7 @@ class account_voucher(osv.osv): total_tax = 0.0 if not tax[0].price_include: - for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]): + for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []): total_tax += tax_line.get('amount', 0.0) total += total_tax else: @@ -231,7 +234,7 @@ class account_voucher(osv.osv): line_total = 0.0 line_tax = 0.0 - for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]): + for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []): line_tax += tax_line.get('amount', 0.0) line_total += tax_line.get('price_unit') total_tax += line_tax @@ -246,8 +249,8 @@ class account_voucher(osv.osv): partner_pool = self.pool.get('res.partner') position_pool = self.pool.get('account.fiscal.position') res = { - 'tax_amount':False, - 'amount':False, + 'tax_amount': False, + 'amount': False, } voucher_total = 0.0 voucher_line_ids = [] @@ -271,7 +274,7 @@ class account_voucher(osv.osv): tax = tax_pool.browse(cr, uid, taxes) if not tax[0].price_include: - for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]): + for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []): total_tax += tax_line.get('amount') total += total_tax @@ -371,7 +374,7 @@ class account_voucher(osv.osv): return default if not partner_id and ids: - line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])]) + line_ids = line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) if line_ids: line_pool.unlink(cr, uid, line_ids) return default @@ -402,7 +405,7 @@ class account_voucher(osv.osv): account_type = 'receivable' if not context.get('move_line_ids', False): - ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) + ids = move_line_pool.search(cr, uid, [('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context) else: ids = context['move_line_ids'] ids.reverse() @@ -469,7 +472,7 @@ class account_voucher(osv.osv): @return: Returns a dict which contains new values, and context """ period_pool = self.pool.get('account.period') - pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)]) + pids = period_pool.search(cr, user, [('date_start', '<=', date), ('date_stop', '>=', date)]) if not pids: return {} return { @@ -685,13 +688,13 @@ class account_voucher(osv.osv): if not self.pool.get('res.currency').is_zero(cr, uid, inv.currency_id, line_total): diff = line_total move_line = { - 'name':name, - 'account_id':False, - 'move_id':move_id , - 'partner_id':inv.partner_id.id, - 'date':inv.date, - 'credit':diff>0 and diff or 0.0, - 'debit':diff<0 and -diff or 0.0, + 'name': name, + 'account_id': False, + 'move_id': move_id , + 'partner_id': inv.partner_id.id, + 'date': inv.date, + 'credit': diff > 0 and diff or 0.0, + 'debit': diff < 0 and -diff or 0.0, } account_id = False if inv.type in ('sale', 'receipt'): @@ -792,10 +795,10 @@ class account_voucher_line(osv.osv): if move_line_id: move_line = move_line_pool.browse(cr, user, move_line_id, context=context) if move_line.credit: - ttype='dr' + ttype = 'dr' amount = move_line.credit else: - ttype='cr' + ttype = 'cr' account_id = move_line.account_id.id res.update({ 'account_id':account_id, @@ -909,4 +912,4 @@ class account_bank_statement_line(osv.osv): self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context) return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context) -account_bank_statement_line() +account_bank_statement_line()
\ No newline at end of file diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 1ad3edd0760..79509542015 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -77,9 +77,9 @@ <group col="10" colspan="4"> <field name="state"/> <button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/> + <button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/> <button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/> <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/> - <button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/> </group> </form> </field> diff --git a/addons/account_voucher/report/account_voucher.py b/addons/account_voucher/report/account_voucher.py index 7655f294bf9..c37d921ecbc 100644 --- a/addons/account_voucher/report/account_voucher.py +++ b/addons/account_voucher/report/account_voucher.py @@ -36,7 +36,7 @@ class report_voucher(report_sxw.rml_parse): }) def convert(self, amount, cur): - amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur); + amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur) return amt_en def get_title(self, type): @@ -48,17 +48,17 @@ class report_voucher(report_sxw.rml_parse): def debit(self, move_ids): debit = 0.0 for move in move_ids: - debit +=move.debit + debit += move.debit return debit def credit(self, move_ids): credit = 0.0 for move in move_ids: - credit +=move.credit + credit += move.credit return credit def _get_ref(self, voucher_id, move_ids): - voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)]) + voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)]) if voucher_line: voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0] return voucher.name @@ -69,4 +69,4 @@ report_sxw.report_sxw( 'account.voucher', 'addons/account_voucher/report/account_voucher.rml', parser=report_voucher,header="external" -) +)
\ No newline at end of file diff --git a/addons/account_voucher/report/account_voucher_print.py b/addons/account_voucher/report/account_voucher_print.py index 0da644c6e4f..d39b77d8374 100644 --- a/addons/account_voucher/report/account_voucher_print.py +++ b/addons/account_voucher/report/account_voucher_print.py @@ -35,10 +35,10 @@ class report_voucher_print(report_sxw.rml_parse): }) def convert(self, amount, cur): - amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur); + amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur) return amt_en - def get_lines(self,voucher): + def get_lines(self, voucher): result = [] if voucher.type in ('payment','receipt'): type = voucher.line_ids and voucher.line_ids[0].type or False diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py index e23d8c52947..d59a5f0551a 100644 --- a/addons/account_voucher/report/rml_parse.py +++ b/addons/account_voucher/report/rml_parse.py @@ -20,15 +20,9 @@ ############################################################################## from report import report_sxw -import xml.dom.minidom -import os, time -import osv -import re -import tools -import pooler -import re -import sys +from datetime import datetime +import re class rml_parse(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): @@ -40,7 +34,7 @@ class rml_parse(report_sxw.rml_parse): 'explode_name' : self._explode_name, }) - def comma_me(self,amount): + def comma_me(self, amount): if not amount: amount = 0.0 if type(amount) is float : @@ -48,7 +42,7 @@ class rml_parse(report_sxw.rml_parse): else : amount = str(amount) if (amount == '0'): - return ' ' + return ' ' orig = amount new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) if orig == new: @@ -60,19 +54,19 @@ class rml_parse(report_sxw.rml_parse): ellipsis = ellipsis or '' try: return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen] - except Exception, e: + except: return False def _strip_name(self, name, maxlen=50): return self._ellipsis(name, maxlen, '...') - def _get_and_change_date_format_for_swiss (self,date_to_format): - date_formatted='' + def _get_and_change_date_format_for_swiss (self, date_to_format): + date_formatted = '' if date_to_format: - date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') + date_formatted = datetime.strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted - def _explode_name(self,chaine,length): + def _explode_name(self, chaine, length): # We will test if the size is less then account full_string = '' if (len(str(chaine)) <= length): @@ -92,7 +86,7 @@ class rml_parse(report_sxw.rml_parse): return full_string - def makeAscii(self,str): + def makeAscii(self, str): try: Stringer = str.encode("utf-8") except UnicodeDecodeError: @@ -106,7 +100,7 @@ class rml_parse(report_sxw.rml_parse): return Stringer return Stringer - def explode_this(self,chaine,length): + def explode_this(self, chaine, length): chaine = rstrip(chaine) ast = list(chaine) i = length @@ -116,7 +110,7 @@ class rml_parse(report_sxw.rml_parse): chaine = str("".join(ast)) return chaine - def repair_string(self,chaine): + def repair_string(self, chaine): ast = list(chaine) UnicodeAst = [] _previouslyfound = False @@ -135,7 +129,7 @@ class rml_parse(report_sxw.rml_parse): i += i + 1 return "".join(UnicodeAst) - def ReencodeAscii(self,str): + def ReencodeAscii(self, str): try: Stringer = str.decode("ascii") except UnicodeEncodeError: @@ -146,7 +140,7 @@ class rml_parse(report_sxw.rml_parse): return Stringer def _add_header(self, node, header=1): - if header==2: + if header == 2: rml_head = self.rml_header2 else: rml_head = self.rml_header diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index 2c5553488d0..16d05f3f62c 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -86,7 +86,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'period_id':statement.period_id.id} voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - voucher_line_dict = False + voucher_line_dict = {} if result['value']['line_ids']: for line_dict in result['value']['line_ids']: move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context) @@ -94,7 +94,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): voucher_line_dict = line_dict if voucher_line_dict: - voucher_line_dict.update({'voucher_id':voucher_id}) + voucher_line_dict.update({'voucher_id': voucher_id}) voucher_line_obj.create(cr, uid, voucher_line_dict, context=context) if line.journal_id.type == 'sale': type = 'customer' @@ -147,11 +147,11 @@ class account_statement_from_invoice(osv.osv_memory): # Creating a group that is unique for importing move lines(move lines, once imported into statement lines, should not appear again) for st_line in statement.line_ids: args_move_line = [] - args_move_line.append(('name','=', st_line.name)) - args_move_line.append(('ref','=',st_line.ref)) + args_move_line.append(('name', '=', st_line.name)) + args_move_line.append(('ref', '=', st_line.ref)) if st_line.partner_id: - args_move_line.append(('partner_id','=',st_line.partner_id.id)) - args_move_line.append(('account_id','=',st_line.account_id.id)) + args_move_line.append(('partner_id', '=', st_line.partner_id.id)) + args_move_line.append(('account_id', '=', st_line.account_id.id)) move_line_id = line_obj.search(cr, uid, args_move_line, context=context) if move_line_id: @@ -159,7 +159,7 @@ class account_statement_from_invoice(osv.osv_memory): journal_ids = data['journal_ids'] if journal_ids == []: - journal_ids = journal_obj.search(cr, uid, [('type', 'in', ('sale','cash','purchase'))], context=context) + journal_ids = journal_obj.search(cr, uid, [('type', 'in', ('sale', 'cash', 'purchase'))], context=context) args = [ ('reconcile_id', '=', False), @@ -167,12 +167,12 @@ class account_statement_from_invoice(osv.osv_memory): ('account_id.reconcile', '=', True)] if repeated_move_line_ids: - args.append(('id','not in',repeated_move_line_ids)) + args.append(('id', 'not in', repeated_move_line_ids)) line_ids = line_obj.search(cr, uid, args, context=context) - model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice_lines')], context=context) + model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_account_statement_from_invoice_lines')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] return { 'domain': "[('id','in', ["+','.join([str(x) for x in line_ids])+"])]", @@ -187,4 +187,4 @@ class account_statement_from_invoice(osv.osv_memory): } account_statement_from_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file diff --git a/addons/account_voucher/wizard/account_voucher_unreconcile.py b/addons/account_voucher/wizard/account_voucher_unreconcile.py index 30cda8958d5..71b4fbc8fb5 100644 --- a/addons/account_voucher/wizard/account_voucher_unreconcile.py +++ b/addons/account_voucher/wizard/account_voucher_unreconcile.py @@ -19,7 +19,6 @@ # ############################################################################## -import netsvc from osv import osv from osv import fields @@ -32,11 +31,11 @@ class account_voucher_unreconcile(osv.osv_memory): } _defaults = { - 'remove': lambda *a: True, + 'remove': True, } def trans_unrec(self, cr, uid, ids, context=None): - res = self.browse(cr, uid, ids[0]) +# res = self.browse(cr, uid, ids[0]) if context is None: context = {} voucher_pool = self.pool.get('account.voucher') diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 66c74a72bc9..bfaa59adf2d 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -156,7 +156,7 @@ class account_analytic_account(osv.osv): return dict([(i, res[i]) for i in ids]) def name_get(self, cr, uid, ids, context=None): - if not len(ids): + if not ids: return [] res = [] for account in self.browse(cr, uid, ids, context=context): @@ -174,7 +174,7 @@ class account_analytic_account(osv.osv): return dict(res) _columns = { - 'name' : fields.char('Account Name', size=128, required=True), + 'name': fields.char('Account Name', size=128, required=True), 'complete_name': fields.function(_complete_name_calc, method=True, type='char', string='Full Account Name'), 'code': fields.char('Account Code', size=24), 'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type', help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'), @@ -182,14 +182,14 @@ class account_analytic_account(osv.osv): 'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2), 'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'), 'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'), - 'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance'), - 'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit'), - 'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit'), + 'balance': fields.function(_balance_calc, method=True, type='float', string='Balance'), + 'debit': fields.function(_debit_calc, method=True, type='float', string='Debit'), + 'credit': fields.function(_credit_calc, method=True, type='float', string='Credit'), 'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity'), 'quantity_max': fields.float('Maximum Quantity', help='Sets the higher limit of quantity of hours.'), - 'partner_id' : fields.many2one('res.partner', 'Associated Partner'), - 'contact_id' : fields.many2one('res.partner.address', 'Contact'), - 'user_id' : fields.many2one('res.users', 'Account Manager'), + 'partner_id': fields.many2one('res.partner', 'Partner'), + 'contact_id': fields.many2one('res.partner.address', 'Contact'), + 'user_id': fields.many2one('res.users', 'Account Manager'), 'date_start': fields.date('Date Start'), 'date': fields.date('Date End'), 'company_id': fields.many2one('res.company', 'Company', required=True), @@ -210,10 +210,10 @@ class account_analytic_account(osv.osv): return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'type' : 'normal', + 'type': 'normal', 'company_id': _default_company, - 'state' : 'open', - 'user_id' : lambda self, cr, uid, ctx : uid, + 'state': 'open', + 'user_id': lambda self, cr, uid, ctx: uid, 'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False), 'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False), 'date_start': time.strftime('%Y-%m-%d') @@ -244,7 +244,7 @@ class account_analytic_account(osv.osv): partner = parent['partner_id'][0] else: partner = False - res = {'value' : {}} + res = {'value': {}} if partner: res['value']['partner_id'] = partner return res @@ -271,19 +271,19 @@ class account_analytic_line(osv.osv): _description = 'Analytic Line' _columns = { - 'name' : fields.char('Description', size=256, required=True), - 'date' : fields.date('Date', required=True, select=1), - 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')), - 'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'), - 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True), - 'user_id' : fields.many2one('res.users', 'User'), + 'name': fields.char('Description', size=256, required=True), + 'date': fields.date('Date', required=True, select=1), + 'amount': fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')), + 'unit_amount': fields.float('Quantity', help='Specifies the amount of quantity to count.'), + 'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True), + 'user_id': fields.many2one('res.users', 'User'), 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), } _defaults = { 'date': time.strftime('%Y-%m-%d'), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c), - 'amount' : 0.00 + 'amount': 0.00 } _order = 'date desc' diff --git a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py index 609d1cad7d9..5718a9fdaa7 100644 --- a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py +++ b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # @@ -15,7 +15,7 @@ # 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/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## @@ -38,7 +38,7 @@ class account_analytic_account(osv.osv): _inherit = "account.analytic.account" _columns = { - 'journal_rate_ids' : fields.one2many('analytic_journal_rate_grid', 'account_id', 'Invoicing Rate per Journal'), + 'journal_rate_ids': fields.one2many('analytic_journal_rate_grid', 'account_id', 'Invoicing Rate per Journal'), } account_analytic_account() @@ -92,7 +92,7 @@ class hr_analytic_timesheet(osv.osv): if to_invoice: res.setdefault('value',{}) res['value']['to_invoice'] = to_invoice[0] - + return res hr_analytic_timesheet() diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 21fe0a7da29..04f66fb8daa 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -40,7 +40,7 @@ class account_analytic_account(osv.osv): _inherit = "account.analytic.account" _columns = { - 'user_product_ids' : fields.one2many('analytic_user_funct_grid', 'account_id', 'Users/Products Rel.'), + 'user_product_ids': fields.one2many('analytic_user_funct_grid', 'account_id', 'Users/Products Rel.'), } account_analytic_account() diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml index a3fb7b5a28a..43de651e554 100644 --- a/addons/auction/auction_view.xml +++ b/addons/auction/auction_view.xml @@ -123,7 +123,7 @@ </group> <separator string="" colspan="4"/> <field name="state"/> - <button name="close" states="draft" string="Create Invoices" type="object" colspan="2" icon="gtk-yes"/> + <button name="close" states="draft" string="Create Invoices" type="object" colspan="2" icon="terp-gtk-go-back-rtl"/> </page> <page string="Accounting" > <group colspan="4" col="4"> diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml b/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml index 8ec4746dcf8..42eb72c18ff 100644 --- a/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml +++ b/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml @@ -19,7 +19,7 @@ <group colspan="4" col="6"> <label string=" " colspan="2"/> <button icon="gtk-close" special="cancel" string="Close"/> - <button icon="gtk-yes" string="Create invoices" name="makeInvoices" type="object"/> + <button icon="terp-gtk-go-back-rtl" string="Create invoices" name="makeInvoices" type="object"/> </group> </form> </field> diff --git a/addons/auction/wizard/auction_lots_make_invoice_view.xml b/addons/auction/wizard/auction_lots_make_invoice_view.xml index 56903865e5f..4399c689f25 100644 --- a/addons/auction/wizard/auction_lots_make_invoice_view.xml +++ b/addons/auction/wizard/auction_lots_make_invoice_view.xml @@ -18,7 +18,7 @@ <group colspan="2" col="2"/> <group colspan="2" col="2"> <button icon="gtk-close" special="cancel" string="Close"/> - <button icon="gtk-yes" string="Create invoices" name="makeInvoices" type="object"/> + <button icon="terp-gtk-go-back-rtl" string="Create invoices" name="makeInvoices" type="object"/> </group> </form> </field> diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index ba91c4b75dd..bc581955571 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -313,6 +313,11 @@ <separator colspan="4" string="" /> <group col="5" colspan="4"> <field name="state" select="2" /> + <button name="do_cancel" + string="Cancel" + states="tentative,confirmed" + type="object" + icon="gtk-cancel" /> <button name="do_tentative" states="confirmed,cancelled" string="Uncertain" @@ -323,11 +328,6 @@ states="tentative,cancelled" type="object" icon="gtk-apply" /> - <button name="do_cancel" - string="Cancel" - states="tentative,confirmed" - type="object" - icon="gtk-cancel" /> </group> </page> <page string="Invitation Detail"> @@ -475,7 +475,7 @@ <separator orientation="vertical" /> <filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" /> - + </group> </search> </field> diff --git a/addons/claim_from_delivery/claim_delivery_view.xml b/addons/claim_from_delivery/claim_delivery_view.xml index d2fe510460d..624e93466db 100644 --- a/addons/claim_from_delivery/claim_delivery_view.xml +++ b/addons/claim_from_delivery/claim_delivery_view.xml @@ -1,18 +1,5 @@ <openerp> - <data> - - <record id="view_picking_delivery" model="ir.ui.view"> - <field name="name">stock.picking.delivery.form20</field> - <field name="model">stock.picking</field> - <field name="type">form</field> - <field name="priority" eval="2"/> - <field name="inherit_id" ref="stock.view_picking_delivery_form"/> - <field name="arch" type="xml"> - <xpath expr="//form/group/field[@name='date']" position="after"> - <field name="partner_id" invisible="1"/> - </xpath> - </field> - </record> + <data> <act_window id="action_claim_from_delivery" name="Claim" domain="[]" target="current" @@ -20,5 +7,5 @@ view_mode="form" res_model="crm.claim" src_model="stock.picking" /> - </data> + </data> </openerp> diff --git a/addons/crm/board_crm_view.xml b/addons/crm/board_crm_view.xml index c299741280a..1f4853b4446 100644 --- a/addons/crm/board_crm_view.xml +++ b/addons/crm/board_crm_view.xml @@ -158,6 +158,5 @@ action="open_board_crm" sequence="1" id="menu_board_crm" icon="terp-graph"/> - <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,base.group_partner_manager" action="open_board_crm"/> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 978b6e1a889..e934fe2980f 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -36,7 +36,7 @@ <field name="date" string="Start Date" required="1" on_change="onchange_dates(date,duration,False,allday)" /> <field name="duration" widget="float_time" - on_change="onchange_dates(date,duration,False,allday)" /> + on_change="onchange_dates(date,duration,False,allday)" readonly="1" /> <field name="date_deadline" string="End Date" required="1" on_change="onchange_dates(date,False,date_deadline)" /> <field name="location" /> @@ -244,6 +244,9 @@ <field name="state" groups="base.group_extended"/> <field name="user_id" invisible="1"/> <field name="show_as" invisible="1" string="Show time as"/> + <button name="case_cancel" string="Cancel" + states="draft,open" type="object" + icon="gtk-cancel" /> <button name="case_reset" string="Reset to Unconfirmed" states="open,done,cancel" type="object" icon="gtk-convert" /> @@ -253,9 +256,6 @@ <button name="case_close" string="Done" states="open" type="object" icon="gtk-jump-to" /> - <button name="case_cancel" string="Cancel" - states="draft,open" type="object" - icon="gtk-cancel" /> </tree> </field> </record> diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 595da873115..127f006544c 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -40,10 +40,10 @@ states="draft,open,pending" icon="gtk-redo" name="action_make_meeting" type="object" /> <field name="state"/> + <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/> <button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/> <button name="case_pending" string="Not Held" states="open" type="object" icon="gtk-media-pause"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> </tree> </field> </record> @@ -105,6 +105,9 @@ <separator colspan="4" /> <group col="8" colspan="4"> <field name="state" select="1" /> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -116,9 +119,6 @@ <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> </group> </form> </field> diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 6ca978ea153..75189fb70f5 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -26,6 +26,9 @@ invisible="context.get('invisible_section', True)" /> <field name="user_id" /> <field name="state" /> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -39,9 +42,6 @@ <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> </tree> </field> <field name="meeting_ids" colspan="4" nolabel="1" > @@ -59,10 +59,10 @@ <field name="categ_id"/> <field name="user_id"/> <field name="state"/> + <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/> <button name="case_close" string="Held" states="open,draft,pending" type="object" icon="gtk-jump-to"/> <button name="case_pending" string="Not Held" states="open" type="object" icon="gtk-media-pause"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> </tree> </field> </page> diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index 6b5f21df920..a52c5d7e93f 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -53,6 +53,9 @@ <field name="categ_id" string="Type" select="1"/> <field name="stage_id" invisible="1"/> <field name="state"/> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -62,9 +65,6 @@ <button name="case_close" string="Close" states="open,draft,pending" type="object" icon="gtk-close" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> </tree> @@ -130,6 +130,9 @@ <separator colspan="4" string=""/> <group col="8" colspan="4"> <field name="state" select="1"/> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -139,9 +142,6 @@ <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> diff --git a/addons/crm_fundraising/crm_fundraising_view.xml b/addons/crm_fundraising/crm_fundraising_view.xml index 6bcf019dabe..f38b46c0a5e 100644 --- a/addons/crm_fundraising/crm_fundraising_view.xml +++ b/addons/crm_fundraising/crm_fundraising_view.xml @@ -54,6 +54,9 @@ <field name="user_id" /> <field name="state" /> <field name="partner_id" invisible="1"/> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -66,9 +69,6 @@ <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-close" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> </tree> @@ -115,6 +115,9 @@ <separator colspan="4"/> <group col="8" colspan="4"> <field name="state"/> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -128,9 +131,6 @@ <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-close" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> diff --git a/addons/crm_helpdesk/crm_helpdesk_view.xml b/addons/crm_helpdesk/crm_helpdesk_view.xml index 0531092dd98..b792097534d 100644 --- a/addons/crm_helpdesk/crm_helpdesk_view.xml +++ b/addons/crm_helpdesk/crm_helpdesk_view.xml @@ -69,6 +69,9 @@ <separator colspan="4"/> <group col="8" colspan="4"> <field name="state" select="1"/> + <button name="case_cancel" + states="draft,open,pending" string="Cancel" + type="object" icon="gtk-cancel" /> <button name="case_open" states="draft,pending" string="Open" type="object" icon="gtk-go-forward" /> @@ -82,9 +85,6 @@ <button name="case_close" states="open,draft,pending" string="Close" type="object" icon="gtk-jump-to" /> - <button name="case_cancel" - states="draft,open,pending" string="Cancel" - type="object" icon="gtk-cancel" /> <button name="case_reset" states="done,cancel" string="Reset to Draft" type="object" @@ -187,6 +187,9 @@ <field name="section_id"/> <field name="priority"/> <field name="state"/> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -200,9 +203,6 @@ <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-close" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert" /> </tree> diff --git a/addons/crm_partner_assign/res_partner_view.xml b/addons/crm_partner_assign/res_partner_view.xml index ab14e7ca7b0..c340483f024 100644 --- a/addons/crm_partner_assign/res_partner_view.xml +++ b/addons/crm_partner_assign/res_partner_view.xml @@ -100,6 +100,9 @@ invisible="context.get('invisible_section', True)" /> <field name="user_id" /> <field name="state" /> + <button name="case_cancel" string="Cancel" + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" /> @@ -113,9 +116,6 @@ <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up" /> - <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> </tree> </field> </page> diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 91513709e03..3d03235d872 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -175,22 +175,6 @@ </field> </record> - <record id="view_picking_withcarrier_delivery_form" model="ir.ui.view"> - <field name="name">delivery.stock.picking_withcarrier.delivery.form.view</field> - <field name="type">form</field> - <field name="model">stock.picking</field> - <field name="inherit_id" ref="stock.view_picking_delivery_form"/> - <field name="arch" type="xml"> - <field name="address_id" position="after"> - <field name="carrier_id"/> - <field name="carrier_tracking_ref" groups="base.group_extended"/> - <field name="number_of_packages" groups="base.group_extended"/> - <field name="weight"/> - <field name="weight_net"/> - </field> - </field> - </record> - <record id="action_picking_tree4" model="ir.actions.act_window"> <field name="name">Picking to be invoiced</field> <field name="res_model">stock.picking</field> @@ -242,19 +226,6 @@ </field> </record> - <record id="view_picking_withcarrier_delivery_move_form" model="ir.ui.view"> - <field name="name">delivery.stock.picking_withcarrier.delivery.move.form.view</field> - <field name="type">form</field> - <field name="model">stock.picking</field> - <field name="inherit_id" ref="stock.view_picking_delivery_form"/> - <field name="arch" type="xml"> - <xpath expr="/form/notebook/page/field[@name='move_lines']/tree/field[@name='product_uom']" position="after"> - <field name="weight"/> - <field name="weight_net"/> - </xpath> - </field> - </record> - <record id="view_move_withweight_form" model="ir.ui.view"> <field name="name">stock.move.form.weight</field> <field name="type">form</field> @@ -287,7 +258,7 @@ <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <xpath expr="/form/notebook/page[@string='Sales Order']/group[1]/button[@name='button_dummy']" position="after"> - <button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':id}"/> + <button name="%(action_delivery_cost)d" states="draft" string="Delivery Costs" type="action" icon="gtk-add" context="{'order_id':active_id}"/> </xpath> </field> </record> diff --git a/addons/delivery/test/delivery_report.yml b/addons/delivery/test/delivery_report.yml index a88b6bd1942..53b06a9d36a 100644 --- a/addons/delivery/test/delivery_report.yml +++ b/addons/delivery/test/delivery_report.yml @@ -12,7 +12,6 @@ invoice_state: none move_lines: - company_id: base.main_company - date_planned: '2010-05-11 15:18:57' location_dest_id: stock.stock_location_customers location_id: stock.stock_location_stock name: HP CD writers diff --git a/addons/delivery/wizard/delivery_sale_order_view.xml b/addons/delivery/wizard/delivery_sale_order_view.xml index 6ac0883493f..fa56b0efcf7 100644 --- a/addons/delivery/wizard/delivery_sale_order_view.xml +++ b/addons/delivery/wizard/delivery_sale_order_view.xml @@ -4,27 +4,27 @@ <!-- Delivery Sale Order --> - <record id="view_make_delivery_wizard" model="ir.ui.view"> + <record id="view_make_delivery_wizard" model="ir.ui.view"> <field name="name">Delivery Costs</field> <field name="model">delivery.sale.order</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Create Deliveries"> - <separator colspan="4" string="Delivery Method" /> - <field name="carrier_id" widget="selection"/> - <newline/> - <separator colspan="4"/> - <group col="2" colspan="4"> - <button icon='gtk-cancel' special="cancel" - string="_Cancel" /> - <button name="delivery_set" string="_Apply" - colspan="1" type="object" icon="gtk-apply" /> - </group> + <separator colspan="4" string="Delivery Method" /> + <field name="carrier_id" widget="selection"/> + <newline/> + <separator colspan="4"/> + <group col="2" colspan="4"> + <button icon='gtk-cancel' special="cancel" + string="_Cancel" /> + <button name="delivery_set" string="_Apply" + colspan="1" type="object" icon="gtk-apply" /> + </group> </form> </field> </record> - <record id="action_delivery_cost" model="ir.actions.act_window"> + <record id="action_delivery_cost" model="ir.actions.act_window"> <field name="name">Delivery Costs</field> <field name="type">ir.actions.act_window</field> <field name="res_model">delivery.sale.order</field> @@ -34,5 +34,5 @@ <field name="target">new</field> </record> - </data> -</openerp> + </data> +</openerp> diff --git a/addons/event/event.py b/addons/event/event.py index 6682a703ea5..5c510ede613 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -88,10 +88,10 @@ class event_event(osv.osv): #send reminder that will confirm the event for all the people that were already confirmed reg_ids = register_pool.search(cr, uid, [ ('event_id', '=', event.id), - ('state', 'not in', ['draft', 'cancel'])]) + ('state', 'not in', ['draft', 'cancel'])], context=context) register_pool.mail_user_confirm(cr, uid, reg_ids) - return self.write(cr, uid, ids, {'state': 'confirm'}) + return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) def button_confirm(self, cr, uid, ids, context=None): """This Function Confirm Event. @@ -114,7 +114,7 @@ class event_event(osv.osv): unconfirmed_ids.append(event.id) if unconfirmed_ids: view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm') - view_data = data_pool.browse(cr, uid, view_id) + view_data = data_pool.browse(cr, uid, view_id, context=context) view_id = view_data.res_id context['event_ids'] = unconfirmed_ids return { @@ -141,7 +141,7 @@ class event_event(osv.osv): """ register_pool = self.pool.get('event.registration') res = {} - for event in self.browse(cr, uid, ids, context): + for event in self.browse(cr, uid, ids, context=context): res[event.id] = {} for field in fields: res[event.id][field] = False @@ -153,12 +153,17 @@ class event_event(osv.osv): reg_ids = register_pool.search(cr, uid, [ ('event_id', '=', event.id), - ('state', 'in', state)]) + ('state', 'in', state)], context=context) + + number = 0.0 + if reg_ids: + cr.execute('SELECT SUM(nb_register) FROM event_registration WHERE id IN %s', (tuple(reg_ids),)) + number = cr.fetchone() if 'register_current' in fields: - res[event.id]['register_current'] = len(reg_ids) + res[event.id]['register_current'] = number and number[0] or 0.0 if 'register_prospect' in fields: - res[event.id]['register_prospect'] = len(reg_ids) + res[event.id]['register_prospect'] = number and number[0] or 0.0 return res @@ -189,8 +194,8 @@ class event_event(osv.osv): register_values['description'] = vals['mail_confirm'] if register_values: - reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)]) - register_pool.write(cr, uid, reg_ids, register_values) + reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)], context=context) + register_pool.write(cr, uid, reg_ids, register_values, context=context) return res _columns = { @@ -226,15 +231,14 @@ class event_event(osv.osv): 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."), 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify for each registration a specific amount if you want to", digits_compute=dp.get_precision('Sale Price')), 'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who are giving speech on event."), - 'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}), + 'speaker_ids': fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}), 'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}), 'speaker_confirmed': fields.boolean('Speaker Confirmed', readonly=False, states={'done': [('readonly', True)]}), 'country_id': fields.related('address_id', 'country_id', type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}), 'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}), 'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}), - 'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=False, states={'done': [('readonly', True)]}), - + 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}), } _defaults = { @@ -250,7 +254,7 @@ class event_event(osv.osv): level = 100 while len(ids): - cr.execute('select distinct parent_id from event_event where id IN %s', (tuple(ids),)) + cr.execute('SELECT DISTINCT parent_id FROM event_event WHERE id IN %s', (tuple(ids),)) ids = filter(None, map(lambda x: x[0], cr.fetchall())) if not level: return False @@ -359,7 +363,7 @@ class event_registration(osv.osv): 'comment': "", 'date_invoice': context.get('date_inv', False) }) - inv_id = inv_pool.create(cr, uid, val_invoice['value']) + inv_id = inv_pool.create(cr, uid, val_invoice['value'], context=context) inv_pool.button_compute(cr, uid, [inv_id]) self.history(cr, uid, [reg], _('Invoiced')) return inv_id @@ -460,12 +464,12 @@ class event_registration(osv.osv): for registration in self.browse(cr, uid, ids, context=context): total_confirmed = registration.event_id.register_current + registration.nb_register if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0: - self.do_open(cr, uid, [registration.id], context) + self.do_open(cr, uid, [registration.id], context=context) else: unconfirmed_ids.append(registration.id) if unconfirmed_ids: view_id = data_pool._get_id(cr, uid, 'event', 'view_event_confirm_registration') - view_data = data_pool.browse(cr, uid, view_id) + view_data = data_pool.browse(cr, uid, view_id, context=context) view_id = view_data.res_id context['registration_ids'] = unconfirmed_ids return { @@ -493,10 +497,10 @@ class event_registration(osv.osv): if registration.tobe_invoiced and not registration.invoice_id: unclosed_ids.append(registration.id) else: - self.do_close(cr, uid, [registration.id]) + self.do_close(cr, uid, [registration.id], context=context) if unclosed_ids: view_id = data_pool._get_id(cr, uid, 'event', 'view_event_make_invoice') - view_data = data_pool.browse(cr, uid, view_id) + view_data = data_pool.browse(cr, uid, view_id, context=context) view_id = view_data.res_id context['active_ids'] = unclosed_ids return { @@ -552,10 +556,10 @@ class event_registration(osv.osv): body = regestration.event_id.mail_confirm if subject or body: tools.email_send(src, email_to, subject, body, email_cc = email_cc, openobject_id = regestration.id) - self.history(cr, uid, [regestration], subject, history=True, \ - email=email_to, details=body, \ - subject=subject, email_from=src, \ - email_cc=', '.join(email_cc)) + self.history(cr, uid, [regestration], subject, history = True, \ + email = email_to, details = body, \ + subject = subject, email_from = src, \ + email_cc = ', '.join(email_cc)) return True @@ -612,12 +616,17 @@ class event_registration(osv.osv): res_obj = self.pool.get('res.partner') data_event = event_obj.browse(cr, uid, event_id) - res = {'value': {'unit_price': False, 'event_product': False, 'user_id': False, - 'date': data_event.date_begin, 'date_deadline': data_event.date_end, 'description': data_event.note, 'name': data_event.name, - 'section_id': data_event.section_id and data_event.section_id.id or False, + res = {'value': {'unit_price': False, + 'event_product': False, + 'user_id': False, + 'date': data_event.date_begin, + 'date_deadline': data_event.date_end, + 'description': data_event.note, + 'name': data_event.name, + 'section_id': data_event.section_id and data_event.section_id.id or False, }} if data_event.user_id.id: - res['value'].update({'user_id':data_event.user_id.id}) + res['value'].update({'user_id': data_event.user_id.id}) if data_event.product_id: pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False if partner_invoice_id: @@ -645,7 +654,7 @@ class event_registration(osv.osv): data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False) if not part: return {'value': data} - data['partner_invoice_id']=part + data['partner_invoice_id'] = part # this calls onchange_partner_invoice_id d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part) # this updates the dictionary @@ -670,8 +679,8 @@ class event_registration(osv.osv): @param event_id: Event ID @param partner_invoice_id: Partner Invoice ID """ - data={} - context={} + data = {} + context = {} event_obj = self.pool.get('event.event') prod_obj = self.pool.get('product.product') res_obj = self.pool.get('res.partner') @@ -679,7 +688,7 @@ class event_registration(osv.osv): data['unit_price']=False if not event_id: return {'value': data} - data_event = event_obj.browse(cr, uid, event_id) + data_event = event_obj.browse(cr, uid, event_id, context=context) if data_event.product_id: data['event_product'] = data_event.product_id.name pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml index 3bf58691c0f..4603a9cf141 100644 --- a/addons/event/event_demo.xml +++ b/addons/event/event_demo.xml @@ -86,8 +86,8 @@ <field name="user_id" ref="base.user_root"/> <field name="mail_auto_registr">True</field> <field name="mail_auto_confirm">True</field> - <field name="mail_registr">Thanks for registrering. We will keep you informed of the modalities.</field> - <field name="mail_confirm">Thanks for registrering. The conference will begin at 2 PM and will be given by Mister Pinckaers.</field> + <field name="mail_registr">Thanks for registration. We will keep you informed of the modalities.</field> + <field name="mail_confirm">Thanks for registration. The conference will begin at 2 PM and will be given by Mr. Pinckaers.</field> </record> <function model="event.event" name="button_confirm" eval="[ref('event_2')]"/> <function model="event.event" name="button_done" eval="[ref('event_2')]"/> diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 185b1d33ec9..c34d6cfe475 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -76,10 +76,10 @@ <field name="note" colspan="4" nolabel="1"/> <field name="state" select="1"/> <group col="4" colspan="2"> - <button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/> <button string="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/> + <button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/> <button string="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/> - <button string="Set To Draft" name="button_draft" states="confirm,cancel,done" type="object" icon="gtk-convert"/> + <button string="Set To Draft" name="button_draft" states="cancel" type="object" icon="gtk-convert"/> </group> </page> <page string="Speakers"> @@ -319,8 +319,8 @@ <field name="event_id" on_change="onchange_event(event_id, partner_invoice_id)" domain="[('state','in',('draft','confirm'))]"/> <field name="create_date" string="Registration Date"/> <field name="name"/> - <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id,event_id)" /> - <field name="user_id"/> + <field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" required="1" on_change="onchange_partner_id(partner_id,event_id)" /> + <field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}" /> <field name="tobe_invoiced"/> </group> <notebook colspan="4"> diff --git a/addons/event/report/report_event_registration.py b/addons/event/report/report_event_registration.py index f74b7d31567..1aa0af9ee2b 100644 --- a/addons/event/report/report_event_registration.py +++ b/addons/event/report/report_event_registration.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # @@ -15,7 +15,7 @@ # 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/>. +# along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## @@ -23,7 +23,7 @@ from osv import fields, osv import tools class report_event_registration(osv.osv): - + _name = "report.event.registration" _description = "Events on registrations and Events on type" _auto = False @@ -31,19 +31,19 @@ class report_event_registration(osv.osv): _columns = { 'date': fields.date('Date', readonly=True), 'year': fields.char('Year', size=4, readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), + 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), - 'day': fields.char('Day', size=128, readonly=True), - 'event_id': fields.many2one('event.event', 'Event Related', required=True), - 'draft_state': fields.integer(' # No of draft Registration.', size=20), - 'confirm_state': fields.integer(' # No of Confirm Registration', size=20), - 'register_max': fields.integer('Maximum Registrations'), - 'nbevent': fields.integer('Number Of Events'), + 'day': fields.char('Day', size=128, readonly=True), + 'event_id': fields.many2one('event.event', 'Event Related', required=True), + 'draft_state': fields.integer(' # No of draft Registration.', size=20), + 'confirm_state': fields.integer(' # No of Confirm Registration', size=20), + 'register_max': fields.integer('Maximum Registrations'), + 'nbevent': fields.integer('Number Of Events'), 'type': fields.many2one('event.type', 'Event Type'), 'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True), - 'user_id':fields.many2one('res.users', 'Responsible', readonly=True), - 'speaker_id':fields.many2one('res.partner', 'Speaker', readonly=True), + 'user_id': fields.many2one('res.users', 'Responsible', readonly=True), + 'speaker_id': fields.many2one('res.partner', 'Speaker', readonly=True), } _order = 'date desc' def init(self, cr): @@ -53,32 +53,32 @@ class report_event_registration(osv.osv): """ tools.drop_view_if_exists(cr, 'report_event_registration') cr.execute(""" - create or replace view report_event_registration as ( - select - e.id as id, - c.event_id as event_id, - e.date_begin as date, - e.user_id as user_id, - e.main_speaker_id as speaker_id, - to_char(e.date_begin, 'YYYY') as year, - to_char(e.date_begin, 'MM') as month, - to_char(e.date_begin, 'YYYY-MM-DD') as day, - count(t.id) as nbevent, - t.id as type, - (SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('draft')) as draft_state, - (SELECT sum(c.nb_register) FROM event_registration c WHERE c.event_id=e.id and t.id=e.type and state in ('open')) as confirm_state, - e.register_max as register_max, - e.state as state - from + CREATE OR REPLACE view report_event_registration AS ( + SELECT + e.id AS id, + c.event_id AS event_id, + e.date_begin AS date, + e.user_id AS user_id, + e.main_speaker_id AS speaker_id, + to_char(e.date_begin, 'YYYY') AS year, + to_char(e.date_begin, 'MM') AS month, + to_char(e.date_begin, 'YYYY-MM-DD') AS day, + count(t.id) AS nbevent, + t.id AS type, + (SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('draft')) AS draft_state, + (SELECT SUM(c.nb_register) FROM event_registration c WHERE c.event_id=e.id AND t.id=e.type AND state IN ('open')) AS confirm_state, + e.register_max AS register_max, + e.state AS state + FROM event_event e - inner join - event_registration c on (e.id=c.event_id) - inner join - event_type t on (e.type=t.id) - group by + INNER JOIN + event_registration c ON (e.id=c.event_id) + INNER JOIN + event_type t ON (e.type=t.id) + GROUP BY to_char(e.date_begin, 'YYYY'), to_char(e.date_begin, 'MM'), - t.id, e.id, e.date_begin,e.main_speaker_id, + t.id, e.id, e.date_begin, e.main_speaker_id, e.register_max, e.type, e.state, c.event_id, e.user_id, to_char(e.date_begin, 'YYYY-MM-DD') )""") diff --git a/addons/event/wizard/event_confirm_registration.py b/addons/event/wizard/event_confirm_registration.py index 92f94474cb8..7b6cd7ee3f3 100644 --- a/addons/event/wizard/event_confirm_registration.py +++ b/addons/event/wizard/event_confirm_registration.py @@ -40,6 +40,8 @@ class event_confirm_registration(osv.osv_memory): """ This function gets default values """ + if context is None: + context = {} registration_pool = self.pool.get('event.registration') registration_ids = context.get('registration_ids', []) res = super(event_confirm_registration, self).default_get(cr, uid, fields, context=context) @@ -56,7 +58,9 @@ class event_confirm_registration(osv.osv_memory): res.update({'msg': msg}) return res - def confirm(self, cr, uid, ids, context): + def confirm(self, cr, uid, ids, context=None): + if context is None: + context = {} registration_pool = self.pool.get('event.registration') registration_ids = context.get('registration_ids', []) registration_pool.do_open(cr, uid, registration_ids, context=context) diff --git a/addons/event/wizard/event_make_invoice.py b/addons/event/wizard/event_make_invoice.py index 12ad2cf0d68..f22db18a78a 100644 --- a/addons/event/wizard/event_make_invoice.py +++ b/addons/event/wizard/event_make_invoice.py @@ -18,6 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## + from osv import fields, osv from tools.translate import _ @@ -29,7 +30,7 @@ class event_make_invoice(osv.osv_memory): _description = "Event Make Invoice" _columns = { 'grouped': fields.boolean('Group the invoices'), - 'invoice_date':fields.date('Invoice Date'), + 'invoice_date': fields.date('Invoice Date'), } def view_init(self, cr, uid, fields, context=None): @@ -61,7 +62,7 @@ class event_make_invoice(osv.osv_memory): _("Registration doesn't have any partner to invoice.")) def default_get(self, cr, uid, fields_list, context=None): - return super(event_make_invoice, self).default_get(cr, uid, fields_list, context) + return super(event_make_invoice, self).default_get(cr, uid, fields_list, context=context) def make_invoice(self, cr, uid, ids, context=None): reg_obj = self.pool.get('event.registration') @@ -70,7 +71,7 @@ class event_make_invoice(osv.osv_memory): if context is None: context = {} - for data in self.browse(cr, uid, ids): + for data in self.browse(cr, uid, ids, context=context): res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date) form_id = mod_obj._get_id(cr, uid, 'account', 'invoice_form') diff --git a/addons/event/wizard/partner_event_registration.py b/addons/event/wizard/partner_event_registration.py index 00f106ab8ae..33ed6e60cdb 100644 --- a/addons/event/wizard/partner_event_registration.py +++ b/addons/event/wizard/partner_event_registration.py @@ -19,7 +19,6 @@ # ############################################################################## -import wizard import netsvc import tools from osv import fields, osv @@ -53,7 +52,6 @@ class partner_event_registration(osv.osv_memory): value = {} res_obj = self.pool.get('res.partner') job_obj = self.pool.get('res.partner.job') - event_obj = self.pool.get('event.event') reg_obj = self.pool.get('event.registration') mod_obj = self.pool.get('ir.model.data') @@ -62,9 +60,9 @@ class partner_event_registration(osv.osv_memory): contact_id = False email = False if addr.has_key('default'): - job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])]) + job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])], context=context) if job_ids: - contact = job_obj.browse(cr, uid, job_ids[0]) + contact = job_obj.browse(cr, uid, job_ids[0], context=context) if contact: contact_id = contact.contact_id.id email = contact.email @@ -72,14 +70,13 @@ class partner_event_registration(osv.osv_memory): result = mod_obj._get_id(cr, uid, 'event', 'view_registration_search') res = mod_obj.read(cr, uid, result, ['res_id']) - data_obj = self.pool.get('ir.model.data') # Select the view - id2 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_form') - id3 = data_obj._get_id(cr, uid, 'event', 'view_event_registration_tree') + id2 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_form') + id3 = mod_obj._get_id(cr, uid, 'event', 'view_event_registration_tree') if id2: - id2 = data_obj.browse(cr, uid, id2, context=context).res_id + id2 = mod_obj.browse(cr, uid, id2, context=context).res_id if id3: - id3 = data_obj.browse(cr, uid, id3, context=context).res_id + id3 = mod_obj.browse(cr, uid, id3, context=context).res_id for current in self.browse(cr, uid, ids, context=context): for partner in res_obj.browse(cr, uid, record_ids, context=context): @@ -105,7 +102,7 @@ class partner_event_registration(osv.osv_memory): 'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')], 'type': 'ir.actions.act_window', 'search_view_id': res['res_id'] - } + } return value def name_get(self, cr, uid, ids, context=None): @@ -118,7 +115,7 @@ class partner_event_registration(osv.osv_memory): res = [] if not ids: return res - reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context) + reads = self.read(cr, uid, ids, ['event_type', 'event_id'], context=context) for record in reads: event_id = record['event_id'][1] if record['event_type']: @@ -135,13 +132,13 @@ class partner_event_registration(osv.osv_memory): context = {} partner_id = context.get('active_id', False) if event_id: - event = event_obj.browse(cr, uid, event_id) + event = event_obj.browse(cr, uid, event_id, context=context) pricelist_id = event.pricelist_id and event.pricelist_id.id or False if partner_id: partner = partner_obj.browse(cr, uid, partner_id, context=context) pricelist_id = pricelist_id or partner.property_product_pricelist.id unit_price = product_obj._product_price(cr, uid, [event.product_id.id], False, False, {'pricelist': pricelist_id})[event.product_id.id] - + res['value'] = { 'event_type': event.type and event.type.id or False, 'start_date': event.date_begin, diff --git a/addons/hr/board_hr_view.xml b/addons/hr/board_hr_view.xml index 58204352ac4..c740114789a 100644 --- a/addons/hr/board_hr_view.xml +++ b/addons/hr/board_hr_view.xml @@ -7,7 +7,7 @@ name="Human Resources" parent="base.dashboard"/> - <!-- This board view will be complete by other hr_* modules--> + <!-- This board view will be complete by other hr_* modules--> <record id="board_hr_form" model="ir.ui.view"> <field name="name">board.hr.form</field> <field name="model">board.board</field> diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 655b9d9bfd1..c05836c393a 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -97,7 +97,7 @@ class hr_job(osv.osv): 'requirements': fields.text('Requirements'), 'department_id': fields.many2one('hr.department', 'Department'), 'company_id': fields.many2one('res.company', 'Company'), - 'state': fields.selection([('open', 'Open'),('old', 'Old'),('recruit', 'In Recruitement')], 'State', readonly=True, required=True), + 'state': fields.selection([('open', 'In Position'),('old', 'Old'),('recruit', 'In Recruitement')], 'State', readonly=True, required=True), } _defaults = { 'expected_employees': 1, diff --git a/addons/hr/hr_data.xml b/addons/hr/hr_data.xml index f76d1457aa1..ae8e30b23f0 100644 --- a/addons/hr/hr_data.xml +++ b/addons/hr/hr_data.xml @@ -16,5 +16,10 @@ <field name="name">Widower</field> </record> + <record id="employee" model="hr.employee"> + <field name="name">Administrator</field> + <field name="user_id" ref="base.user_root"/> + </record> + </data> </openerp> diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index e171f2dfba7..2b1cd596024 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -340,10 +340,10 @@ </page> </notebook> <group col="6" colspan="4"> - <field name="state"/> - <button name="job_recruitement" string="In Recruitement" states="open" type="object" icon="gtk-go-forward"/> - <button name="job_open" string="Open" states="old,recruit" type="object" icon="terp-camera_test"/> - <button name="job_old" string="Old" states="open,recruit" type="object" icon="gtk-cancel"/> + <field name="state"/> + <button name="job_recruitement" string="In Recruitement" states="open" type="object" icon="gtk-go-forward"/> + <button name="job_open" string="In Position" states="old,recruit" type="object" icon="terp-camera_test"/> + <button name="job_old" string="Mark as Old" states="open,recruit" type="object" icon="gtk-cancel"/> </group> </form> </field> diff --git a/addons/hr/installer.py b/addons/hr/installer.py index 1bd615b8699..cdeb2ca77a3 100644 --- a/addons/hr/installer.py +++ b/addons/hr/installer.py @@ -48,10 +48,6 @@ class hr_installer(osv.osv_memory): 'hr_payroll_account': fields.boolean('Payroll Accounting', help="Generic Payroll system Integrated with Accountings."), } - _defaults = { - 'hr_holidays': True, - 'hr_expense': True, - } hr_installer() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml index 44d09bec6cd..7070db1d5b2 100644 --- a/addons/hr_attendance/hr_attendance_view.xml +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -52,11 +52,11 @@ <search string="Hr Attendance Search"> <filter icon="terp-stock_align_left_24" string="My Attendances" domain="[('employee_id.user_id.id', '=', uid)]" /> <separator orientation="vertical"/> - <filter icon="terp-go-today" string="Today" domain="[('name::date','=',current_date)]" /> + <filter icon="terp-go-today" string="Today" name="today" domain="[('name::date','=',current_date)]" /> <separator orientation="vertical"/> - <field name="employee_id" /> - <field name="name" /> - <field name="action" /> + <field name="employee_id"/> + <field name="name"/> + <field name="action"/> <newline/> <group expand="0" string="Group By..."> <filter name="employee" string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/> @@ -72,7 +72,7 @@ <field name="res_model">hr.attendance</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> - <field name="context">{"search_default_employee":1}</field> + <field name="context">{"search_default_today":1}</field> <field name="search_view_id" ref="view_hr_attendance_filter" /> <field name="help">Time Tracking functionality aims to manage employee's attendances on the basis of the actions (Sign in/Sign out) performed by them. You can also link this to an attendance machine using OpenERP's webservices features.</field> </record> @@ -81,7 +81,7 @@ <menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root" sequence="4"/> - <menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_attendance" sequence="3"/> + <menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_attendance" sequence="20"/> <record id="edit_attendance_reason" model="ir.ui.view"> <field name="name">hr.action.reason.form</field> @@ -116,7 +116,9 @@ <field name="view_id" ref="view_attendance_reason"/> </record> - <menuitem sequence="2" id="hr.menu_open_view_attendance_reason_new_config" parent="hr.menu_hr_configuration" name="Attendances" /> + <menuitem + sequence="2" id="hr.menu_open_view_attendance_reason_new_config" parent="hr.menu_hr_configuration" name="Attendances" + groups="base.group_extended"/> <menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_open_view_attendance_reason_new_config"/> <record id="hr_attendance_employee" model="ir.ui.view"> diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index bfcd9ff8b76..1ad05582d47 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -105,7 +105,7 @@ <page string="Miscellaneous"> <group colspan="2" col="2"> <separator string="Personal Info" colspan="2"/> - <field name="bank_account"/> + <field name="bank_account_id"/> <field name="place_of_birth"/> <field name="children"/> </group> diff --git a/addons/hr_evaluation/board_hr_evaluation_view.xml b/addons/hr_evaluation/board_hr_evaluation_view.xml index 5a67fe1945d..70d6245b1ee 100644 --- a/addons/hr_evaluation/board_hr_evaluation_view.xml +++ b/addons/hr_evaluation/board_hr_evaluation_view.xml @@ -14,19 +14,14 @@ <record id="board_hr_evaluation_form" model="ir.ui.view"> <field name="name">board.hr.evaluation.form</field> <field name="model">board.board</field> - <field name="inherit_id" ref="hr.board_hr_form"/> + <field name="inherit_id" ref="hr.board_hr_form"/> <field name="type">form</field> <field name="arch" type="xml"> - <xpath expr="/form/hpaned/child1" position="inside"> - <action colspan="4" height="220" name="%(act_hr_evaluation_tree)d" string="My Evaluation Remaining" width="510"/> - </xpath> + <xpath expr="/form/hpaned/child1" position="inside"> + <action colspan="4" height="220" name="%(act_hr_evaluation_tree)d" string="My Evaluation Remaining" width="510"/> + </xpath> </field> </record> - <menuitem - action="hr.open_board_hr" - icon="terp-graph" - id="base.menu_hr_project" - parent="base.menu_hr_dasboard" - sequence="4"/> + </data> </openerp> diff --git a/addons/hr_expense/board_hr_expense_view.xml b/addons/hr_expense/board_hr_expense_view.xml index 69dbad767d9..e79f581dce0 100644 --- a/addons/hr_expense/board_hr_expense_view.xml +++ b/addons/hr_expense/board_hr_expense_view.xml @@ -20,12 +20,12 @@ <record id="board_hr_expense_form" model="ir.ui.view"> <field name="name">board.hr.expense.form</field> <field name="model">board.board</field> - <field name="inherit_id" ref="hr.board_hr_form"/> + <field name="inherit_id" ref="hr.board_hr_form"/> <field name="type">form</field> <field name="arch" type="xml"> - <xpath expr="/form/hpaned/child1" position="inside"> - <action colspan="4" height="220" name="%(action_my_expense)d" string="My Expenses" /> - </xpath> + <xpath expr="/form/hpaned/child1" position="inside"> + <action colspan="4" height="220" name="%(action_my_expense)d" string="My Expenses" /> + </xpath> </field> </record> diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml index b30b22c559a..5d22113272c 100644 --- a/addons/hr_expense/hr_expense_view.xml +++ b/addons/hr_expense/hr_expense_view.xml @@ -145,12 +145,12 @@ <field name="date" select='1'/> <field name="department_id" widget="selection" string="Department" context="{'invisible_department': False}"> <filter icon="terp-personal+" context="{'invisible_department': False}" domain="[('department_id','=',context.get('department_id',False))]" help="My Department"/> + </field> <field name="name" select='1'/> <field name="user_id" string="User" invisible="True"> <filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]" string="Expenses of My Department"/> </field> - </field> </group> <newline /> <group expand="0" string="Group By..."> @@ -168,7 +168,7 @@ <field name="name">Expenses</field> <field name="res_model">hr.expense.expense</field> <field name="view_type">form</field> - <field name="context">{"search_default_user_id":uid,"search_default_department_id": department_id,"search_default_this":1}</field> + <field name="context">{"search_default_user_id":uid}</field> <field name="search_view_id" ref="view_hr_expense_filter"/> <field name="help">The OpenERP expenses management module allows you to track the full flow. Every month, the employees record their expenses. At the end of the month, their managers validates the expenses sheets which creates costs on projects/analytic accounts. The accountant validates the proposed entries and the employee can be reimbursed. You can also reinvoice the customer at the end of the flow.</field> </record> diff --git a/addons/hr_holidays/__openerp__.py b/addons/hr_holidays/__openerp__.py index 435465e3ddd..f06b41e69da 100644 --- a/addons/hr_holidays/__openerp__.py +++ b/addons/hr_holidays/__openerp__.py @@ -56,6 +56,7 @@ 'security/ir.model.access.csv', 'hr_holidays_workflow.xml', 'hr_holidays_view.xml', + 'hr_holidays_data.xml', 'hr_holidays_wizard.xml', 'hr_holidays_report.xml', 'report/hr_holidays_report_view.xml', diff --git a/addons/hr_holidays/board_hr_holidays_view.xml b/addons/hr_holidays/board_hr_holidays_view.xml index 86786ad1baf..00412073532 100644 --- a/addons/hr_holidays/board_hr_holidays_view.xml +++ b/addons/hr_holidays/board_hr_holidays_view.xml @@ -22,36 +22,36 @@ <record id="board_hr_holidays_form" model="ir.ui.view"> <field name="name">board.hr.holidays.form</field> <field name="model">board.board</field> - <field name="inherit_id" ref="hr.board_hr_form"/> + <field name="inherit_id" ref="hr.board_hr_form"/> <field name="type">form</field> <field name="arch" type="xml"> - <xpath expr="/form/hpaned/child1" position="inside"> - <action colspan="4" height="220" name="%(action_view_holiday_status_board)d" string="My Leaves"/> - </xpath> + <xpath expr="/form/hpaned/child1" position="inside"> + <action colspan="4" height="220" name="%(action_view_holiday_status_board)d" string="My Leaves"/> + </xpath> </field> </record> - <!-- Need to merge in above view --> + <!-- Need to merge in above view --> - <record id="action_hr_holidays_leaves_by_month" model="ir.actions.act_window"> - <field name="name">Leaves by Month</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">available.holidays.report</field> - <field name="view_type">form</field> - <field name="view_mode">graph,tree</field> - <field name="domain">[('user_id','=',uid)]</field> + <record id="action_hr_holidays_leaves_by_month" model="ir.actions.act_window"> + <field name="name">Leaves by Month</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">available.holidays.report</field> + <field name="view_type">form</field> + <field name="view_mode">graph,tree</field> + <field name="domain">[('user_id','=',uid)]</field> <field name="context">{'group_by_no_leaf':1,'group_by':['month']}</field> - <field name="view_id" ref="hr_holidays.view_hr_available_holidays_report_graph"/> - </record> - <record id="board_hr_holidays_leave_by_month_form" model="ir.ui.view"> + <field name="view_id" ref="hr_holidays.view_hr_available_holidays_report_graph"/> + </record> + <record id="board_hr_holidays_leave_by_month_form" model="ir.ui.view"> <field name="name">board.hr.holidays.leave.month.form</field> <field name="model">board.board</field> - <field name="type">form</field> - <field name="inherit_id" ref="hr.board_hr_form"/> + <field name="type">form</field> + <field name="inherit_id" ref="hr.board_hr_form"/> <field name="arch" type="xml"> - <xpath expr="/form/hpaned/child2" position="inside"> - <action colspan="4" height="220" name="%(action_hr_holidays_leaves_by_month)d" string="Leaves by Month" /> - </xpath> + <xpath expr="/form/hpaned/child2" position="inside"> + <action colspan="4" height="220" name="%(action_hr_holidays_leaves_by_month)d" string="Leaves by Month" /> + </xpath> </field> </record> </data> diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 356d697f2c1..eca3c02f301 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -110,9 +110,9 @@ class hr_holidays_status(osv.osv): # To do: we can add remaining_leaves_category field to display remaining leaves for particular type _columns = { - 'name': fields.char('Name', size=64, required=True, translate=True), + 'name': fields.char('Leave Type', size=64, required=True, translate=True), 'categ_id': fields.many2one('crm.case.categ', 'Meeting Category', domain="[('object_id.model', '=', 'crm.meeting')]", help='If you link this type of leave with a category in the CRM, it will synchronize each leave asked with a case in this category, to display it in the company shared calendar for example.'), - 'color_name': fields.selection([('red', 'Red'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color in Report', required=True, help='This color will be used in the leaves summary located in Reporting\Leaves by Departement'), + 'color_name': fields.selection([('red', 'Red'),('blue','Blue'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color in Report', required=True, help='This color will be used in the leaves summary located in Reporting\Leaves by Departement'), 'limit': fields.boolean('Allow to Override Limit', help='If you tick this checkbox, the system will allow, for this section, the employees to take more leaves than the available ones.'), 'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the leave type without removing it."), 'max_leaves': fields.function(_user_left_days, method=True, string='Maximum Leaves Allowed', help='This value is given by the sum of all holidays requests with a positive value.', multi='user_left_days'), @@ -162,7 +162,7 @@ class hr_holidays(osv.osv): 'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',), 'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True), 'category_id': fields.many2one('hr.employee.category', "Category", help='Category Of employee'), - 'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category'), + 'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True), 'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)') } diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml new file mode 100644 index 00000000000..54f53f47a32 --- /dev/null +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<openerp> + <data> + + <!-- Casual leave --> + <record model="hr.holidays.status" id="holiday_status_cl"> + <field name="name">Casual Leave</field> + <field name="double_validation">True</field> + <field name="color_name">black</field> + </record> + + <!-- Legal Holidays --> + <record model="hr.holidays.status" id="holiday_status_sl"> + <field name="name">Legal Holidays</field> + <field name="color_name">blue</field> + </record> + + <!-- Sick leave --> + <record model="hr.holidays.status" id="holiday_status_sl"> + <field name="name">Sick Leave</field> + <field name="limit">True</field> + <field name="color_name">red</field> + </record> + + </data> +</openerp> diff --git a/addons/hr_holidays/hr_holidays_demo.xml b/addons/hr_holidays/hr_holidays_demo.xml index e59bd5a0353..e12d7de16b5 100644 --- a/addons/hr_holidays/hr_holidays_demo.xml +++ b/addons/hr_holidays/hr_holidays_demo.xml @@ -2,13 +2,6 @@ <openerp> <data noupdate="1"> - <!-- Casual leave --> - <record model="hr.holidays.status" id="holiday_status_cl"> - <field name="name">Casual Leave</field> - <field name="double_validation">True</field> - <field name="color_name">black</field> - </record> - <record model="hr.holidays" id="hr_holidays_employee1_allocation_cl"> <field name="name">Casual Leave for Fabien Pinckaers</field> <field name="holiday_status_id" ref="holiday_status_cl"/> @@ -27,13 +20,6 @@ <field name="employee_id" ref="hr.employee1"/> </record> - <!-- Sick leave --> - <record model="hr.holidays.status" id="holiday_status_sl"> - <field name="name">Sick Leave</field> - <field name="limit">True</field> - <field name="color_name">red</field> - </record> - <record model="hr.holidays" id="hr_holidays_employee1_sl"> <field name="name">Doctor Appointment</field> <field name="holiday_status_id" ref="holiday_status_sl"/> diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 124e424f620..1f57b25d402 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -15,10 +15,15 @@ <filter icon="terp-check" domain="[('state','=','draft')]" string="To Confirm"/> <filter icon="terp-camera_test" domain="[('state','=','confirm')]" string="To Approve"/> <separator orientation="vertical"/> - <filter string="This Month" icon="terp-go-month" name="This Month" + <filter string="This Month" icon="terp-go-month" name="This Month" domain="[('date_from','<=', time.strftime('%%Y-%%m-%%d')), ('date_from','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/> <separator orientation="vertical"/> - <field name="employee_id"/> + <field name="employee_id"> + <filter icon="terp-personal" + name="my_leaves" + domain="[('employee_id.user_id','=', uid)]" + help="My Leaves" /> + </field> <field name="department_id" widget="selection"> <filter icon="terp-personal+" help="My Department Holidays" domain="[('department_id.manager_id','=',uid)]" /> @@ -32,14 +37,14 @@ </group> <newline /> <group expand="0" string="Group By..."> - <filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/> + <filter name="group_employee" string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/> <filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'manager_id'}"/> <filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id','set_visible':True}"/> - <separator orientation="vertical"/> - <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'holiday_status_id'}" + <separator orientation="vertical"/> + <filter name="group_type" string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'holiday_status_id'}" default="context.get('report', False)"/> - <separator orientation="vertical"/> - <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> + <separator orientation="vertical"/> + <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> </group> </search> </field> @@ -89,9 +94,9 @@ <field name="notes" nolabel="1" colspan="4"/> <newline/> <field name="state" colspan="2"/> - <group colspan="2"> - <button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> + <group colspan="2" col="6"> <button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> + <button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> @@ -112,7 +117,7 @@ <form string="Allocation Request"> <group col="8" colspan="4"> <field name="name" /> - <field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type"/> + <field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type" groups="base.group_extended"/> <group attrs="{'invisible':[('holiday_type','=','category')]}"> <field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/> </group> @@ -133,11 +138,11 @@ <newline/> <field name="state" colspan="2"/> <group colspan="2"> + <button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> - <button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" groups="base.group_hr_manager"/> </group> </page> @@ -161,11 +166,11 @@ <field name="user_id" invisible="1"/> <!--field name="type"/--> <field name="state"/> + <button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> - <button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" groups="base.group_hr_manager"/> </tree> </field> @@ -191,10 +196,10 @@ <newline/> <field name="state" colspan="2"/> <group colspan="2"> + <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply"/> <button string="Refuse" name="refuse" states="confirm" type="workflow" icon="gtk-no"/> - <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert"/> </group> </page> @@ -221,10 +226,10 @@ <field name="manager_id" invisible="1"/> <field name="user_id" invisible="1"/> <field name="state"/> + <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Refuse" name="refuse" states="confirm" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> - <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" groups="base.group_hr_manager"/> </tree> </field> @@ -248,10 +253,10 @@ <field name="user_id" invisible="1"/> <!--field name="type"/--> <field name="state"/> + <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes" groups="base.group_hr_user,base.group_hr_manager"/> <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_manager"/> <button string="Refuse" name="refuse" states="confirm" type="workflow" icon="gtk-no" groups="base.group_hr_manager"/> - <button string="Cancel" name="cancel" states="validate,refuse,validate1" type="workflow" icon="gtk-cancel" groups="base.group_hr_manager"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" groups="base.group_hr_manager"/> </tree> </field> @@ -269,7 +274,7 @@ <field name="res_model">hr.holidays</field> <field name="view_type">form</field> <field name="view_id" ref="edit_holiday_new"/> - <field name="context">{"search_default_department_id": department_id}</field> + <field name="context">{"search_default_department_id": department_id, "search_default_my_leaves": 1}</field> <field name="domain">[('type','=','remove')]</field> <field name="search_view_id" ref="view_hr_holidays_filter"/> <field name="help">Leaves requests can be recorded by employees and validated by their managers. Once a leave request is validated it appears automatically in the agenda of the employee. You can define several allowance types (paid holidays, sickness, etc) and manage allowances per type.</field> @@ -303,7 +308,7 @@ <field name="name">Allocation Requests</field> <field name="res_model">hr.holidays</field> <field name="view_type">form</field> - <field name="context">{'search_default_user_id':uid,'type':'add',"search_default_department_id": department_id}</field> + <field name="context">{"search_default_my_leaves": 1,'type':'add',"search_default_department_id": department_id}</field> <field name="domain">[('type','=','add')]</field> <field name="view_id" ref="allocation_leave_new"/> <field name="search_view_id" ref="view_hr_holidays_filter"/> @@ -331,7 +336,7 @@ <field name="view_type">form</field> <field name="view_mode">tree,form</field> <field name="view_id" eval="view_holiday_simple"/> - <field name="context">{'allocation_type':'company', 'report':True,"search_default_department_id": department_id}</field> + <field name="context">{'search_default_my_leaves': 1, 'search_default_group_type': 1}</field> <field name="search_view_id" ref="view_hr_holidays_filter"/> </record> @@ -349,12 +354,15 @@ <field name="type">form</field> <field name="arch" type="xml"> <form string="Leave Type"> - <field colspan="4" name="name" /> - <field name="limit"/> - <field name="active"/> - <field name="categ_id" widget="selection"/> - <field name="color_name"/> - <field name="double_validation" /> + <group colspan="4" col="6"> + <field name="name" /> + <field name="color_name"/> + <field name="categ_id" widget="selection" groups="base.group_extended"/> + <newline/> + <field name="limit"/> + <field name="double_validation"/> + <field name="active"/> + </group> </form> </field> </record> diff --git a/addons/hr_holidays/report/hr_holidays_report_view.xml b/addons/hr_holidays/report/hr_holidays_report_view.xml index b2fa98a7720..e2ffc0fc0e9 100644 --- a/addons/hr_holidays/report/hr_holidays_report_view.xml +++ b/addons/hr_holidays/report/hr_holidays_report_view.xml @@ -98,7 +98,7 @@ <field name="res_model">hr.holidays.report</field> <field name="view_type">form</field> <field name="view_mode">tree,graph</field> - <field name="context">{"search_default_user_id": uid, 'search_default_month':1, 'search_default_Employee':1,'search_default_department':1,"search_default_Validated":1, 'group_by':[], 'group_by_no_leaf':1} </field> + <field name="context">{'search_default_Employee':1,'search_default_department':1,"search_default_Validated":1, 'group_by':[], 'group_by_no_leaf':1} </field> <field name="search_view_id" ref="view_hr_holidays_report_search"/> </record> diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 0b06790407d..9d99be20b8a 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -985,11 +985,11 @@ </notebook> <group col="8" colspan="4"> <field name="state"/> + <button string="Cancel" name="cancel_sheet" icon="gtk-cancel" states="draft,hr_check,accont_check,confirm" type="object"/> <button string="Compute" name="compute_sheet" states="new" icon="terp-document-new" type="object"/> <button string="Verify Sheet" icon="gtk-ok" name="verify_sheet" states="draft" type="object"/> <button string="Complete HR Checking" icon="gtk-apply" name="final_verify_sheet" type="object" states="hr_check"/> <button string="Pay Salary" icon="gtk-apply" name="process_sheet" states="confirm" type="object" /> - <button string="Cancel" name="cancel_sheet" icon="gtk-cancel" states="draft,hr_check,accont_check,confirm" type="object"/> <button string="Set to Draft" name="set_to_draft" states="cancel" type="object" icon="gtk-convert" /> </group> </form> diff --git a/addons/hr_payroll/report/report_emp_salary_structure.rml b/addons/hr_payroll/report/report_emp_salary_structure.rml index e5505eb5b02..5f81a0942ae 100644 --- a/addons/hr_payroll/report/report_emp_salary_structure.rml +++ b/addons/hr_payroll/report/report_emp_salary_structure.rml @@ -302,7 +302,7 @@ <para style="terp_tblheader_Details">Other No.</para> </td> <td> - <para style="terp_default_9">[[ employee.pan_no or '' ]]</para> + <para style="terp_default_9">[[ employee.otherid or '' ]]</para> </td> <td> <para style="terp_tblheader_Details">Address</para> @@ -436,6 +436,9 @@ </td> </tr> </blockTable> + <para style="terp_default_1"> + <font color="white"> </font> + </para> <section> <para style="terp_default_1"> <font color="white"> </font> @@ -477,7 +480,13 @@ </td> </tr> </blockTable> + <para style="terp_default_1"> + <font color="white"> </font> + </para> </section> + <para style="terp_default_1"> + <font color="white"> </font> + </para> </section> </section> <para style="terp_default_9"> @@ -490,6 +499,9 @@ </td> </tr> </blockTable> + <para style="terp_default_1"> + <font color="white"> </font> + </para> <section> <para style="terp_default_1"> <font color="white"> </font> @@ -510,6 +522,9 @@ </td> </tr> </blockTable> + <para style="terp_default_1"> + <font color="white"> </font> + </para> <section> <para style="terp_default_9">[[repeatIn(employee.line_ids,'line1')]]</para> <blockTable colWidths="34.0,338.0,81.0,86.0" style="Table12"> @@ -532,6 +547,12 @@ <font color="white"> </font> </para> </section> + <para style="terp_default_1"> + <font color="white"> </font> + </para> </section> + <para style="terp_default_9"> + <font color="white"> </font> + </para> </story> </document> diff --git a/addons/hr_payroll/report/report_employees_detail.py b/addons/hr_payroll/report/report_employees_detail.py index 5c3eff3370b..efa4c1ee236 100644 --- a/addons/hr_payroll/report/report_employees_detail.py +++ b/addons/hr_payroll/report/report_employees_detail.py @@ -48,10 +48,14 @@ class employees_salary_report(rml_parse.rml_parse): m = datetime.date(cy, cm, 1).strftime('%b') mnth_name.append(m) self.mnths.append(str(cm)+'-'+str(cy)) + if cm == 12: cm = 0 cy = ly cm = cm +1 + for c in range(0,(12-no_months)): + mnth_name.append('None') + self.mnths.append('None') return [mnth_name] def get_employee(self,form): @@ -134,11 +138,14 @@ class employees_salary_report(rml_parse.rml_parse): category_name = self.pool.get('hr.allounce.deduction.categoty').read(self.cr, self.uid, [category],['name','type'])[0] result.append(category_name['name']) for mnth in self.mnths: - if len(mnth) != 7: - mnth = '0' + str(mnth) - query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " - self.cr.execute(query) - payslip_id = self.cr.dictfetchone() + if mnth <> 'None': + if len(mnth) != 7: + mnth = '0' + str(mnth) + query = "select id from hr_payslip where employee_id = "+str(emp_id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " + self.cr.execute(query) + payslip_id = self.cr.dictfetchone() + else: + payslip_id = False if payslip_id: payslip_obj = self.pool.get('hr.payslip').browse(self.cr, self.uid, payslip_id['id']) if not category: diff --git a/addons/hr_payroll/report/report_employees_detail.rml b/addons/hr_payroll/report/report_employees_detail.rml index 9ddad713046..542e370eb34 100644 --- a/addons/hr_payroll/report/report_employees_detail.rml +++ b/addons/hr_payroll/report/report_employees_detail.rml @@ -86,19 +86,33 @@ <blockTableStyle id="Table4"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="8,0" stop="8,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="9,0" stop="9,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="9,-1" stop="9,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="10,0" stop="10,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="10,-1" stop="10,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="11,0" stop="11,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="11,-1" stop="11,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="12,0" stop="12,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="12,-1" stop="12,-1"/> + <lineStyle kind="LINEABOVE" colorName="#000000" start="13,0" stop="13,0"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="13,-1" stop="13,-1"/> </blockTableStyle> <blockTableStyle id="Table7"> @@ -108,20 +122,20 @@ <blockTableStyle id="Table6"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="9,-1" stop="9,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="10,-1" stop="10,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="11,-1" stop="11,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="12,-1" stop="12,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="13,-1" stop="13,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="9,-1" stop="9,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="10,-1" stop="10,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="11,-1" stop="11,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="12,-1" stop="12,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="13,-1" stop="13,-1"/> </blockTableStyle> <blockTableStyle id="Table10"> <blockAlignment value="LEFT"/> @@ -130,20 +144,20 @@ <blockTableStyle id="Table8"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="9,-1" stop="9,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="10,-1" stop="10,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="11,-1" stop="11,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="12,-1" stop="12,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="13,-1" stop="13,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="9,-1" stop="9,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="10,-1" stop="10,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="11,-1" stop="11,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="12,-1" stop="12,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="13,-1" stop="13,-1"/> </blockTableStyle> <blockTableStyle id="Table11"> <blockAlignment value="LEFT"/> @@ -152,20 +166,20 @@ <blockTableStyle id="Table9"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="9,-1" stop="9,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="10,-1" stop="10,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="11,-1" stop="11,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="12,-1" stop="12,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="13,-1" stop="13,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="9,-1" stop="9,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="10,-1" stop="10,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="11,-1" stop="11,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="12,-1" stop="12,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="13,-1" stop="13,-1"/> </blockTableStyle> <blockTableStyle id="Table1"> <blockAlignment value="LEFT"/> @@ -292,7 +306,7 @@ <para style="terp_tblheader_Details">Other No.</para> </td> <td> - <para style="terp_default_9">[[ o.pan_no or ' ']]</para> + <para style="terp_default_9">[[ o.otherid or '' ]]</para> </td> <td> <para style="terp_tblheader_Details">Address</para> @@ -329,52 +343,55 @@ </para> <section> <para style="terp_default_8">[[ repeatIn(get_periods(data['form']),'m') ]] [[ get_employee_detail(o) ]]</para> - <blockTable colWidths="99.0,73.0,69.0,74.0,71.0,73.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table4"> + <blockTable colWidths="137.0,64.0,62.0,64.0,68.0,69.0,76.0,71.0,80.0,75.0,79.0,78.0,70.0,70.0" style="Table4"> <tr> <td> <para style="terp_tblheader_Details">Title</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[0] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[0] != 'None' and m[0] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[1] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[1] != 'None' and m[1] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[2] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[2] != 'None' and m[2] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[3] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[3] != 'None' and m[3] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[4] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[4] != 'None' and m[4] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[5] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[5] != 'None' and m[5] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[6] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[6] != 'None' and m[6] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[7] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[7] != 'None' and m[7] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[8] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[8] != 'None' and m[8] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[9] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[9] != 'None' and m[9] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[10] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[10] != 'None' and m[10] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[11] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[11] != 'None' and m[11] or '' ]]</para> </td> <td> <para style="terp_tblheader_Details_Right">Total</para> </td> </tr> </blockTable> + <para style="terp_default_1"> + <font color="white"> </font> + </para> <section> <blockTable colWidths="1063.0" style="Table7"> <tr> @@ -384,8 +401,8 @@ </tr> </blockTable> <section> - <para style="terp_default_9">[[ repeatIn(get_allow(),'e1') ]]</para> - <blockTable colWidths="99.0,73.0,69.0,74.0,70.0,74.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table6"> + <para style="terp_default_1">[[ repeatIn(get_allow(),'e1') ]]</para> + <blockTable colWidths="138.0,62.0,62.0,64.0,68.0,70.0,75.0,70.0,80.0,75.0,79.0,77.0,71.0,70.0" style="Table6"> <tr> <td> <para style="terp_default_9">[[ e1[0] ]]</para> @@ -440,9 +457,8 @@ </tr> </blockTable> <section> - - <para style="terp_default_9">[[ repeatIn(get_deduct(),'e2') ]]</para> - <blockTable colWidths="99.0,73.0,69.0,74.0,70.0,74.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table8"> + <para style="terp_default_1">[[ repeatIn(get_deduct(),'e2') ]]</para> + <blockTable colWidths="137.0,63.0,62.0,63.0,70.0,69.0,76.0,71.0,79.0,76.0,79.0,77.0,73.0,70.0" style="Table8"> <tr> <td> <para style="terp_default_9">[[ e2[0] ]]</para> @@ -497,8 +513,8 @@ </tr> </blockTable> <section> - <para style="terp_default_9">[[ repeatIn(get_other(),'e3') ]]</para> - <blockTable colWidths="99.0,73.0,69.0,74.0,70.0,74.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table9"> + <para style="terp_default_1">[[ repeatIn(get_other(),'e3') ]]</para> + <blockTable colWidths="137.0,62.0,64.0,62.0,69.0,70.0,77.0,70.0,78.0,77.0,79.0,77.0,73.0,69.0" style="Table9"> <tr> <td> <para style="terp_default_9">[[ e3[0] ]]</para> @@ -546,49 +562,49 @@ </blockTable> </section> </section> - <blockTable colWidths="101.0,73.0,68.0,74.0,70.0,74.0,74.0,73.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table1"> + <blockTable colWidths="137.0,62.0,64.0,62.0,60.0,78.0,78.0,70.0,78.0,77.0,78.0,77.0,74.0,68.0" style="Table1"> <tr> <td> <para style="terp_tblheader_Details">[[ get_monthly_total()[0] ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[1]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[1]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[2]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[2]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[3]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[3]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[4]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[4]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[5]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[5]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[6]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[6]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[7]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[7]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[8]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[8]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[9]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[9]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[10]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[10]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[11]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[11]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[12]) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_Details_Right">[[ formatLang(get_monthly_total()[12]) ]][[ company.currency_id.symbol ]]</para> </td> <td> - <para style="terp_tblheader_General_Right">[[ formatLang(get_total()) ]] [[ company.currency_id.symbol ]]</para> + <para style="terp_tblheader_General_Right">[[ formatLang(get_total()) ]][[ company.currency_id.symbol ]]</para> </td> </tr> </blockTable> diff --git a/addons/hr_payroll/report/report_year_report.rml b/addons/hr_payroll/report/report_year_report.rml index e191b5108f2..212bb59e7b3 100755 --- a/addons/hr_payroll/report/report_year_report.rml +++ b/addons/hr_payroll/report/report_year_report.rml @@ -146,58 +146,55 @@ <font color="white"> </font> </para> <section> - <para style="terp_default_8">[[ repeatIn(get_periods(data['form']),'m') ]]</para> + <para style="terp_default_1">[[ repeatIn(get_periods(data['form']),'m') ]]</para> <blockTable colWidths="99.0,73.0,69.0,74.0,71.0,73.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table4"> <tr> <td> <para style="terp_tblheader_Details">Name</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[0] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[0] != 'None' and m[0] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[1] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[1] != 'None' and m[1] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[2] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[2] != 'None' and m[2] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[3] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[3] != 'None' and m[3] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[4] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[4] != 'None' and m[4] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[5] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[5] != 'None' and m[5] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[6] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[6] != 'None' and m[6] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[7] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[7] != 'None' and m[7] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[8] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[8] != 'None' and m[8] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[9] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[9] != 'None' and m[9] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[10] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[10] != 'None' and m[10] or '' ]]</para> </td> <td> - <para style="terp_tblheader_Details_Right">[[ m[11] ]]</para> + <para style="terp_tblheader_Details_Right">[[ m[11] != 'None' and m[11] or '' ]]</para> </td> <td> <para style="terp_tblheader_Details_Right">Total</para> </td> </tr> </blockTable> - <para style="terp_default_1"> - <font color="white"> </font> - </para> <section> - <para style="terp_default_9">[[ repeatIn(get_employee(data['form']),'e') ]]</para> + <para style="terp_default_1">[[ repeatIn(get_employee(data['form']),'e') ]]</para> <blockTable colWidths="99.0,73.0,69.0,74.0,70.0,74.0,75.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table1"> <tr> <td> @@ -247,7 +244,7 @@ </section> </section> <section> - <para style="P1">[[ repeatIn(get_months_tol(),'t') ]]</para> + <para style="terp_default_1">[[ repeatIn(get_months_tol(),'t') ]]</para> <blockTable colWidths="99.0,73.0,69.0,74.0,70.0,75.0,74.0,72.0,76.0,76.0,76.0,76.0,76.0,76.0" style="Table6"> <tr> <td> @@ -298,8 +295,5 @@ <font color="white"> </font> </para> </section> - <para style="terp_default_8"> - <font color="white"> </font> - </para> </story> </document>
\ No newline at end of file diff --git a/addons/hr_payroll/report/report_year_salary.py b/addons/hr_payroll/report/report_year_salary.py index 4d0e0aa670c..0a7857582d4 100755 --- a/addons/hr_payroll/report/report_year_salary.py +++ b/addons/hr_payroll/report/report_year_salary.py @@ -43,6 +43,9 @@ class year_salary_report(rml_parse.rml_parse): cm = 0 cy = ly cm = cm +1 + for c in range(0,(12-no_months)): + mnth_name.append('None') + self.mnths.append('None') return [mnth_name] def get_employee(self,form): @@ -58,11 +61,14 @@ class year_salary_report(rml_parse.rml_parse): ls1.append(emp_id.name) tol = 0.0 for mnth in self.mnths: - if len(mnth) != 7: - mnth = '0' + str(mnth) - query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " - self.cr.execute(query) - sal = self.cr.fetchall() + if mnth <> 'None': + if len(mnth) != 7: + mnth = '0' + str(mnth) + query = "select net from hr_payslip where employee_id = "+str(emp_id.id)+" and to_char(date,'mm-yyyy') like '%"+mnth+"%' and state = 'done' " + self.cr.execute(query) + sal = self.cr.fetchall() + else: + sal = [(0.0,)] try: ls1.append(sal[0][0]) except: diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index 75ad6101e11..84e7db409ab 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -33,6 +33,29 @@ class hr_employee(osv.osv): 'product_id': fields.many2one('product.product', 'Product', help="Specifies employee's designation as a product with type 'service'."), 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal') } + + def _getAnalyticJournal(self, cr, uid, context=None): + md = self.pool.get('ir.model.data') + try: + result = md.get_object_reference(cr, uid, 'hr_timesheet', 'analytic_journal') + return result[1] + except ValueError, e: + pass + return False + + def _getEmployeeProduct(self, cr, uid, context=None): + md = self.pool.get('ir.model.data') + try: + result = md.get_object_reference(cr, uid, 'hr_timesheet', 'product_consultant') + return result[1] + except ValueError, e: + pass + return False + + _defaults = { + 'journal_id' : _getAnalyticJournal, + 'product_id' : _getEmployeeProduct + } hr_employee() diff --git a/addons/hr_timesheet/hr_timesheet_data.xml b/addons/hr_timesheet/hr_timesheet_data.xml index 08a769d7ee6..e7cb3d5e0d4 100644 --- a/addons/hr_timesheet/hr_timesheet_data.xml +++ b/addons/hr_timesheet/hr_timesheet_data.xml @@ -6,5 +6,17 @@ <field name="name">Timesheet Journal</field> <field name="type">general</field> </record> + + <record id="product_consultant" model="product.product"> + <field name="list_price">75.0</field> + <field name="standard_price">30.0</field> + <field name="uom_id" ref="product.uom_hour"/> + <field name="uom_po_id" ref="product.uom_hour"/> + <field name="name">Service on Timesheet</field> + <field name="categ_id" ref="product.cat0"/> + <field name="type">service</field> + <field eval="False" name="purchase_ok"/> + </record> + </data> </openerp> diff --git a/addons/hr_timesheet/hr_timesheet_demo.xml b/addons/hr_timesheet/hr_timesheet_demo.xml index f344b60c83e..e7ba5c91342 100644 --- a/addons/hr_timesheet/hr_timesheet_demo.xml +++ b/addons/hr_timesheet/hr_timesheet_demo.xml @@ -2,20 +2,6 @@ <openerp> <data noupdate="1"> - <record id="product_consultant" model="product.product"> - <field name="default_code">DEV</field> - <field name="list_price">75.0</field> - <field name="standard_price">30.0</field> - <field name="uom_id" ref="product.uom_hour"/> - <field name="uom_po_id" ref="product.uom_hour"/> - <field name="name">Consultancy - Senior Developer</field> - <field name="categ_id" ref="product.product_category_10"/> - <field name="type">service</field> - <field name="supply_method">produce</field> - <field name="procure_method">make_to_order</field> - <field eval="False" name="purchase_ok"/> - </record> - <!-- complete our example employee --> <record id="hr.employee1" model="hr.employee"> <field name="product_id" ref="product_consultant"/> diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index a47fbf24685..664587b75a3 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -111,7 +111,7 @@ <page string="Categories" position="after"> <page string="Timesheets"> <field name="product_id" domain="[('type','=','service')]"/> - <field name="journal_id"/> + <field name="journal_id" widget="selection"/> </page> </page> </field> diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 7f79051edce..f605fd760be 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -63,7 +63,8 @@ class account_analytic_account(osv.osv): _inherit = "account.analytic.account" _columns = { - 'pricelist_id' : fields.many2one('product.pricelist', 'Sale Pricelist'), + 'pricelist_id' : fields.many2one('product.pricelist', 'Sale Pricelist', + help="The product to invoice is defined on the employee form, the price will be deduced by this pricelist on the product."), 'amount_max': fields.float('Max. Invoice Price'), 'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount', help="Total invoiced"), diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index 4beda0999d0..4a70a80f381 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -80,7 +80,7 @@ <field name="arch" type="xml"> <filter name="others" position="after"> <separator orientation="vertical"/> - <filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False),('to_invoice','<>',False)]" icon="terp-sale"/> + <filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False),('to_invoice','<>',False)]" icon="terp-dolar"/> </filter> </field> </record> @@ -112,7 +112,7 @@ <!-- Menus --> <record id="action_hr_analytic_timesheet_open_tree" model="ir.actions.act_window"> - <field name="name">Costs to Invoice</field> + <field name="name">Bill Tasks Works</field> <field name="res_model">account.analytic.line</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 1bb7765b372..475315068ae 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -35,31 +35,14 @@ class hr_timesheet_invoice_create(osv.osv_memory): _name = 'hr.timesheet.invoice.create' _description = 'Create invoice from timesheet' _columns = { - 'accounts': fields.many2many('account.analytic.account', 'invoice_id', 'account_id', 'Analytic Accounts', required=True), 'date': fields.boolean('Date', help='The real date of each work will be displayed on the invoice'), 'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'), 'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'), 'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'), 'product': fields.many2one('product.product', 'Product', help='Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'), - } - - def _get_accounts(self, cr, uid, context=None): - if context is None: - context = {} - if not len(context['active_ids']): - return {} - #Checking whether the analytic line is invoiced or not - analytic_line_obj = self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context=context) - for obj_acc in analytic_line_obj: - if obj_acc.invoice_id and obj_acc.invoice_id.state !='cancel': - raise osv.except_osv(_('Warning'),_('The analytic entry "%s" is already invoiced!')%(obj_acc.name,)) - - cr.execute("SELECT distinct(account_id) from account_analytic_line where id IN %s",(tuple(context['active_ids']),)) - account_ids = cr.fetchall() - return [x[0] for x in account_ids] + } _defaults = { - 'accounts': _get_accounts, 'date': lambda *args: 1, 'name': lambda *args: 1 } @@ -82,12 +65,17 @@ class hr_timesheet_invoice_create(osv.osv_memory): result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') res = mod_obj.read(cr, uid, result, ['res_id'], context=context) data = self.read(cr, uid, ids, [], context=context)[0] - account_ids = data['accounts'] + + account_ids = {} + for line in self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context=context): + account_ids[line.account_id.id] = True + + account_ids = account_ids.keys() #data['accounts'] for account in analytic_account_obj.browse(cr, uid, account_ids, context=context): partner = account.partner_id if (not partner) or not (account.pricelist_id): raise osv.except_osv(_('Analytic Account incomplete'), - _('Please fill in the Associate Partner and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,)) + _('Please fill in the Partner or Customer and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,)) if not partner.address: raise osv.except_osv(_('Partner incomplete'), @@ -190,7 +178,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): invoice_line_obj.create(cr, uid, curr_line, context=context) cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s" ,(last_invoice, account.id, tuple(context['active_ids']))) - invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context) + invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context) mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml index 7b3f5ed4d6a..b45deeae8a2 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_final_view.xml @@ -20,7 +20,7 @@ <separator colspan="4"/> <group col="2" colspan="4"> <button special="cancel" string="Cancel" icon='gtk-cancel'/> - <button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/> + <button name="do_create" string="Create Invoices" colspan="1" type="object" icon="terp-gtk-go-back-rtl"/> </group> </form> </field> @@ -46,4 +46,4 @@ </record> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml index fc6d6da911e..c02215cf742 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create_view.xml @@ -10,23 +10,23 @@ <form string="Invoice analytic lines"> <notebook colspan="4"> <page string="Billing Data"> - <separator string="Do you want to show details of work in invoice ?" colspan="4"/> - <field name="date"/> - <field name="time"/> - <field name="name"/> - <field name="price"/> - <separator string="Force to use a specific product" colspan="4"/> - <field name="product"/> - </page> - <page string="Filter on Accounts" groups="base.group_extended"> - <separator string="Choose accounts you want to invoice" colspan="4"/> - <field name="accounts" colspan="4" nolabel="1"/> + <group col="4" colspan="4"> + <separator string="Do you want to show details of work in invoice ?" colspan="4"/> + <field name="date"/> + <field name="time"/> + <field name="name"/> + <field name="price" groups="base.group_extended"/> + </group> + <group col="2" colspan="4" groups="base.group_extended"> + <separator string="Force to use a specific product" colspan="4" /> + <field name="product"/> + </group> </page> </notebook> <separator colspan="4"/> <group col="2" colspan="4"> <button special="cancel" string="Cancel" icon='gtk-cancel'/> - <button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/> + <button name="do_create" string="Create Invoices" colspan="1" type="object" icon="terp-gtk-go-back-rtl"/> </group> </form> </field> diff --git a/addons/hr_timesheet_sheet/__openerp__.py b/addons/hr_timesheet_sheet/__openerp__.py index 1b554a6b242..7b114d46387 100644 --- a/addons/hr_timesheet_sheet/__openerp__.py +++ b/addons/hr_timesheet_sheet/__openerp__.py @@ -53,7 +53,6 @@ The validation can be configured in the company: 'hr_timesheet_sheet_view.xml', 'hr_timesheet_workflow.xml', 'process/hr_timesheet_sheet_process.xml', - 'report/timesheet_report_view.xml', 'board_hr_timesheet_view.xml', 'report/hr_timesheet_report_view.xml', 'wizard/hr_timesheet_current_view.xml', diff --git a/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml b/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml index f299cb94298..a50042c3dfb 100644 --- a/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml +++ b/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> - <menuitem id="base.menu_hr_dasboard" name="Dashboard" parent="hr.menu_hr_reporting" sequence="0" groups="base.group_system,base.group_hr_manager,base.group_hr_user"/> + <menuitem + id="base.menu_hr_dasboard" name="Dashboard" parent="hr.menu_hr_reporting" + sequence="0" groups="base.group_hr_manager"/> <menuitem action="hr.open_board_hr" icon="terp-graph" @@ -9,16 +11,6 @@ parent="base.menu_hr_dasboard" sequence="4"/> - <record id="action_timesheet_report_all" model="ir.actions.act_window"> - <field name="name">Timesheets by Month</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">timesheet.report</field> - <field name="view_type">form</field> - <field name="view_mode">graph,tree</field> - <field name="domain">[('user_id','=',uid), ('month', '=' , time.strftime('%m')), ('year', '=', time.strftime('%Y'))]</field> - <field name="view_id" ref="hr_timesheet_sheet.view_timesheet_report_graph"/> - </record> - <record id="action_hr_timesheet_sheet_graph" model="ir.actions.act_window"> <field name="name">Timesheets</field> <field name="type">ir.actions.act_window</field> @@ -28,39 +20,6 @@ <field name="view_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_graph"/> </record> - <record id="view_employee_attendance_graph" model="ir.ui.view"> - <field name="name">Employee Attendance Graph</field> - <field name="model">timesheet.report</field> - <field name="type">graph</field> - <field name="arch" type="xml"> - <graph string="Employee Attendances" type="bar"> - <field name="user_id" /> - <field name="total_attendance" operator="+"/> - <field name="total_timesheet" operator="+"/> - </graph> - </field> - </record> - - <record id="action_employee_attendance_graph" model="ir.actions.act_window"> - <field name="name">Employee Attendance Graph</field> - <field name="res_model">timesheet.report</field> - <field name="view_type">form</field> - <field name="view_mode">graph</field> - <field name="view_id" ref="view_employee_attendance_graph"/> - </record> - - <record id="board_hr_timesheet_form" model="ir.ui.view"> - <field name="name">board.hr.timesheet.form</field> - <field name="model">board.board</field> - <field name="inherit_id" ref="hr.board_hr_manager_form"/> - <field name="type">form</field> - <field name="arch" type="xml"> - <xpath expr="/form/hpaned/child2" position="inside"> - <action colspan="4" height="220" name="%(action_employee_attendance_graph)d" string="Employee Attendances" /> - </xpath> - </field> - </record> - <record id="hr_timesheet_sheet_tree" model="ir.ui.view"> <field name="name">hr.timesheet.sheet.tree.simplified.board</field> <field name="model">hr_timesheet_sheet.sheet</field> diff --git a/addons/hr_timesheet_sheet/report/__init__.py b/addons/hr_timesheet_sheet/report/__init__.py index b06b0608356..8dac73f07ec 100644 --- a/addons/hr_timesheet_sheet/report/__init__.py +++ b/addons/hr_timesheet_sheet/report/__init__.py @@ -19,7 +19,5 @@ # ############################################################################## -import timesheet_report import hr_timesheet_report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet_sheet/report/timesheet_report.py b/addons/hr_timesheet_sheet/report/timesheet_report.py deleted file mode 100644 index 6688c747983..00000000000 --- a/addons/hr_timesheet_sheet/report/timesheet_report.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 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/>. -# -############################################################################## - -import tools -from osv import fields,osv - -class timesheet_report(osv.osv): - _name = "timesheet.report" - _description = "Timesheet" - _auto = False - _columns = { - 'year': fields.char('Year',size=64,required=False, readonly=True), - 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), - ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), - 'day': fields.char('Day', size=128, readonly=True), - 'name': fields.char('Description', size=64,readonly=True), - 'product_id' : fields.many2one('product.product', 'Product'), - 'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True), - 'employee_id': fields.many2one('hr.employee', 'Employee',readonly=True), - 'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing',readonly=True), - 'account_id': fields.many2one('account.analytic.account', 'Analytic Account',readonly=True), - 'nbr': fields.integer('#Nbr',readonly=True), - 'total_diff': fields.float('#Total Diff',readonly=True), - 'total_timesheet': fields.float('#Total Timesheet',readonly=True), - 'total_attendance': fields.float('#Total Attendance',readonly=True), - 'company_id': fields.many2one('res.company', 'Company',readonly=True), - 'department_id':fields.many2one('hr.department','Department',readonly=True), - 'date_from': fields.date('Date from',readonly=True,), - 'date_to': fields.date('Date to',readonly=True), - 'date_current': fields.date('Current date', required=True), - 'state' : fields.selection([ - ('new', 'New'), - ('draft','Draft'), - ('confirm','Confirmed'), - ('done','Done')], 'State', readonly=True), - 'quantity': fields.float('#Quantity',readonly=True), - 'cost': fields.float('#Cost',readonly=True), - } - - def init(self, cr): - tools.drop_view_if_exists(cr, 'timesheet_report') - cr.execute(""" - create or replace view timesheet_report as ( - select - min(aal.id) as id, - htss.date_current, - htss.name, - htss.date_from, - htss.date_to, - to_char(htss.date_current,'YYYY') as year, - to_char(htss.date_current,'MM') as month, - to_char(htss.date_current, 'YYYY-MM-DD') as day, - count(*) as nbr, - aal.unit_amount as quantity, - aal.amount as cost, - aal.account_id, - aal.product_id, - (SELECT sum(day.total_difference) - FROM hr_timesheet_sheet_sheet AS sheet - LEFT JOIN hr_timesheet_sheet_sheet_day AS day - ON (sheet.id = day.sheet_id - AND day.name = sheet.date_current) where sheet.id=htss.id) as total_diff, - (SELECT sum(day.total_timesheet) - FROM hr_timesheet_sheet_sheet AS sheet - LEFT JOIN hr_timesheet_sheet_sheet_day AS day - ON (sheet.id = day.sheet_id - AND day.name = sheet.date_current) where sheet.id=htss.id) as total_timesheet, - (SELECT sum(day.total_attendance) - FROM hr_timesheet_sheet_sheet AS sheet - LEFT JOIN hr_timesheet_sheet_sheet_day AS day - ON (sheet.id = day.sheet_id - AND day.name = sheet.date_current) where sheet.id=htss.id) as total_attendance, - aal.to_invoice, - aal.general_account_id, - htss.employee_id as employee_id, - htss.company_id, - htss.department_id, - htss.state - from hr_timesheet_sheet_sheet as htss - left join hr_analytic_timesheet as hat ON (hat.create_uid=htss.create_uid) - left join account_analytic_line as aal ON (hat.line_id=aal.id) - group by - to_char(htss.date_current,'YYYY'), - to_char(htss.date_current,'MM'), - to_char(htss.date_current, 'YYYY-MM-DD'), - aal.account_id, - htss.date_from, - htss.date_to, - aal.unit_amount, - aal.amount, - htss.date_current, - aal.to_invoice, - aal.product_id, - aal.general_account_id, - htss.name, - htss.company_id, - htss.state, - htss.id, - htss.department_id, - htss.employee_id - - ) - """) -timesheet_report() diff --git a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml b/addons/hr_timesheet_sheet/report/timesheet_report_view.xml deleted file mode 100644 index 34397ba1c7d..00000000000 --- a/addons/hr_timesheet_sheet/report/timesheet_report_view.xml +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - <record id="view_timesheet_report_graph" model="ir.ui.view"> - <field name="name">timesheet.report.graph</field> - <field name="model">timesheet.report</field> - <field name="type">graph</field> - <field name="arch" type="xml"> - <graph string="Timesheet" type="bar"> - <field name="employee_id" /> - <field name="quantity" operator = "+"/> - <field name="state" group = "True"/> - </graph> - </field> - </record> - <record id="view_timesheet_report_tree" model="ir.ui.view"> - <field name="name">timesheet.report.tree</field> - <field name="model">timesheet.report</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree colors="blue:state in ('draft');black:state in ('confirm','new');gray:state in('cancel')" string="Timesheet"> - <field name="date_current" invisible="1"/> - <field name="name" invisible="1"/> - <field name="employee_id" invisible="1"/> - <field name="date_from" invisible="1"/> - <field name="date_to" invisible="1"/> - <field name="state" invisible="1"/> - <field name="department_id" invisible="1"/> - <field name="company_id" invisible="1"/> - <field name="to_invoice" invisible="1"/> - <field name="product_id" invisible="1"/> - <field name="account_id" invisible="1" groups="analytic.group_analytic_accounting"/> - <field name="general_account_id" invisible="1"/> - <field name="year" invisible="1"/> - <field name="day" invisible="1"/> - <field name="month" invisible="1"/> - <field name="total_attendance" sum="#Total Attendance"/> - <field name="total_timesheet" sum="#Total Timesheet"/> - <field name="total_diff" sum="#Total Diff"/> - <field name="quantity" sum="#Quantity"/> - <field name="cost" sum="#Cost"/> - </tree> - </field> - </record> - <record id="view_timesheet_report_search" model="ir.ui.view"> - <field name="name">timesheet.report.search</field> - <field name="model">timesheet.report</field> - <field name="type">search</field> - <field name="arch" type="xml"> - <search string="Timesheet"> - <group col="10" colspan="12"> - <filter icon="terp-go-year" string=" Year " - domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')),('date_current','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]" - help="Timesheet in current year"/> - <filter icon="terp-go-month" string=" Month " - name="month" - domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')), ('date_current','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" - help="Timesheet in current month"/> - <filter icon="terp-go-month" - string=" Month-1 " - domain="[('date_current','<=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_current','>',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" - help="Timesheet of last month"/> - <separator orientation="vertical"/> - <filter icon="terp-document-new" - string="Draft" - domain="[('state','=','draft')]"/> - <filter icon="terp-camera_test" - string="Confirmed" - domain="[('state','=','confirm')]"/> - <filter icon="terp-dialog-close" - string="Done" - domain="[('state','=','done')]"/> - <separator orientation="vertical"/> - <field name="account_id" groups="analytic.group_analytic_accounting"/> - <field name="user_id" /> - </group> - <newline/> - <group expand="0" string="Extended Filters..." groups="base.group_extended"> - <field name="general_account_id"/> - <field name="to_invoice" widget="selection"/> - <separator orientation="vertical"/> - <field name="product_id"/> - <separator orientation="vertical"/> - <field name="department_id" widget="selection"/> - <separator orientation="vertical"/> - <field name="company_id" widget="selection" groups="base.group_multi_company"/> - <newline/> - <field name="date_to"/> - <field name="date_from"/> - </group> - <newline/> - <group expand="1" string="Group By..."> - <filter string="Employee" name="Employee_id" icon="terp-personal" context="{'group_by':'employee_id'}"/> - <filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/> - <separator orientation="vertical"/> - <filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/> - <separator orientation="vertical"/> - <filter string="Type of Invoicing" icon="terp-stock_symbol-selection" context="{'group_by':'to_invoice'}"/> - <separator orientation="vertical"/> - <filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/> - <filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/> - <separator orientation="vertical"/> - <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/> - <separator orientation="vertical"/> - <filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> - <separator orientation="vertical"/> - <filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Group by day of date"/> - <filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Group by month of date"/> - <filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Group by year of date"/> - </group> - </search> - </field> - </record> - - <record id="action_timesheet_report_stat_all" model="ir.actions.act_window"> - <field name="name">Timesheet Sheet Analysis</field> - <field name="res_model">timesheet.report</field> - <field name="view_type">form</field> - <field name="view_mode">tree,graph</field> - <field name="context">{'search_default_month':1,'search_default_Employee_id':1,'group_by_no_leaf':1,'group_by':[]}</field> - <field name="search_view_id" ref="view_timesheet_report_search"/> - </record> - <menuitem action="action_timesheet_report_stat_all" id="menu_timesheet_report_all" - parent="hr_timesheet.menu_hr_reporting_timesheet" sequence="1" groups="base.group_hr_manager"/> - </data> -</openerp> diff --git a/addons/idea/idea_view.xml b/addons/idea/idea_view.xml index f7ddb8bf504..456c4dd1f7a 100644 --- a/addons/idea/idea_view.xml +++ b/addons/idea/idea_view.xml @@ -65,7 +65,7 @@ </record> <menuitem name="Configuration" parent="base.menu_tools" - id="base.menu_lunch_survey_root" sequence="20" groups="base.group_system"/> + id="base.menu_lunch_survey_root" sequence="20" groups="base.group_tool_manager"/> <menuitem name="Ideas" parent="base.menu_lunch_survey_root" id="menu_ideas" sequence="3"/> @@ -90,7 +90,8 @@ <menuitem name="Give Vote" parent="menu_ideas1" id="menu_give_vote" - action="action_idea_select"/> + action="action_idea_select" + groups="base.group_tool_user"/> <!-- Open Ideas Action --> @@ -382,12 +383,12 @@ <field name="view_type">form</field> <field name="view_mode">graph,tree</field> </record> - <menuitem name="Reporting" parent="base.menu_tools" id="base.menu_lunch_reporting" sequence="6"/> + <menuitem name="Reporting" parent="base.menu_tools" id="base.menu_lunch_reporting" sequence="6" groups="base.group_tool_manager,base.group_tool_user"/> <menuitem name="Idea" parent="base.menu_lunch_reporting" id="menu_idea_reporting" sequence="3"/> <menuitem name="Vote Statistics" parent="menu_idea_reporting" - id="menu_idea_vote_stat" action="action_idea_vote_stat" groups="base.group_tool_manager,base.group_tool_user,base.group_system"/> + id="menu_idea_vote_stat" action="action_idea_vote_stat" groups="base.group_tool_user"/> <!-- Vote For Idea Action --> <record model="ir.actions.act_window" id="action_idea_vote"> diff --git a/addons/idea/report/report_vote_view.xml b/addons/idea/report/report_vote_view.xml index 8418377065c..c68c829794b 100644 --- a/addons/idea/report/report_vote_view.xml +++ b/addons/idea/report/report_vote_view.xml @@ -91,7 +91,7 @@ <field name="context">{'search_default_User':1,'search_default_State':1,'group_by_no_leaf':1,'group_by':[]}</field> </record> - <menuitem action="action_report_vote_all" id="menu_report_vote_all" parent="menu_idea_reporting" sequence="1" groups="base.group_tool_manager,base.group_system"/> + <menuitem action="action_report_vote_all" id="menu_report_vote_all" parent="menu_idea_reporting" sequence="1" groups="base.group_tool_manager"/> </data> </openerp> diff --git a/addons/idea/security/idea_security.xml b/addons/idea/security/idea_security.xml index ef377c799c9..4b060c51e6c 100644 --- a/addons/idea/security/idea_security.xml +++ b/addons/idea/security/idea_security.xml @@ -2,10 +2,6 @@ <openerp> <data> - <record id="base.group_sale_salesman" model="res.groups"> - <field name="name">Sales / User</field> - </record> - <record model="res.groups" id="base.group_tool_manager"> <field name="name">Tools / Manager</field> </record> @@ -13,7 +9,6 @@ <field name="name">Tools / User</field> </record> - </data> </openerp> diff --git a/addons/idea/security/ir.model.access.csv b/addons/idea/security/ir.model.access.csv index 30dc0850c3f..b76cc9bd58a 100644 --- a/addons/idea/security/ir.model.access.csv +++ b/addons/idea/security/ir.model.access.csv @@ -1,26 +1,8 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_idea_category","idea.category","model_idea_category","base.group_user",1,1,1,1 -"access_idea_idea","idea.idea","model_idea_idea","base.group_user",1,1,1,1 -"access_idea_vote","idea.vote","model_idea_vote","base.group_user",1,1,1,1 -"access_idea_vote_stat","idea.vote.stat","model_idea_vote_stat","base.group_user",1,1,1,1 -"access_idea_category_system","idea.category system","model_idea_category","base.group_system",1,1,1,1 -"access_idea_comment","idea.comment","model_idea_comment","base.group_system",1,1,1,1 -"access_idea_comment_base_user","idea.comment.base.user","model_idea_comment","base.group_user",1,1,1,1 -"access_report_vote","report.vote","model_report_vote","base.group_user",1,1,1,1 -"access_idea_idea_sale_salesman","idea.idea.sale","model_idea_idea","base.group_sale_salesman",1,1,1,1 -"access_idea_vote_sale_salesman","idea.vote.sale","model_idea_vote","base.group_sale_salesman",1,1,1,1 "access_idea_category_user","idea.category user","model_idea_category","base.group_tool_user",1,1,1,1 "access_idea_idea_user","idea.idea user","model_idea_idea","base.group_tool_user",1,1,1,1 "access_idea_vote_user","idea.vote user","model_idea_vote","base.group_tool_user",1,1,1,1 -"access_idea_category_manager","idea.category manager","model_idea_category","base.group_tool_manager",1,1,1,1 -"access_idea_idea_manager","idea.idea manager","model_idea_idea","base.group_tool_manager",1,1,1,1 "access_idea_vote_manager","idea.vote manager","model_idea_vote","base.group_tool_manager",1,1,1,1 "access_idea_vote_stat_user","idea.vote.stat user","model_idea_vote_stat","base.group_tool_user",1,1,1,1 "access_idea_comment_user","idea.comment user","model_idea_comment","base.group_tool_user",1,1,1,1 "access_report_vote_manager","report.vote manager","model_report_vote","base.group_tool_manager",1,1,1,1 -"access_idea_idea_system","idea.idea system","model_idea_idea","base.group_system",1,0,0,0 -"access_idea_vote_system","idea.vote system","model_idea_vote","base.group_system",1,0,0,0 -"access_report_vote_system","report.vote system","model_report_vote","base.group_system",1,0,0,0 -"access_idea_vote_stat_manager","idea.vote.stat manager","model_idea_vote_stat","base.group_tool_manager",1,1,1,1 -"access_idea_vote_stat_system","idea.vote.stat system","model_idea_vote_stat","base.group_system",1,1,1,1 -"access_idea_comment_manager","idea.comment.manager","model_idea_comment","base.group_tool_manager",1,1,1,1 diff --git a/addons/lunch/lunch_view.xml b/addons/lunch/lunch_view.xml index 6b0e4c4b8c7..0ecdea5c017 100644 --- a/addons/lunch/lunch_view.xml +++ b/addons/lunch/lunch_view.xml @@ -6,14 +6,14 @@ id="menu_lunch" sequence="1" /> <menuitem name="Reporting" parent="base.menu_tools" - id="base.menu_lunch_reporting" sequence="6" groups="base.group_system,base.group_tool_manager"/> + id="base.menu_lunch_reporting" sequence="6" groups="base.group_tool_manager"/> <menuitem name="Lunch Orders" parent="base.menu_lunch_reporting" id="menu_lunch_reporting_order" sequence="1" /> <menuitem name="Configuration" parent="base.menu_tools" - id="base.menu_lunch_survey_root" sequence="20" groups="base.group_system"/> + id="base.menu_lunch_survey_root" sequence="20" groups="base.group_tool_manager"/> <menuitem name="Lunch" parent="base.menu_lunch_survey_root" id="menu_lunch_category_root_configuration" sequence="1" /> diff --git a/addons/lunch/security/ir.model.access.csv b/addons/lunch/security/ir.model.access.csv index b936b26a55e..59670a8d1b1 100644 --- a/addons/lunch/security/ir.model.access.csv +++ b/addons/lunch/security/ir.model.access.csv @@ -1,20 +1,8 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_lunch_category","lunch.category","model_lunch_category","base.group_user",1,1,1,1 -"access_lunch_product","lunch.product","model_lunch_product","base.group_user",1,1,1,1 -"access_lunch_cashbox","lunch.cashbox","model_lunch_cashbox","base.group_user",1,1,1,1 -"access_lunch_order","lunch.order","model_lunch_order","base.group_user",1,1,1,1 -"access_report_lunch_amount","report.lunch.amount","model_report_lunch_amount","base.group_user",1,1,1,1 -"access_lunch_order_sale_salesman","lunch.order.sale","model_lunch_order","base.group_sale_salesman",1,1,1,1 "access_lunch_order_user","lunch.order user","model_lunch_order","base.group_tool_user",1,1,1,1 -"access_lunch_order_manager","lunch.order manager","model_lunch_order","base.group_tool_manager",1,1,1,1 "access_lunch_cashmove_user","lunch.cashmove user","model_lunch_cashmove","base.group_tool_user",1,1,1,1 -"access_lunch_cashmove_manager","lunch.cashmove manager","model_lunch_cashmove","base.group_tool_manager",1,1,1,1 "access_report_lunch_amount_manager","report.lunch.amount manager","model_report_lunch_amount","base.group_tool_manager",1,1,1,1 -"access_lunch_category_system","lunch.category system","model_lunch_category","base.group_system",1,1,1,1 -"access_lunch_product_system","lunch.product system","model_lunch_product","base.group_system",1,1,1,1 -"access_lunch_cashbox_system","lunch.cashbox system","model_lunch_cashbox","base.group_system",1,1,1,1 -"access_lunch_order_system","lunch.order system","model_lunch_order","base.group_system",1,0,0,0 -"access_lunch_cashmove_system","lunch.cashmove system","model_lunch_cashmove","base.group_system",1,0,0,0 +"access_lunch_category_manager","lunch.category.user","model_lunch_category","base.group_tool_user",1,1,1,1 "access_report_lunch_order_manager","report.lunch.order manager","model_report_lunch_order","base.group_tool_manager",1,1,1,1 "access_lunch_product_user","lunch.product user","model_lunch_product","base.group_tool_user",1,1,1,1 "access_lunch_cashbox_user","lunch.cashbox user","model_lunch_cashbox","base.group_tool_user",1,1,1,1 diff --git a/addons/lunch/security/lunch_security.xml b/addons/lunch/security/lunch_security.xml index 6c3559fa138..0014f38182b 100644 --- a/addons/lunch/security/lunch_security.xml +++ b/addons/lunch/security/lunch_security.xml @@ -2,9 +2,6 @@ <openerp> <data noupdate="0"> - <record id="base.group_sale_salesman" model="res.groups"> - <field name="name">Sales / User</field> - </record> <record model="res.groups" id="base.group_tool_manager"> <field name="name">Tools / Manager</field> </record> diff --git a/addons/lunch/wizard/lunch_order_cancel_view.xml b/addons/lunch/wizard/lunch_order_cancel_view.xml index d47cc6d8ee9..e50f4ad222c 100644 --- a/addons/lunch/wizard/lunch_order_cancel_view.xml +++ b/addons/lunch/wizard/lunch_order_cancel_view.xml @@ -34,7 +34,7 @@ <act_window id="action_lunch_order_cancel_values" key2="client_action_multi" name="Cancel Order" res_model="lunch.order.cancel" src_model="lunch.order" - view_mode="form" target="new" view_type="form" groups="base.group_tool_manager"/> + view_mode="form" target="new" view_type="form"/> </data> </openerp> diff --git a/addons/lunch/wizard/lunch_order_confirm_view.xml b/addons/lunch/wizard/lunch_order_confirm_view.xml index dabcd7d5e84..eba7d12c846 100644 --- a/addons/lunch/wizard/lunch_order_confirm_view.xml +++ b/addons/lunch/wizard/lunch_order_confirm_view.xml @@ -36,7 +36,7 @@ <act_window id="action_lunch_order_confirm_values" key2="client_action_multi" name="Confirm Order" res_model="lunch.order.confirm" src_model="lunch.order" - view_mode="form" target="new" view_type="form" groups="base.group_tool_manager"/> + view_mode="form" target="new" view_type="form"/> </data> </openerp> diff --git a/addons/marketing_campaign/marketing_campaign_view.xml b/addons/marketing_campaign/marketing_campaign_view.xml index 614055dddcd..b23826969a8 100644 --- a/addons/marketing_campaign/marketing_campaign_view.xml +++ b/addons/marketing_campaign/marketing_campaign_view.xml @@ -36,10 +36,10 @@ <separator string="" colspan="4" /> <group col="10" colspan="4"> <field name="state" readonly="1" /> + <button name="state_cancel_set" string="Cancel" states="running" icon="terp-gtk-stop"/> <button name="state_running_set" string="Run" states="draft,done,cancelled" icon="gtk-apply"/> <button name="state_draft_set" string="Set to Draft" states="done,cancelled" icon="gtk-convert"/> <button name="state_done_set" string="Close" states="running" icon="terp-dialog-close"/> - <button name="state_cancel_set" string="Cancel" states="running" icon="terp-gtk-stop"/> </group> </form> </field> @@ -161,9 +161,9 @@ <separator string="" colspan="4"/> <group col="6" colspan="4"> <field name="state" readonly="1"/> + <button name="state_cancel_set" string="Cancel" states="running" icon="terp-gtk-stop"/> <button name="state_running_set" string="Run" states="draft" icon="gtk-apply"/> <button name="state_done_set" string="Close" states="running" icon="terp-dialog-close"/> - <button name="state_cancel_set" string="Cancel" states="running" icon="terp-gtk-stop"/> <button name="state_draft_set" string="Set to Draft" states="done,cancelled" icon="gtk-convert"/> </group> </form> @@ -382,9 +382,9 @@ <separator string="" colspan="4"/> <group colspan="4" col="11"> <field name="state" readonly="True"/> + <button string="Cancel" states="todo,exception" name="button_cancel" type="object" icon="terp-gtk-stop"/> <button string="Reset" states="exception,cancelled" name="button_draft" type="object" icon="gtk-undo"/> <button string="Process" states="todo" name="process" type="object" icon="terp-gtk-go-back-rtl"/> - <button string="Cancel" states="todo,exception" name="button_cancel" type="object" icon="terp-gtk-stop"/> </group> </form> </field> diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml index ad9c3bcf772..afa1ee9bebe 100644 --- a/addons/membership/membership_view.xml +++ b/addons/membership/membership_view.xml @@ -140,7 +140,8 @@ parent="menu_membership" id="menu_membership_products" action="action_membership_products" - sequence="1"/> + sequence="1" + groups="base.group_partner_manager"/> <!-- MEMBERSHIP/CURRENT MEMBERS --> diff --git a/addons/membership/report/report_membership_view.xml b/addons/membership/report/report_membership_view.xml index abe8b44bcba..291efee4834 100644 --- a/addons/membership/report/report_membership_view.xml +++ b/addons/membership/report/report_membership_view.xml @@ -116,7 +116,8 @@ <menuitem name="Membership Analysis" parent="base.menu_report_association" action="action_report_membership_tree" - id="menu_report_membership"/> + id="menu_report_membership" + groups="base.group_partner_manager"/> </data> </openerp> diff --git a/addons/membership/security/ir.model.access.csv b/addons/membership/security/ir.model.access.csv index 6cf3eb755c2..f3d91646c44 100644 --- a/addons/membership/security/ir.model.access.csv +++ b/addons/membership/security/ir.model.access.csv @@ -1,4 +1,4 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_membership_membership_line_partner_manager","membership.membership_line partner_manager","model_membership_membership_line","base.group_partner_manager",1,0,0,0 +"access_membership_membership_line_partner_manager","membership.membership_line partner_manager","model_membership_membership_line","base.group_partner_manager",1,1,1,1 "access_membership_membership_line","membership.membership_line","model_membership_membership_line",,1,0,0,0 "access_report_membership","report.membership","model_report_membership","base.group_partner_manager",1,0,0,0 diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 7addfbc3194..32f3100b868 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -604,7 +604,7 @@ <field colspan="2" name="move_lines2" nolabel="1" domain="[('state','in', ('done', 'cancel'))]" widget="one2many_list" mode="tree,form" height="275"> - <tree colors="red:scrapped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel','done') " string="Consumed Products" editable="bottom"> + <tree colors="red:scrapped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel') " string="Consumed Products" editable="bottom"> <field name="product_id" readonly="1"/> <field name="product_qty" readonly="1" string="Qty"/> <field name="product_uom" readonly="1" string="UOM" widget="selection"/> @@ -627,12 +627,12 @@ <separator colspan="4"/> <group col="9" colspan="4"> <field name="state"/> + <button name="button_cancel" states="draft,ready,confirmed,in_production,picking_except" string="Cancel" icon="gtk-stop"/> <button name="action_compute" states="draft" string="Compute Data" type="object" icon="terp-stock_format-scientific"/> <button name="button_confirm" states="draft" string="Confirm Production" icon="gtk-apply"/> <button name="button_produce" states="ready" string="Start Production" icon="terp-gtk-jump-to-ltr"/> <button name="%(act_mrp_product_produce)d" states="in_production" string="Produce" icon="gtk-ok" type="action"/> <button name="force_production" states="confirmed,picking_except" string="Force Reservation" type="object" icon="gtk-jump-to"/> - <button name="button_cancel" states="draft,ready,confirmed,in_production,picking_except" string="Cancel" icon="gtk-stop"/> <button name="button_recreate" states="picking_except" string="Recreate Picking" icon="terp-document-new"/> </group> </page> diff --git a/addons/mrp/test/mrp_procurement.yml b/addons/mrp/test/mrp_procurement.yml index 40d22ae817f..4e01062d7b2 100644 --- a/addons/mrp/test/mrp_procurement.yml +++ b/addons/mrp/test/mrp_procurement.yml @@ -177,7 +177,7 @@ purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')]) wf_service = netsvc.LocalService("workflow") for p_id in purch_ids: - wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) - I confirm purchase order for Buttons. @@ -187,7 +187,7 @@ purch_ids = self.search(cr, uid, [('partner_id.name','=','ASUStek')]) wf_service = netsvc.LocalService("workflow") for p_id in purch_ids: - wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr) - I Check incoming shipments for cloth. And receive products. @@ -284,7 +284,7 @@ assert prod_ids, _('No Ready Manufacturing Orders found!') wf_service = netsvc.LocalService("workflow") for p_id in prod_ids: - wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr) + wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr) - I create record for producing products with quantity 5.00. - diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index 9a93b67a36f..62298f4aa5f 100644 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -14,10 +14,10 @@ <xpath expr="/form/notebook/page/field[@name='workcenter_lines']/form/field[@name='hour']" position="after"> <group colspan="8" col="8"> <field name="state"/> + <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop" help="Cancel Order"/> <button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert" help="Set to Draft"/> <button name="button_start_working" string="Start" states="draft" icon="terp-gtk-jump-to-ltr" help="Start Working"/> <button name="button_resume" string="Resume" states="pause" icon="gtk-media-pause" help="Resume Work Order"/> - <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop" help="Cancel Order"/> <button name="button_pause" string="Pause" states="startworking" icon="gtk-media-pause" help="Pause Work Order"/> <button name="button_done" string="Finished" states="startworking" icon="terp-dialog-close" help="Finish Order"/> </group> @@ -32,10 +32,10 @@ <field name="inherit_id" ref="mrp.mrp_production_form_view"/> <field name="arch" type="xml"> <xpath expr="/form/notebook/page/field[@name='workcenter_lines']/tree/field[@name='hour']" position="after"> + <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop"/> <button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert"/> <button name="button_start_working" string="Start" states="draft" icon="terp-gtk-jump-to-ltr"/> <button name="button_resume" string="Resume" states="pause" icon="gtk-media-pause"/> - <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop"/> <button name="button_pause" string="Pause" states="startworking" icon="gtk-media-pause"/> <button name="button_done" string="Finished" states="startworking" icon="terp-dialog-close"/> <field name="state"/> @@ -114,10 +114,10 @@ <separator string="" colspan="4"/> <group colspan="8" col="8"> <field name="state"/> + <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop"/> <button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert"/> <button name="button_start_working" string="Start" states="draft" icon="terp-gtk-jump-to-ltr"/> <button name="button_resume" string="Resume" states="pause" icon="gtk-media-pause"/> - <button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop"/> <button name="button_pause" string="Pause" states="startworking" icon="gtk-media-pause"/> <button name="button_done" string="Finished" states="startworking" icon="terp-dialog-close"/> </group> diff --git a/addons/mrp_repair/mrp_repair_view.xml b/addons/mrp_repair/mrp_repair_view.xml index 04c9587b6c5..15878ec1b37 100644 --- a/addons/mrp_repair/mrp_repair_view.xml +++ b/addons/mrp_repair/mrp_repair_view.xml @@ -2,24 +2,24 @@ <openerp> <data> - <record id="view_repair_order_tree" model="ir.ui.view"> - <field name="name">mrp.repair.tree</field> - <field name="model">mrp.repair</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Repairs order" colors="gray:state in ('done','cancel');black:state not in ('done','cancel');blue:state=='draft'"> - <field name="name" select="1" /> - <field name="product_id" select="1" /> - <field name="move_id"/> - <field name="partner_id"/> - <field name="address_id"/> - <field name="location_id"/> - <field name="location_dest_id"/> - <field name="guarantee_limit"/> - <field name="state"/> - </tree> - </field> - </record> + <record id="view_repair_order_tree" model="ir.ui.view"> + <field name="name">mrp.repair.tree</field> + <field name="model">mrp.repair</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Repairs order" colors="gray:state in ('done','cancel');black:state not in ('done','cancel');blue:state=='draft'"> + <field name="name" select="1" /> + <field name="product_id" select="1" /> + <field name="move_id"/> + <field name="partner_id"/> + <field name="address_id"/> + <field name="location_id"/> + <field name="location_dest_id"/> + <field name="guarantee_limit"/> + <field name="state"/> + </tree> + </field> + </record> <record id="view_repair_order_form" model="ir.ui.view"> <field name="name">mrp.repair.form</field> @@ -177,30 +177,30 @@ <field name="type">search</field> <field name="arch" type="xml"> <search string="Search Reair Orders"> - <group col='4' colspan='4'> - <filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/> + <group col='4' colspan='4'> + <filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/> <filter icon="terp-check" string="Confirmed" domain="[('state','=','confirmed')]" name="current" /> <filter icon="terp-emblem-important" string="Ready To Repair" domain="[('state','=','ready')]"/> <separator orientation="vertical"/> <filter icon="terp-dolar" string="invoiced" domain="[('invoiced','=',True)]"/> <separator orientation="vertical"/> - <field name="name"/> - <field name="product_id"/> - <field name="partner_id"/> - <field name="state" /> - </group> - <newline/> - <group expand="0" string="Group By..." colspan="10" col="8" groups="base.group_extended"> - <filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/> + <field name="name"/> + <field name="product_id"/> + <field name="partner_id"/> + <field name="state" /> + </group> + <newline/> + <group expand="0" string="Group By..." colspan="10" col="8"> + <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> <separator orientation="vertical"/> <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/> <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> <separator orientation="vertical"/> - <filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'guarantee_limit'}"/> + <filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'guarantee_limit'}" help="Guarantee limit"/> </group> </search> </field> - </record> + </record> diff --git a/addons/mrp_repair/wizard/mrp_repair_make_invoice_view.xml b/addons/mrp_repair/wizard/mrp_repair_make_invoice_view.xml index 982ee5d4bc0..4c3f6ede30d 100644 --- a/addons/mrp_repair/wizard/mrp_repair_make_invoice_view.xml +++ b/addons/mrp_repair/wizard/mrp_repair_make_invoice_view.xml @@ -17,7 +17,7 @@ <button icon="gtk-stop" special="cancel" string="Cancel" /> <button name="make_invoices" string="Create Invoice" - colspan="1" type="object" icon="terp-dolar" /> + colspan="1" type="object" icon="terp-gtk-go-back-rtl" /> </group> </form> </field> diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index c8cb8f460f0..4f0d3530a80 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -322,7 +322,7 @@ class procurement_order(osv.osv): if procurement.procure_method == 'make_to_order': source = procurement.product_id.product_tmpl_id.property_stock_procurement.id id = move_obj.create(cr, uid, { - 'name': 'PROC:' + procurement.name, + 'name': procurement.name, 'location_id': source, 'location_dest_id': procurement.location_id.id, 'product_id': procurement.product_id.id, @@ -374,10 +374,6 @@ class procurement_order(osv.osv): "Not enough stock and no minimum orderpoint rule defined.") % \ procurement.name self.log(cr, uid, procurement.id, message) - if procurement.state=='exception' and procurement.message=='': - cr.execute('update procurement_order set message=%s where id=%s', - (_('Not enough stock '), procurement.id) ) - return ok def action_produce_assign_service(self, cr, uid, ids, context={}): diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 03a4c5aad82..3c9bff9be9c 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -72,9 +72,9 @@ <field colspan="4" name="message" readonly="1"/> <field name="state" readonly="1"/> <group col="7" colspan="2"> + <button name="button_cancel" states="draft,exception,waiting" string="Cancel" icon="gtk-cancel"/> <button name="button_confirm" states="draft" string="Confirm" icon="gtk-apply"/> <button name="button_restart" states="exception" string="Retry" icon="gtk-convert"/> - <button name="button_cancel" states="draft,exception,waiting" string="Cancel" icon="gtk-cancel"/> <button name="button_check" states="confirmed" string="Run Procurement" icon="gtk-media-play"/> </group> </page> diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py index 06cbb86957a..9abdf3d1ff5 100644 --- a/addons/procurement/schedulers.py +++ b/addons/procurement/schedulers.py @@ -23,8 +23,10 @@ import time from mx import DateTime from osv import osv +from tools.translate import _ import netsvc import pooler +from tools.translate import _ class procurement_order(osv.osv): _inherit = 'procurement.order' @@ -170,8 +172,8 @@ class procurement_order(osv.osv): else: continue proc_id = proc_obj.create(cr, uid, { - 'name': 'Automatic OP: %s' % product.name, - 'origin': 'SCHEDULER', + 'name': _('Automatic OP: %s') % (product.name,), + 'origin': _('SCHEDULER'), 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'product_id': product.id, 'product_qty': -product.virtual_available, @@ -236,7 +238,7 @@ class procurement_order(osv.osv): continue if op.product_id.type not in ('consu'): proc_id = procurement_obj.create(cr, uid, { - 'name': 'OP:' + str(op.id), + 'name': op.name, 'date_planned': newdate.strftime('%Y-%m-%d'), 'product_id': op.product_id.id, 'product_qty': qty, diff --git a/addons/product/product.py b/addons/product/product.py index 22f57ac981f..04a5232b1ea 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -308,6 +308,7 @@ class product_template(osv.osv): 'uos_coeff' : lambda *a: 1.0, 'mes_type' : lambda *a: 'fixed', 'categ_id' : _default_category, + 'type' : lambda *a: 'consu', } def _check_uom(self, cursor, user, ids): @@ -386,7 +387,7 @@ class product_product(osv.osv): def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context={}): for supinfo in product.seller_ids: if supinfo.name.id == partner_id: - return {'code': supinfo.product_code, 'name': supinfo.product_name, 'variants': ''} + return {'code': supinfo.product_code or product.default_code, 'name': supinfo.product_name or product.name, 'variants': ''} res = {'code': product.default_code, 'name': product.name, 'variants': product.variants} return res diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 5872e325715..b58fa4cc811 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -9,10 +9,8 @@ <field name="type">search</field> <field name="arch" type="xml"> <search string="Product"> - <filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/> - <filter icon="terp-accessories-archiver" string="Consumable" - domain="[('type','=', 'consumable')]"/> - <filter string="Stockable" icon="terp-accessories-archiver" domain="['|',('type','=','product'),('type','=','consu')]"/> + <filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/> + <filter string="Consumable/Stockable" icon="terp-accessories-archiver" domain="['|',('type','=','product'),('type','=','consu')]"/> <separator orientation="vertical"/> <filter string="To Sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/> <filter string="To Purchase" icon="terp-accessories-archiver+" domain="[('purchase_ok', '=', 1)]" /> @@ -197,7 +195,6 @@ <field name="search_view_id" ref="product_search_form_view"/> <field name="help">In OpenERP, a product is something you can buy and sell. It can be a raw material, a stockable product, a consumable or a service. The product form contains a detailed information on the products like procurement logistic, sales price, product category, suppliers, etc.</field> </record> - <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_system,group_product_manager"/> <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9" groups="group_product_manager,base.group_sale_salesman,base.group_system"/> <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,group_product_manager"/> diff --git a/addons/project/board_project_view.xml b/addons/project/board_project_view.xml index 275a969cbe9..71b5d87aa1f 100644 --- a/addons/project/board_project_view.xml +++ b/addons/project/board_project_view.xml @@ -88,16 +88,10 @@ <child1> <action colspan="4" height="100" name="%(action_view_task_tree)d" string="My Open Tasks" width="510"/> <action colspan="4" height="100" name="%(action_view_delegate_task_tree)d" string="My Delegated Tasks" width="510"/> - </child1> + </child1> <child2> - <vpaned> - <child1> - <action colspan="4" height="100" name="%(project.action_project_vs_planned_total_hours_graph)d" string="My Projects: Planned vs Total Hours" /> - </child1> - <child2> - <action colspan="4" height="100" name="%(project.action_project_vs_remaining_hours_graph)d" string="My Remaining Hours by Project" /> - </child2> - </vpaned> + <action colspan="4" height="100" name="%(project.action_project_vs_planned_total_hours_graph)d" string="My Projects: Planned vs Total Hours" /> + <action colspan="4" height="100" name="%(project.action_project_vs_remaining_hours_graph)d" string="My Remaining Hours by Project" /> </child2> </hpaned> </form> diff --git a/addons/project/project.py b/addons/project/project.py index 27bbb2f8c7f..c0f9be5394e 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -315,7 +315,7 @@ class project(osv.osv): if child_ids: self.setActive(cr, uid, child_ids, value, context=None) return True - + project() class users(osv.osv): @@ -418,7 +418,7 @@ class task(osv.osv): 'active': fields.function(_is_template, method=True, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."), 'name': fields.char('Task Summary', size=128, required=True), 'description': fields.text('Description'), - 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'), + 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Priority'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of tasks."), 'type_id': fields.many2one('project.task.type', 'Stage',), 'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True, @@ -526,7 +526,7 @@ class task(osv.osv): if not project_id: return False task = self.browse(cr, uid, project_id, context=context) project = task.project_id - res = self.do_close(cr, uid, [project_id], context=context) + res = self.do_close(cr, uid, [project_id], context=context) if project.warn_manager or project.warn_customer: return { 'name': _('Send Email after close task'), @@ -537,7 +537,7 @@ class task(osv.osv): 'target': 'new', 'nodestroy': True, 'context': {'active_id': task.id} - } + } return res def do_close(self, cr, uid, ids, context=None): @@ -678,7 +678,7 @@ class task(osv.osv): if types: if not typeid: self.write(cr, uid, task.id, {'type_id': types[0]}) - elif typeid and typeid in types and types.index(typeid) != len(types)-1 : + elif typeid and typeid in types and types.index(typeid) != len(types)-1: index = types.index(typeid) self.write(cr, uid, task.id, {'type_id': types[index+1]}) return True diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 5e5be5ee4b0..6fd11bd245f 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -27,7 +27,7 @@ </group> <notebook colspan="4"> <page string="Administration"> - <group col="2" colspan="2"> + <group col="2" colspan="2" groups="base.group_extended"> <separator colspan="2" string="Scheduling"/> <field name="priority"/> <field name="active"/> @@ -46,11 +46,11 @@ <separator colspan="4"/> <group col="9" colspan="8"> <field name="state" select="1" readonly="1"/> - <button name="set_template" string="Set as Template" type="object" states="open" icon="gtk-convert"/> + <button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/> + <button name="set_template" string="Set as Template" type="object" states="open" icon="gtk-convert" groups="base.group_extended"/> <button name="set_open" string="Reactivate Project" type="object" states="pending,cancelled,close" icon="gtk-ok"/> <button name="set_pending" string="Pending" type="object" states="open" icon="gtk-media-pause"/> <button name="set_done" string="Done" type="object" states="open,pending" icon="terp-dialog-close"/> - <button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/> <button name="reset_project" string="Reset as Project" type="object" states="template" icon="gtk-convert"/> <button string="New Project Based on Template" @@ -67,16 +67,18 @@ </tree> </field> </page> - <page groups="base.group_extended" string="Partner Info"> - <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id)" select="1"/> - <field domain="[('partner_id','=',partner_id)]" name="contact_id" string="Contact Address"/> + <page string="Billing" groups="account.group_account_invoice"> + <field colspan="4" name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" string="Customer"/> + <field domain="[('partner_id','=',partner_id)]" name="contact_id" string="Invoice Address"/> <field name="warn_customer"/> <newline/> - <separator colspan="2" string="Mail Header"/> - <separator colspan="2" string="Mail Footer"/> - <field name="warn_header" nolabel="1" colspan="2"/> - <field name="warn_footer" nolabel="1" colspan="2"/> - <group col="3" colspan="4"> + <group colspan="4" col="4" groups="base.group_extended"> + <separator colspan="2" string="Mail Header"/> + <separator colspan="2" string="Mail Footer"/> + <field name="warn_header" nolabel="1" colspan="2"/> + <field name="warn_footer" nolabel="1" colspan="2"/> + </group> + <group col="3" colspan="4" groups="base.group_extended"> <separator string="Automatic variables for headers and footer. Use exactly the same notation." colspan="4"/> <label string="Task: %%(name)s"/> <label string="User: %%(user_id)s"/> @@ -242,13 +244,13 @@ <newline/> <group col="11" colspan="4"> <field name="state" select="1"/> + <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel"/> <button name="do_draft" states="open" string="Draft" type="object" icon="gtk-indent"/> <button name="do_open" states="pending,draft" string="Start Task" type="object" icon="gtk-execute"/> <button name="%(action_project_task_reevaluate)d" states="done,cancelled" string="Reactivate" type="action" icon="gtk-convert" context="{'button_reactivate':True}" /> <button name="do_pending" states="open" string="Pending" type="object" icon="gtk-media-pause"/> <button groups="base.group_extended" name="%(action_project_task_delegate)d" states="pending,open" string="Delegate" type="action" icon="gtk-sort-descending"/> <button name="action_close" states="pending,open" string="Done" type="object" icon="terp-dialog-close"/> - <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel"/> </group> </page> <page groups="base.group_extended" string="Delegations"> @@ -323,10 +325,10 @@ <field name="date_end" invisible="1"/> <field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/> <field name="state" invisible="context.get('set_visible',False)"/> - <button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/> + <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/> + <button name="do_open" states="pending,draft,done,cancel" string="Start Task" type="object" icon="gtk-execute" help="For changing to open state" invisible="context.get('set_visible',False)"/> <button groups="base.group_extended" name="%(action_project_task_delegate)d" states="pending,open,draft" string="Delegate" type="action" icon="gtk-sort-descending" help="For changing to delegate state"/> <button name="action_close" states="draft,pending,open" string="Done" type="object" icon="gtk-apply" help="For changing to done state"/> - <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/> </tree> </field> </record> diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index a5032047c2a..4623f968c05 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -84,10 +84,10 @@ <separator colspan="4"/> <group col="8" colspan="4"> <field name="state" /> + <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/> <button name="case_close" string="Close" states="open,draft,pending" type="object" icon="terp-dialog-close"/> <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/> </group> @@ -191,9 +191,9 @@ <field name="assigned_to"/> <field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/> <field name="state"/> + <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward" help="To Do"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/> @@ -290,9 +290,9 @@ <field name="version_id"/> <field name="user_id"/> <field name="state"/> + <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_close" string="Done" states="open,draft,pending" type="object" icon="gtk-jump-to"/> <button name="case_open" string="Open" states="draft,pending" type="object" icon="gtk-go-forward"/> - <button name="case_cancel" string="Cancel" states="draft,open,pending" type="object" icon="gtk-cancel"/> <button name="case_pending" string="Pending" states="draft,open" type="object" icon="gtk-media-pause"/> <button name="case_escalate" string="Escalate" states="open,draft,pending" type="object" icon="gtk-go-up"/> <button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/> diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml index fa645af4127..f2e4c6efd68 100644 --- a/addons/project_long_term/project_long_term_view.xml +++ b/addons/project_long_term/project_long_term_view.xml @@ -146,11 +146,11 @@ <separator string="" colspan="4"/> <group col="12" colspan="4"> <field name="state" select="1"/> + <button string="Cancel" name="set_cancel" states="draft,open,pending" icon="gtk-cancel"/> <button string="Draft" name="set_draft" states="open" icon="gtk-indent"/> <button string="Pending" name="set_pending" states="open" icon="gtk-media-pause"/> <button string="Done" name="set_done" states="pending,open" icon="terp-dialog-close"/> <button string="Start Phase" name="set_open" states="pending,draft" icon="gtk-execute"/> - <button string="Cancel" name="set_cancel" states="draft,open,pending" icon="gtk-cancel"/> </group> </page> <page string="Task Detail"> diff --git a/addons/project_planning/project_planning_view.xml b/addons/project_planning/project_planning_view.xml index ff354c69ccd..8e14631fb2c 100644 --- a/addons/project_planning/project_planning_view.xml +++ b/addons/project_planning/project_planning_view.xml @@ -104,14 +104,13 @@ <field colspan="4" name="description" nolabel="1" attrs="{'readonly':[('state','=','done')]}" widget="text_wiki"/> <group col="11" colspan="4"> <field name="state" select="1"/> + <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel"/> <button name="do_draft" states="open" string="Draft" type="object" icon="gtk-indent"/> <button name="do_open" states="pending,draft" string="Start Task" type="object" icon="gtk-execute"/> <button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert"/> <button name="do_pending" states="open" string="Pending" type="object" icon="gtk-media-pause"/> <button groups="base.group_extended" name="%(project.action_project_task_delegate)d" states="pending,open" string="Delegate" type="action" icon="gtk-sort-descending"/> <button name="%(project.action_project_task_close)d" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/> - <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel"/> - </group> </page> <page groups="base.group_extended" string="Extra Info" attrs="{'readonly':[('state','=','done')]}"> @@ -139,12 +138,12 @@ <group col="6" colspan="4"> <field name="state" select="1" readonly="1" /> + <button name="action_cancel" states="draft,open" + string="Cancel" type="object" icon="gtk-cancel" /> <button name="action_open" states="draft" string="Open" type="object" icon="gtk-yes" /> <button name="action_done" states="open" string="Done" type="object" icon="gtk-jump-to" /> - <button name="action_cancel" states="draft,open" - string="Cancel" type="object" icon="gtk-cancel" /> <button name="action_draft" states="done,cancel" string="Reset to Draft" type="object" icon="gtk-convert" /> </group> diff --git a/addons/project_scrum/project_scrum_view.xml b/addons/project_scrum/project_scrum_view.xml index 843b35646e4..7ae07d9eea8 100644 --- a/addons/project_scrum/project_scrum_view.xml +++ b/addons/project_scrum/project_scrum_view.xml @@ -113,12 +113,12 @@ </notebook> <group col="8" colspan="4"> <field name="state" select="1" readonly="1"/> + <button type="object" string="Cancel" name="button_cancel" states="open,pending" icon="gtk-stop"/> <button type="object" string="Open" name="button_open" states="draft,pending" icon="terp-camera_test"/> <button type="action" string="Convert to Task" name="%(action_scrum_backlog_to_task)d" states="pending" icon="gtk-execute"/> <button type="object" string="Pending" name="button_pending" states="open" icon="gtk-media-pause"/> <button type="object" string="Close" name="button_close" states="open,pending" icon="terp-dialog-close"/> <button type="object" string="Set to Draft" name="button_draft" states="cancel,done" icon="gtk-convert"/> - <button type="object" string="Cancel" name="button_cancel" states="open,pending" icon="gtk-stop"/> </group> </form> </field> diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index 2a1b94620a8..61834abbe66 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -11,9 +11,9 @@ <group colspan="4" col="4"> <separator colspan="4" string="Invoicing Data"/> <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection"/> - <field name="to_invoice" widget="selection"/> - <field name="amount_max"/> - <field name="amount_invoiced"/> + <field name="to_invoice" widget="selection" string="Invoice Task Work"/> + <field name="amount_max" groups="base.group_extended"/> + <field name="amount_invoiced" groups="base.group_extended"/> </group> </field> </field> diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index ebd0b0becaf..b3fe345308a 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -3,19 +3,17 @@ <data noupdate="1"> <!--Resource: purchase.order--> - - <record id="order_purchase1" model="purchase.order"> + + <record id="order_purchase1" model="purchase.order"> <field model="stock.location" name="location_id" search="[]"/> <field model="product.pricelist" name="pricelist_id" search="[]"/> - <field name="user_id" ref="base.user_root"/> <field model="res.partner" name="partner_id" search="[]"/> <field model="res.partner.address" name="partner_address_id" search="[]"/> - </record> - - <record id="order_purchase2" model="purchase.order"> + </record> + + <record id="order_purchase2" model="purchase.order"> <field model="stock.location" name="location_id" search="[]"/> <field model="product.pricelist" name="pricelist_id" search="[]"/> - <field name="user_id" ref="base.user_demo"/> <field model="res.partner" name="partner_id" search="[]"/> <field model="res.partner.address" name="partner_address_id" search="[]"/> </record> @@ -30,7 +28,6 @@ <field model="product.uom" name="product_uom" search="[]"/> <field name="price_unit">150</field> <field name="product_qty">5</field> - <field name="type">make_to_stock</field> </record> <record id="line2_purchase" model="purchase.order.line"> @@ -57,4 +54,4 @@ </data> </openerp> -
\ No newline at end of file + diff --git a/addons/purchase/security/ir.model.access.csv b/addons/purchase/security/ir.model.access.csv index 86784a34351..77a0aff7bb4 100644 --- a/addons/purchase/security/ir.model.access.csv +++ b/addons/purchase/security/ir.model.access.csv @@ -31,8 +31,9 @@ "access_account_sequence_fiscalyear_purchase_user","account.sequence.fiscalyear purchase","account.model_account_sequence_fiscalyear","group_purchase_user",1,1,1,1 "access_res_partner_purchase_user","res.partner purchase","base.model_res_partner","group_purchase_user",1,0,0,0 "access_res_partner_address_purchase_user","res.partner.address purchase","base.model_res_partner_address","group_purchase_user",1,0,0,0 -"access_account_journal","account.journal","account.model_account_journal","group_purchase_user",1,1,1,0 -"access_account_journal_manager","account.journal","account.model_account_journal","group_purchase_manager",1,1,1,1 +"access_account_journal_period","account.journal.period","account.model_account_journal_period","group_purchase_user",1,1,1,0 +"access_account_journal","account.journal","account.model_account_journal","group_purchase_user",1,0,0,0 +"access_account_journal_manager","account.journal","account.model_account_journal","group_purchase_manager",1,0,0,0 "access_account_period","account.period","account.model_account_period","group_purchase_user",1,0,0,0 "access_account_fiscalyear","account.fiscalyear","account.model_account_fiscalyear","group_purchase_user",1,0,0,0 "access_account_move","account.move","account.model_account_move","group_purchase_user",1,1,1,1 diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml index de25b07ff9d..d209ef6b3fd 100644 --- a/addons/purchase_requisition/purchase_requisition_view.xml +++ b/addons/purchase_requisition/purchase_requisition_view.xml @@ -61,10 +61,10 @@ <separator colspan="4"/> <group col="8" colspan="4"> <field name="state" select="1" readonly ="1"/> + <button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" icon="gtk-cancel" /> <button name="tender_in_progress" states="draft" string="Confirm" type="object" icon="gtk-apply" /> <button name="tender_reset" states="done,cancel" string="Reset to Draft" type="object" icon="gtk-convert" /> <button name="tender_done" states="in_progress" string="Done" type="object" icon="gtk-jump-to" /> - <button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" icon="gtk-cancel" /> </group> </page> <page string="Quotations"> @@ -78,9 +78,9 @@ <field name="minimum_planned_date"/> <field name="origin"/> <field name="state"/> + <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/> <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/> <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/> - <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/> </tree> </field> <separator colspan="4" string=""/> diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 3f3aae2d8f0..c61a83a9b39 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -127,7 +127,7 @@ - !python {model: stock.picking }: | from tools.translate import _ - picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) assert (pick.state =='confirmed'),_('Picking is not in confirm state.') diff --git a/addons/report_designer/installer.py b/addons/report_designer/installer.py index 1accab65c0b..f849392d328 100644 --- a/addons/report_designer/installer.py +++ b/addons/report_designer/installer.py @@ -31,7 +31,6 @@ class report_designer_installer(osv.osv_memory): "upload the report using the same wizard."), 'base_report_creator':fields.boolean('Query Builder',help="Allows you to create any statistic " "reports on several objects. It's a SQL query builder and browser for end users."), - 'olap':fields.boolean('Business Intelligence Report',help="Helps you manage Online Analytical Process with the mdx query and provides Cube Designing and Cube Browsing"), } report_designer_installer() diff --git a/addons/report_designer/report_designer_installer.xml b/addons/report_designer/report_designer_installer.xml index b377331a208..2f838c0b74c 100644 --- a/addons/report_designer/report_designer_installer.xml +++ b/addons/report_designer/report_designer_installer.xml @@ -28,7 +28,6 @@ <group colspan="8"> <field name="base_report_designer"/> <field name="base_report_creator"/> - <field name="olap"/> </group> </data> </field> diff --git a/addons/sale/board_sale_view.xml b/addons/sale/board_sale_view.xml index 39ce39eee9d..0aa1a9d238d 100644 --- a/addons/sale/board_sale_view.xml +++ b/addons/sale/board_sale_view.xml @@ -33,8 +33,7 @@ <field name="view_mode">form</field> <field name="view_id" ref="board_sales_manager_form"/> </record> - <menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/> + <menuitem id="board.menu_dasboard" name="Dashboard" sequence="0" parent="base.next_id_64"/> <menuitem action="open_board_sales_manager" icon="terp-graph" id="menu_board_sales_manager" parent="board.menu_dasboard" sequence="0" groups="base.group_sale_manager"/> - <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,base.group_partner_manager" action="open_board_sales_manager"/> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/sale/process/sale_process.xml b/addons/sale/process/sale_process.xml index 20f20a7ef72..e20cf959c9b 100644 --- a/addons/sale/process/sale_process.xml +++ b/addons/sale/process/sale_process.xml @@ -85,7 +85,6 @@ </record> <record id="process_node_deliveryorder0" model="process.node"> - <field name="menu_id" ref="stock.menu_action_picking_tree_delivery"/> <field name="model_id" ref="stock.model_stock_picking"/> <field eval=""""state"""" name="kind"/> <field eval=""""Delivery Order"""" name="name"/> diff --git a/addons/sale/sale.py b/addons/sale/sale.py index ac2b1a620cf..8a26ef6ebba 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1234,11 +1234,6 @@ class sale_config_picking_policy(osv.osv_memory): ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], o.order_policy) if o.step == 'one': md = self.pool.get('ir.model.data') - group_id = md._get_id(cr, uid, 'base', 'group_no_one') - group_id = md.browse(cr, uid, group_id, context=context).res_id - menu_id = md._get_id(cr, uid, 'stock', 'menu_action_picking_tree_delivery') - menu_id = md.browse(cr, uid, menu_id, context=context).res_id - self.pool.get('ir.ui.menu').write(cr, uid, [menu_id], {'groups_id': [(6, 0, [group_id])]}) location_id = md._get_id(cr, uid, 'stock', 'stock_location_output') location_id = md.browse(cr, uid, location_id, context=context).res_id self.pool.get('stock.location').write(cr, uid, [location_id], {'chained_auto_packing': 'transparent'}) diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml index 6c8249131e8..f2ebe3af020 100644 --- a/addons/sale/sale_data.xml +++ b/addons/sale/sale_data.xml @@ -2,16 +2,16 @@ <openerp> <data noupdate="1"> <!-- - Requests Links - --> + Requests Links + --> <record id="req_link_sale_order" model="res.request.link"> <field name="name">Sale Order</field> <field name="object">sale.order</field> </record> <!-- - Resource: sale.shop - --> + Resource: sale.shop + --> <record id="shop" model="sale.shop"> <field model="res.company" name="name" search="[]" use="name"/> <field model="stock.warehouse" name="warehouse_id" search="[]"/> diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 913dfa1f82d..85dd4c86c27 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -2,7 +2,8 @@ <openerp> <data> - <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager,base.group_system,base.group_partner_manager"/> + <menuitem icon="terp-partner" id="base.menu_base_partner" name="Sales" sequence="0" + groups="base.group_sale_salesman,base.group_sale_manager,base.group_system"/> <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/> <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/> @@ -205,7 +206,7 @@ <button name="ship_recreate" states="shipping_except" string="Recreate Procurement" icon="gtk-ok"/> <button name="ship_corrected" states="shipping_except" string="Procurement Corrected" icon="gtk-apply"/> <button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/> - <button name="manual_invoice" states="manual" string="Create Invoice" icon="gtk-go-forward" type="object"/> + <button name="manual_invoice" states="manual" string="Create Invoice" icon="terp-gtk-go-back-rtl" type="object"/> <button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/> <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/> <button name="cancel" states="draft" string="Cancel Order" icon="gtk-cancel"/> @@ -375,22 +376,22 @@ to your configuration: from the sales order, from the pickings, etc. <field name="type">form</field> <field name="arch" type="xml"> <form string="Sales Order Lines"> - <group colspan="4" col="6"> - <field name="order_id"/> - <field name="product_id" readonly="1"/> - <field name="invoiced"/> - <field name="product_uom_qty" readonly="1"/> - <field groups="product.group_uos" name="product_uos_qty"/> - <field name="product_uom"/> - <field colspan="4" name="name" groups="base.group_extended"/> - <field name="company_id" groups="base.group_multi_company" readonly="1"/> - <field name="order_partner_id" readonly="1" invisible="1"/> - </group> + <group colspan="4" col="6"> + <field name="order_id"/> + <field name="product_id" readonly="1"/> + <field name="invoiced"/> + <field name="product_uom_qty" readonly="1"/> + <field groups="product.group_uos" name="product_uos_qty"/> + <field name="product_uom"/> + <field colspan="4" name="name" groups="base.group_extended"/> + <field name="company_id" groups="base.group_multi_company" readonly="1"/> + <field name="order_partner_id" readonly="1" invisible="1"/> + </group> <separator colspan="4" string="Price"/> <group colspan="4" col="6"> - <field name="price_unit"/> - <field name="discount"/> - <field name="price_subtotal"/> + <field name="price_unit"/> + <field name="discount"/> + <field name="price_subtotal"/> </group> <separator colspan="4" string="Notes"/> <field colspan="4" name="notes" nolabel="1"/> @@ -518,7 +519,7 @@ to your configuration: from the sales order, from the pickings, etc. groups="base.group_extended"/> <menuitem id="menu_invoiced" name="Billing" parent="base.menu_base_partner" sequence="5" - groups="base.group_extended"/> + groups="base.group_extended"/> <menuitem action="action_order_line_tree2" id="menu_invoicing_sales_order_lines" parent="menu_invoiced" sequence="2" groups="base.group_sale_salesman,base.group_sale_manager"/> <!-- configartion view --> diff --git a/addons/sale/stock_view.xml b/addons/sale/stock_view.xml index 93529fd3b7d..dddcad07932 100644 --- a/addons/sale/stock_view.xml +++ b/addons/sale/stock_view.xml @@ -23,7 +23,30 @@ <field name="sale_line_id" colspan="2"/> </xpath> </field> - </record> + </record> + + <act_window + domain="[('sale_id', '=', active_id)]" + id="act_sale_order_2_stock_picking" + name="Picking" + res_model="stock.picking" + src_model="sale.order" + context="{'contact_display': 'partner'}" /> + + <record id="action_sale_picking_out_tree_view" model="ir.actions.act_window.view"> + <field eval="1" name="sequence"/> + <field name="view_mode">tree</field> + <field name="view_id" ref="stock.view_picking_out_tree"/> + <field name="act_window_id" ref="act_sale_order_2_stock_picking"/> + </record> + + <record id="action_sale_picking_out_form_view" model="ir.actions.act_window.view"> + <field eval="2" name="sequence"/> + <field name="view_mode">form</field> + <field name="view_id" ref="stock.view_picking_out_form"/> + <field name="act_window_id" ref="act_sale_order_2_stock_picking"/> + </record> + <!-- Adding Sale Order Reference to outgoing picking --> <record id="stock_picking_out_inherit_sale" model="ir.ui.view"> diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index c6cf4d66c74..7cb253a2bfb 100644 --- a/addons/sale/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -110,7 +110,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so0")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) assert (picking_id),"Delivery order has not been generated" - I verify that a procurement has been generated for so @@ -282,7 +282,7 @@ import time sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so0")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) pick.force_assign(cr, uid) @@ -304,7 +304,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so0")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) pick = self.browse(cr,uid,picking_id[0]) assert (pick.state) =='done', "Picking for SO is not in done state." - diff --git a/addons/sale/test/picking_order_policy.yml b/addons/sale/test/picking_order_policy.yml index e90d58bab68..c3f4ba87aaf 100644 --- a/addons/sale/test/picking_order_policy.yml +++ b/addons/sale/test/picking_order_policy.yml @@ -261,7 +261,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so7")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) assert (picking_id),"Delivery order has not been generated" - I verify that delivery has been done @@ -270,7 +270,7 @@ import time sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so7")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) pick.force_assign(cr, uid) @@ -292,7 +292,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so7")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) if picking_id: pick = self.browse(cr,uid,picking_id[0]) assert (pick.state) =='done', "Picking for SO is not in done state." diff --git a/addons/sale/test/postpaid_order_policy.yml b/addons/sale/test/postpaid_order_policy.yml index 8ef86840fc9..bbd015d726b 100644 --- a/addons/sale/test/postpaid_order_policy.yml +++ b/addons/sale/test/postpaid_order_policy.yml @@ -73,7 +73,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so8")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) assert (picking_id),"Delivery order has not been generated" - I click on the Products Sent button and then on the Validate button @@ -82,7 +82,7 @@ import time sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so8")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) pick.force_assign(cr, uid) @@ -104,7 +104,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so8")) - picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')]) + picking_id = self.search(cr, uid, [('origin','=',so.name)]) if picking_id: pick = self.browse(cr,uid,picking_id[0]) assert (pick.state) =='done', "Picking for SO is not in done state." diff --git a/addons/sale/test/prepaid_order_policy.yml b/addons/sale/test/prepaid_order_policy.yml index f9bf8dbd330..0a8f2aafa81 100644 --- a/addons/sale/test/prepaid_order_policy.yml +++ b/addons/sale/test/prepaid_order_policy.yml @@ -40,7 +40,7 @@ !python {model: stock.picking }: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) - picking_id = self.search(cr, uid, [('origin','!=',so.name),(('type','=','out')and('type','=','delivery'))]) + picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')]) assert picking_id,"There is a picking attached to this sale order" - I open the Invoice for the SO. diff --git a/addons/sale/test/so_make_invoice.yml b/addons/sale/test/so_make_invoice.yml index 61d379c9a60..0133391395b 100644 --- a/addons/sale/test/so_make_invoice.yml +++ b/addons/sale/test/so_make_invoice.yml @@ -110,7 +110,7 @@ sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so4")) pick_obj = self.pool.get('stock.picking') - pick_id = pick_obj.search(cr, uid, [('origin', '=', so.name),('type','=','delivery')]) + pick_id = pick_obj.search(cr, uid, [('origin', '=', so.name)]) pick_brw = pick_obj.browse(cr,uid,pick_id)[0] move_obj = self.pool.get('stock.move') move_id = move_obj.search(cr, uid, [('picking_id', '=', pick_brw.name),('name','=','LG Viewty Smart')]) diff --git a/addons/sale/wizard/sale_line_invoice.xml b/addons/sale/wizard/sale_line_invoice.xml index c1e9d9c3b89..774759c82c7 100644 --- a/addons/sale/wizard/sale_line_invoice.xml +++ b/addons/sale/wizard/sale_line_invoice.xml @@ -9,7 +9,7 @@ <form string="Create invoices"> <separator colspan="4" string="Do you really want to create the invoice(s) ?" /> <button special="cancel" string="Cancel" icon="gtk-cancel"/> - <button name="make_invoices" string="Create Invoices" type="object" icon="gtk-ok"/> + <button name="make_invoices" string="Create Invoices" type="object" icon="terp-gtk-go-back-rtl"/> </form> </field> </record> diff --git a/addons/sale/wizard/sale_make_invoice.xml b/addons/sale/wizard/sale_make_invoice.xml index 106e6945207..e8e698e56b9 100644 --- a/addons/sale/wizard/sale_make_invoice.xml +++ b/addons/sale/wizard/sale_make_invoice.xml @@ -13,7 +13,7 @@ <field name="invoice_date"/> <separator string="" colspan="6"/> <button special="cancel" string="Cancel" icon="gtk-cancel"/> - <button name="make_invoices" string="Create Invoices" type="object" icon="gtk-ok"/> + <button name="make_invoices" string="Create Invoices" type="object" icon="terp-gtk-go-back-rtl"/> </form> </field> </record> @@ -38,4 +38,4 @@ <field name="model">sale.order</field> </record> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/sale/wizard/sale_make_invoice_advance.xml b/addons/sale/wizard/sale_make_invoice_advance.xml index 3257d1aafe8..6e192d31108 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.xml +++ b/addons/sale/wizard/sale_make_invoice_advance.xml @@ -15,7 +15,7 @@ <separator string="" colspan="4"/> <label string="" colspan="2" /> <button special="cancel" string="Cancel" icon="gtk-cancel"/> - <button name="create_invoices" string="Create Partial Invoice" type="object" icon="gtk-ok"/> + <button name="create_invoices" string="Create Partial Invoice" type="object" icon="terp-gtk-go-back-rtl"/> </form> </field> </record> @@ -55,4 +55,4 @@ <field name="target">new</field> </record> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/sale_journal/sale_journal_view.xml b/addons/sale_journal/sale_journal_view.xml index 8c9103d25f0..029908da37a 100644 --- a/addons/sale_journal/sale_journal_view.xml +++ b/addons/sale_journal/sale_journal_view.xml @@ -213,38 +213,6 @@ </field> </record> - <!-- Inherit stock picking delivery's form view.--> - - <record model="ir.ui.view" id="sale_journal_picking_order_del"> - <field name="name">stock.picking.journal.view.form</field> - <field name="type">form</field> - <field name="model">stock.picking</field> - <field name="inherit_id" ref="stock.view_picking_delivery_form" /> - <field name="arch" type="xml"> - <field name="origin" position="after"> - <field name="journal_id" select="1"/> - <field name="sale_journal_id" select="1"/> - <field name="invoice_type_id" select="1"/> - </field> - </field> - </record> - - <!-- Inherit stock picking delivery's tree view.--> - - <record model="ir.ui.view" id="sale_journal_picking_order_tree_del"> - <field name="name">stock.picking.journal.view.tree</field> - <field name="type">tree</field> - <field name="model">stock.picking</field> - <field name="inherit_id" ref="stock.view_picking_delivery_tree" /> - <field name="arch" type="xml"> - <field name="origin" position="after"> - <field name="journal_id" select="1"/> - <field name="invoice_type_id" select="1"/> - <field name="sale_journal_id" select="1"/> - </field> - </field> - </record> - <record model="ir.ui.view" id="sale_journal_picking_order_in"> <field name="name">stock.picking.journal.view.form</field> <field name="type">form</field> @@ -487,18 +455,6 @@ <field name="object" eval="True"/> </record> - <record id="view_picking_delivery_jorunal_search_form" model="ir.ui.view"> - <field name="name">stock.picking.journal.search</field> - <field name="model">stock.picking</field> - <field name="type">search</field> - <field name="inherit_id" ref="stock.view_stock_delivery_filter"/> - <field name="arch" type="xml"> - <xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after"> - <filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/> - </xpath> - </field> - </record> - <record id="view_picking_out_jorunal_search_form" model="ir.ui.view"> <field name="name">stock.picking.journal.search</field> <field name="model">stock.picking</field> diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 561bb9f2206..60fab009d0e 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -61,8 +61,8 @@ <field name="arch" type="xml"> <field name="standard_price" position="replace"> <group col="4" colspan="2"> - <field name="standard_price" readonly="True"/> - <button name="%(action_view_change_standard_price)d" string="Change Price" type="action" icon="gtk-execute"/> + <field name="standard_price" readonly="1"/> + <button name="%(action_view_change_standard_price)d" string="Change Price" type="action" icon="gtk-execute" attrs="{'readonly':[('cost_method','=','average')]}"/> </group> </field> </field> diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py index 618c086cd4f..49c3f8fb327 100644 --- a/addons/stock/report/report_stock_move.py +++ b/addons/stock/report/report_stock_move.py @@ -39,7 +39,7 @@ class report_stock_move(osv.osv): 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), 'picking_id':fields.many2one('stock.picking', 'Packing', readonly=True), - 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery'), ('other', 'Others')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."), + 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('other', 'Others')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."), 'location_id': fields.many2one('stock.location', 'Source Location', readonly=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."), 'location_dest_id': fields.many2one('stock.location', 'Dest. Location', readonly=True, select=True, help="Location where the system will stock the finished products."), 'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True), @@ -85,7 +85,7 @@ class report_stock_move(osv.osv): al.stock_journal as stock_journal, sum(al.in_value - al.out_value) as value FROM (SELECT - CASE WHEN sp.type in ('out','delivery') THEN + CASE WHEN sp.type in ('out') THEN sum(sm.product_qty * pu.factor) ELSE 0.0 END AS out_qty, @@ -93,7 +93,7 @@ class report_stock_move(osv.osv): sum(sm.product_qty * pu.factor) ELSE 0.0 END AS in_qty, - CASE WHEN sp.type in ('out','delivery') THEN + CASE WHEN sp.type in ('out') THEN sum(sm.product_qty * pu.factor) * pt.standard_price ELSE 0.0 END AS out_value, diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml index 353b8b6bc9c..1d9dc4a5ce4 100644 --- a/addons/stock/report/report_stock_move_view.xml +++ b/addons/stock/report/report_stock_move_view.xml @@ -74,7 +74,6 @@ <filter icon="terp-go-month" string="Month-1" name="month-1" - separator="1" domain="[('date','<=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','>',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]" help="Last month"/> <filter icon="terp-go-month" string="Month" @@ -96,7 +95,6 @@ <filter icon="terp-go-home" name="in" string="Incoming" domain="[('type','=','in')]"/> <filter icon="terp-go-home" name="internal" string="Internal" domain="[('type','=','internal')]"/> <filter icon="terp-go-home" name="out" string="Outgoing" domain="[('type','=','out')]"/> - <filter icon="terp-go-home" name="delivery" string="Deliveries" domain="[('type','=','delivery')]"/> <separator orientation="vertical"/> <field name="product_id" default_focus="1"/> <field name="partner_id" context="{'contact_display':'partner'}"/> diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 989fc50cc31..5717143c1a6 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -186,7 +186,7 @@ class stock_location(osv.osv): "validated automatically. With 'Manual Operation', the stock move has to be validated "\ "by a worker. With 'Automatic No Step Added', the location is replaced in the original move." ), - 'chained_picking_type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', help="Shipping Type of the Picking List that will contain the chained move (leave empty to automatically detect the type based on the source and destination locations)."), + 'chained_picking_type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', help="Shipping Type of the Picking List that will contain the chained move (leave empty to automatically detect the type based on the source and destination locations)."), 'chained_company_id': fields.many2one('res.company', 'Chained Company', help='The company the Picking List containing the chained move will belong to (leave empty to use the default company determination rules'), 'chained_delay': fields.integer('Chaining Lead Time',help="Delay between original move and chained move in days"), 'address_id': fields.many2one('res.partner.address', 'Location Address',help="Address of customer or supplier."), @@ -242,7 +242,7 @@ class stock_location(osv.osv): """ result = 'internal' if (from_location.usage=='internal') and (to_location and to_location.usage in ('customer', 'supplier')): - result = 'delivery' + result = 'out' elif (from_location.usage in ('supplier', 'customer')) and (to_location.usage == 'internal'): result = 'in' return result @@ -602,7 +602,7 @@ class stock_picking(osv.osv): 'name': fields.char('Reference', size=64, select=True), 'origin': fields.char('Origin', size=64, help="Reference of the document that produced this picking.", select=True), 'backorder_id': fields.many2one('stock.picking', 'Back Order of', help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True), - 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."), + 'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."), 'note': fields.text('Notes'), 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True), 'location_id': fields.many2one('stock.location', 'Location', help="Keep empty if you produce at the location where the finished products are needed." \ @@ -980,6 +980,8 @@ class stock_picking(osv.osv): invoices_group[partner.id] = invoice_id res[picking.id] = invoice_id for move_line in picking.move_lines: + if move_line.state == 'cancel': + continue origin = move_line.picking_id.name or '' if move_line.picking_id.origin: origin += ':' + move_line.picking_id.origin @@ -1251,7 +1253,6 @@ class stock_picking(osv.osv): 'out':'Picking List', 'in':'Reception', 'internal': 'Internal picking', - 'delivery': 'Delivery order' } message = type_list.get(pick.type, _('Document')) + " '" + (pick.name or 'n/a') + "' " if pick.min_date: @@ -1652,10 +1653,20 @@ class stock_move(osv.osv): ) if dest: if dest[1] == 'transparent': + newdate = (datetime.strptime(m.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=dest[2] or 0)).strftime('%Y-%m-%d') self.write(cr, uid, [m.id], { - 'date': (datetime.strptime(m.date, '%Y-%m-%d %H:%M:%S') + \ - relativedelta(days=dest[2] or 0)).strftime('%Y-%m-%d'), + 'date': newdate, 'location_dest_id': dest[0].id}) + if m.picking_id and (dest[3] or dest[5]): + self.pool.get('stock.picking').write(cr, uid, [m.picking_id.id], { + 'stock_journal_id': dest[3] or m.picking_id.stock_journal_id.id, + 'type': dest[5] or m.picking_id.type + }, context=context) + m.location_dest_id = dest[0] + res2 = self._chain_compute(cr, uid, [m], context=context) + for pick_id in res2.keys(): + result.setdefault(pick_id, []) + result[pick_id] += res2[pick_id] else: result.setdefault(m.picking_id, []) result[m.picking_id].append( (m, dest) ) @@ -1695,16 +1706,10 @@ class stock_move(osv.osv): for picking, todo in self._chain_compute(cr, uid, moves, context=context).items(): ptype = todo[0][1][5] and todo[0][1][5] or self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0]) pick_name = picking.name or '' - if ptype == 'delivery': - pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.delivery') - check_picking_ids = picking_obj.search(cr, uid, [('name','=',picking.name),('origin','=',str(picking.origin or '')),('type','=',ptype),('move_type','=',picking.move_type)]) - if check_picking_ids: - pickid = check_picking_ids[0] + if picking: + pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context) else: - if picking: - pickid = self._create_chained_picking(cr, uid, pick_name,picking,ptype,todo,context) - else: - pickid = False + pickid = False for move, (loc, auto, delay, journal, company_id, ptype) in todo: new_id = move_obj.copy(cr, uid, move.id, { 'location_id': move.location_dest_id.id, diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index b9aaff33e72..be1881634eb 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -74,11 +74,17 @@ <field name="usage">view</field> <field name="location_id" ref="stock_location_locations"/> </record> + + <record id="journal_delivery" model="stock.journal"> + <field name="name">Delivery Orders</field> + </record> <record id="stock_location_output" model="stock.location"> <field name="name">Output</field> <field name="location_id" ref="stock_location_company"/> <field name="usage">internal</field> <field name="chained_location_type">customer</field> + <field name="chained_picking_type">out</field> + <field name="chained_journal_id" ref="journal_delivery"/> </record> <record id="stock_location_stock" model="stock.location"> <field name="name">Stock</field> diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index 1249317a2e4..33d130c2d77 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -3,8 +3,8 @@ <data noupdate="1"> <!-- - Resource: stock.location - --> + Resource: stock.location + --> <record id="stock_location_3" model="stock.location"> <field name="name">IT Suppliers</field> <field name="location_id" ref="stock_location_suppliers"/> @@ -30,30 +30,18 @@ <field name="location_id" ref="stock_location_customers"/> <field name="usage">customer</field> </record> - <record id="stock_location_13" model="stock.location"> - <field name="name">Stock Level 1</field> - <field name="location_id" ref="stock_location_stock"/> - </record> <record id="stock_location_14" model="stock.location"> <field name="name">Shelf 2</field> - <field name="location_id" ref="stock_location_13"/> - </record> - <record id="stock_location_15" model="stock.location"> - <field name="name">Sub Products</field> - <field name="location_id" ref="stock_location_13"/> - </record> - <record id="stock_location_workshop" model="stock.location"> - <field name="name">Workshop</field> <field name="location_id" ref="stock_location_stock"/> </record> <record id="stock_location_components" model="stock.location"> <field name="name">Shelf 1</field> - <field name="location_id" ref="stock_location_workshop"/> + <field name="location_id" ref="stock_location_stock"/> </record> <!-- - Resource: stock.inventory - --> + Resource: stock.inventory + --> <record id="stock_inventory_0" model="stock.inventory"> <field name="name">Starting Inventory</field> @@ -62,8 +50,8 @@ </record> <!-- - Resource: stock.inventory.line - --> + Resource: stock.inventory.line + --> <record id="stock_inventory_line_0" model="stock.inventory.line"> <field name="product_id" ref="product.product_product_pc1"/> @@ -189,7 +177,7 @@ <field eval="0" name="customer"/> <field eval="0" name="supplier"/> <field eval="1" name="active"/> - <field eval=""""Tiny Shop 1"""" name="name"/> + <field eval=""""Shop 1"""" name="name"/> </record> <record id="res_partner_address_fabien0" model="res.partner.address"> <field eval=""""Fabien"""" name="name"/> @@ -206,7 +194,7 @@ <field eval="1" name="customer"/> <field eval="0" name="supplier"/> <field eval="1" name="active"/> - <field eval=""""Tiny Shop 2"""" name="name"/> + <field eval=""""Shop 2"""" name="name"/> </record> <record id="res_partner_address_eric0" model="res.partner.address"> <field eval=""""Eric"""" name="name"/> @@ -223,7 +211,7 @@ </record> <record id="stock_location_shop0" model="stock.location"> <field model="res.partner.address" name="address_id" search="[('name','=','Fabien')]"/> - <field name="location_id" ref="stock.stock_location_company"/> + <field name="location_id" ref="stock.stock_location_locations"/> <field name="company_id" ref="res_company_shop0"/> <field eval=""""internal"""" name="usage"/> <field eval=""""none"""" name="chained_location_type"/> @@ -234,14 +222,14 @@ <record id="stock_location_shop1" model="stock.location"> <field model="res.partner.address" name="address_id" search="[('name','=','Eric')]"/> <field name="company_id" ref="res_company_tinyshop0"/> - <field name="location_id" ref="stock.stock_location_company"/> + <field name="location_id" ref="stock.stock_location_locations"/> <field eval=""""internal"""" name="usage"/> <field eval="1" name="active"/> <field eval=""""Shop 2"""" name="name"/> </record> <record id="stock_location_intermediatelocation0" model="stock.location"> <field name="address_id" ref="base.main_address"/> - <field name="location_id" ref="stock.stock_location_company"/> + <field name="location_id" ref="stock.stock_location_locations_partner"/> <field eval=""""procurement"""" name="usage"/> <field eval=""""Internal Shippings"""" name="name"/> </record> @@ -263,13 +251,13 @@ <field name="lot_input_id" ref="stock_location_shop1"/> </record> - <record forcecreate="True" id="property_stock_variation" model="ir.property"> + <record forcecreate="True" id="property_stock_variation" model="ir.property"> <field name="name">property_stock_variation</field> <field name="fields_id" search="[('model','=','product.category'),('name','=','property_stock_variation')]"/> - <field eval="'account.account,'+str(ref('account.a_recv'))" model="account.account" name="value"/> - <field name="company_id" ref="base.main_company"/> + <field eval="'account.account,'+str(ref('account.a_recv'))" model="account.account" name="value"/> + <field name="company_id" ref="base.main_company"/> </record> - <record id="stock_picking_1" model="stock.picking"> + <record id="stock_picking_1" model="stock.picking"> <field name="name">PACKO1</field> <field name="type">out</field> <field name="move_type">direct</field> diff --git a/addons/stock/stock_sequence.xml b/addons/stock/stock_sequence.xml index 06d898c6637..cabf24dda5b 100644 --- a/addons/stock/stock_sequence.xml +++ b/addons/stock/stock_sequence.xml @@ -20,14 +20,9 @@ <field name="code">stock.picking.internal</field> </record> - <record id="seq_type_picking_delivery" model="ir.sequence.type"> - <field name="name">Picking Delivery</field> - <field name="code">stock.picking.delivery</field> - </record> - - <!-- - Sequences for pickings - --> + <!-- + Sequences for pickings + --> <record id="seq_picking_in" model="ir.sequence"> <field name="name">Picking IN</field> @@ -50,13 +45,6 @@ <field name="padding">5</field> </record> - <record id="seq_picking_delivery" model="ir.sequence"> - <field name="name">Picking DLV</field> - <field name="code">stock.picking.delivery</field> - <field name="prefix">DLV/</field> - <field name="padding">5</field> - </record> - <!-- Sequences from tracking numbers --> diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index fa81b7534c3..2a4bec6fe3b 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -134,9 +134,9 @@ </notebook> <field name="state"/> <group col="4" colspan="2"> + <button name="action_cancel_inventary" states="draft" string="Cancel Inventory" type="object" icon="gtk-cancel"/> <button name="action_done" states="draft" string="Confirm Inventory" type="object" icon="gtk-apply"/> <button name="action_cancel" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/> - <button name="action_cancel_inventary" states="draft" string="Cancel Inventory" type="object" icon="gtk-cancel"/> </group> </form> @@ -652,7 +652,6 @@ <page string="Products"> <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines}"> <tree colors="grey:scrapped == True" string="Stock Moves"> - <field name="name" string="Move Name"/> <field name="product_id"/> <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/> <field name="product_uom" string="UoM"/> @@ -682,7 +681,6 @@ states="draft,assigned,confirmed,done"/> <field name="location_id"/> <field name="location_dest_id"/> - <field name="date"/> <field name="date_expected" string="Date Expected"/> <field name="state"/> </tree> @@ -734,10 +732,10 @@ <label string="" colspan="4"/> <field name="state"/> <group col="4" colspan="2"> + <button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/> <button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/> - <button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -748,7 +746,7 @@ <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> <button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-apply"/> - <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> + <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/> </group> </page> @@ -798,224 +796,6 @@ </field> </record> - <record id="view_picking_delivery_tree" model="ir.ui.view"> - <field name="name">stock.picking.delivery.tree</field> - <field name="model">stock.picking</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date < current_date" string="Picking list"> - <field name="name"/> - <field name="partner_id"/> - <field name="backorder_id" groups="base.group_extended"/> - <field name="origin"/> - <field name="date"/> - <field name="min_date"/> - <field name="stock_journal_id" groups="base.group_extended" widget="selection"/> - <field name="state"/> - <button name="%(action_partial_picking)d" states="assigned" type="action" icon="gtk-go-forward" string="Approve Delivery"/> - <button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" confirm="This operation will cancel the delivery. Do you want to continue?"/> - </tree> - </field> - </record> - <record id="view_picking_delivery_form" model="ir.ui.view"> - <field name="name">stock.picking.delivery.form</field> - <field name="model">stock.picking</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Delivery Picking list"> - <group col="6" colspan="4" attrs="{'readonly': [('state','not in',['draft','auto'])]}"> - <group colspan="4" col="4"> - <field name="name" readonly="1"/> - <field name="origin" readonly="1"/> - <field name="address_id" on_change="onchange_partner_in(address_id)" context="{'contact_display':'partner'}" required="1" colspan="4"/> - <field name="invoice_state"/> - <field name="backorder_id" readonly="1" groups="base.group_extended"/> - </group> - <group colspan="2" col="2"> - <field name="date"/> - <field name="min_date" readonly="1"/> - <field name="stock_journal_id" groups="base.group_extended" widget="selection"/> - </group> - </group> - <notebook colspan="4"> - <page string="Products"> - <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" > - <tree colors="grey:scrapped == True" string="Stock Moves"> - <field name="name" string="Move Name"/> - <field name="product_id"/> - <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/> - <field name="product_uom" string="UoM"/> - <field name="product_uos" groups="product.product_uos"/> - <button name="%(stock.move_scrap)d" - string="Scrap Products" type="action" - icon="gtk-convert" context="{'scrap': True}" - states="draft,waiting,confirmed,assigned" - groups="base.group_extended"/> - <field name="scrapped" invisible="1"/> - <field name="prodlot_id" groups="base.group_extended"/> - <button - name="%(stock.track_line)d" - string="Split in production lots" - type="action" icon="terp-stock_effects-object-colorize" - groups="base.group_extended" - states="draft,waiting,confirmed,assigned" /> - <field groups="base.group_extended" name="tracking_id"/> - <button name="setlast_tracking" string="Put in current pack" type="object" - attrs="{'invisible': [('tracking_id','<>',False)]}" - groups="base.group_extended" - icon="terp-stock_effects-object-colorize" - states="draft,assigned,confirmed,done"/> - <button name="%(split_into)d" string="Put in a new pack" type="action" - icon="terp-stock_effects-object-colorize" - states="draft,assigned,confirmed,done" - groups="base.group_extended"/> - <field name="location_id"/> - <field name="location_dest_id"/> - <field name="date"/> - <field name="date_expected" string="Date Expected"/> - <field name="state"/> - </tree> - <form string="Stock Moves"> - <group colspan="2" col="4"> - <separator colspan="2" string="Move Information"/> - <field name="name" invisible="1" colspan="4"/> - <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.address_id)" colspan="4"/> - <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="3"/> - <button name="%(stock.move_scrap)d" - string="Scrap" type="action" groups="base.group_extended" - icon="gtk-convert" context="{'scrap': True}" - states="draft,waiting,confirmed,assigned" colspan="1"/> - <field name="product_uom" string="Unit Of Measure" widget="selection" colspan="4"/> - <field name="product_uos_qty" groups="product.product_uos" colspan="4"/> - <field groups="product.group_uos" name="product_uos" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="4"/> - <field groups="base.group_extended" name="product_packaging" domain="[('product_id','=',product_id)]" colspan="4"/> - </group> - - <group colspan="2" col="2"> - <separator string="Locations" colspan="2" /> - <field name="location_id" domain="[('usage','=','internal')]" /> - <field name="location_dest_id" domain="[('usage','<>','view')]" /> - </group> - - <group colspan="2" col="2"> - <separator string="Dates" colspan="2" /> - <field name="create_date" invisible="1"/> - <field name="date"/> - <field name="date_expected"/> - </group> - - <group colspan="2" col="4" groups="base.group_extended"> - <separator string="Traceability" colspan="4" groups="base.group_extended"/> - <field name="tracking_id" groups="base.group_extended" colspan="3"/> - <button name="%(split_into)d" string="New pack" type="action" - groups="base.group_extended" - icon="terp-stock_effects-object-colorize" - states="draft,assigned,confirmed,done" colspan="1"/> - <field name="prodlot_id" groups="base.group_extended" - context="{'location_id':location_id, 'product_id':product_id}" - domain="[('product_id','=?',product_id)]" - on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)" colspan="3"/> - <button name="%(track_line)d" - groups="base.group_extended" - states="draft,waiting,confirmed,assigned,done" - string="Split" type="action" icon="terp-stock_effects-object-colorize" colspan="1" /> - </group> - <label string="" colspan="4"/> - <field name="state"/> - <group col="4" colspan="2"> - <button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/> - <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> - <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/> - <button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/> - </group> - </form> - </field> - <group col="10" colspan="4"> - <field name="state" readonly="1"/> - <button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/> - <button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/> - <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/> - <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> - <button name="%(action_partial_picking)d" states="assigned" string="Products Sent" type="action" icon="gtk-go-forward"/> - <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> - <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/> - </group> - </page> - <page string="Additional info" groups="base.group_extended,base.group_multi_company"> - <field name="auto_picking" groups="base.group_extended"/> - <field name="date_done" groups="base.group_extended"/> - <field name="move_type" groups="base.group_extended"/> - <field name="type" groups="base.group_extended"/> - <field name="company_id" groups="base.group_multi_company" widget="selection"/> - </page> - <page string="Notes"> - <field colspan="4" name="note" nolabel="1"/> - </page> - </notebook> - </form> - </field> - </record> - - <record id="view_stock_delivery_filter" model="ir.ui.view"> - <field name="name">stock.view_stock_delivery_filter.list.select</field> - <field name="model">stock.picking</field> - <field name="type">search</field> - <field name="arch" type="xml"> - <search string="Search Stock Delivery"> - <group col="10" colspan="4"> - <filter icon="terp-check" name="available" string="Available" domain="[('state','=','assigned')]" help="Assigned Orders" /> - <filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirmed')]" help="Confirmed Orders"/> - <separator orientation="vertical"/> - <filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id','!=',False)]" help="Is a Back Order" groups="base.group_extended"/> - <separator orientation="vertical"/> - <field name="name"/> - <field name="partner_id"/> - <field name="origin"/> - <field name="stock_journal_id" groups="base.group_extended" widget="selection"/> - </group> - <newline/> - <group expand="0" string="Group By..." colspan="4" col="10"> - <filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/> - <separator orientation="vertical" /> - <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> - <separator orientation="vertical" /> - <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/> - <separator orientation="vertical" /> - <filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/> - </group> - </search> - </field> - </record> - - <record id="action_picking_tree_delivery" model="ir.actions.act_window"> - <field name="name">Delivery Orders</field> - <field name="res_model">stock.picking</field> - <field name="type">ir.actions.act_window</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form,calendar</field> - <field name="domain">[('type','=','delivery')]</field> - <field name="context">{'contact_display': 'partner_address',"search_default_available":1}</field> - <field name="search_view_id" ref="view_stock_delivery_filter"/> - </record> - <record id="action_picking_tree_delivery_view1" model="ir.actions.act_window.view"> - <field eval="1" name="sequence"/> - <field name="view_mode">tree</field> - <field name="view_id" ref="view_picking_delivery_tree"/> - <field name="act_window_id" ref="action_picking_tree_delivery"/> - </record> - <record id="action_picking_tree_delivery_view2" model="ir.actions.act_window.view"> - <field eval="2" name="sequence"/> - <field name="view_mode">form</field> - <field name="view_id" ref="view_picking_delivery_form"/> - <field name="act_window_id" ref="action_picking_tree_delivery"/> - </record> - <record id="action_picking_tree_delivery_view2_calendar" model="ir.actions.act_window.view"> - <field eval="3" name="sequence"/> - <field name="view_mode">calendar</field> - <field name="act_window_id" ref="action_picking_tree_delivery"/> - </record> - <menuitem action="action_picking_tree_delivery" id="menu_action_picking_tree_delivery" parent="menu_stock_warehouse_mgmt" sequence="7"/> - <!-- # # Sending Products @@ -1142,10 +922,10 @@ <label string="" colspan="4"/> <field name="state"/> <group col="4" colspan="2"> + <button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/> <button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/> - <button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -1156,7 +936,7 @@ <button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> <button name="%(action_partial_picking)d" states="assigned" string="Done" type="action" icon="gtk-execute"/> - <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> + <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/> </group> </page> @@ -1357,10 +1137,10 @@ <label string="" colspan="4"/> <field name="state"/> <group col="4" colspan="2"> + <button name="action_cancel" states="assigned" string="_Cancel" type="object" icon="gtk-cancel"/> <button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/> <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/> - <button name="action_cancel" states="assigned" string="_Cancel" type="object" icon="gtk-cancel"/> </group> </form> </field> @@ -1371,7 +1151,7 @@ <button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/> <button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/> <button name="%(action_partial_picking)d" states="assigned" string="Products Received" type="action" icon="gtk-ok"/> - <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> + <button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/> <button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/> </group> </page> @@ -1486,7 +1266,7 @@ <field name="view_type">form</field> <field name="view_mode">tree,form,calendar</field> <field name="domain">[('type','=','internal')]</field> - <field name="context">{'contact_display': 'partner_address',"search_default_confirmed":1}</field> + <field name="context">{'contact_display': 'partner_address',"search_default_available":1}</field> <field name="search_view_id" ref="view_picking_internal_search"/> </record> @@ -1809,8 +1589,8 @@ </field> </record> - <record id="view_move_search_reception_picking" model="ir.ui.view"> - <field name="name">stock.move.search2</field> + <record id="view_move_search_reception_incoming_picking" model="ir.ui.view"> + <field name="name">stock.move.incoming.search2</field> <field name="model">stock.move</field> <field name="type">search</field> <field eval="6" name="priority"/> @@ -1845,6 +1625,42 @@ </field> </record> + <record id="view_move_search_reception_outcoming_picking" model="ir.ui.view"> + <field name="name">stock.move.outgoing.search2</field> + <field name="model">stock.move</field> + <field name="type">search</field> + <field eval="6" name="priority"/> + <field name="arch" type="xml"> + <search string="Stock Moves"> + <group col="8" colspan="4"> + <filter icon="terp-go-today" string="Today" domain="[('date','<=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','>=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/> + <separator orientation="vertical"/> + <filter icon="terp-gtk-go-back-rtl" name="receive" string="To Do" domain="[('state','in',('confirmed','assigned'))]" help="Stock to be received"/> + <filter icon="terp-check" name="received" string="Done" domain="[('state','=','done')]"/> + <separator orientation="vertical"/> + <field name="origin"/> + <field name="partner_id" string="Partner"/> + <field name="product_id"/> + </group> + <newline/> + <group expand="0" string="Group By..." colspan="4" col="8"> + <filter string="Customer" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'partner_id'}"/> + <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/> + <separator orientation="vertical"/> + <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/> + <filter string="Order" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'origin'}"/> + <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> + <separator orientation="vertical"/> + <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" /> + </group> + <newline/> + <group expand="0" string="Extended options..." groups="base.group_extended"> + <field name="tracking_id" context="{'tracking': self}" filter_domain="[]" /> + </group> + </search> + </field> + </record> + <record id="action_reception_picking_move" model="ir.actions.act_window"> <field name="name">Incoming Products</field> <field name="res_model">stock.move</field> @@ -1854,7 +1670,7 @@ <field name="domain">['|','&',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&',('picking_id','!=',False),('picking_id.type','=','in')]</field> <field name="view_id" ref="view_move_tree_reception_picking"/> <field name="context">{"search_default_receive":1}</field> - <field name="search_view_id" ref="view_move_search_reception_picking"/> + <field name="search_view_id" ref="view_move_search_reception_incoming_picking"/> </record> <record model="ir.actions.act_window.view" id="action_move_reception_picking_tree"> @@ -1988,7 +1804,7 @@ <field name="domain">['|','&',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&',('picking_id','!=',False),('picking_id.type','=','out')]</field> <field name="view_id" ref="view_move_tree_reception_picking"/> <field name="context">{"search_default_receive":1}</field> - <field name="search_view_id" ref="view_move_search_reception_picking"/> + <field name="search_view_id" ref="view_move_search_reception_outcoming_picking"/> </record> <record model="ir.actions.act_window.view" id="action_move_out_picking_tree"> diff --git a/addons/stock/test/stock_report.yml b/addons/stock/test/stock_report.yml index 48396019c6c..f6bcd60ad5e 100644 --- a/addons/stock/test/stock_report.yml +++ b/addons/stock/test/stock_report.yml @@ -3,7 +3,7 @@ - !python {model: stock.location}: | import netsvc, tools, os - (data, format) = netsvc.LocalService('report.lot.stock.overview_all').create(cr, uid, [ref('stock.stock_location_13')], {}, {}) + (data, format) = netsvc.LocalService('report.lot.stock.overview_all').create(cr, uid, [ref('stock.stock_location_stock')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'stock-overviewall'+format), 'wb+').write(data) - diff --git a/addons/stock/wizard/stock_invoice_onshipping_view.xml b/addons/stock/wizard/stock_invoice_onshipping_view.xml index eddffb594aa..6284121553c 100644 --- a/addons/stock/wizard/stock_invoice_onshipping_view.xml +++ b/addons/stock/wizard/stock_invoice_onshipping_view.xml @@ -17,7 +17,7 @@ <field name="invoice_date" /> <separator string="" colspan="4" /> <button special="cancel" string="_Cancel" icon='gtk-cancel'/> - <button name="create_invoice" string="Create Invoices" type="object" icon="gtk-ok"/> + <button name="create_invoice" string="Create Invoices" type="object" icon="terp-gtk-go-back-rtl"/> </form> </field> </record> diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py index 4825fa9c47e..5c7fd3c9472 100644 --- a/addons/stock/wizard/stock_partial_move.py +++ b/addons/stock/wizard/stock_partial_move.py @@ -38,7 +38,7 @@ class stock_partial_move(osv.osv_memory): context={} for m in move_obj.browse(cr, uid, context.get('active_ids', [])): if m.state in ('done', 'cancel'): - raise osv.except_osv(_('Invalid action !'), _('Cannot delivery products which are already delivered !')) + raise osv.except_osv(_('Invalid action !'), _('Cannot deliver products which are already delivered !')) if 'move%s_product_id'%(m.id) not in self._columns: diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index d52198170a6..2d9ec901a8d 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -63,7 +63,7 @@ class stock_partial_picking(osv.osv_memory): _moves_arch_lst = """<form string="Deliver Products"> <separator colspan="4" string="Delivery Information"/> <group colspan="4" col="4"> - <field name="date"/> + <field name="date"/> </group> <separator colspan="4" string="Move Detail"/> """ diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py index a54e6a485c2..c514c9714eb 100644 --- a/addons/stock/wizard/stock_splitinto.py +++ b/addons/stock/wizard/stock_splitinto.py @@ -41,14 +41,14 @@ class stock_split_into(osv.osv_memory): quantity = self.browse(cr, uid, data[0], context).quantity or 0.0 for move in move_obj.browse(cr, uid, rec_id): quantity_rest = move.product_qty - quantity - if move.tracking_id : - raise osv.except_osv(_('Error!'), _('The current move line is already assigned to a pack, please remove it first if you really want to change it ' \ - 'for this product: "%s" (id: %d)') % \ - (move.product_id.name, move.product_id.id,)) + #if move.tracking_id : + # raise osv.except_osv(_('Error!'), _('The current move line is already assigned to a pack, please remove it first if you really want to change it ' \ + # 'for this product: "%s" (id: %d)') % \ + # (move.product_id.name, move.product_id.id,)) if quantity > move.product_qty: raise osv.except_osv(_('Error!'), _('Total quantity after split exceeds the quantity to split ' \ 'for this product: "%s" (id: %d)') % \ - (move.product_id.name, move.product_id.id,)) + (move.product_id.name, move.product_id.id,)) if quantity > 0: move_obj.setlast_tracking(cr, uid, [move.id], context=context) move_obj.write(cr, uid, [move.id], { @@ -63,12 +63,12 @@ class stock_split_into(osv.osv_memory): move_obj.write(cr, uid, [move.id], {'tracking_id': tracking_id}) else: default_val = { - 'product_qty': quantity_rest, - 'product_uos_qty': quantity_rest, - 'tracking_id': tracking_id, - 'state': move.state, - 'product_uos': move.product_uom.id - } + 'product_qty': quantity_rest, + 'product_uos_qty': quantity_rest, + 'tracking_id': tracking_id, + 'state': move.state, + 'product_uos': move.product_uom.id + } move_obj.copy(cr, uid, move.id, default_val) return {} stock_split_into() diff --git a/addons/stock_location/__openerp__.py b/addons/stock_location/__openerp__.py index e5d6f767975..5c2ae8e63e5 100644 --- a/addons/stock_location/__openerp__.py +++ b/addons/stock_location/__openerp__.py @@ -74,19 +74,29 @@ Technically, Pull flows allow to process procurement orders differently, not onl the product being considered, but also depending on which location holds the "need" for that product (i.e. the destination location of that procurement order). +Use-Case +-------- + +You can use the demo data as follow: + CPU1: Sell some CPU1 from Shop 1 and run the scheduler + - Warehouse: delivery order, Shop 1: reception + CPU3: + - When receiving the product, it goes to Quality Control location then stored to shelf 2. + - When delivering the customer: Pick List -> Packing -> Delivery Order from Gate A """, 'author': 'OpenERP SA', - 'depends': ['procurement','stock'], + 'depends': ['procurement','stock','sale'], 'init_xml': [], 'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'mrp_pull_workflow.xml'], - 'demo_xml': ['stock_location_demo.xml',], - + 'demo_xml': [ + 'stock_location_demo_cpu1.xml', + 'stock_location_demo_cpu3.yml', + ], 'installable': True, - 'test':['' - 'test/stock_location_pull_flow.yml', - 'test/stock_location_push_flow.yml', - ], + 'test':[ +# 'test/stock_location_pull_flow.yml', +# 'test/stock_location_push_flow.yml', + ], 'active': False, 'certificate': '0046505115101', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py index 5404946e3ee..baa9692ba75 100644 --- a/addons/stock_location/stock_location.py +++ b/addons/stock_location/stock_location.py @@ -26,20 +26,21 @@ import pooler class stock_location_path(osv.osv): _name = "stock.location.path" + _description = "Pushed Flows" _columns = { 'name': fields.char('Operation', size=64), 'company_id': fields.many2one('res.company', 'Company'), 'product_id' : fields.many2one('product.product', 'Products', ondelete='cascade', select=1), 'journal_id': fields.many2one('stock.journal','Journal'), - 'location_from_id' : fields.many2one('stock.location', 'Source Location', ondelete='cascade', select=1), - 'location_dest_id' : fields.many2one('stock.location', 'Destination Location', ondelete='cascade', select=1), + 'location_from_id' : fields.many2one('stock.location', 'Source Location', ondelete='cascade', select=1, required=True), + 'location_dest_id' : fields.many2one('stock.location', 'Destination Location', ondelete='cascade', select=1, required=True), 'delay': fields.integer('Delay (days)', help="Number of days to do this transition"), 'invoice_state': fields.selection([ ("invoiced", "Invoiced"), ("2binvoiced", "To Be Invoiced"), ("none", "Not from Picking")], "Invoice Status", required=True,), - 'picking_type': fields.selection([('out','Sending Goods'),('in','Getting Goods'),('internal','Internal'),('delivery','Delivery')], 'Shipping Type', required=True, select=True, help="Depending on the company, choose whatever you want to receive or send products"), + 'picking_type': fields.selection([('out','Sending Goods'),('in','Getting Goods'),('internal','Internal')], 'Shipping Type', required=True, select=True, help="Depending on the company, choose whatever you want to receive or send products"), 'auto': fields.selection( [('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')], 'Automatic Move', @@ -71,7 +72,7 @@ class product_pulled_flow(osv.osv): 'type_proc': fields.selection([('produce','Produce'),('buy','Buy'),('move','Move')], 'Type of Procurement', required=True), 'company_id': fields.many2one('res.company', 'Company', help="Is used to know to which company belong packings and moves"), 'partner_address_id': fields.many2one('res.partner.address', 'Partner Address'), - 'picking_type': fields.selection([('out','Sending Goods'),('in','Getting Goods'),('internal','Internal'),('delivery','Delivery')], 'Shipping Type', required=True, select=True, help="Depending on the company, choose whatever you want to receive or send products"), + 'picking_type': fields.selection([('out','Sending Goods'),('in','Getting Goods'),('internal','Internal')], 'Shipping Type', required=True, select=True, help="Depending on the company, choose whatever you want to receive or send products"), 'product_id':fields.many2one('product.product','Product'), 'invoice_state': fields.selection([ ("invoiced", "Invoiced"), diff --git a/addons/stock_location/stock_location_demo.xml b/addons/stock_location/stock_location_demo_cpu1.xml index a828eb76f2d..01f711839d4 100644 --- a/addons/stock_location/stock_location_demo.xml +++ b/addons/stock_location/stock_location_demo_cpu1.xml @@ -4,86 +4,89 @@ <record id="product.product_product_cpu1" model="product.product"> <field name="description">This product is configured with example of push/pull flows</field> </record> - <record id="stock_location_input0" model="stock.location"> - <field name="location_id" ref="stock.stock_location_company"/> - <field eval="0" name="scrap_location"/> - <field name="company_id" ref="base.main_company"/> - <field name="usage">internal</field> - <field name="chained_location_type">none</field> - <field name="name">Input</field> - <field name="chained_auto_packing">manual</field> + <record id="stock_journal_quality" model="stock.journal"> + <field name="name">Quality Control</field> </record> + <record id="stock_location_qualitytest0" model="stock.location"> <field name="location_id" ref="stock.stock_location_company"/> <field eval="0" name="scrap_location"/> <field name="company_id" ref="base.main_company"/> <field name="usage">internal</field> <field name="chained_location_type">none</field> - <field name="name">Quality test</field> + <field name="name">Quality Control</field> <field name="chained_auto_packing">manual</field> </record> - <record id="stock.warehouse0" model="stock.warehouse"> - <field name="lot_input_id" ref="stock_location_input0"/> - </record> - <record id="stock_location_path_3" model="stock.location.path"> - <field name="location_from_id" ref="stock.stock_location_suppliers"/> - <field name="product_id" ref="product.product_product_cpu1"/> - <field name="auto">auto</field> - <field name="invoice_state">none</field> - <field eval="1" name="delay"/> - <field model="stock.location" name="location_dest_id" search="[('name', '=', u'Input')]"/> - <field name="picking_type">out</field> - </record> <record id="stock_location_path_4" model="stock.location.path"> <field model="stock.location" name="location_from_id" search="[('name', '=', u'Input')]"/> - <field name="product_id" ref="product.product_product_cpu1"/> - <field name="auto">auto</field> + <field name="product_id" ref="product.product_product_cpu3"/> + <field name="auto">transparent</field> <field name="invoice_state">none</field> <field eval="1" name="delay"/> - <field model="stock.location" name="location_dest_id" search="[('name', '=', u'Quality test')]"/> - <field name="picking_type">out</field> + <field name="name">Receptions to Quality Control</field> + <field name="location_dest_id" ref="stock_location_qualitytest0"/> + <field name="location_from_id" ref="stock.stock_location_stock"/> + <field name="picking_type">in</field> </record> <record id="stock_location_path_5" model="stock.location.path"> - <field model="stock.location" name="location_from_id" search="[('name', '=', u'Quality test')]"/> - <field name="product_id" ref="product.product_product_cpu1"/> - <field name="auto">auto</field> + <field name="location_from_id" ref="stock_location_qualitytest0"/> + <field name="product_id" ref="product.product_product_cpu3"/> + <field name="auto">manual</field> <field name="invoice_state">none</field> + <field name="journal_id" ref="stock_journal_quality"/> + <field name="name">Store in Shelf</field> <field eval="5" name="delay"/> - <field name="location_dest_id" ref="stock.stock_location_stock"/> - <field name="picking_type">out</field> + <field name="location_dest_id" ref="stock.stock_location_14"/> + <field name="picking_type">internal</field> </record> <record id="product_pulled_flow_l0" model="product.pulled.flow"> <field name="product_id" ref="product.product_product_cpu1"/> - <field name="location_src_id" ref="stock.stock_location_stock"/> + <field name="location_src_id" ref="stock.stock_location_intermediatelocation0"/> <field name="location_id" ref="stock.stock_location_shop0"/> <field name="partner_address_id" ref="base.main_address"/> <field name="invoice_state">none</field> - <field name="company_id" ref="base.main_company"/> + <field name="company_id" ref="stock.res_company_shop0"/> <field name="type_proc">move</field> <field eval="0" name="cancel_cascade"/> - <field name="procure_method">make_to_stock</field> - <field name="picking_type">internal</field> - <field name="name">L001</field> + <field name="procure_method">make_to_order</field> + <field name="picking_type">in</field> + <field name="name">Receive from Warehouse</field> </record> <record id="product_pulled_flow_l1" model="product.pulled.flow"> <field name="product_id" ref="product.product_product_cpu1"/> - <field name="location_id" ref="stock.stock_location_suppliers"/> + <field name="location_id" ref="stock.stock_location_intermediatelocation0"/> + <field name="location_src_id" ref="stock.stock_location_stock"/> + <field name="partner_address_id" ref="stock.res_partner_address_fabien0"/> + <field name="type_proc">move</field> <field name="invoice_state">none</field> <field name="company_id" ref="base.main_company"/> - <field name="type_proc">buy</field> <field eval="0" name="cancel_cascade"/> <field name="procure_method">make_to_stock</field> <field name="picking_type">out</field> - <field name="name">L002</field> + <field name="name">Deliver Shop</field> </record> <record id="stock_warehouse_orderpoint_shop1_cpu1" model="stock.warehouse.orderpoint"> <field name="product_max_qty">20.0</field> <field name="product_min_qty">10.0</field> <field name="product_uom" ref="product.product_uom_unit"/> + <field name="company_id" ref="stock.res_company_shop0"/> <field name="warehouse_id" ref="stock.stock_warehouse_shop0"/> <field name="location_id" ref="stock.stock_location_shop0"/> <field model="product.product" name="product_id" ref="product.product_product_cpu1"/> </record> + + <record id="sale_shop1" model="sale.shop"> + <field name="name">Shop 1</field> + <field name="warehouse_id" ref="stock.stock_warehouse_shop0"/> + <field name="company_id" ref="stock.res_company_shop0"/> + <field model="account.payment.term" name="payment_default_id" search="[]"/> + </record> + <record id="sale_shop2" model="sale.shop"> + <field name="name">Shop 2</field> + <field name="warehouse_id" ref="stock.stock_warehouse_shop1"/> + <field name="company_id" ref="stock.res_company_tinyshop0"/> + <field model="account.payment.term" name="payment_default_id" search="[]"/> + </record> </data> </openerp> diff --git a/addons/stock_location/stock_location_demo_cpu3.yml b/addons/stock_location/stock_location_demo_cpu3.yml new file mode 100644 index 00000000000..74c9998b1b6 --- /dev/null +++ b/addons/stock_location/stock_location_demo_cpu3.yml @@ -0,0 +1,55 @@ +- + !record {model: stock.journal, id: journal_pick}: + name: Pick List +- + !record {model: stock.journal, id: journal_pack}: + name: Packing +- + !record {model: stock.journal, id: journal_gate_a}: + name: Delivery Gate A +- + !record {model: stock.journal, id: journal_gate_b}: + name: Delivery Gate B +- + !record {model: stock.location, id: location_order}: + name: Order Processing + usage: internal + location_id: stock.stock_location_company +- + !record {model: stock.location, id: location_dispatch_zone}: + name: Dispatch Zone + usage: internal + location_id: location_order +- + !record {model: stock.location, id: location_gate_a}: + name: Gate A + usage: internal + location_id: location_dispatch_zone + chained_journal_id: journal_gate_a + chained_location_type: customer + chained_auto_packing: manual + chained_picking_type: out +- + !record {model: stock.location, id: location_pack_zone}: + name: Pack Zone + usage: internal + location_id: location_order + chained_journal_id: journal_pack + chained_location_id: location_gate_a + chained_location_type: fixed + chained_auto_packing: manual + chained_picking_type: internal +- + !record {model: stock.location, id: location_gate_b}: + name: Gate B + usage: internal + location_id: location_dispatch_zone +- + !record {model: stock.location.path, id: push_pick}: + name: Pick List + product_id: product.product_product_cpu3 + journal_id: journal_pick + location_from_id: stock.stock_location_output + location_dest_id: location_pack_zone + picking_type: internal + auto: transparent diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml index 49c3a808e70..eca4ade39fa 100644 --- a/addons/stock_location/stock_location_view.xml +++ b/addons/stock_location/stock_location_view.xml @@ -43,10 +43,11 @@ <page string="Logistic Flow"> <field name="flow_pull_ids" editable="bottom" colspan="4" nolabel="1"> <tree string="Pulled flows"> - <field name="location_id"/> - <field name="type_proc"/> - <field name="company_id" groups="base.group_multi_company"/> - <field name="name"/> + <field name="location_id"/> + <field name="type_proc"/> + <field name="name"/> + <field name="company_id" groups="base.group_multi_company"/> + <field name="journal_id" groups="base.group_extended"/> </tree> <form string="Pulled Paths"> <separator string="Conditions" colspan="4"/> @@ -64,11 +65,12 @@ <field name="procure_method"/> <field name="cancel_cascade"/> <field name="invoice_state"/> + <field name="journal_id" groups="base.group_extended"/> </group> </form> </field> <field name="path_ids" editable="bottom" colspan="4" nolabel="1"> - <field name="name"/> + <field name="name"/> <tree string="Pushed flows" editable="bottom"> <field name="location_from_id"/> <field name="location_dest_id"/> @@ -86,13 +88,14 @@ <field name="name"/> <field name="invoice_state"/> <field name="company_id" groups="base.group_multi_company"/> + <field name="journal_id" groups="base.group_extended"/> </form> </field> </page> </notebook> </field> </record> - </data> + </data> </openerp> diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml index 989134c13bb..3f473026c8b 100644 --- a/addons/stock_location/test/stock_location_push_flow.yml +++ b/addons/stock_location/test/stock_location_push_flow.yml @@ -47,12 +47,12 @@ path_ids: - auto: auto invoice_state: none - location_dest_id: stock_location.stock_location_input0 + location_dest_id: stock.stock_location_stock location_from_id: stock.stock_location_suppliers - auto: auto invoice_state: none location_dest_id: stock_location.stock_location_qualitytest0 - location_from_id: stock_location.stock_location_input0 + location_from_id: stock.stock_location_stock - auto: auto invoice_state: none location_dest_id: stock.stock_location_stock @@ -73,7 +73,7 @@ invoice_state: none move_lines: - date_expected: '2010-10-08 15:36:53' - location_dest_id: stock_location.stock_location_input0 + location_dest_id: stock.stock_location_stock location_id: stock.stock_location_suppliers name: 'HP CD writers' product_id: product_product_hpcdwriters0 diff --git a/addons/stock_no_autopicking/test/stock_no_autopicking.yml b/addons/stock_no_autopicking/test/stock_no_autopicking.yml index 9732e17194c..34e20eeb6c4 100644 --- a/addons/stock_no_autopicking/test/stock_no_autopicking.yml +++ b/addons/stock_no_autopicking/test/stock_no_autopicking.yml @@ -86,7 +86,7 @@ - !record {model: mrp.routing, id: mrp_routing_productionrouting0}: name: Production Routing - location_id: stock.stock_location_13 + location_id: stock.stock_location_stock workcenter_lines: - cycle_nbr: 1.0 hour_nbr: 0.5 diff --git a/addons/subscription/security/ir.model.access.csv b/addons/subscription/security/ir.model.access.csv index e19fdde993b..4d4f829092b 100644 --- a/addons/subscription/security/ir.model.access.csv +++ b/addons/subscription/security/ir.model.access.csv @@ -1,10 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_subscription_document,subscription.document,model_subscription_document,base.group_system,1,1,1,1 -access_subscription_document_fields,subscription.document.fields,model_subscription_document_fields,base.group_system,1,1,1,1 -access_subscription_subscription,subscription.subscription,model_subscription_subscription,base.group_user,1,1,1,1 -access_subscription_subscription_history,subscription.subscription.history,model_subscription_subscription_history,base.group_user,1,1,1,1 +access_subscription_document_fields,subscription.document.fields,model_subscription_document_fields,base.group_tool_manager,1,1,1,1 access_subscription_subscription_user,subscription.subscription user,model_subscription_subscription,base.group_tool_user,1,1,1,1 -access_subscription_subscription_manager,subscription.subscription manager,model_subscription_subscription,base.group_tool_manager,1,0,0,0 access_subscription_subscription_history_user,subscription.subscription.history user,model_subscription_subscription_history,base.group_tool_user,1,1,1,1 -access_subscription_subscription_system,subscription.subscription system,model_subscription_subscription,base.group_system,1,0,0,0 access_subscription_document_user,subscription.document user,model_subscription_document,base.group_tool_user,1,1,1,1 +access_res_partner_user,res.partner.user,base.model_res_partner,base.group_tool_user,1,1,1,1 +access_res_partner_address_user,res.partner.address.user,base.model_res_partner_address,base.group_tool_user,1,1,1,1 +access_ir_cron_user,ir.cron.user,base.model_ir_cron,base.group_tool_user,1,1,1,1 diff --git a/addons/subscription/subscription_view.xml b/addons/subscription/subscription_view.xml index b27414bb60c..37841919b1b 100644 --- a/addons/subscription/subscription_view.xml +++ b/addons/subscription/subscription_view.xml @@ -212,7 +212,7 @@ <field name="search_view_id" ref="view_subscription_document_filter" /> </record> <menuitem name="Configuration" parent="base.menu_tools" - id="base.menu_lunch_survey_root" sequence="20" groups="base.group_system" /> + id="base.menu_lunch_survey_root" sequence="20" groups="base.group_tool_manager" /> <menuitem id="config_recuuring_event" name="Recurring Events" parent="base.menu_lunch_survey_root" sequence="4"/> <menuitem action="action_document_form" id="menu_action_document_form" parent="config_recuuring_event"/> </data> diff --git a/addons/survey/security/ir.model.access.csv b/addons/survey/security/ir.model.access.csv index 5ea4017fb01..1a1c8cab818 100644 --- a/addons/survey/security/ir.model.access.csv +++ b/addons/survey/security/ir.model.access.csv @@ -1,51 +1,37 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" -"access_survey_type_manager","survey.type manager","model_survey_type","base.group_tool_manager",1,1,1,1 -"access_survey_type_user","survey.type user","model_survey_type","base.group_tool_user",1,1,1,1 -"access_survey_manager","survey","model_survey","base.group_tool_manager",1,1,1,1 -"access_survey_system","survey","model_survey","base.group_system",1,0,0,0 -"access_survey_user","survey","model_survey","base.group_tool_user",1,1,1,1 +"access_survey_res_partner_manager","survey.res.partner.manager","base.model_res_partner","base.group_tool_manager",1,1,1,1 +"access_survey_type_manager","survey.type.manager","model_survey_type","base.group_tool_manager",1,1,1,1 +"access_survey_manager","survey.manager","model_survey","base.group_tool_manager",1,1,1,1 "access_survey_page_manager","survey.page manager","model_survey_page","base.group_tool_manager",1,1,1,1 -"access_survey_page_system","survey.page system","model_survey_page","base.group_system",1,0,0,0 -"access_survey_page_user","survey.page user","model_survey_page","base.group_tool_user",1,1,1,1 "access_survey_question_manager","survey.question manager","model_survey_question","base.group_tool_manager",1,1,1,1 -"access_survey_question_user","survey.question user","model_survey_question","base.group_tool_user",1,1,1,1 "access_survey_answer_manager","survey.answer manager","model_survey_answer","base.group_tool_manager",1,1,1,1 -"access_survey_answer_user","survey.answer user","model_survey_answer","base.group_tool_user",1,1,1,1 "access_survey_response_manager","survey.response manager","model_survey_response","base.group_tool_manager",1,1,1,1 -"access_survey_response_user","survey.response user","model_survey_response","base.group_tool_user",1,1,1,1 "access_survey_response_answer_manager","survey.response.answer manager","model_survey_response_answer","base.group_tool_manager",1,1,1,1 -"access_survey_response_answer_user","survey.response.answer user","model_survey_response_answer","base.group_tool_user",1,1,1,1 -"access_survey_history_user","survey.history.user","model_survey_history","base.group_tool_user",1,1,1,1 +"access_survey_history_manager","survey.history.manager","model_survey_history","base.group_tool_manager",1,1,1,1 "access_survey_question_column_heading_manager","survey.question.column.heading manager","model_survey_question_column_heading","base.group_tool_manager",1,1,1,1 -"access_survey_question_column_heading_user","survey.question.column.heading user","model_survey_question_column_heading","base.group_tool_user",1,0,0,0 "access_survey_request_manager","survey.request manager","model_survey_request","base.group_tool_manager",1,1,1,1 -"access_survey_request_user","survey.request user","model_survey_request","base.group_tool_user",1,1,1,1 -"access_survey_request_system","survey.request system","model_survey_request","base.group_system",1,0,0,0 "access_survey_tbl_column_heading_manager","survey.tbl.column.heading manager","model_survey_tbl_column_heading","base.group_tool_manager",1,1,1,1 -"access_survey_tbl_column_heading_user","survey.tbl.column.heading user","model_survey_tbl_column_heading","base.group_tool_user",1,1,1,1 "access_survey_response_line_manager","survey.response.line manager","model_survey_response_line","base.group_tool_manager",1,1,1,1 +"access_survey_res_partner_address_manager","survey.res.partner.address.manager","base.model_res_partner_address","base.group_tool_manager",1,1,1,0 +"access_survey_res_partner_manager","survey.res.partner.manager","base.model_res_partner","base.group_tool_manager",1,1,1,1 +"access_survey_res_partner_user","survey.res.partner.user","base.model_res_partner","base.group_tool_user",1,1,1,1 +"access_survey_user","survey.user","model_survey","base.group_tool_user",1,1,1,1 +"access_survey_page_user","survey.page user","model_survey_page","base.group_tool_user",1,1,1,1 +"access_survey_question_user","survey.question user","model_survey_question","base.group_tool_user",1,1,1,1 +"access_survey_answer_user","survey.answer user","model_survey_answer","base.group_tool_user",1,1,1,1 +"access_survey_response_user","survey.response user","model_survey_response","base.group_tool_user",1,1,1,1 +"access_survey_response_answer_user","survey.response.answer user","model_survey_response_answer","base.group_tool_user",1,1,1,1 +"access_survey_history_user","survey.history.user","model_survey_history","base.group_tool_user",1,1,1,1 "access_survey_response_line_user","survey.response.line user","model_survey_response_line","base.group_tool_user",1,1,1,1 -"access_survey_history_survey_manager","survey.history manager","model_survey_history","base.group_tool_manager",1,1,1,1 -"access_survey_type_system","survey.type system","model_survey_type","base.group_system",1,0,0,0 -"access_survey_question_system","survey.question system","model_survey_question","base.group_system",1,0,0,0 -"access_survey_history_system","survey.history.system","model_survey_history","base.group_system",1,0,0,0 -"access_survey_answer_system","survey.answer system","model_survey_answer","base.group_system",1,0,0,0 -"access_survey_answer_base_user","survey.answer.base.user","model_survey_answer","base.group_user",1,1,1,1 -"access_survey_question_base_user","survey.question.base.user","model_survey_question","base.group_user",1,1,1,1 "access_survey_res_partner_address_user","survey.res.partner.address.user","base.model_res_partner_address","base.group_tool_user",1,1,1,0 -"access_survey_request_employee","survey.request.employee","model_survey_request","base.group_user",1,0,0,0 -"access_survey_response_employee","survey.response employee","model_survey_response","base.group_user",1,0,0,0 -"access_survey_employee","survey.employee","model_survey","base.group_user",1,0,0,0 +"access_survey_res_partner_user","survey.res.partner.user","base.model_res_partner","base.group_tool_user",1,1,1,1 "access_survey_survey_user","survey.survey.user","model_survey","group_survey_user",1,1,1,1 -"access_survey_type_survey_user","survey.type.survey.user","model_survey_type","group_survey_user",1,1,1,1 "access_survey_page_survey_user","survey.page.survey.user","model_survey_page","group_survey_user",1,1,1,1 -"access_survey_request_survey_user","survey.request.survey.user","model_survey_request","group_survey_user",1,1,1,1 "access_survey_question_survey_user","survey.question.survey.user","model_survey_question","group_survey_user",1,1,1,1 "access_survey_answer_survey_user","survey.answer.survey.user","model_survey_answer","group_survey_user",1,1,1,1 "access_survey_response_survey_user","survey.response.survey.user","model_survey_response","group_survey_user",1,1,1,1 "access_survey_response_answer_survey_user","survey.response.answer.survey.user","model_survey_response_answer","group_survey_user",1,1,1,1 "access_survey_history_survey_user","survey.history.survey.user","model_survey_history","group_survey_user",1,1,1,1 -"access_survey_question_column_heading_survey_user","survey.question.column.heading.survey.user","model_survey_question_column_heading","group_survey_user",1,0,0,0 -"access_survey_tbl_column_heading_survey_user","survey.tbl.column.heading.survey.user","model_survey_tbl_column_heading","group_survey_user",1,1,1,1 "access_survey_response_line_survey_user","survey.response.line.survey.user","model_survey_response_line","group_survey_user",1,1,1,1 -"access_survey_res_partner_address_survey_user","survey.res.partner.address.survey.user","base.model_res_partner_address","group_survey_user",1,1,1,0 +"access_survey_question_column_heading_survey_user","survey.question.column.heading.survey.user","model_survey_question_column_heading","group_survey_user",1,0,0,0 +"access_survey_question_column_heading_user","survey.question.column.heading user","model_survey_question_column_heading","base.group_tool_user",1,1,1,1 diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 4fc58962442..44bcb4475b5 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -3,12 +3,11 @@ <data> <menuitem icon="STOCK_PREFERENCES" id="base.menu_tools" name="Tools" sequence="28"/> - <menuitem name="Surveys" id="menu_surveys" parent="base.menu_tools" - groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user,group_survey_user" sequence="2"/> + <menuitem name="Surveys" id="menu_surveys" parent="base.menu_tools" sequence="2" groups="base.group_tool_user,base.group_tool_manager,group_survey_user"/> <menuitem name="Define Surveys" id="menu_define_survey" - groups="base.group_tool_manager,base.group_tool_user,base.group_system,group_survey_user" + groups="base.group_tool_manager" parent="menu_surveys" /> - <menuitem id="menu_answer_surveys" name="Answer Surveys" parent="menu_surveys" groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user,group_survey_user"/> + <menuitem id="menu_answer_surveys" name="Answer Surveys" parent="menu_surveys" groups="base.group_tool_user,base.group_tool_manager,group_survey_user"/> <menuitem name="Reporting" parent="base.menu_tools" id="base.menu_lunch_reporting" sequence="6"/> <menuitem name="Surveys" id="menu_reporting" parent="base.menu_lunch_reporting" sequence="2"/> @@ -184,6 +183,8 @@ </field> <group col="9" colspan="4"> <field name="state"/> + <button name="survey_cancel" + string="Cancel" states="open" type="object" icon="gtk-cancel"/> <button name="survey_draft" string="Set to draft" states="cancel,close" type="object" icon="gtk-new"/> @@ -191,8 +192,6 @@ states="draft" type="object" icon="gtk-go-forward"/> <button name="survey_close" string="Close" states="open" type="object" icon="gtk-close"/> - <button name="survey_cancel" - string="Cancel" states="open" type="object" icon="gtk-cancel"/> </group> </page> <page string="Other"> @@ -292,7 +291,7 @@ <menuitem name="Surveys" id="menu_survey_form" action="action_survey_form1" parent="menu_define_survey" - groups="base.group_tool_manager,base.group_tool_user,base.group_system,group_survey_user"/> + groups="base.group_tool_manager"/> <!-- Survey Pages @@ -492,7 +491,7 @@ <menuitem name="Survey Pages" id="menu_survey_page_form1" action="action_survey_page_form" parent='menu_define_survey' - groups="base.group_tool_manager,base.group_tool_user,base.group_system,group_survey_user"/> + groups="base.group_tool_manager"/> <record model="ir.ui.view" id="survey_page_wizard_test1"> <field name="name">survey_page_wizard_test</field> @@ -1126,7 +1125,7 @@ <menuitem name="Survey Requests" id="menu_survey_type_form1" action="action_survey_request_tree" parent='menu_answer_surveys' - groups="base.group_tool_manager,base.group_tool_user,base.group_system,group_survey_user"/> + groups="base.group_tool_manager"/> <!-- Survey Type @@ -1193,7 +1192,7 @@ src_model="survey.question"/> <menuitem name="Answer a Survey" id="menu_run_survey_form" sequence="2" - action="action_view_survey_name" parent="menu_answer_surveys" groups="base.group_tool_manager,base.group_tool_user,base.group_system,base.group_user,group_survey_user" icon="STOCK_INDEX"/> + action="action_view_survey_name" parent="menu_answer_surveys" groups="base.group_tool_user,base.group_tool_manager,group_survey_user" icon="STOCK_INDEX"/> </data> </openerp> diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 92097d99333..69cc8e10796 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -62,7 +62,7 @@ class survey_name_wiz(osv.osv_memory): for sur in surv_obj.browse(cr, uid, [context.get('survey_id',False)]): result.append((sur.id, sur.title)) return result - group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User'))]) + group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))]) user_obj = self.pool.get('res.users') user_rec = user_obj.read(cr, uid, uid) for sur in surv_obj.browse(cr, uid, surv_obj.search(cr, uid, [])): |
