bzr revid: vir@tinyerp.com-20100910055932-sg2i20ky2sy4nsj5
This commit is contained in:
Vir (Open ERP)
2010-09-10 11:29:32 +05:30
9 changed files with 86 additions and 52 deletions
+6
View File
@@ -109,6 +109,8 @@
<field name="base_amount"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="factor_base" invisible="True"/>
<field name="factor_tax" invisible="True"/>
</form>
</field>
</record>
@@ -194,6 +196,8 @@
<field invisible="True" name="base_amount"/>
<field invisible="True" name="tax_amount"/>
<field name="factor_base" invisible="True"/>
<field name="factor_tax" invisible="True"/>
</tree>
</field>
</group>
@@ -286,6 +290,8 @@
<field name="amount" on_change="amount_change(amount,parent.currency_id,parent.company_id,parent.date_invoice)"/>
<field invisible="True" name="base_amount"/>
<field invisible="True" name="tax_amount"/>
<field name="factor_base" invisible="True"/>
<field name="factor_tax" invisible="True"/>
</tree>
</field>
</group>
+27 -8
View File
@@ -1471,6 +1471,24 @@ account_invoice_line()
class account_invoice_tax(osv.osv):
_name = "account.invoice.tax"
_description = "Invoice Tax"
def _count_factor(self, cr, uid, ids, name, args, context=None):
res = {}
for invoice_tax in self.browse(cr, uid, ids, context=context):
res[invoice_tax.id] = {
'factor_base': 1.0,
'factor_tax': 1.0,
}
if invoice_tax.amount <> 0.0:
factor_tax = invoice_tax.tax_amount / invoice_tax.amount
res[invoice_tax.id]['factor_tax'] = factor_tax
if invoice_tax.base <> 0.0:
factor_base = invoice_tax.base_amount / invoice_tax.base
res[invoice_tax.id]['factor_base'] = factor_base
return res
_columns = {
'invoice_id': fields.many2one('account.invoice', 'Invoice Line', ondelete='cascade', select=True),
'name': fields.char('Tax Description', size=64, required=True),
@@ -1485,33 +1503,34 @@ class account_invoice_tax(osv.osv):
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')),
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
}
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency = False
factor = 1
if ids:
factor = self.read(cr, uid, ids[0], ['factor_base'])['factor_base']
if company_id:
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
base = cur_obj.compute(cr, uid, currency_id, company_currency, base*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'base_amount':base}}
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency = False
tax_sign = 1
factor = 1
if ids:
tax_amount = self.read(cr, uid, ids[0], ['tax_amount'])['tax_amount']
if tax_amount < 0:
tax_sign = -1
elif tax_amount == 0:
tax_sign = 0
factor = self.read(cr, uid, ids[0], ['factor_tax'])['factor_tax']
if company_id:
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*tax_sign, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'tax_amount': amount}}
_order = 'sequence'
@@ -8,5 +8,14 @@
name="account.invoice.layout"
rml="account_invoice_layout/report/report_account_invoice_layout.rml"
auto="False"/>
<report id="account_invoices_layout_message"
menu="False"
string="Invoices with Layout and Message"
model="account.invoice"
name="notify_account.invoice"
rml="account_invoice_layout/report/special_message_invoice.rml"
auto="False"/>
</data>
</openerp>
+2 -2
View File
@@ -119,7 +119,7 @@ class crm_lead(crm_case, osv.osv):
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
'categ_id': fields.many2one('crm.case.categ', 'Lead Source', \
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]"),
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', \
@@ -148,7 +148,7 @@ class crm_lead(crm_case, osv.osv):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}
+5 -8
View File
@@ -57,6 +57,9 @@
<group colspan="4" col="7">
<field name="name" required="1" string="Name"/>
<field name="priority"/>
<field name="categ_id"
widget="selection"
domain="[('object_id.model','=','crm.lead')]"/>
<button
name="convert_opportunity"
string="Convert to Opportunity"
@@ -71,10 +74,10 @@
domain="[('section_id','=',section_id), ('object_id.model', '=', 'crm.lead')]" />
<group col="2" colspan="1">
<button name="stage_previous" string="Previous"
states="open,pending" type="object"
states="open,pending,draft" type="object"
icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
states="open,pending,draft" type="object"
icon="gtk-go-forward" />
</group>
<field name="type" invisible="1"/>
@@ -144,9 +147,6 @@
<field name="company_id"
groups="base.group_multi_company"
widget="selection" colspan="2" />
<field name="categ_id"
widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
<field name="type_id" string="Campaign" select="1"/>
<field name="referred"/>
</group>
@@ -265,9 +265,6 @@
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</record>
+8 -13
View File
@@ -36,8 +36,6 @@
<field name="date_action"/>
<field name="title_action"/>
<field name="priority" string="Priority"/>
<button string="Merge with other Opportunity"
name="%(merge_opportunity_act)d" icon="gtk-add" type="action" />
<newline/>
<field name="type" invisible="1"/>
</group>
@@ -55,9 +53,9 @@
attrs="{'invisible':[('partner_id','!=',False)]}"/>
</group>
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
@@ -142,9 +140,9 @@
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
<field name="email_to" size="512"/>
<field name="email_cc" size="512"/>
<field name="name" colspan="4"/>
<field name="history" invisible="1"/>
</group>
<notebook colspan="4">
@@ -236,7 +234,7 @@
<button name="stage_next" string="Next Stage"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="planned_revenue" sum="Total of Planned Revenue"/>
<field name="planned_revenue" sum="Expected Revenues"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="section_id"
invisible="context.get('invisible_section', True)" />
@@ -250,9 +248,6 @@
<button name="case_pending" string="Pending"
states="open,draft" type="object"
icon="gtk-media-pause" />
<button name="case_mark_lost" string="Lost"
states="open,pending" type="object"
icon="gtk-cancel" />
<button name="case_close" string="Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
@@ -303,12 +298,12 @@
/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="user_id">
<filter icon="terp-personal-"
domain="[('user_id','=', False)]"
help="Unassigned Opportunities" />
</field>
<field name="email_from"/>
<field name="section_id"
default="context.get('section_id', False)"
context="{'invisible_section': False}"
+13 -2
View File
@@ -176,6 +176,14 @@ class mailgate_message(osv.osv):
'''
Mailgateway Message
'''
def truncate_data(self, cr, uid, data, context=None):
data_list = data and data.split('\n') or []
if len(data_list) > 3:
res = '\n\t'.join(data_list[:3]) + '...'
else:
res = '\n\t'.join(data_list)
return res
def _get_display_text(self, cr, uid, ids, name, arg, context=None):
if context is None:
context = {}
@@ -186,11 +194,14 @@ class mailgate_message(osv.osv):
if message.history:
msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.description:
msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...'
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
else:
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.name == _('Opportunity'):
msg_txt += _("Converted to Opportunity")
elif message.name == _('Note'):
msg_txt = (message.user_id.name or '/') + _(' added note on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
else:
msg_txt += _("Changed Status to: ") + message.name
result[message.id] = msg_txt
+3 -5
View File
@@ -80,10 +80,9 @@
<field name="arch" type="xml">
<tree string="Sales orders">
<field name="name"/>
<field name="date_order"/>
<field name="partner_id"/>
<field name="user_id" />
<field name="date_order"/>
<field name="partner_shipping_id"/>
<field name="picked_rate" widget="progressbar"/>
<field name="invoiced_rate" widget="progressbar"/>
<field name="amount_untaxed" sum="Total Untaxed amount"/>
@@ -262,12 +261,11 @@
<filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sale Orders ready to be invoiced"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="date_order" select="1" string="Order date" />
<field name="partner_id" select="1"/>
<field name="user_id" select="1">
<filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
<filter domain="[('user_id','=',uid)]" help="My Sale Orders" icon="terp-personal"/>
</field>
<field name="date_order" select="1" string="Order date" />
<newline/>
<group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_extended">
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
+13 -14
View File
@@ -245,7 +245,7 @@
<newline/>
<field name="author_id" readonly="1"/>
<newline/>
<separator string="Description" colspan="4"/>
<separator string="Description" colspan="4"/>
<field colspan="4" name="description" nolabel="1"/>
</form>
</field>
@@ -549,7 +549,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Entry Lines">
<group height="200" width="500">
<group height="200" width="500">
<field name="address_id" invisible="True" context="{'contact_display':'partner'}"/>
<field name="picking_id" invisible="True"/>
<field domain="[('picking_id','&lt;&gt;',picking_id),('state','in',['confirmed','assigned']),('picking_id.address_id','=',address_id)]" name="move_ids" nolabel="1" height="100" width="500"/><newline/>
@@ -562,14 +562,14 @@
</field>
</record>
<act_window name="Unreceived Products"
res_model="stock.picking.move.wizard"
src_model="stock.picking"
view_mode="form"
target="new"
<act_window name="Unreceived Products"
res_model="stock.picking.move.wizard"
src_model="stock.picking"
view_mode="form"
target="new"
key2="client_action_multi"
id="act_stock_picking_move_wizard"/>
id="act_stock_picking_move_wizard"/>
<record model="ir.ui.view" id="stock_picking_calendar">
<field name="name">stock.picking.calendar</field>
<field name="model">stock.picking</field>
@@ -597,8 +597,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-go-forward" help="Approve Picking"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the picking. Do you want to continue?"/>
<button name="%(action_partial_picking)d" states="confirmed,assigned" string="Approve" type="action" icon="gtk-go-forward" help="Approve Picking"/>
</tree>
</field>
</record>
@@ -1124,7 +1123,7 @@
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
</group>
</page>
@@ -1335,7 +1334,7 @@
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Products Received" type="action" icon="gtk-ok"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
</group>
</page>
@@ -1790,7 +1789,7 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context">{"search_default_receive":1}</field>
<field name="search_view_id" ref="view_move_search_reception_picking"/>