parent
aace682897
commit
3fbbe298e6
|
@ -281,7 +281,16 @@ class account_account(osv.osv):
|
|||
|
||||
'parent_left': fields.integer('Parent Left', select=1),
|
||||
'parent_right': fields.integer('Parent Right', select=1),
|
||||
'check_history': fields.boolean('Display History', help="Check this box if you want to print all entries when printing the General Ledger, otherwise it will only print its balance.")
|
||||
'currency_mode': fields.selection([('current','At Date'),('average','Average Rate')], 'Outgoing Currencies Rate',
|
||||
help=
|
||||
'This will select how is computed the current currency rate for outgoing transactions. '\
|
||||
'In most countries the legal method is "average" but only a few softwares are able to '\
|
||||
'manage this. So if you import from another software, you may have to use the rate at date. ' \
|
||||
'Incoming transactions, always use the rate at date.', \
|
||||
required=True),
|
||||
'check_history': fields.boolean('Display History',
|
||||
help="Check this box if you want to print all entries when printing the General Ledger, "\
|
||||
"otherwise it will only print its balance.")
|
||||
}
|
||||
|
||||
def _default_company(self, cr, uid, context={}):
|
||||
|
@ -296,6 +305,7 @@ class account_account(osv.osv):
|
|||
'company_id': _default_company,
|
||||
'active': lambda *a: True,
|
||||
'check_history': lambda *a: True,
|
||||
'currency_mode': lambda *a: 'current'
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
|
|
|
@ -191,8 +191,14 @@ class account_bank_statement(osv.osv):
|
|||
continue
|
||||
|
||||
torec = []
|
||||
if move.amount >= 0:
|
||||
account_id = st.journal_id.default_credit_account_id.id
|
||||
else:
|
||||
account_id = st.journal_id.default_debit_account_id.id
|
||||
acc_cur = ((move.amount<=0) and st.journal_id.default_debit_account_id) or move.account_id
|
||||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, move.amount, context=context)
|
||||
company_currency_id, move.amount, context=context,
|
||||
account=acc_cur)
|
||||
if move.reconcile_id and move.reconcile_id.line_new_ids:
|
||||
for newline in move.reconcile_id.line_new_ids:
|
||||
amount += newline.amount
|
||||
|
@ -213,7 +219,8 @@ class account_bank_statement(osv.osv):
|
|||
}
|
||||
|
||||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, move.amount, context=context)
|
||||
company_currency_id, move.amount, context=context,
|
||||
account=acc_cur)
|
||||
|
||||
if move.account_id and move.account_id.currency_id:
|
||||
val['currency_id'] = move.account_id.currency_id.id
|
||||
|
@ -221,7 +228,8 @@ class account_bank_statement(osv.osv):
|
|||
amount_cur = move.amount
|
||||
else:
|
||||
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
|
||||
move.account_id.currency_id.id, amount, context=context)
|
||||
move.account_id.currency_id.id, amount, context=context,
|
||||
account=acc_cur)
|
||||
val['amount_currency'] = amount_cur
|
||||
|
||||
torec.append(account_move_line_obj.create(cr, uid, val , context=context))
|
||||
|
@ -242,11 +250,6 @@ class account_bank_statement(osv.osv):
|
|||
'period_id': st.period_id.id,
|
||||
}, context=context)
|
||||
|
||||
if amount >= 0:
|
||||
account_id = st.journal_id.default_credit_account_id.id
|
||||
else:
|
||||
account_id = st.journal_id.default_debit_account_id.id
|
||||
|
||||
# Fill the secondary amount/currency
|
||||
# if currency is not the same than the company
|
||||
amount_currency = False
|
||||
|
@ -370,10 +373,16 @@ class account_bank_statement_reconcile(osv.osv):
|
|||
context=context).company_id.currency_id.id
|
||||
currency_id = context.get('currency_id', company_currency_id)
|
||||
|
||||
acc_cur = None
|
||||
if context.get('journal_id', False) and context.get('account_id',False):
|
||||
st =self.pool.get('account.journal').browse(cursor, user, context['journal_id'])
|
||||
acc = self.pool.get('account.account').browse(cursor, user, context['account_id'])
|
||||
acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc
|
||||
|
||||
for reconcile_id in ids:
|
||||
res[reconcile_id] = res_currency_obj.compute(cursor, user,
|
||||
currency_id, company_currency_id,
|
||||
context.get('amount', 0.0), context=context)
|
||||
context.get('amount', 0.0), context=context, account=acc_cur)
|
||||
return res
|
||||
|
||||
def _default_amount(self, cursor, user, context=None):
|
||||
|
@ -386,9 +395,15 @@ class account_bank_statement_reconcile(osv.osv):
|
|||
context=context).company_id.currency_id.id
|
||||
currency_id = context.get('currency_id', company_currency_id)
|
||||
|
||||
acc_cur = None
|
||||
if context.get('journal_id', False) and context.get('account_id',False):
|
||||
st =self.pool.get('account.journal').browse(cursor, user, context['journal_id'])
|
||||
acc = self.pool.get('account.account').browse(cursor, user, context['account_id'])
|
||||
acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc
|
||||
|
||||
return res_currency_obj.compute(cursor, user,
|
||||
currency_id, company_currency_id,
|
||||
context.get('amount', 0.0), context=context)
|
||||
context.get('amount', 0.0), context=context, account=acc_cur)
|
||||
|
||||
def _total_currency(self, cursor, user, ids, name, attrs, context=None):
|
||||
res = {}
|
||||
|
|
|
@ -122,8 +122,9 @@
|
|||
<page string="General Information">
|
||||
<newline/>
|
||||
<field name="currency_id" select="2"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="currency_mode" select="2"/>
|
||||
<field name="reconcile"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="check_history"/>
|
||||
<newline/>
|
||||
<newline/>
|
||||
|
@ -323,7 +324,7 @@
|
|||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
||||
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
|
||||
<field name="amount"/>
|
||||
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency}" name="reconcile_id"/>
|
||||
<field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id}" name="reconcile_id"/>
|
||||
<field invisible="1" name="reconcile_amount"/>
|
||||
</tree>
|
||||
<form string="Statement lines">
|
||||
|
@ -333,7 +334,7 @@
|
|||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
||||
<field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id"/>
|
||||
<field name="amount"/>
|
||||
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id}" name="reconcile_id"/>
|
||||
<field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'journal_id':parent.journal_id}" name="reconcile_id"/>
|
||||
<field name="ref"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
|
|
|
@ -1001,7 +1001,7 @@ class mrp_procurement(osv.osv):
|
|||
}
|
||||
|
||||
taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
|
||||
self.pool.get('account.fiscal.position').map_tax(cr, uid, partner, taxes)
|
||||
self.pool.get('account.fiscal.position').map_tax(cr, uid, partner, taxes_ids)
|
||||
line.update({
|
||||
'taxes_id':[(6,0,taxes_ids)]
|
||||
})
|
||||
|
|
|
@ -2,76 +2,79 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<wizard id="action_open_margin" menu="False" model="product.product" name="product.margins" string="Product Margins"/>
|
||||
|
||||
<wizard id="action_open_margin" menu="False" model="product.product" name="product.margins" string="Product Margins"/>
|
||||
|
||||
<menuitem id="menu_product_reporting" name="Reporting" parent ="product.menu_main_product" />
|
||||
|
||||
|
||||
<menuitem icon="STOCK_JUSTIFY_FILL" action="action_open_margin" id="menu_action_product_margin" type="wizard" sequence="5" parent="menu_product_reporting" />
|
||||
|
||||
<record model="ir.ui.view" id="view_product_margin_graph">
|
||||
|
||||
<record model="ir.ui.view" id="view_product_margin_graph">
|
||||
<field name="name">product.margin.graph</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="sequence" eval="50"/>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Product Margins" type="bar">
|
||||
<field name="name"/>
|
||||
<field name="turnover" operator="+"/>
|
||||
<field name="total_cost" operator="+"/>
|
||||
<field name="total_cost" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_margin_form" model="ir.ui.view">
|
||||
<record id="view_product_margin_form" model="ir.ui.view">
|
||||
<field name="name">product.margin.form.inherit</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority">5</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product Margins">
|
||||
<group col="6" colspan="4">
|
||||
<field name="sequence" eval="50"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product Margins">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1"/>
|
||||
<field name="default_code" select="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Margins">
|
||||
<separator string="Analysis Criteria" colspan="4"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<newline/>
|
||||
<field name="invoice_state" />
|
||||
|
||||
<separator string="Sales" colspan="4"/>
|
||||
<field name="sale_avg_price"/>
|
||||
<field name="list_price" string="Catalog Price" readonly="1"/>
|
||||
<field name="sale_num_invoiced" />
|
||||
<field name="sales_gap" />
|
||||
<field name="turnover" />
|
||||
<field name="sale_expected" />
|
||||
|
||||
<separator string="Purchases" colspan="4"/>
|
||||
<field name="purchase_avg_price"/>
|
||||
<field name="standard_price" string="Standard Price" readonly="1"/>
|
||||
<field name="purchase_num_invoiced" />
|
||||
<field name="purchase_gap" />
|
||||
<field name="total_cost" />
|
||||
<field name="normal_cost" />
|
||||
|
||||
<separator string="Margins" colspan="4"/>
|
||||
<field name="total_margin"/>
|
||||
<field name="expected_margin"/>
|
||||
<field name="total_margin_rate" widget="progressbar"/>
|
||||
<field name="expected_margin_rate" widget="progressbar"/>
|
||||
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Margins">
|
||||
<separator string="Analysis Criteria" colspan="4"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<newline/>
|
||||
<field name="invoice_state" />
|
||||
|
||||
<separator string="Sales" colspan="4"/>
|
||||
<field name="sale_avg_price"/>
|
||||
<field name="list_price" string="Catalog Price" readonly="1"/>
|
||||
<field name="sale_num_invoiced" />
|
||||
<field name="sales_gap" />
|
||||
<field name="turnover" />
|
||||
<field name="sale_expected" />
|
||||
|
||||
<separator string="Purchases" colspan="4"/>
|
||||
<field name="purchase_avg_price"/>
|
||||
<field name="standard_price" string="Standard Price" readonly="1"/>
|
||||
<field name="purchase_num_invoiced" />
|
||||
<field name="purchase_gap" />
|
||||
<field name="total_cost" />
|
||||
<field name="normal_cost" />
|
||||
|
||||
<separator string="Margins" colspan="4"/>
|
||||
<field name="total_margin"/>
|
||||
<field name="expected_margin"/>
|
||||
<field name="total_margin_rate" widget="progressbar"/>
|
||||
<field name="expected_margin_rate" widget="progressbar"/>
|
||||
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_margin_tree" model="ir.ui.view">
|
||||
|
||||
<record id="view_product_margin_tree" model="ir.ui.view">
|
||||
<field name="name">product.margin.tree</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="sequence" eval="50"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product Margins">
|
||||
<field name="name" select="1"/>
|
||||
|
@ -89,6 +92,6 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -43,9 +43,9 @@ def _action_open_window(self, cr, uid, data, context):
|
|||
'res_model':'product.product',
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_id': view_res,
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class product_margins(wizard.interface):
|
||||
form1 = '''<?xml version="1.0"?>
|
||||
<form string="View Stock of Products">
|
||||
|
@ -58,13 +58,13 @@ class product_margins(wizard.interface):
|
|||
'from_date': {
|
||||
'string': 'From',
|
||||
'type': 'date',
|
||||
'default': lambda *a:time.strftime('%Y-01-01'),
|
||||
'default': lambda *a:time.strftime('%Y-01-01'),
|
||||
|
||||
},
|
||||
'to_date': {
|
||||
'string': 'To',
|
||||
'type': 'date',
|
||||
'default': lambda *a:time.strftime('%Y-12-31'),
|
||||
'default': lambda *a:time.strftime('%Y-12-31'),
|
||||
|
||||
},
|
||||
'invoice_state': {
|
||||
|
|
Loading…
Reference in New Issue