[MERGE] branch merged with lp:~openerp-dev/openobject-addons/trunk-dev-addons3
bzr revid: ara@tinyerp.com-20101027132631-5gt288cqflae9vfs
This commit is contained in:
@@ -326,8 +326,8 @@ class account_cash_statement(osv.osv):
|
||||
statement_pool = self.pool.get('account.bank.statement')
|
||||
for statement in statement_pool.browse(cr, uid, ids, context=context):
|
||||
vals = {}
|
||||
|
||||
if not self._user_allow(cr, uid, statement.id, context=context):
|
||||
force_allow = context.get('force_allow',False)
|
||||
if not force_allow and not self._user_allow(cr, uid, statement.id, context=context):
|
||||
raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name)))
|
||||
|
||||
if statement.name and statement.name == '/':
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<field name="date"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -34,9 +34,9 @@ class tax_report(rml_parse.rml_parse, common_report_header):
|
||||
self.period_ids = []
|
||||
period_obj = self.pool.get('account.period')
|
||||
res['periods'] = ''
|
||||
res['fiscalyear'] = data['form']['fiscalyear_id']
|
||||
res['fiscalyear'] = data['form'].get('fiscalyear_id', False)
|
||||
|
||||
if data['form']['period_from'] and data['form']['period_to']:
|
||||
if data['form'].get('period_from', False) and data['form'].get('period_to', False):
|
||||
self.period_ids = period_obj.build_ctx_periods(self.cr, self.uid, data['form']['period_from'], data['form']['period_to'])
|
||||
periods_l = period_obj.read(self.cr, self.uid, self.period_ids, ['name'])
|
||||
for period in periods_l:
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
@@ -100,7 +102,7 @@ class rml_parse(report_sxw.rml_parse):
|
||||
return Stringer
|
||||
return Stringer
|
||||
def explode_this(self,chaine,length):
|
||||
chaine = rstrip(chaine)
|
||||
chaine = chaine.rstrip()
|
||||
ast = list(chaine)
|
||||
i = length
|
||||
while i <= len(ast):
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
I clicked on Open CashBox button to open the cashbox
|
||||
-
|
||||
!python {model: account.bank.statement}: |
|
||||
self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
|
||||
self.button_open(cr, uid, [ref("account_bank_statement_1")], {"force_allow":True, "lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
|
||||
|
||||
-
|
||||
I check that now bank statement is in the "Open" state
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
In order to test the PDF reports defined on an invoice, we will create a Invoice Record
|
||||
-
|
||||
!record {model: account.invoice, id: test_invoice_1}:
|
||||
currency_id: base.EUR
|
||||
currency_id: base.EUR
|
||||
company_id: base.main_company
|
||||
address_invoice_id: base.res_partner_address_tang
|
||||
partner_id: base.res_partner_asus
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import intersect
|
||||
from osv.orm import intersect, except_orm
|
||||
import tools.sql
|
||||
from tools.translate import _
|
||||
from decimal_precision import decimal_precision as dp
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<field name="inherit_id" ref="account.view_invoice_line_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='name']" position="before">
|
||||
<field name="name" position="before">
|
||||
<field name="state" select="1" on_change="onchange_invoice_line_view(state)" />
|
||||
<field name="sequence"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
In order to Print the Invoice layout report in Normal Mode, we will create a invoice record
|
||||
-
|
||||
!record {model: account.invoice, id: test_invoice_1}:
|
||||
currency_id: base.EUR
|
||||
currency_id: base.EUR
|
||||
company_id: base.main_company
|
||||
address_invoice_id: base.res_partner_address_tang
|
||||
partner_id: base.res_partner_asus
|
||||
|
||||
@@ -184,11 +184,11 @@
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="currency" invisible="1" position="after">
|
||||
<button name="%(action_view_account_statement_from_invoice_lines)d"
|
||||
<field name="currency" invisible="1" position="after">
|
||||
<button name="%(action_view_account_statement_from_invoice_lines)d"
|
||||
string="Import Invoices" type="action" icon="gtk-execute"
|
||||
attrs="{'invisible':[('state','=','confirm')]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form2"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@name='line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
|
||||
<xpath expr="/form/notebook/page/field[@name='line_ids']/tree/field[@name='amount']" position="after">
|
||||
<field name="voucher_id" context="{'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
@@ -233,7 +233,7 @@
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form2"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@name='line_ids']/field[@name='line_ids']/form/field[@name='amount']" position="after">
|
||||
<xpath expr="/form/notebook/page/field[@name='line_ids']/form/field[@name='amount']" position="after">
|
||||
<field name="voucher_id" context="{'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -101,7 +101,7 @@ class rml_parse(report_sxw.rml_parse):
|
||||
return Stringer
|
||||
|
||||
def explode_this(self, chaine, length):
|
||||
chaine = rstrip(chaine)
|
||||
chaine = chaine.rstrip(chaine)
|
||||
ast = list(chaine)
|
||||
i = length
|
||||
while i <= len(ast):
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
</record>
|
||||
|
||||
<menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9" groups="base.group_extended"/>
|
||||
<menuitem name="Events Organisation" id="base.menu_event_main" parent="base.menu_association" />
|
||||
<menuitem name="Configuration" id="base.menu_event_config" parent="base.menu_association" sequence="30" groups="base.group_extended"/>
|
||||
<menuitem name="Reporting" id="base.menu_report_association" parent="base.menu_association" sequence="20"/>
|
||||
</data>
|
||||
|
||||
@@ -44,7 +44,7 @@ class buyer_form_report(report_sxw.rml_parse):
|
||||
taxes.append(lot.author_right)
|
||||
if lot.auction_id:
|
||||
taxes += lot.auction_id.buyer_costs
|
||||
tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
tax=self.pool.get('account.tax').compute_all(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
for t in tax:
|
||||
amount+=t['amount']
|
||||
return amount
|
||||
|
||||
@@ -35,7 +35,7 @@ class seller_form_report(report_sxw.rml_parse):
|
||||
'sum_taxes': self.sum_taxes,
|
||||
'sellerinfo' : self.seller_info,
|
||||
'grand_total' : self.grand_seller_total,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
def sum_taxes(self, lot):
|
||||
@@ -45,7 +45,7 @@ class seller_form_report(report_sxw.rml_parse):
|
||||
taxes.append(lot.bord_vnd_id.tax_id)
|
||||
elif lot.auction_id and lot.auction_id.seller_costs:
|
||||
taxes += lot.auction_id.seller_costs
|
||||
tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
tax=self.pool.get('account.tax').compute_all(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
for t in tax:
|
||||
amount+=t['amount']
|
||||
return amount
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_auction_artists","auction.artists","model_auction_artists","group_auction_manager",1,1,1,1
|
||||
"access_auction_dates_user","auction.dates user","model_auction_dates","group_auction_user",1,0,0,0
|
||||
"access_auction_dates_manager","auction.dates manager","model_auction_dates","group_auction_manager",1,1,1,1
|
||||
"access_auction_deposit_manager","auction.deposit manager","model_auction_deposit","group_auction_manager",1,1,1,1
|
||||
"access_auction_deposit_user","auction.deposit user","model_auction_deposit","group_auction_user",1,0,0,0
|
||||
"access_auction_deposit_cost","auction.deposit.cost","model_auction_deposit_cost","group_auction_manager",1,1,1,1
|
||||
"access_auction_lot_category","auction.lot.category","model_auction_lot_category","group_auction_user",1,0,0,0
|
||||
"access_auction_lot_category_manager","auction.lot.category manager","model_auction_lot_category","group_auction_manager",1,1,1,1
|
||||
"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,1
|
||||
"access_auction_lots","auction.lots","model_auction_lots","group_auction_user",1,1,1,0
|
||||
"access_auction_lots_manager","auction.lots manager","model_auction_lots","group_auction_manager",1,0,0,0
|
||||
"access_auction_bid","auction.bid","model_auction_bid","group_auction_user",1,1,1,1
|
||||
"access_auction_bid_manager","auction.bid manager","model_auction_bid","group_auction_manager",1,0,0,0
|
||||
@@ -18,6 +20,7 @@
|
||||
"access_report_auction_adjudication","report.auction.adjudication","model_report_auction_adjudication","group_auction_manager",1,1,1,1
|
||||
"access_report_object_encoded","report.object.encoded","model_report_object_encoded","group_auction_manager",1,1,1,1
|
||||
"access_aie_category","aie.category","model_aie_category","group_auction_manager",1,1,1,1
|
||||
"access_auction_account_tax_user","account.tax user","account.model_account_tax","group_auction_user",1,0,0,0
|
||||
"access_auction_account_tax","account.tax manager","account.model_account_tax","group_auction_manager",1,1,1,0
|
||||
"access_auction_account_fiscalyear","account.fiscalyear manager","account.model_account_fiscalyear","group_auction_manager",1,1,1,0
|
||||
"access_auction_account_journal","account.journal manager","account.model_account_journal","group_auction_manager",1,1,1,0
|
||||
|
||||
|
@@ -27,8 +27,8 @@
|
||||
I will search for one of the recurrent event and count the number of events
|
||||
-
|
||||
!python {model: calendar.event}: |
|
||||
ids = self.search(cr, uid, [('date', '>=', '2010-05-01 00:00:00'), ('date', '<=', '2010-05-31 00:00:00')] )
|
||||
assert len(ids) == 9
|
||||
ids = self.search(cr, uid, [('date', '>=', '2010-04-30 16:00:00'), ('date', '<=', '2010-05-31 00:00:00')] )
|
||||
assert len(ids) == 10
|
||||
- |
|
||||
Now I will make All day event and test it
|
||||
-
|
||||
|
||||
+111
-94
@@ -2,67 +2,65 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_calendar_collection_form">
|
||||
<field name="name">Calendar Collections : Form</field>
|
||||
<field name="model">document.directory</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Calendar Collections">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="user_id"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="calendar_ids" colspan="4" nolabel="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_calendar_collection_tree">
|
||||
<field name="name">Calendar Collections : Tree</field>
|
||||
<field name="model">document.directory</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Calendar Collections" toolbar="1">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<field name="name">Calendar Collections : Form</field>
|
||||
<field name="model">document.directory</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Calendar Collections">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="user_id"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="calendar_ids" colspan="4" nolabel="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_calendar_collection_form">
|
||||
<field name="name">Calendar Collections</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.directory</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('calendar_collection','=',True)]</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_calendar_collection_tree">
|
||||
<field name="name">Calendar Collections : Tree</field>
|
||||
<field name="model">document.directory</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Calendar Collections" toolbar="1">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="document.action_document_directory_form">
|
||||
<field name="domain">[('calendar_collection','=',False)]</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_calendar_collection_form">
|
||||
<field name="name">Calendar Collections</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">document.directory</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('calendar_collection','=',True)]</field>
|
||||
</record>
|
||||
|
||||
<record id="action_dir_view1" model="ir.actions.act_window.view">
|
||||
<field eval="10" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_calendar_collection_tree"/>
|
||||
<field name="act_window_id" ref="action_calendar_collection_form"/>
|
||||
</record>
|
||||
<record id="action_dir_view2" model="ir.actions.act_window.view">
|
||||
<field eval="20" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_calendar_collection_form"/>
|
||||
<field name="act_window_id" ref="action_calendar_collection_form"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="document.action_document_directory_form">
|
||||
<field name="domain">[('calendar_collection','=',False)]</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_calendar"
|
||||
name="Calendar"
|
||||
parent="knowledge.menu_document_configuration"/>
|
||||
<record id="action_dir_view1" model="ir.actions.act_window.view">
|
||||
<field eval="10" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_calendar_collection_tree"/>
|
||||
<field name="act_window_id" ref="action_calendar_collection_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="action_calendar_collection_form"
|
||||
id="menu_calendar_collection"
|
||||
parent="menu_calendar"/>
|
||||
<record id="action_dir_view2" model="ir.actions.act_window.view">
|
||||
<field eval="20" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_calendar_collection_form"/>
|
||||
<field name="act_window_id" ref="action_calendar_collection_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_calendar" name="Calendar"
|
||||
parent="knowledge.menu_document_configuration" />
|
||||
|
||||
<menuitem action="action_calendar_collection_form"
|
||||
id="menu_calendar_collection" parent="menu_calendar" />
|
||||
|
||||
<record model="ir.ui.view" id="view_caldav_form">
|
||||
<field name="name">Calendar : Form</field>
|
||||
@@ -100,7 +98,7 @@
|
||||
<separator string="Value Mapping" colspan="4" />
|
||||
<field name="mapping" select="1" colspan="4" nolabel="1" />
|
||||
</form>
|
||||
</field>
|
||||
</field>
|
||||
</form>
|
||||
<tree string="Calendar Lines" editable="bottom">
|
||||
<field name="name" select="1" />
|
||||
@@ -118,45 +116,64 @@
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_caldav_tree">
|
||||
<field name="name">Calendar : Tree</field>
|
||||
<field name="model">basic.calendar</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Calendars" toolbar="1">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="user_id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_caldav_tree">
|
||||
<field name="name">Calendar : Tree</field>
|
||||
<field name="model">basic.calendar</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Calendars" toolbar="1">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="user_id"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_caldav_form">
|
||||
<field name="name">Calendars</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">basic.calendar</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="view_caldav_search">
|
||||
<field name="name">Calendar: Search</field>
|
||||
<field name="model">basic.calendar</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Calendars">
|
||||
<filter string="WebCal" icon="terp-calendar" domain="[('has_webcal', '=', True)]" help="Webcal Calendar"/>
|
||||
<filter string="Event" icon="terp-calendar" domain="[('type', '=', 'vevent')]"/>
|
||||
<filter string="Todo" icon="terp-calendar" domain="[('type', '=', 'vtodo')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-personal" domain="[('user_id', '=', uid)]" help="My Calendar(s)" string="MY"/>
|
||||
</field>
|
||||
<field name="collection_id" required="1"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_caldav_view1" model="ir.actions.act_window.view">
|
||||
<field eval="10" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_caldav_tree"/>
|
||||
<field name="act_window_id" ref="action_caldav_form"/>
|
||||
</record>
|
||||
<record id="action_caldav_view2" model="ir.actions.act_window.view">
|
||||
<field eval="20" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_caldav_form"/>
|
||||
<field name="act_window_id" ref="action_caldav_form"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_caldav_form">
|
||||
<field name="name">Calendars</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">basic.calendar</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<record id="action_caldav_view1" model="ir.actions.act_window.view">
|
||||
<field eval="10" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_caldav_tree"/>
|
||||
<field name="act_window_id" ref="action_caldav_form"/>
|
||||
</record>
|
||||
<record id="action_caldav_view2" model="ir.actions.act_window.view">
|
||||
<field eval="20" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_caldav_form"/>
|
||||
<field name="act_window_id" ref="action_caldav_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_caldav_form"
|
||||
id="menu_caldav_directories" parent="menu_calendar" />
|
||||
|
||||
<menuitem
|
||||
action="action_caldav_form"
|
||||
id="menu_caldav_directories"
|
||||
parent="menu_calendar"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree,form</field>
|
||||
<field name="view_id" ref="view_crm_opportunity_categ_graph"/>
|
||||
<field name="domain">[('state','!=','done'),('state','!=','cancel')]</field>
|
||||
<field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="act_opportunity_stage">
|
||||
@@ -56,7 +56,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree,form</field>
|
||||
<field name="view_id" ref="view_crm_opportunity_stage_graph"/>
|
||||
<field name="domain">[('state','!=','done'),('state','!=','cancel')]</field>
|
||||
<field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="act_oppor_stage_user">
|
||||
|
||||
@@ -325,7 +325,7 @@
|
||||
|
||||
<act_window
|
||||
domain="[('partner_address_id', '=', active_id)]"
|
||||
context="{'default_partner_address_id': active_id}"
|
||||
context="{'default_partner_id': partner_id}"
|
||||
id="act_claim_partner_address"
|
||||
name="Report a Claim"
|
||||
view_mode="form,tree"
|
||||
|
||||
@@ -3,3 +3,5 @@
|
||||
"access_crm_profiling_answer_manager","crm_profiling.answer manager","model_crm_profiling_answer","base.group_sale_manager",1,0,0,0
|
||||
"access_crm_profiling_question_manager","crm_profiling.question manager","model_crm_profiling_question","base.group_sale_salesman",1,1,1,0
|
||||
"access_crm_profiling_question_user","crm_profiling.question user","model_crm_profiling_question","base.group_sale_manager",1,0,0,0
|
||||
"access_crm_profiling_questionnarie_user","crm_profiling.questionnarie user","model_crm_profiling_questionnaire","base.group_sale_salesman",1,0,0,0
|
||||
"access_crm_profiling_questionnarie_manager","crm_profiling.questionnarie manager","model_crm_profiling_questionnaire","base.group_sale_manager",1,1,1,1
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
'partner_view.xml'
|
||||
],
|
||||
'demo_xml': ['delivery_demo.xml'],
|
||||
'test':['test/delivery_test.yml','test/delivery_report.yml'],
|
||||
'test':['test/delivery_report.yml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0033981912253',
|
||||
|
||||
@@ -732,6 +732,8 @@ class email_template_preview(osv.osv_memory):
|
||||
ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model']
|
||||
model_obj = self.pool.get(ref_obj_name)
|
||||
ref_obj_ids = model_obj.search(cr, uid, [], 0, 20, 'id desc', context=context)
|
||||
if not ref_obj_ids:
|
||||
ref_obj_ids = []
|
||||
|
||||
# also add the default one if requested, otherwise it won't be available for selection:
|
||||
default_id = context.get('default_rel_model_ref')
|
||||
@@ -762,7 +764,7 @@ class email_template_preview(osv.osv_memory):
|
||||
user,
|
||||
context['template_id'],
|
||||
['object_name'],
|
||||
context)['object_name']
|
||||
context).get('object_name', False)
|
||||
|
||||
_columns = {
|
||||
'ref_template':fields.many2one(
|
||||
@@ -789,7 +791,7 @@ class email_template_preview(osv.osv_memory):
|
||||
'report':fields.char('Report Name', size=100, readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'ref_template': lambda self, cr, uid, ctx:ctx['template_id'],
|
||||
'ref_template': lambda self, cr, uid, ctx:ctx['template_id'] or False,
|
||||
'rel_model': _default_model,
|
||||
}
|
||||
def on_change_ref(self, cr, uid, ids, rel_model_ref, context=None):
|
||||
|
||||
@@ -281,8 +281,8 @@ class event_event(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
team_pool = self.pool.get('crm.case.section')
|
||||
team = team_pool.browse(cr, uid, team_id, context=context)
|
||||
res = {}
|
||||
team = team_pool.browse(cr, uid, team_id, context=context)
|
||||
if team.reply_to:
|
||||
res = {'value': {'reply_to': team.reply_to}}
|
||||
return res
|
||||
@@ -424,7 +424,6 @@ class event_registration(osv.osv):
|
||||
res = self._make_invoice(cr, uid, k, [v], context=context)
|
||||
self.do_close(cr, uid, [k.id], context={'invoice_id': res})
|
||||
if res: new_invoice_ids.append(res)
|
||||
|
||||
return new_invoice_ids
|
||||
|
||||
def do_open(self, cr, uid, ids, context=None):
|
||||
@@ -605,7 +604,7 @@ class event_registration(osv.osv):
|
||||
@param event_id: Event ID
|
||||
@param partner_invoice_id: Partner Invoice ID
|
||||
"""
|
||||
context={}
|
||||
context = {}
|
||||
if not event_id:
|
||||
return {'value': {'unit_price': False, 'event_product': False}}
|
||||
|
||||
|
||||
@@ -19,18 +19,17 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
from osv import fields, osv
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
_columns = {
|
||||
'speaker': fields.boolean('Speaker'),
|
||||
'event_ids': fields.one2many('event.event','main_speaker_id',readonly=True),
|
||||
'event_registration_ids': fields.one2many('event.registration','partner_id',readonly=True),
|
||||
'event_ids': fields.one2many('event.event','main_speaker_id', readonly=True),
|
||||
'event_registration_ids': fields.one2many('event.registration','partner_id', readonly=True),
|
||||
}
|
||||
|
||||
res_partner()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -47,5 +47,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</openerp>
|
||||
@@ -13,3 +13,4 @@
|
||||
"access_event_event_sale_salesman","event.event.sale","model_event_event","base.group_sale_salesman",1,0,0,0
|
||||
"access_account_account_invoice_manager","account.account.invoice","account.model_account_invoice","base.group_marketing_manager",1,0,0,0
|
||||
"access_event_registration_badge","event.registration.badge","model_event_registration_badge","marketing.group_marketing_user",1,0,0,0
|
||||
"access_event_registration_sale_user","event.registration.sale.user","model_event_registration","base.group_sale_salesman",1,0,0,0
|
||||
|
||||
|
+3
-3
@@ -30,7 +30,7 @@ import addons
|
||||
class hr_employee_category(osv.osv):
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context)
|
||||
res = []
|
||||
@@ -167,9 +167,9 @@ class hr_employee(osv.osv):
|
||||
'passport_id':fields.char('Passport', size=64)
|
||||
}
|
||||
|
||||
def onchange_company(self, cr, uid, ids, company, context=None):
|
||||
def onchange_company(self, cr, uid, ids, company, context=None):
|
||||
address_id = False
|
||||
if company:
|
||||
if company:
|
||||
company_id = self.pool.get('res.company').browse(cr,uid,company)
|
||||
address = self.pool.get('res.partner').address_get(cr, uid, [company_id.partner_id.id], ['default'])
|
||||
address_id = address and address['default'] or False
|
||||
|
||||
@@ -26,7 +26,7 @@ class hr_department(osv.osv):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
|
||||
res = []
|
||||
|
||||
@@ -136,7 +136,7 @@ class hr_employee(osv.osv):
|
||||
warning_sign = 'sign'
|
||||
res = {}
|
||||
|
||||
#Special case when button calls this method :type=context
|
||||
#Special case when button calls this method: type=context
|
||||
if isinstance(type, dict):
|
||||
type = type.get('type','action')
|
||||
if type == 'sign_in':
|
||||
|
||||
@@ -76,10 +76,10 @@ class hr_evaluation_plan_phase(osv.osv):
|
||||
'email_subject':fields.text('char')
|
||||
}
|
||||
_defaults = {
|
||||
'sequence' : 1,
|
||||
'sequence': 1,
|
||||
'email_subject': _('''Regarding '''),
|
||||
'mail_body' : lambda *a:_('''
|
||||
Date : %(date)s
|
||||
'mail_body': lambda *a:_('''
|
||||
Date: %(date)s
|
||||
|
||||
Dear %(employee_name)s,
|
||||
|
||||
@@ -111,8 +111,8 @@ class hr_employee(osv.osv):
|
||||
for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context):
|
||||
if id.evaluation_plan_id and id.evaluation_date:
|
||||
if (parser.parse(id.evaluation_date) + relativedelta(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
self.write(cr, uid, id.id, {'evaluation_date' : (parser.parse(id.evaluation_date) + relativedelta(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context)
|
||||
obj_evaluation.create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id}, context=context)
|
||||
self.write(cr, uid, id.id, {'evaluation_date': (parser.parse(id.evaluation_date) + relativedelta(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context)
|
||||
obj_evaluation.create(cr, uid, {'employee_id': id.id, 'plan_id': id.evaluation_plan_id}, context=context)
|
||||
return True
|
||||
|
||||
def onchange_evaluation_plan_id(self, cr, uid, ids, evaluation_plan_id, evaluation_date, context=None):
|
||||
@@ -139,7 +139,7 @@ class hr_employee(osv.osv):
|
||||
context = {}
|
||||
id = super(hr_employee, self).create(cr, uid, vals, context=context)
|
||||
if vals.get('evaluation_plan_id', False):
|
||||
self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context)
|
||||
self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id': id, 'plan_id': vals['evaluation_plan_id']}, context=context)
|
||||
return id
|
||||
|
||||
hr_employee()
|
||||
@@ -172,17 +172,17 @@ class hr_evaluation(osv.osv):
|
||||
('cancel','Cancelled'),
|
||||
], 'State', required=True, readonly=True),
|
||||
'date_close': fields.date('Ending Date'),
|
||||
'progress' : fields.float("Progress"),
|
||||
'progress': fields.float("Progress"),
|
||||
}
|
||||
_defaults = {
|
||||
'date' : lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'state' : lambda *a: 'draft',
|
||||
'date': lambda *a: (parser.parse(datetime.now().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'state': lambda *a: 'draft',
|
||||
}
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
res = []
|
||||
@@ -249,7 +249,7 @@ class hr_evaluation(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'progress'}, context=context)
|
||||
for id in self.browse(cr, uid ,ids, context=context):
|
||||
for id in self.browse(cr, uid, ids, context=context):
|
||||
if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', '=', 'done')], context=context)):
|
||||
raise osv.except_osv(_('Warning !'),_("You cannot change state, because some appraisal in waiting answer or draft state"))
|
||||
return True
|
||||
@@ -266,7 +266,7 @@ class hr_evaluation(osv.osv):
|
||||
context = {}
|
||||
self.write(cr, uid, ids,{'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -277,7 +277,7 @@ class hr_evaluation(osv.osv):
|
||||
for survey_req in evalutation.survey_request_ids:
|
||||
obj_hr_eval_iterview.write(cr, uid, [survey_req.id], new_vals, context=context)
|
||||
return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
|
||||
hr_evaluation()
|
||||
|
||||
class survey_request(osv.osv):
|
||||
@@ -304,11 +304,11 @@ class hr_evaluation_interview(osv.osv):
|
||||
_defaults = {
|
||||
'is_evaluation': True,
|
||||
}
|
||||
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.browse(cr, uid, ids, context=context)
|
||||
res = []
|
||||
@@ -316,11 +316,11 @@ class hr_evaluation_interview(osv.osv):
|
||||
name = record.request_id.survey_id.title
|
||||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
|
||||
def survey_req_waiting_answer(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, { 'state' : 'waiting_answer'}, context=context)
|
||||
self.write(cr, uid, ids, { 'state': 'waiting_answer'}, context=context)
|
||||
return True
|
||||
|
||||
def survey_req_done(self, cr, uid, ids, context=None):
|
||||
@@ -335,12 +335,12 @@ class hr_evaluation_interview(osv.osv):
|
||||
raise osv.except_osv(_('Warning !'),_("You cannot start evaluation without Evaluation."))
|
||||
records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id], context=context)[0].survey_request_ids
|
||||
for child in records:
|
||||
if child.state == "draft" :
|
||||
if child.state == "draft":
|
||||
wating_id = child.id
|
||||
continue
|
||||
if child.state != "done":
|
||||
flag = True
|
||||
else :
|
||||
else:
|
||||
tot_done_req += 1
|
||||
if not flag and wating_id:
|
||||
self.survey_req_waiting_answer(cr, uid, [wating_id], context=context)
|
||||
@@ -369,7 +369,7 @@ class hr_evaluation_interview(osv.osv):
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Survey IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for print survey form.
|
||||
@return: Dictionary value for print survey form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
@@ -90,10 +90,10 @@ class hr_expense_expense(osv.osv):
|
||||
\nIf the admin accepts it, the state is \'Accepted\'.\n If an invoice is made for the expense request, the state is \'Invoiced\'.\n If the expense is paid to user, the state is \'Reimbursed\'.'),
|
||||
}
|
||||
_defaults = {
|
||||
'date' : time.strftime('%Y-%m-%d'),
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'state': 'draft',
|
||||
'employee_id' : _employee_get,
|
||||
'user_id' : lambda cr, uid, id, c={}: id,
|
||||
'employee_id': _employee_get,
|
||||
'user_id': lambda cr, uid, id, c={}: id,
|
||||
'currency_id': _get_currency,
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class hr_expense_expense(osv.osv):
|
||||
department_id = False
|
||||
if employee_id:
|
||||
department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id).department_id.id or False
|
||||
return {'value':{'department_id':department_id}}
|
||||
return {'value':{'department_id':department_id}}
|
||||
|
||||
def expense_confirm(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {
|
||||
@@ -219,7 +219,7 @@ class hr_expense_line(osv.osv):
|
||||
def _amount(self, cr, uid, ids, field_name, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return {}
|
||||
cr.execute("SELECT l.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_line l WHERE id IN %s GROUP BY l.id ",(tuple(ids),))
|
||||
res = dict(cr.fetchall())
|
||||
@@ -237,7 +237,7 @@ class hr_expense_line(osv.osv):
|
||||
'description': fields.text('Description'),
|
||||
'analytic_account': fields.many2one('account.analytic.account','Analytic account'),
|
||||
'ref': fields.char('Reference', size=32),
|
||||
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of expense lines."),
|
||||
}
|
||||
_defaults = {
|
||||
'unit_quantity': 1,
|
||||
|
||||
@@ -147,8 +147,8 @@ class hr_holidays(osv.osv):
|
||||
'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True),
|
||||
'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
|
||||
'holiday_status_id': fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
|
||||
#'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
|
||||
#'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
|
||||
@@ -167,7 +167,7 @@ class hr_holidays(osv.osv):
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'employee_id': _employee_get ,
|
||||
'employee_id': _employee_get,
|
||||
'state': 'draft',
|
||||
'type': 'remove',
|
||||
'allocation_type': 'employee',
|
||||
@@ -216,12 +216,12 @@ class hr_holidays(osv.osv):
|
||||
|
||||
def onchange_type(self, cr, uid, ids, holiday_type):
|
||||
result = {}
|
||||
if holiday_type=='employee':
|
||||
if holiday_type == 'employee':
|
||||
ids_employee = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
|
||||
if ids_employee:
|
||||
result['value'] = {
|
||||
'employee_id': ids_employee[0]
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
def _get_number_of_days(self, date_from, date_to):
|
||||
@@ -235,10 +235,11 @@ class hr_holidays(osv.osv):
|
||||
return diff_day
|
||||
|
||||
def _update_user_holidays(self, cr, uid, ids):
|
||||
obj_crm_meeting = self.pool.get('crm.meeting')
|
||||
for record in self.browse(cr, uid, ids):
|
||||
if record.state=='validate':
|
||||
if record.case_id:
|
||||
self.pool.get('crm.meeting').unlink(cr, uid, [record.case_id.id])
|
||||
obj_crm_meeting.unlink(cr, uid, [record.case_id.id])
|
||||
if record.linked_request_ids:
|
||||
list_ids = [ lr.id for lr in record.linked_request_ids]
|
||||
self.holidays_cancel(cr, uid, list_ids)
|
||||
@@ -313,8 +314,7 @@ class hr_holidays(osv.osv):
|
||||
vals['manager_id'] = ids2[0]
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'),_('No user related to the selected employee.'))
|
||||
self.write(cr, uid, ids, vals)
|
||||
return True
|
||||
return self.write(cr, uid, ids, vals)
|
||||
|
||||
def holidays_validate(self, cr, uid, ids, *args):
|
||||
obj_emp = self.pool.get('hr.employee')
|
||||
@@ -358,6 +358,7 @@ class hr_holidays(osv.osv):
|
||||
return True
|
||||
|
||||
def holidays_confirm(self, cr, uid, ids, *args):
|
||||
obj_hr_holiday_status = self.pool.get('hr.holidays.status')
|
||||
for record in self.browse(cr, uid, ids):
|
||||
user_id = False
|
||||
leave_asked = record.number_of_days_temp
|
||||
@@ -369,7 +370,7 @@ class hr_holidays(osv.osv):
|
||||
nb = -(record.number_of_days_temp)
|
||||
elif record.holiday_type == 'category' and record.type == 'remove':
|
||||
if record.category_id and not record.holiday_status_id.limit:
|
||||
leaves_rest = self.pool.get('hr.holidays.status').get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
|
||||
leaves_rest = obj_hr_holiday_status.get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves']
|
||||
if leaves_rest < leave_asked:
|
||||
raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves.' %(record.category_id.name)))
|
||||
nb = -(record.number_of_days_temp)
|
||||
@@ -397,8 +398,7 @@ class hr_holidays(osv.osv):
|
||||
return True
|
||||
|
||||
def holidays_draft(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state': 'draft'})
|
||||
return True
|
||||
return self.write(cr, uid, ids, {'state': 'draft'})
|
||||
|
||||
def check_holidays(self, cr, uid, ids):
|
||||
holi_status_obj = self.pool.get('hr.holidays.status')
|
||||
@@ -424,12 +424,12 @@ class hr_holidays(osv.osv):
|
||||
else:# This condition will never meet!!
|
||||
holiday_ids = []
|
||||
vals = {
|
||||
'name' : record.name,
|
||||
'holiday_status_id' : record.holiday_status_id.id,
|
||||
'name': record.name,
|
||||
'holiday_status_id': record.holiday_status_id.id,
|
||||
'state': 'draft',
|
||||
'date_from' : record.date_from,
|
||||
'date_to' : record.date_to,
|
||||
'notes' : record.notes,
|
||||
'date_from': record.date_from,
|
||||
'date_to': record.date_to,
|
||||
'notes': record.notes,
|
||||
'number_of_days': record.number_of_days,
|
||||
'number_of_days_temp': record.number_of_days_temp,
|
||||
'type': record.type,
|
||||
@@ -449,12 +449,12 @@ class hr_holidays(osv.osv):
|
||||
if record.holiday_status_id.categ_id and record.date_from and record.date_to and record.employee_id:
|
||||
diff_day = self._get_number_of_days(record.date_from, record.date_to)
|
||||
vals = {
|
||||
'name' : record.name,
|
||||
'categ_id' : record.holiday_status_id.categ_id.id,
|
||||
'duration' : (diff_day) * 8,
|
||||
'note' : record.notes,
|
||||
'user_id' : record.user_id.id,
|
||||
'date' : record.date_from,
|
||||
'name': record.name,
|
||||
'categ_id': record.holiday_status_id.categ_id.id,
|
||||
'duration': (diff_day) * 8,
|
||||
'note': record.notes,
|
||||
'user_id': record.user_id.id,
|
||||
'date': record.date_from,
|
||||
}
|
||||
case_id = meeting_obj.create(cr, uid, vals)
|
||||
self.write(cr, uid, ids, {'case_id': case_id})
|
||||
@@ -472,4 +472,4 @@ class resource_calendar_leaves(osv.osv):
|
||||
|
||||
resource_calendar_leaves()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -24,6 +24,7 @@ import time
|
||||
from datetime import date
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
import datetime
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
@@ -52,8 +53,9 @@ class hr_contract_wage_type(osv.osv):
|
||||
|
||||
_inherit = 'hr.contract.wage.type'
|
||||
_columns = {
|
||||
'type' : fields.selection([('basic','Basic'), ('gross','Gross'), ('net','Net')], 'Type', required=True),
|
||||
'type': fields.selection([('basic','Basic'), ('gross','Gross'), ('net','Net')], 'Type', required=True),
|
||||
}
|
||||
|
||||
hr_contract_wage_type()
|
||||
|
||||
class hr_passport(osv.osv):
|
||||
@@ -86,7 +88,7 @@ class hr_payroll_structure(osv.osv):
|
||||
- Allowlance
|
||||
- Deductions
|
||||
"""
|
||||
|
||||
|
||||
_name = 'hr.payroll.structure'
|
||||
_description = 'Salary Structure'
|
||||
_columns = {
|
||||
@@ -120,8 +122,7 @@ class hr_payroll_structure(osv.osv):
|
||||
'code':code+"(copy)",
|
||||
'company_id':self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
}
|
||||
res_id = super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
|
||||
return res_id
|
||||
return super(hr_payroll_structure, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
hr_payroll_structure()
|
||||
|
||||
@@ -130,14 +131,14 @@ class hr_contract(osv.osv):
|
||||
Employee contract based on the visa, work permits
|
||||
allowas to configure different Salary structure
|
||||
"""
|
||||
|
||||
|
||||
def compute_basic(self, cr, uid, ids, context={}):
|
||||
res = {}
|
||||
ids += context.get('employee_structure', [])
|
||||
|
||||
|
||||
slip_pool = self.pool.get('hr.payslip')
|
||||
slip_line_pool = self.pool.get('hr.payslip.line')
|
||||
|
||||
|
||||
for contract in self.browse(cr, uid, ids, context):
|
||||
all_per = 0.0
|
||||
ded_per = 0.0
|
||||
@@ -154,20 +155,20 @@ class hr_contract(osv.osv):
|
||||
if contract.wage_type_id.type == 'basic':
|
||||
obj['basic'] = contract.wage
|
||||
update['basic'] = contract.wage
|
||||
|
||||
|
||||
sal_type = contract.wage_type_id.type
|
||||
function = contract.struct_id.id
|
||||
lines = contract.struct_id.line_ids
|
||||
if not contract.struct_id:
|
||||
res[contract.id] = obj['basic']
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
ad = []
|
||||
c_type = {}
|
||||
for line in lines:
|
||||
cd = line.code.lower()
|
||||
obj[cd] = line.amount or 0.0
|
||||
|
||||
|
||||
for line in lines:
|
||||
if line.category_id.code in ad:
|
||||
continue
|
||||
@@ -178,7 +179,7 @@ class hr_contract(osv.osv):
|
||||
exp = line.category_id.condition
|
||||
calculate = eval(exp, obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
|
||||
if not calculate:
|
||||
continue
|
||||
@@ -193,7 +194,7 @@ class hr_contract(osv.osv):
|
||||
#Please have a look at the configuration guide.
|
||||
amt = eval(base, obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
|
||||
if sal_type in ('gross', 'net'):
|
||||
if line.amount_type == 'per':
|
||||
@@ -231,22 +232,22 @@ class hr_contract(osv.osv):
|
||||
per = (all_per - ded_per)
|
||||
else:
|
||||
per = all_per
|
||||
if per <=0 :
|
||||
if per <=0:
|
||||
per *= -1
|
||||
final = (per * 100) + 100
|
||||
basic = (sal * 100) / final
|
||||
else:
|
||||
basic = contract.wage
|
||||
|
||||
|
||||
res[contract.id] = basic
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def check_vals(self, val1, val2):
|
||||
if val1 == val2 and val1 == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
|
||||
res = self.compute_basic(cr, uid, ids, context)
|
||||
vals = {}
|
||||
@@ -259,7 +260,7 @@ class hr_contract(osv.osv):
|
||||
obj['gross'] = rs.wage
|
||||
if rs.wage_type_id.type == 'net':
|
||||
obj['net'] = rs.net
|
||||
|
||||
|
||||
if not rs.struct_id:
|
||||
if self.check_vals(obj['basic'], obj['gross']):
|
||||
obj['gross'] = obj['basic'] = obj['net']
|
||||
@@ -276,19 +277,19 @@ class hr_contract(osv.osv):
|
||||
}
|
||||
vals[rs.id] = record
|
||||
continue
|
||||
|
||||
|
||||
for line in rs.struct_id.line_ids:
|
||||
amount = 0.0
|
||||
if line.amount_type == 'per':
|
||||
try:
|
||||
amount = line.amount * eval(str(line.category_id.base), obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
elif line.amount_type in ('fix', 'func'):
|
||||
amount = line.amount
|
||||
cd = line.category_id.code.lower()
|
||||
obj[cd] = amount
|
||||
|
||||
|
||||
if line.type == 'allowance':
|
||||
allow += amount
|
||||
elif line.type == 'deduction':
|
||||
@@ -313,11 +314,11 @@ class hr_contract(osv.osv):
|
||||
_inherit = 'hr.contract'
|
||||
_description = 'Employee Contract'
|
||||
_columns = {
|
||||
'permit_no':fields.char('Work Permit No', size=256, required=False, readonly=False),
|
||||
'passport_id':fields.many2one('hr.passport', 'Passport', required=False),
|
||||
'visa_no':fields.char('Visa No', size=64, required=False, readonly=False),
|
||||
'permit_no': fields.char('Work Permit No', size=256, required=False, readonly=False),
|
||||
'passport_id': fields.many2one('hr.passport', 'Passport', required=False),
|
||||
'visa_no': fields.char('Visa No', size=64, required=False, readonly=False),
|
||||
'visa_expire': fields.date('Visa Expire Date'),
|
||||
'struct_id' : fields.many2one('hr.payroll.structure', 'Salary Structure'),
|
||||
'struct_id': fields.many2one('hr.payroll.structure', 'Salary Structure'),
|
||||
'working_days_per_week': fields.integer('Working Days', help="No of Working days / week for an employee"),
|
||||
'basic': fields.function(_calculate_salary, method=True, store=True, multi='dc', type='float', string='Basic Salary', digits=(14,2)),
|
||||
'gross': fields.function(_calculate_salary, method=True, store=True, multi='dc', type='float', string='Gross Salary', digits=(14,2)),
|
||||
@@ -334,7 +335,7 @@ class payroll_register(osv.osv):
|
||||
"""
|
||||
Payroll Register
|
||||
"""
|
||||
|
||||
|
||||
_name = 'hr.payroll.register'
|
||||
_description = 'Payroll Register'
|
||||
|
||||
@@ -425,6 +426,18 @@ class payroll_register(osv.osv):
|
||||
self.write(cr, uid, ids, {'state':'draft', 'number':number}, context=context)
|
||||
return True
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
return True
|
||||
|
||||
def cancel_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
|
||||
return True
|
||||
|
||||
def verify_sheet(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -453,7 +466,7 @@ class payroll_register(osv.osv):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for sid in sids:
|
||||
wf_service.trg_validate(uid, 'hr.payslip', sid, 'final_verify_sheet', cr)
|
||||
|
||||
|
||||
company_name = users_pool.browse(cr, uid, uid, context=context).company_id.name
|
||||
for reg in self.browse(cr, uid, ids, context=context):
|
||||
advice = {
|
||||
@@ -462,7 +475,7 @@ class payroll_register(osv.osv):
|
||||
'register_id':reg.id
|
||||
}
|
||||
pid = advice_pool.create(cr, uid, advice, context=context)
|
||||
|
||||
|
||||
for slip in reg.line_ids:
|
||||
if not slip.employee_id.bank_account_id:
|
||||
raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee' % (slip.employee_id.name)))
|
||||
@@ -495,7 +508,7 @@ class payroll_advice(osv.osv):
|
||||
'''
|
||||
Bank Advice Note
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.payroll.advice'
|
||||
_description = 'Bank Advice Note'
|
||||
_columns = {
|
||||
@@ -557,7 +570,7 @@ class payroll_advice_line(osv.osv):
|
||||
'''
|
||||
Bank Advice Lines
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.payroll.advice.line'
|
||||
_description = 'Bank Advice Lines'
|
||||
_columns = {
|
||||
@@ -595,7 +608,7 @@ class contrib_register(osv.osv):
|
||||
'''
|
||||
Contribution Register
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.contibution.register'
|
||||
_description = 'Contribution Register'
|
||||
|
||||
@@ -635,7 +648,7 @@ class contrib_register_line(osv.osv):
|
||||
'''
|
||||
Contribution Register Line
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.contibution.register.line'
|
||||
_description = 'Contribution Register Line'
|
||||
|
||||
@@ -745,7 +758,7 @@ class company_contribution(osv.osv):
|
||||
self.pool.get('res.users').browse(cr, uid, uid,
|
||||
context=context).company_id.id,
|
||||
}
|
||||
|
||||
|
||||
def _execute_function(self, cr, uid, id, value, context=None):
|
||||
"""
|
||||
self: pointer to self object
|
||||
@@ -764,7 +777,7 @@ class company_contribution(osv.osv):
|
||||
else:
|
||||
res = line_pool.browse(cr, uid, ids, context=context)[0].value
|
||||
return res
|
||||
|
||||
|
||||
def compute(self, cr, uid, id, value, context={}):
|
||||
contrib = self.browse(cr, uid, id, context)
|
||||
if contrib.amount_type == 'fix':
|
||||
@@ -798,7 +811,7 @@ class company_contribution_line(osv.osv):
|
||||
company_contribution_line()
|
||||
|
||||
class hr_holidays_status(osv.osv):
|
||||
|
||||
|
||||
_inherit = "hr.holidays.status"
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
@@ -823,7 +836,7 @@ class hr_payslip(osv.osv):
|
||||
'''
|
||||
Pay Slip
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.payslip'
|
||||
_description = 'Pay Slip'
|
||||
|
||||
@@ -847,7 +860,7 @@ class hr_payslip(osv.osv):
|
||||
try:
|
||||
amount = line.amount * eval(str(line.category_id.base), obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
elif line.amount_type in ('fix', 'func'):
|
||||
amount = line.amount
|
||||
cd = line.category_id.code.lower()
|
||||
@@ -981,12 +994,12 @@ class hr_payslip(osv.osv):
|
||||
context = {}
|
||||
self.write(cr, uid, ids, {'paid':True, 'state':'done'}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
def verify_sheet(self, cr, uid, ids, context={}):
|
||||
payslip_pool = self.pool.get('hr.payslip.line')
|
||||
register_pool = self.pool.get('company.contribution')
|
||||
register_line_pool = self.pool.get('hr.contibution.register.line')
|
||||
|
||||
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
base = {
|
||||
'basic':slip.basic,
|
||||
@@ -1009,7 +1022,7 @@ class hr_payslip(osv.osv):
|
||||
'total':line.total + line.total
|
||||
}
|
||||
register_line_pool.create(cr, uid, reg_line)
|
||||
|
||||
|
||||
self.write(cr, uid, ids, {'state':'confirm'}, context=context)
|
||||
return True
|
||||
|
||||
@@ -1078,13 +1091,12 @@ class hr_payslip(osv.osv):
|
||||
#Check for the Holidays
|
||||
def get_days(start, end, month, year, calc_day):
|
||||
count = 0
|
||||
import datetime
|
||||
for day in range(start, end):
|
||||
if datetime.date(year, month, day).weekday() == calc_day:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
old_slip_ids = slip_line_pool.search(cr, uid, [('slip_id','=',slip.id)], context=context)
|
||||
slip_line_pool.unlink(cr, uid, old_slip_ids, context=context)
|
||||
update = {}
|
||||
@@ -1145,7 +1157,7 @@ class hr_payslip(osv.osv):
|
||||
exp = line.category_id.condition
|
||||
calculate = eval(exp, obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
|
||||
if not calculate:
|
||||
continue
|
||||
@@ -1160,7 +1172,7 @@ class hr_payslip(osv.osv):
|
||||
#Please have a look at the configuration guide.
|
||||
amt = eval(base, obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
|
||||
if sal_type in ('gross', 'net'):
|
||||
if line.amount_type == 'per':
|
||||
@@ -1206,7 +1218,7 @@ class hr_payslip(osv.osv):
|
||||
per = (all_per - ded_per)
|
||||
else:
|
||||
per = all_per
|
||||
if per <=0 :
|
||||
if per <=0:
|
||||
per *= -1
|
||||
final = (per * 100) + 100
|
||||
basic = (sal * 100) / final
|
||||
@@ -1224,7 +1236,7 @@ class hr_payslip(osv.osv):
|
||||
'contract_id':contract.id,
|
||||
'company_id':slip.employee_id.company_id.id
|
||||
})
|
||||
|
||||
|
||||
for line in slip.employee_id.line_ids:
|
||||
vals = {
|
||||
'amount':line.amount,
|
||||
@@ -1234,7 +1246,7 @@ class hr_payslip(osv.osv):
|
||||
'base':base
|
||||
}
|
||||
slip_line_pool.copy(cr, uid, line.id, vals, {})
|
||||
|
||||
|
||||
self.write(cr, uid, [slip.id], update, context=context)
|
||||
|
||||
for slip in self.browse(cr, uid, ids, context=context):
|
||||
@@ -1260,7 +1272,7 @@ class hr_payslip(osv.osv):
|
||||
for hday in holiday_pool.browse(cr, uid, leave_ids, context=context):
|
||||
if not hday.holiday_status_id.head_id:
|
||||
raise osv.except_osv(_('Error !'), _('Please check configuration of %s, payroll head is missing' % (hday.holiday_status_id.name)))
|
||||
|
||||
|
||||
res = {
|
||||
'slip_id':slip.id,
|
||||
'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
|
||||
@@ -1281,7 +1293,7 @@ class hr_payslip(osv.osv):
|
||||
# res['type'] = 'allowance'
|
||||
# leave += days
|
||||
# total += perday * days
|
||||
|
||||
|
||||
elif hday.holiday_status_id.type == 'halfpaid':
|
||||
paid_leave += (days / 2)
|
||||
res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
|
||||
@@ -1315,7 +1327,7 @@ class hr_payslip_line(osv.osv):
|
||||
'''
|
||||
Payslip Line
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.payslip.line'
|
||||
_description = 'Payslip Line'
|
||||
|
||||
@@ -1346,7 +1358,7 @@ class hr_payslip_line(osv.osv):
|
||||
'employee_id':fields.many2one('hr.employee', 'Employee', required=False),
|
||||
'name':fields.char('Name', size=256, required=True, readonly=False),
|
||||
'base':fields.char('Formula', size=1024, required=False, readonly=False),
|
||||
'code':fields.char('Code', size=64, required=False, readonly=False),
|
||||
'code':fields.char('Code', size=64, required=False, readonly=False),
|
||||
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Category', required=True),
|
||||
'type':fields.selection([
|
||||
('allowance','Allowance'),
|
||||
@@ -1397,7 +1409,7 @@ class hr_payslip_line_line(osv.osv):
|
||||
'''
|
||||
Function Line
|
||||
'''
|
||||
|
||||
|
||||
_name = 'hr.payslip.line.line'
|
||||
_description = 'Function Line'
|
||||
_order = 'sequence'
|
||||
@@ -1418,28 +1430,28 @@ class hr_employee(osv.osv):
|
||||
'''
|
||||
Employee
|
||||
'''
|
||||
|
||||
|
||||
_inherit = 'hr.employee'
|
||||
_description = 'Employee'
|
||||
|
||||
|
||||
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
|
||||
vals = {}
|
||||
slip_line_pool = self.pool.get('hr.payslip.line')
|
||||
|
||||
|
||||
for employee in self.browse(cr, uid, ids, context):
|
||||
if not employee.contract_id:
|
||||
vals[employee.id] = {'basic':0.0, 'gross':0.0, 'net':0.0, 'advantages_gross':0.0, 'advantages_net':0.0}
|
||||
continue
|
||||
|
||||
|
||||
basic = employee.contract_id.basic
|
||||
gross = employee.contract_id.gross
|
||||
net = employee.contract_id.net
|
||||
allowance = employee.contract_id.advantages_gross
|
||||
deduction = employee.contract_id.advantages_net
|
||||
|
||||
|
||||
obj = {
|
||||
'basic':basic,
|
||||
'gross':gross,
|
||||
'basic':basic,
|
||||
'gross':gross,
|
||||
'net':net
|
||||
}
|
||||
for line in employee.line_ids:
|
||||
@@ -1447,7 +1459,7 @@ class hr_employee(osv.osv):
|
||||
try:
|
||||
amt = eval(base, obj)
|
||||
except Exception, e:
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
|
||||
raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e)))
|
||||
amount = 0.0
|
||||
if line.amount_type == 'per':
|
||||
amount = amt * line.amount
|
||||
@@ -1455,27 +1467,27 @@ class hr_employee(osv.osv):
|
||||
amount = slip_line_pool.execute_function(cr, uid, line.id, amt, context)
|
||||
elif line.amount_type == 'fix':
|
||||
amount = line.amount
|
||||
|
||||
|
||||
if line.type == 'allowance':
|
||||
allowance += amount
|
||||
elif line.type == 'deduction':
|
||||
deduction += amount
|
||||
|
||||
|
||||
vals[employee.id] = {
|
||||
'basic':basic,
|
||||
'advantages_gross':allowance,
|
||||
'gross':basic + allowance,
|
||||
'basic':basic,
|
||||
'advantages_gross':allowance,
|
||||
'gross':basic + allowance,
|
||||
'advantages_net':deduction,
|
||||
'net':basic + allowance - deduction
|
||||
}
|
||||
return vals
|
||||
|
||||
|
||||
_columns = {
|
||||
'passport_id':fields.many2one('hr.passport', 'Passport', required=False, domain="[('employee_id','=',active_id), ('address_id','=',address_home_id)]", help="Employee Passport Information"),
|
||||
'line_ids':fields.one2many('hr.payslip.line', 'employee_id', 'Salary Structure', required=False),
|
||||
'slip_ids':fields.one2many('hr.payslip', 'employee_id', 'Payslips', required=False, readonly=True),
|
||||
'otherid': fields.char('Other Id', size=64),
|
||||
|
||||
|
||||
'basic': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Basic Salary', digits=(14,2)),
|
||||
'gross': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Gross Salary', digits=(14,2)),
|
||||
'net': fields.function(_calculate_salary, method=True, multi='dc', type='float', string='Net Salary', digits=(14,2)),
|
||||
|
||||
@@ -36,15 +36,15 @@ class employees_salary_report(rml_parse.rml_parse):
|
||||
super(employees_salary_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_employee' : self.get_employee,
|
||||
'get_employee_detail' : self.get_employee_detail,
|
||||
'cal_monthly_amt':self.cal_monthly_amt,
|
||||
'get_periods' : self.get_periods,
|
||||
'get_total' : self.get_total,
|
||||
'get_allow':self.get_allow,
|
||||
'get_deduct':self.get_deduct,
|
||||
'get_other':self.get_other,
|
||||
'get_monthly_total':self.get_monthly_total,
|
||||
'get_employee': self.get_employee,
|
||||
'get_employee_detail': self.get_employee_detail,
|
||||
'cal_monthly_amt': self.cal_monthly_amt,
|
||||
'get_periods': self.get_periods,
|
||||
'get_total': self.get_total,
|
||||
'get_allow': self.get_allow,
|
||||
'get_deduct': self.get_deduct,
|
||||
'get_other': self.get_other,
|
||||
'get_monthly_total': self.get_monthly_total,
|
||||
})
|
||||
|
||||
self.mnths =[]
|
||||
|
||||
@@ -36,16 +36,16 @@ class payroll_advice_report(report_sxw.rml_parse):
|
||||
self.total_bysal = 0.00
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_month' : self.get_month,
|
||||
'convert' : self.convert,
|
||||
'get_detail' : self.get_detail,
|
||||
'get_total' : self.get_total,
|
||||
'get_bysal_total' : self.get_bysal_total,
|
||||
'get_month': self.get_month,
|
||||
'convert': self.convert,
|
||||
'get_detail': self.get_detail,
|
||||
'get_total': self.get_total,
|
||||
'get_bysal_total': self.get_bysal_total,
|
||||
})
|
||||
|
||||
def get_month(self,input_date):
|
||||
res = {
|
||||
'mname':''
|
||||
'mname': ''
|
||||
}
|
||||
date = datetime.strptime(input_date, '%Y-%m-%d')
|
||||
res['mname']= date.strftime('%B')+'-'+date.strftime('%Y')
|
||||
|
||||
@@ -51,7 +51,7 @@ class payslip_report(report_sxw.rml_parse):
|
||||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type in ('advance', 'loan', 'otherpay', 'otherdeduct', 'installment'):
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
@@ -62,7 +62,7 @@ class payslip_report(report_sxw.rml_parse):
|
||||
for id in range(len(obj)):
|
||||
if obj[id].type == 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
@@ -73,7 +73,7 @@ class payslip_report(report_sxw.rml_parse):
|
||||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type == 'allowance' and obj[id].type != 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
@@ -84,7 +84,7 @@ class payslip_report(report_sxw.rml_parse):
|
||||
for id in range(len(obj)):
|
||||
if obj[id].category_id.type == 'deduction' and obj[id].type != 'leaves':
|
||||
ids.append(obj[id].id)
|
||||
if len(ids):
|
||||
if ids:
|
||||
res = payslip_line.browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ class year_salary_report(rml_parse.rml_parse):
|
||||
super(year_salary_report, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_employee' : self.get_employee,
|
||||
'get_periods' : self.get_periods,
|
||||
'get_months_tol' : self.get_months_tol,
|
||||
'get_total' : self.get_total,
|
||||
'get_employee': self.get_employee,
|
||||
'get_periods': self.get_periods,
|
||||
'get_months_tol': self.get_months_tol,
|
||||
'get_total': self.get_total,
|
||||
})
|
||||
|
||||
self.mnths =[]
|
||||
|
||||
@@ -32,16 +32,16 @@ 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):
|
||||
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 ' '
|
||||
@@ -144,10 +144,10 @@ class rml_parse(report_sxw.rml_parse):
|
||||
head_dom = etree.XML(rml_head)
|
||||
for tag in head_dom:
|
||||
found = rml_dom.find('.//'+tag.tag)
|
||||
if found is not None and len(found):
|
||||
if found is not None and found:
|
||||
if tag.get('position'):
|
||||
found.append(tag)
|
||||
else :
|
||||
else:
|
||||
found.getparent().replace(found,tag)
|
||||
return True
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class hr_payroll_employees_detail(osv.osv_memory):
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : return report
|
||||
@return: return report
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
@@ -56,7 +56,7 @@ class hr_payroll_year_salary(osv.osv_memory):
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : return report
|
||||
@return: return report
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
'init_xml': [
|
||||
],
|
||||
'update_xml': [
|
||||
"security/ir.model.access.csv",
|
||||
"hr_payroll_account_view.xml",
|
||||
],
|
||||
'demo_xml': [
|
||||
@@ -47,4 +48,4 @@
|
||||
'active': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -42,7 +42,7 @@ def prev_bounds(cdate=False):
|
||||
class hr_payroll_structure(osv.osv):
|
||||
_inherit = 'hr.payroll.structure'
|
||||
_description = 'Salary Structure'
|
||||
|
||||
|
||||
_columns = {
|
||||
'account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
}
|
||||
@@ -97,13 +97,13 @@ hr_employee()
|
||||
class payroll_register(osv.osv):
|
||||
_inherit = 'hr.payroll.register'
|
||||
_description = 'Payroll Register'
|
||||
|
||||
|
||||
_columns = {
|
||||
'journal_id': fields.many2one('account.journal', 'Expanse Journal'),
|
||||
'bank_journal_id': fields.many2one('account.journal', 'Bank Journal'),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
|
||||
}
|
||||
|
||||
|
||||
def compute_sheet(self, cr, uid, ids, context={}):
|
||||
emp_pool = self.pool.get('hr.employee')
|
||||
slip_pool = self.pool.get('hr.payslip')
|
||||
@@ -141,7 +141,7 @@ payroll_register()
|
||||
class payroll_advice(osv.osv):
|
||||
_inherit = 'hr.payroll.advice'
|
||||
_description = 'Bank Advice Note'
|
||||
|
||||
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.account', 'Account'),
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class contrib_register(osv.osv):
|
||||
'yearly_total_by_comp':c_year
|
||||
}
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.account', 'Account'),
|
||||
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
@@ -191,7 +191,7 @@ contrib_register()
|
||||
class contrib_register_line(osv.osv):
|
||||
_inherit = 'hr.contibution.register.line'
|
||||
_description = 'Contribution Register Line'
|
||||
|
||||
|
||||
_columns = {
|
||||
'period_id': fields.many2one('account.period', 'Period'),
|
||||
}
|
||||
@@ -296,29 +296,29 @@ class hr_payslip(osv.osv):
|
||||
|
||||
name = "To %s account" % (slip.employee_id.name)
|
||||
ded_rec = {
|
||||
'move_id':move_id,
|
||||
'move_id': move_id,
|
||||
'name': name,
|
||||
'date': slip.date,
|
||||
'account_id': slip.employee_id.property_bank_account.id,
|
||||
'debit': 0.0,
|
||||
'credit' : slip.total_pay,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'credit': slip.total_pay,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
|
||||
name = "By %s account" % (slip.employee_id.property_bank_account.name)
|
||||
cre_rec = {
|
||||
'move_id':move_id,
|
||||
'move_id': move_id,
|
||||
'name': name,
|
||||
'partner_id': partner_id,
|
||||
'date': slip.date,
|
||||
'account_id': partner.property_account_payable.id,
|
||||
'debit': slip.total_pay,
|
||||
'credit' : 0.0,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'debit': slip.total_pay,
|
||||
'credit': 0.0,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)]
|
||||
|
||||
@@ -510,17 +510,17 @@ class hr_payslip(osv.osv):
|
||||
continue
|
||||
|
||||
rec = {
|
||||
'move_id':move_id,
|
||||
'move_id': move_id,
|
||||
'name': name,
|
||||
'date': slip.date,
|
||||
'account_id': line.account_id.id,
|
||||
'debit': 0.0,
|
||||
'credit' : 0.0,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'analytic_account_id':False,
|
||||
'ref':slip.number,
|
||||
'quantity':1
|
||||
'credit': 0.0,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'analytic_account_id': False,
|
||||
'ref': slip.number,
|
||||
'quantity': 1
|
||||
}
|
||||
|
||||
#Setting Analysis Account for Salary Slip Lines
|
||||
@@ -534,17 +534,17 @@ class hr_payslip(osv.osv):
|
||||
if not partner.property_account_payable:
|
||||
raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Payable Account!!'))
|
||||
ded_rec = {
|
||||
'move_id':move_id,
|
||||
'move_id': move_id,
|
||||
'name': name,
|
||||
'partner_id': partner_id,
|
||||
'date': slip.date,
|
||||
'account_id': partner.property_account_payable.id,
|
||||
'debit': 0.0,
|
||||
'quantity':1,
|
||||
'credit' : amount,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'quantity': 1,
|
||||
'credit': amount,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
|
||||
elif line.type == 'deduction' or line.type == 'otherdeduct':
|
||||
@@ -553,17 +553,17 @@ class hr_payslip(osv.osv):
|
||||
rec['credit'] = amount
|
||||
total_deduct += amount
|
||||
ded_rec = {
|
||||
'move_id':move_id,
|
||||
'move_id': move_id,
|
||||
'name': name,
|
||||
'partner_id': partner_id,
|
||||
'date': slip.date,
|
||||
'quantity':1,
|
||||
'quantity': 1,
|
||||
'account_id': partner.property_account_receivable.id,
|
||||
'debit': amount,
|
||||
'credit' : 0.0,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'credit': 0.0,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
|
||||
|
||||
@@ -580,38 +580,38 @@ class hr_payslip(osv.osv):
|
||||
'period_id': period_id,
|
||||
'date': slip.date,
|
||||
'ref':slip.number,
|
||||
'narration': 'Adjustment : %s' % (slip.name)
|
||||
'narration': 'Adjustment: %s' % (slip.name)
|
||||
}
|
||||
adj_move_id = move_pool.create(cr, uid, move, context=context)
|
||||
name = "Adjustment Entry - %s" % (slip.employee_id.name)
|
||||
self.create_voucher(cr, uid, [slip.id], name, adj_move_id)
|
||||
|
||||
ded_rec = {
|
||||
'move_id':adj_move_id,
|
||||
'move_id': adj_move_id,
|
||||
'name': name,
|
||||
'partner_id': partner_id,
|
||||
'date': slip.date,
|
||||
'account_id': partner.property_account_receivable.id,
|
||||
'debit': 0.0,
|
||||
'quantity':1,
|
||||
'credit' : total_deduct,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'quantity': 1,
|
||||
'credit': total_deduct,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, ded_rec, context=context)]
|
||||
cre_rec = {
|
||||
'move_id':adj_move_id,
|
||||
'move_id': adj_move_id,
|
||||
'name': name,
|
||||
'partner_id': partner_id,
|
||||
'date': slip.date,
|
||||
'account_id': partner.property_account_payable.id,
|
||||
'debit': total_deduct,
|
||||
'quantity':1,
|
||||
'credit' : 0.0,
|
||||
'journal_id' : slip.journal_id.id,
|
||||
'period_id' :period_id,
|
||||
'ref':slip.number
|
||||
'quantity': 1,
|
||||
'credit': 0.0,
|
||||
'journal_id': slip.journal_id.id,
|
||||
'period_id': period_id,
|
||||
'ref': slip.number
|
||||
}
|
||||
line_ids += [movel_pool.create(cr, uid, cre_rec, context=context)]
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_hr_payslip_account_move_user","access.hr.payslip.account.move.user","model_hr_payslip_account_move","base.group_user",1,0,0,0
|
||||
|
@@ -123,13 +123,13 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
|
||||
'description': fields.text('Description'),
|
||||
'email_from': fields.char('Email', size=128, help="These people will receive email."),
|
||||
'email_cc': fields.text('Watchers Emails', size=252 , help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
|
||||
'email_cc': fields.text('Watchers Emails', size=252, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
|
||||
'probability': fields.float('Probability'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
|
||||
domain="[('partner_id','=',partner_id)]"),
|
||||
'create_date': fields.datetime('Creation Date' , readonly=True),
|
||||
'write_date': fields.datetime('Update Date' , readonly=True),
|
||||
'create_date': fields.datetime('Creation Date', readonly=True),
|
||||
'write_date': fields.datetime('Update Date', readonly=True),
|
||||
'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
@@ -153,10 +153,10 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
'partner_phone': fields.char('Phone', size=32),
|
||||
'partner_mobile': fields.char('Mobile', size=32),
|
||||
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
|
||||
'department_id':fields.many2one('hr.department', 'Department'),
|
||||
'department_id': fields.many2one('hr.department', 'Department'),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
|
||||
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
|
||||
'response' : fields.integer("Response"),
|
||||
'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
|
||||
'response': fields.integer("Response"),
|
||||
'reference': fields.char('Reference', size=128),
|
||||
'day_open': fields.function(_compute_day, string='Days to Open', \
|
||||
method=True, multi='day_open', type="float", store=True),
|
||||
@@ -238,7 +238,7 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
@param ids: List of Opportunity to Meeting IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
||||
@return : Dictionary value for created Meeting view
|
||||
@return: Dictionary value for created Meeting view
|
||||
"""
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
@@ -289,13 +289,13 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Survey IDs
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : Dictionary value for print survey form.
|
||||
@return: Dictionary value for print survey form.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
record = self.browse(cr, uid, ids, context=context)
|
||||
record = record and record[0]
|
||||
context.update({'survey_id': record.survey.id, 'response_id' : [record.response], 'response_no':0, })
|
||||
context.update({'survey_id': record.survey.id, 'response_id': [record.response], 'response_no': 0, })
|
||||
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context)
|
||||
return value
|
||||
|
||||
@@ -427,8 +427,8 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
self.log(cr, uid, id, message)
|
||||
|
||||
applicant = self.browse(cr, uid, ids)[0]
|
||||
if applicant.job_id :
|
||||
emp_id = employee_obj.create(cr,uid,{'name':applicant.name,'job_id':applicant.job_id.id})
|
||||
if applicant.job_id:
|
||||
emp_id = employee_obj.create(cr,uid,{'name': applicant.name,'job_id': applicant.job_id.id})
|
||||
return res
|
||||
|
||||
def case_reset(self, cr, uid, ids, *args):
|
||||
@@ -441,7 +441,7 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
"""
|
||||
|
||||
res = super(hr_applicant, self).case_reset(cr, uid, ids, *args)
|
||||
self.write(cr, uid, ids, {'date_open': False, 'date_closed':False})
|
||||
self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
|
||||
return res
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class hr_recruitment_report(osv.osv):
|
||||
_rec_name = 'date'
|
||||
|
||||
_columns = {
|
||||
'user_id':fields.many2one('res.users', 'User', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'nbr': fields.integer('# of Cases', readonly=True),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
|
||||
'month':fields.selection([('01', 'January'), ('02', 'February'), \
|
||||
@@ -54,14 +54,14 @@ class hr_recruitment_report(osv.osv):
|
||||
'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True),
|
||||
'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'),
|
||||
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
|
||||
'department_id':fields.many2one('hr.department','Department',readonly=True),
|
||||
'department_id': fields.many2one('hr.department','Department',readonly=True),
|
||||
'priority': fields.selection(hr_recruitment.AVAILABLE_PRIORITIES, 'Appreciation'),
|
||||
'salary_prop' : fields.float("Salary Proposed"),
|
||||
'salary_prop_avg' : fields.float("Avg Salary Proposed", group_operator="avg"),
|
||||
'salary_exp' : fields.float("Salary Expected"),
|
||||
'salary_prop': fields.float("Salary Proposed"),
|
||||
'salary_prop_avg': fields.float("Avg Salary Proposed", group_operator="avg"),
|
||||
'salary_exp': fields.float("Salary Expected"),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner',readonly=True),
|
||||
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact Name',readonly=True),
|
||||
'available' : fields.float("Availability"),
|
||||
'available': fields.float("Availability"),
|
||||
'delay_open': fields.float('Avg. Delay to Open', digits=(16,2), readonly=True, group_operator="avg",
|
||||
help="Number of Days to close the project issue"),
|
||||
'delay_close': fields.float('Avg. Delay to Close', digits=(16,2), readonly=True, group_operator="avg",
|
||||
|
||||
@@ -82,19 +82,19 @@ class job2phonecall(osv.osv_memory):
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for job in job_case_obj.browse(cr, uid, context['active_ids'], context=context):
|
||||
#TODO : Take other info from job
|
||||
#TODO: Take other info from job
|
||||
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
|
||||
'name' : job.name,
|
||||
'user_id' : form['user_id'],
|
||||
'categ_id' : form['category_id'],
|
||||
'description' : form['note'],
|
||||
'date' : form['deadline'],
|
||||
'description':job.description,
|
||||
'partner_id':job.partner_id.id,
|
||||
'partner_address_id':job.partner_address_id.id,
|
||||
'partner_phone':job.partner_phone,
|
||||
'partner_mobile':job.partner_mobile,
|
||||
'description':job.description,
|
||||
'name': job.name,
|
||||
'user_id': form['user_id'],
|
||||
'categ_id': form['category_id'],
|
||||
'description': form['note'],
|
||||
'date': form['deadline'],
|
||||
'description': job.description,
|
||||
'partner_id': job.partner_id.id,
|
||||
'partner_address_id': job.partner_address_id.id,
|
||||
'partner_phone': job.partner_phone,
|
||||
'partner_mobile': job.partner_mobile,
|
||||
'description': job.description,
|
||||
'date':job.date,
|
||||
}, context=context)
|
||||
new_phonecall = phonecall_case_obj.browse(cr, uid, new_phonecall_id, context=context)
|
||||
@@ -108,7 +108,7 @@ class job2phonecall(osv.osv_memory):
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'crm.phonecall',
|
||||
'res_id' : new_phonecall_id,
|
||||
'res_id': new_phonecall_id,
|
||||
'views': [(id3,'form'), (id2,'tree'), (False,'calendar'), (False,'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
|
||||
@@ -32,7 +32,7 @@ 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:
|
||||
@@ -52,8 +52,8 @@ class hr_employee(osv.osv):
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'journal_id' : _getAnalyticJournal,
|
||||
'product_id' : _getEmployeeProduct
|
||||
'journal_id': _getAnalyticJournal,
|
||||
'product_id': _getEmployeeProduct
|
||||
}
|
||||
hr_employee()
|
||||
|
||||
@@ -65,7 +65,7 @@ class hr_analytic_timesheet(osv.osv):
|
||||
_inherits = {'account.analytic.line': 'line_id'}
|
||||
_order = "id desc"
|
||||
_columns = {
|
||||
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True),
|
||||
'line_id': fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True),
|
||||
'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id', relation='res.partner', store=True),
|
||||
}
|
||||
|
||||
@@ -148,12 +148,12 @@ class hr_analytic_timesheet(osv.osv):
|
||||
|
||||
|
||||
_defaults = {
|
||||
'product_uom_id' : _getEmployeeUnit,
|
||||
'product_id' : _getEmployeeProduct,
|
||||
'general_account_id' : _getGeneralAccount,
|
||||
'journal_id' : _getAnalyticJournal,
|
||||
'date' : lambda self, cr, uid, ctx : ctx.get('date', time.strftime('%Y-%m-%d')),
|
||||
'user_id' : lambda obj, cr, uid, ctx : ctx.get('user_id', uid),
|
||||
'product_uom_id': _getEmployeeUnit,
|
||||
'product_id': _getEmployeeProduct,
|
||||
'general_account_id': _getGeneralAccount,
|
||||
'journal_id': _getAnalyticJournal,
|
||||
'date': lambda self, cr, uid, ctx: ctx.get('date', time.strftime('%Y-%m-%d')),
|
||||
'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid),
|
||||
}
|
||||
def on_change_account_id(self, cr, uid, ids, account_id):
|
||||
return {'value':{}}
|
||||
@@ -184,13 +184,13 @@ class hr_analytic_timesheet(osv.osv):
|
||||
if not user_id:
|
||||
return {}
|
||||
context = {'user_id': user_id}
|
||||
return {'value' : {
|
||||
'product_id' : self._getEmployeeProduct(cr, uid, context),
|
||||
'product_uom_id' : self._getEmployeeUnit(cr, uid, context),
|
||||
'general_account_id' :self._getGeneralAccount(cr, uid, context),
|
||||
'journal_id' : self._getAnalyticJournal(cr, uid, context),
|
||||
return {'value': {
|
||||
'product_id': self. _getEmployeeProduct(cr, uid, context),
|
||||
'product_uom_id': self._getEmployeeUnit(cr, uid, context),
|
||||
'general_account_id': self._getGeneralAccount(cr, uid, context),
|
||||
'journal_id': self._getAnalyticJournal(cr, uid, context),
|
||||
}}
|
||||
|
||||
|
||||
hr_analytic_timesheet()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -66,7 +66,7 @@ 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',
|
||||
|
||||
@@ -128,14 +128,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 =ANY(%s) AND date>=%s AND date<=%s AND amount>0", (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
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount<0", (ids, date1, date2))
|
||||
@@ -148,7 +148,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
||||
|
||||
def _sum_qty(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s", (ids,date1, date2))
|
||||
@@ -156,7 +156,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
||||
|
||||
def _sum_revenue(self, accounts):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
res = 0.0
|
||||
for id in ids:
|
||||
|
||||
@@ -28,16 +28,16 @@ class report_timesheet_line(osv.osv):
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year',size=64,required=False, readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'User', readonly=True),
|
||||
'date' : fields.date('Date', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'cost': fields.float('Cost', readonly=True),
|
||||
'product_id' : fields.many2one('product.product', 'Product',readonly=True),
|
||||
'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
|
||||
'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product',readonly=True),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
|
||||
'general_account_id': fields.many2one('account.account', 'General Account', readonly=True),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoiced', readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
|
||||
'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),
|
||||
}
|
||||
_order = 'name desc,user_id desc'
|
||||
@@ -223,11 +223,11 @@ class report_random_timsheet(osv.osv):
|
||||
_auto = False
|
||||
|
||||
_columns = {
|
||||
'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True),
|
||||
'name': fields.char('Description', size=64, readonly=True),
|
||||
'quantity' : fields.float('Quantity', readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'user_id' : fields.many2one('res.users', 'User', readonly=True)
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True)
|
||||
}
|
||||
_order = "date desc"
|
||||
|
||||
@@ -273,14 +273,14 @@ class random_timesheet_lines(osv.osv):
|
||||
_columns = {
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'name': fields.char('Description', size=64, readonly=True),
|
||||
'user_id' : fields.many2one('res.users', 'User', readonly=True),
|
||||
'quantity' : fields.float('Quantity', readonly=True),
|
||||
'product_id' : fields.many2one('product.product', 'Product', readonly=True),
|
||||
'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
|
||||
'uom_id' : fields.many2one('product.uom', 'UoM', readonly=True),
|
||||
'amount' : fields.float('Amount', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True),
|
||||
'uom_id': fields.many2one('product.uom', 'UoM', readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True),
|
||||
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invoicing', readonly=True),
|
||||
'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True)
|
||||
'general_account_id': fields.many2one('account.account', 'General Account', readonly=True)
|
||||
}
|
||||
|
||||
_order = "date desc"
|
||||
|
||||
@@ -176,7 +176,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
||||
|
||||
curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note))
|
||||
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'])))
|
||||
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)
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="state"/>
|
||||
<group col="4" colspan="2">
|
||||
<button name="button_confirm" states="draft" string="Close" type="object" icon="terp-check"/>
|
||||
<group col="6" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="button_confirm" states="draft" string="Confirm" type="object" icon="terp-check"/>
|
||||
<button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-cancel"/>
|
||||
<button name="done" states="confirm" string="Approve" type="workflow" icon="terp-camera_test"/>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"mail_gateway_mailgate_message","mail_gateway.mailgate.message","model_mailgate_message","base.group_system",1,1,1,1
|
||||
"mail_gateway_mailgate_thread","mail_gateway.mailgate.thread","model_mailgate_thread","base.group_system",1,1,1,1
|
||||
"mail_gateway_message_internal_user","mail_gateway.mailgate.message.internal","model_mailgate_message","base.group_user",1,0,0,0
|
||||
|
||||
|
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
from tools import config
|
||||
import decimal_precision as dp
|
||||
from tools.translate import _
|
||||
|
||||
@@ -525,15 +524,15 @@ class account_invoice_line(osv.osv):
|
||||
date_to = line.product_id.membership_date_to
|
||||
if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
|
||||
date_from = line.invoice_id.date_invoice
|
||||
line_id = member_line_obj.create(cr, uid, {
|
||||
'partner': line.invoice_id.partner_id.id,
|
||||
'membership_id': line.product_id.id,
|
||||
'member_price': line.price_unit,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'account_invoice_line': line.id,
|
||||
}, context=context)
|
||||
member_line_obj.create(cr, uid, {
|
||||
'partner': line.invoice_id.partner_id.id,
|
||||
'membership_id': line.product_id.id,
|
||||
'member_price': line.price_unit,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'account_invoice_line': line.id,
|
||||
}, context=context)
|
||||
if line.product_id and not line.product_id.membership and ml_ids:
|
||||
# Product line has changed to a non membership product
|
||||
member_line_obj.unlink(cr, uid, ml_ids, context=context)
|
||||
@@ -564,7 +563,7 @@ class account_invoice_line(osv.osv):
|
||||
date_to = line.product_id.membership_date_to
|
||||
if line.invoice_id.date_invoice > date_from and line.invoice_id.date_invoice < date_to:
|
||||
date_from = line.invoice_id.date_invoice
|
||||
line_id = member_line_obj.create(cr, uid, {
|
||||
member_line_obj.create(cr, uid, {
|
||||
'partner': line.invoice_id.partner_id and line.invoice_id.partner_id.id or False,
|
||||
'membership_id': line.product_id.id,
|
||||
'member_price': line.price_unit,
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<field name="name"/>
|
||||
<field name="default_code"/>
|
||||
<field name="active"/>
|
||||
<field name="membership" invisible="1"/>
|
||||
<field name="membership_date_from" required="1"/>
|
||||
<field name="membership_date_to" required="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
|
||||
@@ -39,6 +39,7 @@ class membership_invoice(osv.osv_memory):
|
||||
return {'value': {'member_price': self.pool.get('product.product').price_get(cr, uid, [product_id])[product_id]}}
|
||||
|
||||
def membership_invoice(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
datas = {}
|
||||
if not context:
|
||||
@@ -51,6 +52,9 @@ class membership_invoice(osv.osv_memory):
|
||||
'amount': data.member_price
|
||||
}
|
||||
invoice_list = partner_obj.create_membership_invoice(cr, uid, context.get('active_ids', []), datas=datas, context=context)
|
||||
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
|
||||
return {
|
||||
'domain': [('id', 'in', invoice_list)],
|
||||
'name': 'Membership Invoices',
|
||||
@@ -58,7 +62,7 @@ class membership_invoice(osv.osv_memory):
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.invoice',
|
||||
'type': 'ir.actions.act_window',
|
||||
# missing search view ?
|
||||
'search_view_id': res and res[1] or False
|
||||
}
|
||||
|
||||
membership_invoice()
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pad
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.0-rc1\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2010-10-27 12:46:22+0000\n"
|
||||
"PO-Revision-Date: 2010-10-27 12:46:22+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: pad
|
||||
#: sql_constraint:ir.module.module:0
|
||||
msgid "The certificate ID of the module must be unique !"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: code:addons/pad/web/editors.py:0
|
||||
#, python-format
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: code:addons/pad/web/editors.py:0
|
||||
#, python-format
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: sql_constraint:ir.module.module:0
|
||||
msgid "The name of the module must be unique !"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: help:res.company,pad_index:0
|
||||
msgid "The root URL of the company's pad instance"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: model:ir.model,name:pad.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: model:ir.module.module,description:pad.module_meta_information
|
||||
msgid "\n"
|
||||
"Adds enhanced support for (Ether)Pad attachments in the web client, lets the\n"
|
||||
"company customize which Pad installation should be used to link to new pads\n"
|
||||
"(by default, pad.openerp.com)\n"
|
||||
" "
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: field:res.company,pad_index:0
|
||||
msgid "Pad root URL"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: code:addons/pad/web/editors.py:0
|
||||
#: view:res.company:0
|
||||
#, python-format
|
||||
msgid "Pad"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: model:ir.module.module,shortdesc:pad.module_meta_information
|
||||
msgid "Enhanced support for (Ether)Pad attachments"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: pad
|
||||
#: sql_constraint:ir.model.fields:0
|
||||
msgid "Size of the field can never be less than 1 !"
|
||||
msgstr ""
|
||||
@@ -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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -64,7 +64,7 @@ Main features :
|
||||
'wizard/pos_return_view.xml',
|
||||
'point_of_sale_report.xml',
|
||||
'point_of_sale_view.xml',
|
||||
'report/report_pos_order_view.xml',
|
||||
'report/pos_order_report_view.xml',
|
||||
'report/report_cash_register_view.xml',
|
||||
'point_of_sale_sequence.xml',
|
||||
'point_of_sale_workflow.xml',
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -35,8 +35,8 @@ import pos_payment_report_user
|
||||
import pos_sales_user_today_current_user
|
||||
import pos_receipt_with_remboursment
|
||||
import pos_receipt_without_remboursment
|
||||
import point_of_sale_report
|
||||
import report_pos_order
|
||||
import pos_report
|
||||
import pos_order_report
|
||||
import report_cash_register
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class account_statement(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -30,8 +29,8 @@ class account_statement(report_sxw.rml_parse):
|
||||
self.total = 0.0
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_total':self._get_total,
|
||||
'get_data':self._get_data,
|
||||
'get_total': self._get_total,
|
||||
'get_data': self._get_data,
|
||||
})
|
||||
|
||||
def _get_data(self, statement):
|
||||
@@ -49,3 +48,4 @@ class account_statement(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.account.statement', 'account.bank.statement', 'addons/statement/report/account_statement.rml', parser=account_statement,header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
#TOFIX: sql injection problem: SQL Request must be pass from sql injection...
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -38,6 +37,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
'get_sub_total':self._get_sub_total,
|
||||
'get_net_total_starting':self._get_net_total_starting,
|
||||
})
|
||||
|
||||
def _get_user(self,line_ids):
|
||||
sql = "select name from res_users where id = %d"%(line_ids['create_uid'])
|
||||
self.cr.execute(sql)
|
||||
@@ -70,9 +70,9 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
sql =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d """%(data['id'])
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
if res :
|
||||
if res:
|
||||
return res[0]['bal']
|
||||
else :
|
||||
else:
|
||||
return False
|
||||
|
||||
def _get_sub_total(self,user,data,date):
|
||||
@@ -89,6 +89,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
return res[0][0]
|
||||
else:
|
||||
return False
|
||||
|
||||
def _get_partner(self,statement):
|
||||
res = {}
|
||||
if statement['pos_statement_id']:
|
||||
@@ -98,10 +99,9 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall() or {}
|
||||
return res and res[0]['name']
|
||||
else :
|
||||
else:
|
||||
return 0.00
|
||||
|
||||
|
||||
def _get_net_total_starting(self,user):
|
||||
lst = []
|
||||
res={}
|
||||
@@ -113,7 +113,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
and abs.user_id = %d"""%(user.id)
|
||||
self.cr.execute(sql)
|
||||
res = self.cr.dictfetchall()
|
||||
for r in res :
|
||||
for r in res:
|
||||
total_ending_bal += (r['net_total'] or 0.0)
|
||||
sql1 =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d"""%(r['id'])
|
||||
self.cr.execute(sql1)
|
||||
@@ -136,3 +136,5 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
|
||||
return res[0]['net_total'] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day,header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,238 +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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import time
|
||||
import netsvc
|
||||
import tools
|
||||
|
||||
class report_transaction_pos(osv.osv):
|
||||
_name = "report.transaction.pos"
|
||||
_description = "transaction for the pos"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_create': fields.char('Date', size=16, readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Sales Journal', readonly=True),
|
||||
'jl_id': fields.many2one('account.journal', 'Cash Journals', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'no_trans': fields.float('Number of Transaction', readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True),
|
||||
'invoice_id': fields.float('Nbr Invoice', readonly=True),
|
||||
'invoice_am': fields.float('Invoice Amount', readonly=True),
|
||||
'product_nb': fields.float('Product Nb.', readonly=True),
|
||||
'disc': fields.float('Disc.', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_transaction_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_transaction_pos as (
|
||||
select
|
||||
min(absl.id) as id,
|
||||
count(absl.id) as no_trans,
|
||||
sum(absl.amount) as amount,
|
||||
sum(line.price_ded) as disc,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
po.user_id as user_id,
|
||||
po.sale_journal as journal_id,
|
||||
abs.journal_id as jl_id,
|
||||
count(po.invoice_id) as invoice_id,
|
||||
count(p.id) as product_nb
|
||||
from
|
||||
account_bank_statement_line as absl,
|
||||
account_bank_statement as abs,
|
||||
product_product as p,
|
||||
pos_order_line as line,
|
||||
pos_order as po
|
||||
where
|
||||
absl.pos_statement_id = po.id and
|
||||
line.order_id=po.id and
|
||||
line.product_id=p.id and
|
||||
absl.statement_id=abs.id
|
||||
|
||||
group by
|
||||
po.user_id,po.sale_journal, abs.journal_id,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text
|
||||
)
|
||||
""")
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
report_transaction_pos()
|
||||
|
||||
class report_sales_by_user_pos(osv.osv):
|
||||
_name = "report.sales.by.user.pos"
|
||||
_description = "Sales by user"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos()
|
||||
|
||||
class report_sales_by_user_pos_month(osv.osv):
|
||||
_name = "report.sales.by.user.pos.month"
|
||||
_description = "Sales by user monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos_month as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos_month()
|
||||
|
||||
class report_sales_by_margin_pos(osv.osv):
|
||||
_name = "report.sales.by.margin.pos"
|
||||
_description = "Sales by margin"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos()
|
||||
|
||||
class report_sales_by_margin_pos_month(osv.osv):
|
||||
_name = "report.sales.by.margin.pos.month"
|
||||
_description = "Sales by margin monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos_month as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos_month()
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_details(report_sxw.rml_parse):
|
||||
|
||||
def _get_invoice(self,inv_id,user):
|
||||
@@ -36,13 +35,13 @@ class pos_details(report_sxw.rml_parse):
|
||||
|
||||
def _pos_sales_details(self,form,user):
|
||||
data={}
|
||||
self.cr.execute ("select po.name as pos_name,po.date_order,pt.name ,pp.default_code as code,pol.qty,pu.name as uom,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
||||
self.cr.execute ("select po.name as pos_name,po.date_order,pt.name, pp.default_code as code,pol.qty,pu.name as uom,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu,res_users as ru,res_company as rc " \
|
||||
"where pt.id=pp.product_tmpl_id and pu.id=pt.uom_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('done','paid','invoiced') " \
|
||||
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
|
||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
"group by po.name,pol.qty,po.date_order,pt.name,pp.default_code,pu.name,pol.price_unit,pol.discount,po.invoice_id " \
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
data=self.cr.dictfetchall()
|
||||
if data:
|
||||
for d in data:
|
||||
@@ -59,13 +58,13 @@ class pos_details(report_sxw.rml_parse):
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('done','paid','invoiced') " \
|
||||
" and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
|
||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
qty = self.cr.fetchone()
|
||||
return qty[0] or 0.00
|
||||
|
||||
def _get_sales_total_2(self, form,user):
|
||||
self.cr.execute("select sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
||||
"from pos_order_line as pol , pos_order po, product_product as pp,product_template as pt " \
|
||||
"from pos_order_line as pol, pos_order po, product_product as pp,product_template as pt " \
|
||||
" where po.company_id='%s' and po.id=pol.order_id and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= '%s' " \
|
||||
" and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= '%s' and po.state IN ('paid','invoiced','done') " \
|
||||
" and pt.id=pp.product_tmpl_id and pol.product_id=pp.id"% (str(user.company_id.id),form['date_start'],form['date_end']))
|
||||
@@ -75,11 +74,11 @@ class pos_details(report_sxw.rml_parse):
|
||||
def _get_sum_invoice_2(self,form,user):
|
||||
res2=[]
|
||||
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc,account_invoice as ai " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc,account_invoice as ai " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and ai.id=po.invoice_id " \
|
||||
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
|
||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
res2=self.cr.fetchone()
|
||||
self.total_invoiced=res2[0]
|
||||
return res2[0] or False
|
||||
@@ -91,7 +90,7 @@ class pos_details(report_sxw.rml_parse):
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('paid','invoiced','done') " \
|
||||
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
|
||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
res3=self.cr.fetchone()
|
||||
self.total_paid=res3[0]
|
||||
return res3[0] or False
|
||||
@@ -99,16 +98,15 @@ class pos_details(report_sxw.rml_parse):
|
||||
def _get_sum_dis_2(self,form,user):
|
||||
res4=[]
|
||||
self.cr.execute ("select sum(pol.price_ded * pol.qty)" \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('paid') " \
|
||||
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
|
||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
||||
res4=self.cr.fetchone()
|
||||
self.total_invoiced=res4[0]
|
||||
return res4[0] or False
|
||||
|
||||
|
||||
def _get_sum_discount(self, objects):
|
||||
#code for the sum of discount value
|
||||
return reduce(lambda acc, object:
|
||||
@@ -122,14 +120,15 @@ class pos_details(report_sxw.rml_parse):
|
||||
|
||||
def _get_payments(self, form,user):
|
||||
statement_line_obj = self.pool.get("account.bank.statement.line")
|
||||
pos_ids=self.pool.get("pos.order").search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
pos_order_obj = self.pool.get("pos.order")
|
||||
pos_ids=pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
data={}
|
||||
if pos_ids:
|
||||
st_line_ids = statement_line_obj.search(self.cr, self.uid, [('pos_statement_id', 'in', pos_ids)])
|
||||
if st_line_ids:
|
||||
st_id = statement_line_obj.browse(self.cr, self.uid, st_line_ids)
|
||||
a_l=[]
|
||||
for r in st_id :
|
||||
for r in st_id:
|
||||
a_l.append(r['id'])
|
||||
self.cr.execute("select aj.name,sum(amount) from account_bank_statement_line as absl,account_bank_statement as abs,account_journal as aj " \
|
||||
"where absl.statement_id = abs.id and abs.journal_id = aj.id and absl.id IN %s " \
|
||||
@@ -142,7 +141,7 @@ class pos_details(report_sxw.rml_parse):
|
||||
|
||||
def _total_of_the_day(self, objects):
|
||||
if self.total_paid:
|
||||
if self.total_paid == self.total_invoiced :
|
||||
if self.total_paid == self.total_invoiced:
|
||||
return self.total_paid
|
||||
else:
|
||||
return ((self.total_paid or 0.00) - (self.total_invoiced or 0.00))
|
||||
@@ -170,9 +169,10 @@ class pos_details(report_sxw.rml_parse):
|
||||
temp={}
|
||||
list_ids = []
|
||||
temp2 = 0.0
|
||||
pos_ids=self.pool.get("pos.order").search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
pos_order_obj = self.pool.get("pos.order")
|
||||
pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
temp.update({'name':''})
|
||||
for order in self.pool.get("pos.order").browse(self.cr, self.uid, pos_ids):
|
||||
for order in pos_order_obj.browse(self.cr, self.uid, pos_ids):
|
||||
temp2 +=order.amount_tax
|
||||
for line in order.lines:
|
||||
if len(line.product_id.taxes_id):
|
||||
@@ -215,5 +215,4 @@ class pos_details(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.details', 'pos.order', 'addons/point_of_sale_singer/report/pos_details.rml', parser=pos_details, header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_details_summary(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(pos_details_summary, self).__init__(cr, uid, name, context=context)
|
||||
@@ -137,5 +136,4 @@ report_sxw.report_sxw('report.pos.details_summary',
|
||||
parser=pos_details_summary,
|
||||
header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -20,11 +20,11 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class pos_invoice(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -33,7 +33,6 @@ class pos_invoice(report_sxw.rml_parse):
|
||||
'time': time,
|
||||
})
|
||||
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
super(pos_invoice, self).set_context(objects, data, ids, report_type)
|
||||
iids = []
|
||||
@@ -56,3 +55,4 @@ class pos_invoice(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/account/report/account_print_invoice.rml', parser= pos_invoice)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,7 +22,6 @@
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_lines(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -47,12 +46,10 @@ class pos_lines(report_sxw.rml_parse):
|
||||
" LEFT JOIN pos_order_line as pol ON po.id = pol.order_id " \
|
||||
" LEFT JOIN product_taxes_rel as ptr ON pol.product_id = ptr.prod_id " \
|
||||
" LEFT JOIN account_tax as acct ON acct.id = ptr.tax_id " \
|
||||
" WHERE pol.id = %s" ,(obj.id,))
|
||||
" WHERE pol.id = %s", (obj.id,))
|
||||
res=self.cr.fetchone()[0]
|
||||
return res
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.pos.lines', 'pos.order', 'addons/point_of_sale/report/pos_lines.rml', parser=pos_lines,header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_payment_report(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -44,7 +44,7 @@ class pos_payment_report(report_sxw.rml_parse):
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
|
||||
"and po.state IN ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date and po.id=%d"%(obj.id))
|
||||
data=self.cr.dictfetchall()
|
||||
else :
|
||||
else:
|
||||
self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
|
||||
"(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, product_uom as pu " \
|
||||
@@ -56,17 +56,9 @@ class pos_payment_report(report_sxw.rml_parse):
|
||||
self.total += d['price_unit'] * d['qty']
|
||||
return data
|
||||
|
||||
|
||||
def _pos_payment_total(self,o):
|
||||
return self.total
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.pos.payment.report', 'pos.order', 'addons/point_of_sale/report/pos_payment_report.rml', parser=pos_payment_report,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_payment_report_date(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -43,14 +43,14 @@ class pos_payment_report_date(report_sxw.rml_parse):
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
|
||||
"and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id IN %s " \
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
else:
|
||||
self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
|
||||
"(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
|
||||
"and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s" \
|
||||
,(dt1,dt2))
|
||||
,(dt1,dt2))
|
||||
data=self.cr.dictfetchall()
|
||||
return data
|
||||
|
||||
@@ -63,23 +63,17 @@ class pos_payment_report_date(report_sxw.rml_parse):
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id IN %s " \
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
else:
|
||||
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and po.state IN ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s" \
|
||||
,(dt1,dt2))
|
||||
,(dt1,dt2))
|
||||
res=self.cr.fetchone()[0] or 0.0
|
||||
return res
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.pos.payment.report.date', 'pos.order', 'addons/point_of_sale/report/pos_payment_report_date.rml', parser=pos_payment_report_date,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
@@ -44,6 +45,7 @@ class pos_payment_report_user(report_sxw.rml_parse):
|
||||
self.cr.execute (sql, (tuple(ids), ))
|
||||
data=self.cr.dictfetchall()
|
||||
return data
|
||||
|
||||
def __pos_payment_user__total__(self, form):
|
||||
res=[]
|
||||
ids = form['user_id']
|
||||
@@ -57,21 +59,6 @@ class pos_payment_report_user(report_sxw.rml_parse):
|
||||
|
||||
return res
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.pos.payment.report.user', 'pos.order', 'addons/point_of_sale/report/pos_payment_report_user.rml', parser=pos_payment_report_user,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -74,5 +74,4 @@ class order(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.receipt', 'pos.order', 'addons/point_of_sale/report/pos_receipt.rml', parser=order, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -23,7 +23,6 @@ import time
|
||||
from report import report_sxw
|
||||
import pooler
|
||||
|
||||
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -55,6 +54,7 @@ class order(report_sxw.rml_parse):
|
||||
if line[0] != 0:
|
||||
dsum = dsum +(line[2] * (line[0]*line[1]/100))
|
||||
return dsum
|
||||
|
||||
def _get_journal_amt(self, order_id):
|
||||
lst=[]
|
||||
sql = """ select aj.name from account_bank_statement as abs
|
||||
@@ -75,5 +75,4 @@ class order(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.receipt.with.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_with_remboursment.rml', parser=order, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -23,7 +23,6 @@ import time
|
||||
from report import report_sxw
|
||||
import pooler
|
||||
|
||||
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -76,5 +75,4 @@ class order(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.receipt.without.remboursment', 'pos.order', 'addons/point_of_sale/report/pos_receipt_without_remboursment.rml', parser=order, header=False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_sales_user(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -41,17 +41,11 @@ class pos_sales_user(report_sxw.rml_parse):
|
||||
"from pos_order as po,res_users as ru,res_company as rc " \
|
||||
"where po.date_order >= %s and po.date_order <= %s " \
|
||||
"and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s " \
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
|
||||
data = self.cr.dictfetchall()
|
||||
return data
|
||||
|
||||
report_sxw.report_sxw('report.pos.sales.user', 'pos.order', 'addons/point_of_sale/report/pos_sales_user.rml', parser=pos_sales_user,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_sales_user_today(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -40,17 +40,11 @@ class pos_sales_user_today(report_sxw.rml_parse):
|
||||
self.cr.execute("select po.name as pos,po.date_order,ru.name as user,po.state,rc.name " \
|
||||
"from pos_order as po,res_users as ru,res_company as rc " \
|
||||
"where to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
|
||||
"and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s" ,(tuple(ids), ))
|
||||
"and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s", (tuple(ids), ))
|
||||
|
||||
data = self.cr.dictfetchall()
|
||||
return data
|
||||
|
||||
report_sxw.report_sxw('report.pos.sales.user.today', 'pos.order', 'addons/point_of_sale/report/pos_sales_user_today.rml', parser=pos_sales_user_today,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_sales_user_today_current_user(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -45,11 +45,11 @@ class pos_sales_user_today_current_user(report_sxw.rml_parse):
|
||||
def _get_data_current_user(self, user):
|
||||
data={}
|
||||
self.cr.execute("select po.name,po. state,sum(pol.qty)as Qty,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc " \
|
||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
||||
"group by po.name, po.state " \
|
||||
,(str(user.company_id.id),str(self.uid)))
|
||||
,(str(user.company_id.id),str(self.uid)))
|
||||
|
||||
data = self.cr.dictfetchall()
|
||||
for d in data:
|
||||
@@ -65,10 +65,4 @@ class pos_sales_user_today_current_user(report_sxw.rml_parse):
|
||||
|
||||
report_sxw.report_sxw('report.pos.sales.user.today.current.user', 'pos.order', 'addons/point_of_sale/report/pos_sales_user_today_current_user.rml', parser=pos_sales_user_today_current_user,header='internal')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,10 +18,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
class pos_user_product(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -33,8 +33,9 @@ class pos_user_product(report_sxw.rml_parse):
|
||||
'get_total':self._get_total,
|
||||
|
||||
})
|
||||
|
||||
def _get_data(self,o):
|
||||
self.total = 0.0
|
||||
self.total = 0.0
|
||||
data={}
|
||||
sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state='paid' and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id)
|
||||
self.cr.execute(sql1)
|
||||
@@ -51,14 +52,17 @@ class pos_user_product(report_sxw.rml_parse):
|
||||
return data
|
||||
|
||||
def _get_user(self,object):
|
||||
for o in object :
|
||||
for o in object:
|
||||
sql = """select ru.name from account_bank_statement as abs,res_users ru
|
||||
where abs.user_id = ru.id
|
||||
and abs.id = %d"""%(o.id)
|
||||
self.cr.execute(sql)
|
||||
data = self.cr.fetchone()
|
||||
return data[0]
|
||||
|
||||
def _get_total(self,o):
|
||||
return self.total
|
||||
|
||||
report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product,header='internal')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,6 +18,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import tools
|
||||
from osv import fields,osv
|
||||
|
||||
@@ -39,6 +40,7 @@ class report_cash_register(osv.osv):
|
||||
'balance_end_real': fields.float('Closing Balance'),
|
||||
}
|
||||
_order = 'date desc'
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_cash_register')
|
||||
cr.execute("""
|
||||
@@ -62,3 +64,5 @@ class report_cash_register(osv.osv):
|
||||
to_char(s.create_date, 'YYYY-MM-DD'))""")
|
||||
|
||||
report_cash_register()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,95 +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 report_pos_order(osv.osv):
|
||||
_name = "report.pos.order"
|
||||
_description = "Point of Sale Orders Statistics"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date': fields.date('Date Order', readonly=True),
|
||||
'year': fields.char('Year', size=4, 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),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('payment', 'Payment'),
|
||||
('advance','Advance'),
|
||||
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced'), ('cancel', 'Cancel')],
|
||||
'State'),
|
||||
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
'price_total':fields.float('Total Price', readonly=True),
|
||||
'total_discount':fields.float('Total Discount', readonly=True),
|
||||
'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
|
||||
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
'product_qty':fields.integer('# of Qty', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal'),
|
||||
'delay_validation': fields.integer('Delay Validation'),
|
||||
'delay_payment': fields.integer('Delay Payment'),
|
||||
'date_validation': fields.date('Validation Date', required=True),
|
||||
'date_payment': fields.date('Payment Date', required=True),
|
||||
}
|
||||
_order = 'date desc'
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_pos_order')
|
||||
cr.execute("""
|
||||
create or replace view report_pos_order as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
count(*) as nbr,
|
||||
to_date(to_char(s.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
|
||||
sum(l.qty * u.factor) as product_qty,
|
||||
sum(l.qty * l.price_unit) as price_total,
|
||||
sum(l.qty * l.price_ded) as total_discount,
|
||||
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
|
||||
sum(cast(to_char(date_trunc('day',s.date_validation) - date_trunc('day',s.date_order),'DD') as int)) as delay_validation,
|
||||
sum(cast(to_char(date_trunc('day',s.date_payment) - date_trunc('day',s.date_order),'DD') as int)) as delay_payment,
|
||||
to_char(s.date_order, 'YYYY') as year,
|
||||
to_char(s.date_order, 'MM') as month,
|
||||
to_char(s.date_order, 'YYYY-MM-DD') as day,
|
||||
s.partner_id as partner_id,
|
||||
s.state as state,
|
||||
s.user_id as user_id,
|
||||
s.shop_id as shop_id,
|
||||
s.company_id as company_id,
|
||||
s.sale_journal as journal_id,
|
||||
l.product_id as product_id,
|
||||
s.date_validation,
|
||||
s.date_payment
|
||||
from pos_order_line as l
|
||||
left join pos_order s on (s.id=l.order_id)
|
||||
left join product_template pt on (pt.id=l.product_id)
|
||||
left join product_uom u on (u.id=pt.uom_id)
|
||||
group by
|
||||
to_char(s.date_order, 'dd-MM-YYYY'),to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),
|
||||
to_char(s.date_order, 'YYYY-MM-DD'), s.partner_id,s.state,
|
||||
s.user_id,s.shop_id,s.company_id,s.sale_journal,l.product_id,s.date_validation,
|
||||
s.date_payment
|
||||
having
|
||||
sum(l.qty * u.factor) != 0)""")
|
||||
|
||||
report_pos_order()
|
||||
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_report_pos_order_tree" model="ir.ui.view">
|
||||
<field name="name">report.pos.order.tree</field>
|
||||
<field name="model">report.pos.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Point of Sale Analysis">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="shop_id" invisible="1"/>
|
||||
<!--<field name="journal_id" invisible="1"/>-->
|
||||
<field name="date_validation" invisible="1"/>
|
||||
<field name="date_payment" invisible="1"/>
|
||||
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="product_qty" sum="# of Qty"/>
|
||||
<field name="average_price" sum="Average Price"/>
|
||||
<field name="total_discount" sum="Total Discount"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="delay_validation"/>
|
||||
<field name="delay_payment"/>
|
||||
<!--<field name="state" invisible="1"/>-->
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_pos_order_search" model="ir.ui.view">
|
||||
<field name="name">report.pos.order.search</field>
|
||||
<field name="model">report.pos.order</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Point of Sale Analysis">
|
||||
<group>
|
||||
<filter icon="terp-go-year" string="Year"
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
help="POS ordered created during current year"/>
|
||||
<filter icon="terp-go-month" string="Month"
|
||||
domain="[('date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created during current month"/>
|
||||
<filter icon="terp-go-month"
|
||||
string="Month -1"
|
||||
separator="1"
|
||||
domain="[('date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created last month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-go-today"
|
||||
string="Today"
|
||||
name="today"
|
||||
separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created by today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-dolar"
|
||||
string="Invoiced"
|
||||
domain="[('state','=',('invoiced'))]"/>
|
||||
<filter icon="terp-dolar"
|
||||
string="Paid"
|
||||
domain="[('state','=',('paid'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-personal"
|
||||
string="My Sales"
|
||||
help="My Sales"
|
||||
domain="[('user_id','=',uid)]"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended Filters..." groups="base.group_extended">
|
||||
<field name="date_validation"/>
|
||||
<field name="date_payment"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Salesman" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Customer" icon="terp-personal" context="{'group_by':'partner_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Day of order date"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}" help="Month of order date"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Year of order date"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_report_pos_order_all" model="ir.actions.act_window">
|
||||
<field name="name">Point of Sale Analysis</field>
|
||||
<field name="res_model">report.pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_report_pos_order_search"/>
|
||||
<field name="context">{'search_default_today':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_report_pos_order_all" id="menu_report_pos_order_all" parent="menu_point_rep" sequence="3"/>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -35,13 +35,11 @@ class all_closed_cashbox_of_the_day(osv.osv_memory):
|
||||
@return : retrun report
|
||||
"""
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = {}
|
||||
datas['form'] = res
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'all.closed.cashbox.of.the.day',
|
||||
'datas': datas,
|
||||
}
|
||||
}
|
||||
|
||||
all_closed_cashbox_of_the_day()
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class pos_box_entries(osv.osv_memory):
|
||||
}, context=context)
|
||||
|
||||
vals['statement_id'] = statement_id
|
||||
valss['journal_id'] = data['journal_id']
|
||||
vals['journal_id'] = data['journal_id']
|
||||
if acc_id:
|
||||
vals['account_id'] = acc_id.id
|
||||
vals['amount'] = data['amount'] or 0.0
|
||||
|
||||
@@ -123,7 +123,7 @@ class pos_box_out(osv.osv_memory):
|
||||
address_u = res_obj.browse(cr, uid, uid, context=context).address_id
|
||||
if address_u:
|
||||
vals['partner_id'] = address_u.partner_id and address_u.partner_id.id or None
|
||||
statement_line_id = statement_line_obj.create(cr, uid, vals, context=context)
|
||||
statement_line_obj.create(cr, uid, vals, context=context)
|
||||
return {}
|
||||
|
||||
pos_box_out()
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
import netsvc
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class pos_confirm(osv.osv_memory):
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class pos_details(osv.osv_memory):
|
||||
_name = 'pos.details'
|
||||
@@ -57,7 +55,7 @@ class pos_details(osv.osv_memory):
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'pos.details',
|
||||
'datas': datas,
|
||||
}
|
||||
}
|
||||
|
||||
pos_details()
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class pos_discount(osv.osv_memory):
|
||||
_name = 'pos.discount'
|
||||
@@ -45,12 +43,13 @@ class pos_discount(osv.osv_memory):
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view with new columns.
|
||||
"""
|
||||
res = super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
|
||||
super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
order = self.pool.get('pos.order').browse(cr, uid, record_id, context=context)
|
||||
if not order.lines:
|
||||
raise osv.except_osv('Error!','No Order Lines ')
|
||||
True
|
||||
|
||||
def apply_discount(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
To give the discount of product and check the.
|
||||
|
||||
@@ -42,15 +42,15 @@ class pos_make_payment(osv.osv_memory):
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
j_obj = self.pool.get('account.journal')
|
||||
order_obj=self.pool.get('pos.order')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
order_obj = self.pool.get('pos.order')
|
||||
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
|
||||
active_id = context and context.get('active_id', False)
|
||||
if active_id:
|
||||
cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
|
||||
"WHERE user_id = %d ORDER BY journal_id"% (uid, ))
|
||||
j_ids = map(lambda x1: x1[0], cr.fetchall())
|
||||
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)], context=context)
|
||||
journal = journal_obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)], context=context)
|
||||
journal = journal and journal[0] or False
|
||||
order = order_obj.browse(cr, uid, active_id, context=context)
|
||||
#get amount to pay
|
||||
@@ -105,7 +105,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
if context is None:
|
||||
context = {}
|
||||
active_model = context.get('active_model')
|
||||
active_id = context.get('active_id', False)
|
||||
active_id = context and context.get('active_id', False) or False
|
||||
if not active_id or (active_model and active_model != 'pos.order'):
|
||||
return result
|
||||
|
||||
@@ -141,25 +141,23 @@ class pos_make_payment(osv.osv_memory):
|
||||
"""
|
||||
order_obj = self.pool.get('pos.order')
|
||||
active_id = context and context.get('active_id', False)
|
||||
order = order_obj.browse(cr, uid, active_id, context)
|
||||
order = order_obj.browse(cr, uid, active_id, context=context)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
invoice_wanted = data['invoice_wanted']
|
||||
is_accompte = data['is_acc']
|
||||
# Todo need to check ...
|
||||
if is_accompte:
|
||||
if data['is_acc']:
|
||||
line_id, price = order_obj.add_product(cr, uid, order.id, data['product_id'], -1.0, context)
|
||||
amount = order.amount_total - order.amount_paid - price
|
||||
|
||||
if amount != 0.0:
|
||||
order_obj.write(cr, uid, [active_id], {'invoice_wanted': invoice_wanted, 'partner_id': data['partner_id']}, context=context)
|
||||
order_obj.write(cr, uid, [active_id], {'invoice_wanted': data['invoice_wanted'], 'partner_id': data['partner_id']}, context=context)
|
||||
order_obj.add_payment(cr, uid, active_id, data, context=context)
|
||||
|
||||
if order_obj.test_paid(cr, uid, [active_id]):
|
||||
if data['partner_id'] and invoice_wanted:
|
||||
if data['partner_id'] and data['invoice_wanted']:
|
||||
order_obj.action_invoice(cr, uid, [active_id], context)
|
||||
order_obj.create_picking(cr, uid, [active_id], context)
|
||||
if context.get('return'):
|
||||
if context.get('return', False):
|
||||
order_obj.write(cr, uid, [active_id], {'state':'done'}, context=context)
|
||||
else:
|
||||
order_obj.write(cr, uid, [active_id],{'state':'paid'}, context=context)
|
||||
@@ -167,7 +165,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
else:
|
||||
context.update({'flag': True})
|
||||
order_obj.action_paid(cr, uid, [active_id], context)
|
||||
if context.get('return'):
|
||||
if context.get('return', False):
|
||||
order_obj.write(cr, uid, [active_id], {'state':'done'}, context=context)
|
||||
else:
|
||||
order_obj.write(cr, uid, [active_id], {'state':'paid'}, context=context)
|
||||
@@ -188,7 +186,6 @@ class pos_make_payment(osv.osv_memory):
|
||||
"""
|
||||
active_ids = [context and context.get('active_id', False)]
|
||||
datas = {'ids': active_ids}
|
||||
datas['form'] = {}
|
||||
return {
|
||||
'type' : 'ir.actions.report.xml',
|
||||
'report_name':'pos.invoice',
|
||||
@@ -208,18 +205,16 @@ class pos_make_payment(osv.osv_memory):
|
||||
context = {}
|
||||
active_id = context.get('active_id', [])
|
||||
datas = {'ids' : [active_id]}
|
||||
res = {}
|
||||
datas['form'] = res
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'pos.receipt',
|
||||
'datas': datas,
|
||||
}
|
||||
}
|
||||
|
||||
_columns = {
|
||||
'journal': fields.selection(pos_box_entries.get_journal, "Cash Register", required=True),
|
||||
'product_id': fields.many2one('product.product', "Advance"),
|
||||
'amount': fields.float('Amount', digits=(16,2) ,required= True),
|
||||
'amount': fields.float('Amount', digits=(16,2), required= True),
|
||||
'payment_name': fields.char('Payment name', size=32, required=True),
|
||||
'payment_date': fields.date('Payment date', required=True),
|
||||
'is_acc': fields.boolean('Advance'),
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
class pos_payment_report(osv.osv_memory):
|
||||
_name = 'pos.payment.report'
|
||||
|
||||
@@ -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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -26,39 +26,31 @@ class pos_receipt(osv.osv_memory):
|
||||
_name = 'pos.receipt'
|
||||
_description = 'Point of sale receipt'
|
||||
|
||||
_columns = {
|
||||
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
"""
|
||||
Creates view dynamically and adding fields at runtime.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view with new columns.
|
||||
Creates view dynamically and adding fields at runtime.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view with new columns.
|
||||
"""
|
||||
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'])
|
||||
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'], context=context)
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
|
||||
"""
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : retrun report
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : retrun report
|
||||
"""
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = {}
|
||||
datas['form'] = res
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'pos.receipt',
|
||||
'datas': datas,
|
||||
}
|
||||
}
|
||||
|
||||
pos_receipt()
|
||||
|
||||
@@ -40,7 +40,7 @@ class stock_production_lot(osv.osv):
|
||||
# set date to False when no expiry time specified on the product
|
||||
date = duration and (datetime.datetime.today()
|
||||
+ datetime.timedelta(days=duration))
|
||||
return date and date.strftime('%Y-%m-%d %H:%M:%S')
|
||||
return date and date.strftime('%Y-%m-%d %H:%M:%S') or False
|
||||
return calc_date
|
||||
|
||||
_columns = {
|
||||
|
||||
@@ -325,7 +325,7 @@
|
||||
<field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/>
|
||||
<field name="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 name="do_open" states="pending,draft,done,cancelled" 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="terp-dialog-close" help="For changing to done state"/>
|
||||
</tree>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
<field name="help">This report allows you to analyse the performance of your projects and users. You can analyse the quantities of tasks, the hours spent compared to the planned hours, the average number of days to open or close a task, etc.</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_tasks_config" name="Tasks" parent="project.menu_definitions" sequence="1"/>
|
||||
<menuitem action="action_project_task_user_tree" id="menu_project_task_user_tree" parent="base.menu_project_report" groups="project.group_project_manager"/>
|
||||
|
||||
<!-- Views and action for project dashboard -->
|
||||
<record id="view_project_vs_remaining_hours_tree" model="ir.ui.view">
|
||||
|
||||
@@ -1,108 +1,108 @@
|
||||
-
|
||||
Test project template feature
|
||||
-
|
||||
-
|
||||
Create project 'OpenERP Training Programme'
|
||||
-
|
||||
-
|
||||
!record {model: project.project, id: project_project_openerptrainingprogramme0}:
|
||||
company_id: base.main_company
|
||||
name: OpenERP Training Programme
|
||||
-
|
||||
name: OpenERP Training Programme
|
||||
-
|
||||
Create task 'Technical Training' for this project
|
||||
-
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
date_start: '2010-05-31 11:48:38'
|
||||
name: Technical Training
|
||||
planned_hours: 30.0
|
||||
project_id: project_project_openerptrainingprogramme0
|
||||
remaining_hours: 30.0
|
||||
state: draft
|
||||
-
|
||||
state: draft
|
||||
-
|
||||
Create task 'Functional Training' for this project
|
||||
-
|
||||
-
|
||||
!record {model: project.task, id: project_task_functionaltraining0}:
|
||||
date_start: '2010-05-31 11:49:11'
|
||||
name: Functional Training
|
||||
planned_hours: 30.0
|
||||
project_id: project_project_openerptrainingprogramme0
|
||||
remaining_hours: 30.0
|
||||
state: draft
|
||||
-
|
||||
state: draft
|
||||
-
|
||||
Set project as project template
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.set_template(cr, uid, [ref("project_project_openerptrainingprogramme0")],
|
||||
{"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")],
|
||||
"tz": False, "active_id": ref("project.menu_open_view_project_all"), })
|
||||
-
|
||||
-
|
||||
Check if project in template state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}:
|
||||
- state == "template"
|
||||
-
|
||||
- state == "template"
|
||||
-
|
||||
Create new project based on this template
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")],
|
||||
{"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")],
|
||||
"tz": False, "active_id": ref("project.menu_open_view_project_all"), })
|
||||
if not new_prj:
|
||||
raise Exception( "New project based on template not created")
|
||||
raise Exception( "New project based on template not created")
|
||||
new_id = new_prj['res_id']
|
||||
new_prj = self.read(cr, uid, [new_id], ['name', 'state'])[0]
|
||||
state = new_prj['state']
|
||||
name = new_prj['name']
|
||||
assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state
|
||||
-
|
||||
Reset project template to normal project
|
||||
-
|
||||
name = new_prj['name']
|
||||
assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state
|
||||
-
|
||||
Reset project template to normal project
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids":
|
||||
[ref("project.menu_open_view_project_all")], "tz": False, "active_model":
|
||||
"ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"),
|
||||
})
|
||||
-
|
||||
-
|
||||
Check if project in open state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}:
|
||||
- state == "open"
|
||||
-
|
||||
Test for different project-states
|
||||
-
|
||||
Test for different project-states
|
||||
-
|
||||
Keep project pending
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids":
|
||||
[ref("project.menu_open_view_project_all")], "tz": False, "active_model":
|
||||
"ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"),
|
||||
})
|
||||
-
|
||||
-
|
||||
Check if project in pending state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}:
|
||||
- state == "pending"
|
||||
-
|
||||
- state == "pending"
|
||||
-
|
||||
Cancel the project
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.set_cancel(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids":
|
||||
[ref("project.menu_open_view_project_all")], "tz": False, "active_model":
|
||||
"ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"),
|
||||
})
|
||||
-
|
||||
-
|
||||
Check if project in cancel state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in cancel state}:
|
||||
- state == "cancelled"
|
||||
-
|
||||
-
|
||||
Re-open the project
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.set_open(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")],
|
||||
"tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id":
|
||||
ref("project.menu_open_view_project_all"), })
|
||||
-
|
||||
-
|
||||
Check if project in open state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}:
|
||||
- state == "open"
|
||||
-
|
||||
@@ -124,17 +124,17 @@
|
||||
self.compute_hours(cr, uid, [ref('project_task_technicaltraining_remainingwiz0')], {'active_id': ref("project_task_technicaltraining0"),'button_reactivate': True})
|
||||
- |
|
||||
Check if task 'Technical Training' in open state and for other initial values
|
||||
-
|
||||
-
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in open state}:
|
||||
- state == "open"
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 30
|
||||
- delay_hours == 0.0
|
||||
- effective_hours == 0.0
|
||||
-
|
||||
- effective_hours == 0.0
|
||||
-
|
||||
Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 15:04:22'
|
||||
hours: 10.0
|
||||
@@ -146,10 +146,10 @@
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}:
|
||||
- remaining_hours == 20
|
||||
- effective_hours == 10.0
|
||||
-
|
||||
-
|
||||
Make a work task entry 'Training on OpenERP xml views' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
|
||||
work_ids:
|
||||
- date: '2010-06-01 15:04:46'
|
||||
hours: 10.0
|
||||
@@ -161,10 +161,10 @@
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}:
|
||||
- remaining_hours == 10
|
||||
- effective_hours == 20.0
|
||||
-
|
||||
Make a work task entry 'Training on workflows' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
-
|
||||
Make a work task entry 'Training on workflows' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
|
||||
work_ids:
|
||||
- date: '2010-06-02 15:05:24'
|
||||
hours: 10.0
|
||||
@@ -176,20 +176,20 @@
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}:
|
||||
- remaining_hours == 0
|
||||
- effective_hours == 30.0
|
||||
-
|
||||
Set remaining hours of 10 hours for reevaluating the task
|
||||
-
|
||||
-
|
||||
Set remaining hours of 10 hours for reevaluating the task
|
||||
-
|
||||
!record {model: project.task.reevaluate, id: config_compute_remaining_0}:
|
||||
remaining_hours: 10.0
|
||||
-
|
||||
Reevaluate the task
|
||||
-
|
||||
-
|
||||
!python {model: project.task.reevaluate}: |
|
||||
self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US",
|
||||
"project_id": False, "tz": False, "active_model": "project.task", "search_default_project_id":
|
||||
False, "search_default_user_id": 1, "search_default_current": 1, "active_ids":
|
||||
[ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), })
|
||||
|
||||
|
||||
-
|
||||
Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30
|
||||
-
|
||||
@@ -197,10 +197,10 @@
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 10.0
|
||||
- effective_hours == 30.0
|
||||
-
|
||||
-
|
||||
Make a work task entry 'Training on reports and wizards' of 10 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 15:08:40'
|
||||
hours: 10.0
|
||||
@@ -213,28 +213,28 @@
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 0
|
||||
- effective_hours == 40.0
|
||||
-
|
||||
-
|
||||
Close the task
|
||||
-
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False})
|
||||
-
|
||||
-
|
||||
Check if task in done state
|
||||
-
|
||||
-
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}:
|
||||
- state == "done"
|
||||
|
||||
|
||||
- state == "done"
|
||||
|
||||
|
||||
-
|
||||
Test for task reactivation
|
||||
Test for task reactivation
|
||||
-
|
||||
Reactivate task
|
||||
-
|
||||
Reactivate task
|
||||
-
|
||||
!record {model: project.task.reevaluate, id: config_compute_remaining_1}:
|
||||
remaining_hours: 10.0
|
||||
-
|
||||
remaining_hours: 10.0
|
||||
-
|
||||
Reevaluate the task with 10 hours remaining
|
||||
-
|
||||
-
|
||||
!python {model: project.task.reevaluate}: |
|
||||
self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US",
|
||||
"project_id": False, "tz": False, "button_reactivate": True, "active_model":
|
||||
@@ -248,10 +248,10 @@
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 10.0
|
||||
- effective_hours == 40.0
|
||||
-
|
||||
-
|
||||
Make a work task entry 'Training on yml' of 5 hours
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0}:
|
||||
-
|
||||
!record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}:
|
||||
work_ids:
|
||||
- date: '2010-05-31 16:55:27'
|
||||
hours: 5.0
|
||||
@@ -264,16 +264,16 @@
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 5.0
|
||||
- effective_hours == 45.0
|
||||
-
|
||||
-
|
||||
Close the task
|
||||
-
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {'mail_send': False})
|
||||
-
|
||||
-
|
||||
Check if task in done state
|
||||
-
|
||||
-
|
||||
!assert {model: project.task, id: project_task_technicaltraining0, severity: error}:
|
||||
- state == "done"
|
||||
- state == "done"
|
||||
-
|
||||
Check for effective hours and remaining hours
|
||||
-
|
||||
@@ -281,16 +281,16 @@
|
||||
- planned_hours == 30
|
||||
- remaining_hours == 0.0
|
||||
- effective_hours == 45.0
|
||||
-
|
||||
-
|
||||
Close project 'OpenERP Training Programme'
|
||||
-
|
||||
-
|
||||
!python {model: project.project}: |
|
||||
self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")],
|
||||
"tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id":
|
||||
ref("project.menu_open_view_project_all"), })
|
||||
-
|
||||
-
|
||||
Check if project in close state
|
||||
-
|
||||
-
|
||||
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: "Project must be in closed state"}:
|
||||
- state == "close"
|
||||
|
||||
- state == "close"
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
<field name="model">project.task.close</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Send Email" >
|
||||
<form string="Send Email">
|
||||
<group colspan="4" col="4">
|
||||
<field name="manager_warn" invisible="1"/>
|
||||
<field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}"/>
|
||||
<field name="manager_email" widget="email" attrs="{'invisible':[('manager_warn','=',False)], 'required':[('manager_warn','=',True)]}" width="250"/>
|
||||
<field name="partner_warn" invisible="1"/>
|
||||
<field name="partner_email" widget="email" attrs="{'invisible':[('partner_warn','=',False)], 'required':[('partner_warn','=',True)]}"/>
|
||||
<separator string="Warn Message" colspan="4"/>
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
<field name="description" nolabel="1" colspan="4" width="200" height="150"/>
|
||||
</group>
|
||||
<separator string="" colspan="4"/>
|
||||
<group colspan="2" col="2">
|
||||
|
||||
@@ -32,6 +32,7 @@ class project_task(osv.osv):
|
||||
# force inherit from project.project_task so that
|
||||
# calendar.todo.active is masked oute
|
||||
'active': base_project_task._columns['active'],
|
||||
'date_deadline': base_project_task._columns['date_deadline'],
|
||||
'write_date': fields.datetime('Write Date'),
|
||||
'create_date': fields.datetime('Create Date', readonly=True),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', \
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<button name="case_reset" string="Reset to Draft" states="done,cancel" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Emails" groups="base.group_extended">
|
||||
<page string="History" groups="base.group_extended">
|
||||
<group colspan="4">
|
||||
<field colspan="4" name="email_cc" string="Global CC" widget="url"/>
|
||||
</group>
|
||||
@@ -146,7 +146,7 @@
|
||||
context="{'mail':'new', 'model': 'project.issue'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
</page>
|
||||
<page string="History" groups="base.group_extended">
|
||||
<page string="Extra Info" groups="base.group_extended">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Date"/>
|
||||
<field name="create_date"/>
|
||||
|
||||
@@ -346,6 +346,30 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_phase_task_search_form_group" model="ir.ui.view">
|
||||
<field name="name">phase.task.search.form.group</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="project.view_task_search_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}" position="after">
|
||||
<filter string="Project Phase" name="group_project_id_phase" icon="terp-folder-violet" domain="[]" context="{'group_by':'phase_id'}" groups="base.group_extended"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_phase_task_search_form_tree" model="ir.ui.view">
|
||||
<field name="name">phase.task.search.form.tree</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="project.view_task_tree2"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="project_id" position="after">
|
||||
<field name="phase_id" invisible="1" groups="base.group_extended"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="project_phase_task_list"
|
||||
name="Related Tasks"
|
||||
|
||||
@@ -80,42 +80,42 @@ class project_work(osv.osv):
|
||||
|
||||
vals_line = {}
|
||||
context = kwargs.get('context', {})
|
||||
if not context.get('no_analytic_entry',False):
|
||||
obj_task = task_obj.browse(cr, uid, vals['task_id'])
|
||||
result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
|
||||
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
|
||||
vals_line['user_id'] = vals['user_id']
|
||||
vals_line['product_id'] = result['product_id']
|
||||
vals_line['date'] = vals['date'][:10]
|
||||
|
||||
#calculate quantity based on employee's product's uom
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
|
||||
obj_task = task_obj.browse(cr, uid, vals['task_id'])
|
||||
result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
|
||||
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
|
||||
vals_line['user_id'] = vals['user_id']
|
||||
vals_line['product_id'] = result['product_id']
|
||||
vals_line['date'] = vals['date'][:10]
|
||||
|
||||
#calculate quantity based on employee's product's uom
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
|
||||
if result['product_uom_id'] != default_uom:
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
|
||||
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
|
||||
if acc_id:
|
||||
vals_line['account_id'] = acc_id
|
||||
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
|
||||
if res.get('value'):
|
||||
vals_line.update(res['value'])
|
||||
vals_line['general_account_id'] = result['general_account_id']
|
||||
vals_line['journal_id'] = result['journal_id']
|
||||
vals_line['amount'] = 0.0
|
||||
vals_line['product_uom_id'] = result['product_uom_id']
|
||||
amount = vals_line['unit_amount']
|
||||
prod_id = vals_line['product_id']
|
||||
unit = False
|
||||
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)
|
||||
|
||||
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
|
||||
if result['product_uom_id'] != default_uom:
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
|
||||
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
|
||||
if acc_id:
|
||||
vals_line['account_id'] = acc_id
|
||||
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
|
||||
if res.get('value'):
|
||||
vals_line.update(res['value'])
|
||||
vals_line['general_account_id'] = result['general_account_id']
|
||||
vals_line['journal_id'] = result['journal_id']
|
||||
vals_line['amount'] = 0.0
|
||||
vals_line['product_uom_id'] = result['product_uom_id']
|
||||
amount = vals_line['unit_amount']
|
||||
prod_id = vals_line['product_id']
|
||||
unit = False
|
||||
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)
|
||||
|
||||
# Compute based on pricetype
|
||||
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
|
||||
prod_id, amount, False, unit, context=context)
|
||||
if amount_unit and 'amount' in amount_unit.get('value',{}):
|
||||
updv = { 'amount': amount_unit['value']['amount'] }
|
||||
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
|
||||
vals['hr_analytic_timesheet_id'] = timeline_id
|
||||
# Compute based on pricetype
|
||||
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
|
||||
prod_id, amount, False, unit, context=context)
|
||||
if amount_unit and 'amount' in amount_unit.get('value',{}):
|
||||
updv = { 'amount': amount_unit['value']['amount'] }
|
||||
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
|
||||
vals['hr_analytic_timesheet_id'] = timeline_id
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
||||
+3
-2
@@ -931,9 +931,10 @@ class sale_order_line(osv.osv):
|
||||
'for this product: "%s" (id:%d)') % \
|
||||
(line.product_id.name, line.product_id.id,))
|
||||
else:
|
||||
a = self.pool.get('ir.property').get(cr, uid,
|
||||
prop = self.pool.get('ir.property').get(cr, uid,
|
||||
'property_account_income_categ', 'product.category',
|
||||
context=context).id
|
||||
context=context)
|
||||
a = prop and prop.id or False
|
||||
uosqty = _get_line_qty(line)
|
||||
uos_id = _get_line_uom(line)
|
||||
pu = 0.0
|
||||
|
||||
@@ -292,6 +292,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="search_view_id" ref="view_sales_order_filter"/>
|
||||
<field name="context">{"search_default_user_id":uid}</field>
|
||||
<field name="help">Sales Orders helps you manage quotations and orders done with your customers. OpenERP suggests that you to start by creating a quotation. Once the order is confirmed, the quotation is converted into a Sale Order. OpenERP can handle several types of products so that a sales order can trigger tasks, delivery orders, manufacturing orders, purchases and so on. Based on the configuration of the sale order, a draft invoice will be generated so that you just have to confirm it when you want to bill your customer.</field>
|
||||
</record>
|
||||
<menuitem action="action_order_form" id="menu_sale_order" parent="base.menu_sales" sequence="3" groups="base.group_sale_salesman,base.group_sale_manager"/>
|
||||
|
||||
@@ -31,6 +31,19 @@
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="sale_order_personal_rule" model="ir.rule">
|
||||
<field name="name">Personal Orders</field>
|
||||
<field ref="model_sale_order" name="model_id"/>
|
||||
<field name="domain_force">['|',('user_id','=',user.id),('user_id','=',False)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="sale_order_line_personal_rule" model="ir.rule">
|
||||
<field name="name">Personal Order Lines</field>
|
||||
<field ref="model_sale_order_line" name="model_id"/>
|
||||
<field name="domain_force">['|',('order_id.user_id','=',user.id),('order_id.user_id','=',False)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user