[MERGE]: Merged with parent
bzr revid: uco@tinyerp.co.in-20091212135838-a77n0yp8cd2wfq3g
This commit is contained in:
@@ -26,8 +26,8 @@
|
||||
<search string="Analytic Account">
|
||||
<group col="8" colspan="4">
|
||||
<filter icon="gtk-execute" string="My Accounts" domain="[('user_id','=',uid)]" help="My Analytic Accounts"/>
|
||||
<filter icon="gtk-execute" string="Current" domain="[('user_id','=',uid),('state','=','open')]" help="My Current Accounts"/>
|
||||
<filter icon="gtk-execute" string="Pending" domain="[('user_id','=',uid),('state','=','pending')]" help="My Pending Accounts"/>
|
||||
<filter icon="gtk-execute" string="Current" domain="[('state','=','open')]" help="Current Accounts"/>
|
||||
<filter icon="gtk-execute" string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
|
||||
@@ -101,9 +101,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Meetings">
|
||||
<group col="10" colspan="4">
|
||||
<filter icon="terp-crm" string="My Meetings" domain="[('user_id','=',uid)]" help="My Meetings"/>
|
||||
<filter icon="terp-crm" string="Draft" domain="[('state','=','draft')]" help="Draft Meetings"/>
|
||||
<filter icon="terp-crm" string="Confirmed" domain="[('state','=','done')]" help="Confirmed Meetings"/>
|
||||
<filter icon="terp-crm" string="My Meetings" domain="[('user_id','=',uid)]" help="My Meetings"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1" string="Subject"/>
|
||||
<field name="partner_id" select="1"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="crm_configuration.menu_crm_case_category_act_meetings" model="ir.ui.menu">
|
||||
<record id="crm.menu_crm_case_category_act_meetings" model="ir.ui.menu">
|
||||
<field eval=""Calendar of Meetings"" name="name"/>
|
||||
<field eval=""terp-calendar"" name="icon"/>
|
||||
<field eval="False" name="parent_id"/>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
"id","expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
|
||||
1,0,,,,0,1,"indicator","BILAN","Bilan"
|
||||
2,"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
|
||||
3,"balance('2')",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
|
||||
4,"balance('3')",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
|
||||
5,"balance('4')",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
|
||||
6,"balance('5')",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
|
||||
7,"report('BCAP') + report('BRESNET')",,"BILAN",1,0,1,"fiscal","PASSIF","Passif"
|
||||
8,"balance('1')",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
|
||||
9,"-balance('7')+balance('6')",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
|
||||
10,0,,,,0,1,"fiscal","CRES","Compte des résultats"
|
||||
11,"report('CCHAR','CBENEF')",,"CRES",,0,1,"fiscal","CRESACTIF","Résultat Actif"
|
||||
12,"balance('6')",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
|
||||
13,"report('CRESPROD')",,"CRES",,0,1,"fiscal","CRESPASSIF","Résultat Passif"
|
||||
14,"-balance('7')",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
|
||||
15,"-balance('7')+balance('6')",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
|
||||
16,0,,,,0,1,"indicator","IIMMO","Immobilisations"
|
||||
17,"balance('1')/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
|
||||
18,0,,,,0,1,"indicator","ITRE","Trésorerie"
|
||||
19,"balance('3','4','5') / balance('101','13','15','16','17','18')","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
|
||||
20,"balance('4','5') / balance('101','13','15','16','17','18')",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"
|
||||
"expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
|
||||
0,,,,0,1,"indicator","BILAN","Bilan"
|
||||
"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
|
||||
"balance('2')",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
|
||||
"balance('3')",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
|
||||
"balance('4')",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
|
||||
"balance('5')",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
|
||||
"report('BCAP') + report('BRESNET')",,"BILAN",1,0,1,"fiscal","PASSIF","Passif"
|
||||
"balance('1')",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
|
||||
"-balance('7')+balance('6')",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
|
||||
0,,,,0,1,"fiscal","CRES","Compte des résultats"
|
||||
"report('CCHAR','CBENEF')",,"CRES",,0,1,"fiscal","CRESACTIF","Résultat Actif"
|
||||
"balance('6')",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
|
||||
"report('CRESPROD')",,"CRES",,0,1,"fiscal","CRESPASSIF","Résultat Passif"
|
||||
"-balance('7')",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
|
||||
"-balance('7')+balance('6')",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
|
||||
0,,,,0,1,"indicator","IIMMO","Immobilisations"
|
||||
"balance('1')/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
|
||||
0,,,,0,1,"indicator","ITRE","Trésorerie"
|
||||
"balance('3','4','5') / balance('101','13','15','16','17','18')","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
|
||||
"balance('4','5') / balance('101','13','15','16','17','18')",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"
|
||||
|
||||
|
@@ -1,21 +1,21 @@
|
||||
"id","expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
|
||||
1,0,,,,0,1,"indicator","BILAN","Bilan"
|
||||
2,"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
|
||||
3,"balance(['2'])",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
|
||||
4,"balance(['3']",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
|
||||
5,"balance(['4'])",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
|
||||
6,"balance(['5'])",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
|
||||
7,"report('BCAP') + report('BRESNET')",,"BILAN",1,0,1,"fiscal","PASSIF","Passif"
|
||||
8,"balance(['1'])",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
|
||||
9,"-balance(['7'])+balance(['6'])",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
|
||||
10,0,,,,0,1,"fiscal","CRES","Compte des résultats"
|
||||
11,"report('CCHAR','CBENEF')",,"CRES",,0,1,"fiscal","CRESACTIF","Résultat Actif"
|
||||
12,"balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
|
||||
13,"report('CRESPROD')",,"CRES",,0,1,"fiscal","CRESPASSIF","Résultat Passif"
|
||||
14,"-balance(['7'])",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
|
||||
15,"-balance(['7'])+balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
|
||||
16,0,,,,0,1,"indicator","IIMMO","Immobilisations"
|
||||
17,"balance(['1'])/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
|
||||
18,0,,,,0,1,"indicator","ITRE","Trésorerie"
|
||||
19,"balance(['3','4','5']) / balance(['101','13','15','16','17','18'])","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
|
||||
20,"balance(['4','5']) / balance(['101','13','15','16','17','18'])",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"
|
||||
"expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
|
||||
0,,,,0,1,"indicator","BILAN","Bilan"
|
||||
"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
|
||||
"balance(['2'])",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
|
||||
"balance(['3']",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
|
||||
"balance(['4'])",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
|
||||
"balance(['5'])",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
|
||||
"report('BCAP') + report('BRESNET')",,"BILAN",1,0,1,"fiscal","PASSIF","Passif"
|
||||
"balance(['1'])",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
|
||||
"-balance(['7'])+balance(['6'])",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
|
||||
0,,,,0,1,"fiscal","CRES","Compte des résultats"
|
||||
"report('CCHAR','CBENEF')",,"CRES",,0,1,"fiscal","CRESACTIF","Résultat Actif"
|
||||
"balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
|
||||
"report('CRESPROD')",,"CRES",,0,1,"fiscal","CRESPASSIF","Résultat Passif"
|
||||
"-balance(['7'])",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
|
||||
"-balance(['7'])+balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
|
||||
0,,,,0,1,"indicator","IIMMO","Immobilisations"
|
||||
"balance(['1'])/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
|
||||
0,,,,0,1,"indicator","ITRE","Trésorerie"
|
||||
"balance(['3','4','5']) / balance(['101','13','15','16','17','18'])","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
|
||||
"balance(['4','5']) / balance(['101','13','15','16','17','18'])",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"
|
||||
|
||||
|
@@ -77,8 +77,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="next_id_64" name="Reporting" parent="crm.menu_crm" sequence="50"/>
|
||||
<menuitem id="crm.next_id_52" name="All Cases" parent="next_id_64" sequence="0"/>
|
||||
<menuitem id="crm.next_id_64" name="Reporting" parent="crm.menu_crm" sequence="50"/>
|
||||
<menuitem id="crm.next_id_52" name="All Cases" parent="crm.next_id_64" sequence="0"/>
|
||||
|
||||
<record id="action_report_crm_case_user_tree" model="ir.actions.act_window">
|
||||
<field name="name">Cases by User and Section</field>
|
||||
@@ -87,7 +87,7 @@
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_crm_case_user_filter"/>
|
||||
</record>
|
||||
<menuitem action="action_report_crm_case_user_tree" id="menu_crm_case_user_tree" parent="next_id_64"/>
|
||||
<menuitem action="action_report_crm_case_user_tree" id="menu_crm_case_user_tree" parent="crm.next_id_64"/>
|
||||
|
||||
<record id="action_report_crm_case_user_tree_my" model="ir.actions.act_window">
|
||||
<field name="name">My cases by section</field>
|
||||
@@ -97,7 +97,7 @@
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
<field name="search_view_id" ref="view_crm_case_user_filter"/>
|
||||
</record>
|
||||
<menuitem action="action_report_crm_case_user_tree_my" id="menu_crm_case_user_tree_my" parent="report_crm.next_id_64"/>
|
||||
<menuitem action="action_report_crm_case_user_tree_my" id="menu_crm_case_user_tree_my" parent="crm.next_id_64"/>
|
||||
|
||||
<!-- # Cases by section and categoryof case -->
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_crm_case_categ_filter"/>
|
||||
</record>
|
||||
<menuitem action="action_report_crm_case_categ_tree" id="menu_crm_case_categ_tree" parent="report_crm.next_id_64"/>
|
||||
<menuitem action="action_report_crm_case_categ_tree" id="menu_crm_case_categ_tree" parent="crm.next_id_64"/>
|
||||
|
||||
<act_window domain="[('user_id', '=', active_id)]" id="act_res_users_2_report_crm_case_user" name="Monthly cases" res_model="report.crm.case.user" src_model="res.users"/>
|
||||
|
||||
@@ -299,4 +299,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position)"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
groups="base.group_extended"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<separator colspan="4" string="Manual Description"/>
|
||||
<field colspan="4" name="name" select="2"/>
|
||||
<field name="price_unit" select="2"/>
|
||||
@@ -354,7 +355,7 @@
|
||||
<field name="product_uom"/>
|
||||
<field name="product_id" readonly="1" select="1"/>
|
||||
<field name="invoiced" select="2"/>
|
||||
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<separator colspan="4" string="Manual Designation"/>
|
||||
<field colspan="4" name="name" select="2"/>
|
||||
<field name="price_unit" select="2"/>
|
||||
|
||||
@@ -1000,10 +1000,10 @@ class stock_move(osv.osv):
|
||||
\nThe state is \'Waiting\' if the move is waiting for another one.'),
|
||||
'price_unit': fields.float('Unit Price',
|
||||
digits=(16, int(config['price_accuracy']))),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'purchase_id': fields.related('picking_id','purchase_id',type='many2one', relation="purchase.order", string="Purchase Orders"),
|
||||
'supplier_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Supplier"),
|
||||
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Orders"),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner"),
|
||||
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Orders"),
|
||||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
|
||||
}
|
||||
_constraints = [
|
||||
(_check_tracking,
|
||||
|
||||
@@ -1216,9 +1216,9 @@
|
||||
<field eval="6" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree color="grey:state=='cancel' or state=='done'" string="Moves">
|
||||
<field name="picking_id" string="Reference"/>
|
||||
<field name="purchase_id"/>
|
||||
<field name="supplier_id"/>
|
||||
<field name="picking_id" string="Reference"/>
|
||||
<field name="origin" string="Purchase Order"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" />
|
||||
<field name="product_uom" string="UOM"/>
|
||||
@@ -1240,7 +1240,7 @@
|
||||
<field eval="6" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Moves">
|
||||
<field name="picking_id"/>
|
||||
<field name="picking_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" />
|
||||
<field name="product_uom" string="UOM"/>
|
||||
@@ -1263,9 +1263,9 @@
|
||||
<filter icon="terp-stock" string="Back Orders" domain="[('backorder_id','!=',False)]" help="Back Orders"/>
|
||||
<filter icon="terp-stock" string="Planned Today" domain="[('date_planned','=',time.strftime('%%m-%%d-%%Y %%H:%%M:%%S')))]" help="Orders planned for today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="supplier_id" select="1"/>
|
||||
<field name="product_id" select="1"/>
|
||||
<field name="purchase_id" select="1"/>
|
||||
<field name="origin" string="Purchase Order"/>
|
||||
<field name="partner_id" string="Supplier"/>
|
||||
<field name="product_id"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -1277,6 +1277,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">[('picking_id.type','=','in')]</field>
|
||||
<field name="view_id" ref="view_move_tree_reception_picking"/>
|
||||
<field name="search_view_id" ref="view_move_search_reception_picking"/>
|
||||
</record>
|
||||
|
||||
@@ -34,12 +34,8 @@ _moves_fields = UpdateableDict()
|
||||
|
||||
_moves_arch_end = '''<?xml version="1.0"?>
|
||||
<form string="Picking result">
|
||||
<label string="The picking has been successfully made !" colspan="4"/>
|
||||
<field name="back_order_notification" colspan="4" nolabel="1"/>
|
||||
<label string="Move(s) have been successfully Done !" colspan="4"/>
|
||||
</form>'''
|
||||
_moves_fields_end = {
|
||||
'back_order_notification': {'string':'Back Order' ,'type':'text', 'readonly':True}
|
||||
}
|
||||
|
||||
def make_default(val):
|
||||
def fct(uid, data, state):
|
||||
@@ -51,145 +47,142 @@ def _to_xml(s):
|
||||
|
||||
def _get_moves(self, cr, uid, data, context):
|
||||
move_obj = pooler.get_pool(cr.dbname).get('stock.move')
|
||||
move_lines = move_obj.browse(cr, uid, [data['id']], context)
|
||||
move_lines = move_obj.browse(cr, uid, data['ids'], context)
|
||||
res = {}
|
||||
|
||||
_moves_fields.clear()
|
||||
_moves_arch_lst = ['<?xml version="1.0"?>', '<form string="Partial Stock Moves">']
|
||||
|
||||
for m in move_lines:
|
||||
quantity = m.product_qty
|
||||
if m.state<>'assigned':
|
||||
for move in move_lines:
|
||||
quantity = move.product_qty
|
||||
if move.state <> 'assigned':
|
||||
quantity = 0
|
||||
|
||||
_moves_arch_lst.append('<field name="move%s" />' % (m.id,))
|
||||
_moves_fields['move%s' % m.id] = {
|
||||
'string': _to_xml(m.name),
|
||||
_moves_arch_lst.append('<field name="move%s" />' % (move.id,))
|
||||
_moves_fields['move%s' % move.id] = {
|
||||
'string': _to_xml(move.name),
|
||||
'type' : 'float', 'required' : True, 'default' : make_default(quantity)}
|
||||
|
||||
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
price=0
|
||||
if hasattr(m, 'purchase_line_id') and m.purchase_line_id:
|
||||
price=m.purchase_line_id.price_unit
|
||||
if (move.picking_id.type == 'in') and (move.product_id.cost_method == 'average'):
|
||||
price = 0
|
||||
if hasattr(move, 'purchase_line_id') and move.purchase_line_id:
|
||||
price = move.purchase_line_id.price_unit
|
||||
|
||||
currency=0
|
||||
if hasattr(m.picking_id, 'purchase_id') and m.purchase_id:
|
||||
currency=m.purchase_id.pricelist_id.currency_id.id
|
||||
currency = 0
|
||||
if hasattr(move.picking_id, 'purchase_id') and move.picking_id.purchase_id:
|
||||
currency = move.picking_id.purchase_id.pricelist_id.currency_id.id
|
||||
|
||||
_moves_arch_lst.append('<group col="6"><field name="uom%s" nolabel="1"/>\
|
||||
<field name="price%s"/>' % (m.id,m.id,))
|
||||
<field name="price%s"/>' % (move.id, move.id,))
|
||||
|
||||
_moves_fields['price%s' % m.id] = {'string': 'Unit Price',
|
||||
_moves_fields['price%s' % move.id] = {'string': 'Unit Price',
|
||||
'type': 'float', 'required': True, 'default': make_default(price)}
|
||||
|
||||
_moves_fields['uom%s' % m.id] = {'string': 'UOM', 'type': 'many2one',
|
||||
_moves_fields['uom%s' % move.id] = {'string': 'UOM', 'type': 'many2one',
|
||||
'relation': 'product.uom', 'required': True,
|
||||
'default': make_default(m.product_uom.id)}
|
||||
'default': make_default(move.product_uom.id)}
|
||||
|
||||
_moves_arch_lst.append('<field name="currency%d" nolabel="1"/></group>' % (m.id,))
|
||||
_moves_arch_lst.append('<field name="currency%d" nolabel="1"/></group>' % (move.id,))
|
||||
_moves_fields['currency%s' % m.id] = {'string': 'Currency',
|
||||
'type': 'many2one', 'relation': 'res.currency',
|
||||
'required': True, 'default': make_default(currency)}
|
||||
|
||||
_moves_arch_lst.append('<newline/>')
|
||||
res.setdefault('moves', []).append(m.id)
|
||||
res.setdefault('moves', []).append(move.id)
|
||||
|
||||
_moves_arch_lst.append('</form>')
|
||||
_moves_arch.string = '\n'.join(_moves_arch_lst)
|
||||
return res
|
||||
|
||||
def _do_split(self, cr, uid, data, context):
|
||||
move_obj = pooler.get_pool(cr.dbname).get('stock.move')
|
||||
pick_obj = pooler.get_pool(cr.dbname).get('stock.picking')
|
||||
move_lines = move_obj.browse(cr, uid, data['id'])
|
||||
pick = pick_obj.browse(cr, uid, [move_lines.picking_id.id])[0]
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
complete, too_few, too_many = False, False, False
|
||||
states = []
|
||||
move_obj = pool.get('stock.move')
|
||||
pick_obj = pool.get('stock.picking')
|
||||
product_obj = pool.get('product.product')
|
||||
currency_obj = pool.get('res.currency')
|
||||
users_obj = pool.get('res.users')
|
||||
uom_obj = pool.get('product.uom')
|
||||
move_lines = move_obj.browse(cr, uid, data['ids'])
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
complete, too_few, too_many = [], [], []
|
||||
for move in move_lines:
|
||||
states = []
|
||||
|
||||
if move_lines.product_qty == data['form']['move%s' % data['id']]:
|
||||
complete = move_lines
|
||||
elif move_lines.product_qty > data['form']['move%s' % data['id']]:
|
||||
too_few = move_lines
|
||||
else:
|
||||
too_many = move_lines
|
||||
|
||||
if move.product_qty == data['form']['move%s' % move.id]:
|
||||
complete.append(move)
|
||||
elif move.product_qty > data['form']['move%s' % move.id]:
|
||||
too_few.append(move)
|
||||
else:
|
||||
too_many.append(move)
|
||||
# Average price computation
|
||||
if (move_lines.picking_id.type == 'in') and (move_lines.product_id.cost_method == 'average'):
|
||||
product_obj = pool.get('product.product')
|
||||
currency_obj = pool.get('res.currency')
|
||||
users_obj = pool.get('res.users')
|
||||
uom_obj = pool.get('product.uom')
|
||||
if (move.picking_id.type == 'in') and (move.product_id.cost_method == 'average'):
|
||||
product = move.product_id
|
||||
user = users_obj.browse(cr, uid, uid)
|
||||
qty = data['form']['move%s' % move.id]
|
||||
uom = data['form']['uom%s' % move.id]
|
||||
price = data['form']['price%s' % move.id]
|
||||
currency = data['form']['currency%s' % move.id]
|
||||
|
||||
product = product_obj.browse(cr, uid, [move_lines.product_id.id])[0]
|
||||
user = users_obj.browse(cr, uid, [uid])[0]
|
||||
qty = uom_obj._compute_qty(cr, uid, uom, qty, product.uom_id.id)
|
||||
|
||||
qty = data['form']['move%s' % move_lines.id]
|
||||
uom = data['form']['uom%s' % move_lines.id]
|
||||
price = data['form']['price%s' % move_lines.id]
|
||||
currency = data['form']['currency%s' % move_lines.id]
|
||||
if (qty > 0):
|
||||
new_price = currency_obj.compute(cr, uid, currency,
|
||||
user.company_id.currency_id.id, price)
|
||||
new_price = uom_obj._compute_price(cr, uid, uom, new_price,
|
||||
product.uom_id.id)
|
||||
if product.qty_available<=0:
|
||||
new_std_price = new_price
|
||||
else:
|
||||
new_std_price = ((product.standard_price * product.qty_available)\
|
||||
+ (new_price * qty))/(product.qty_available + qty)
|
||||
|
||||
qty = uom_obj._compute_qty(cr, uid, uom, qty, product.uom_id.id)
|
||||
product_obj.write(cr, uid, [product.id],
|
||||
{'standard_price': new_std_price})
|
||||
move_obj.write(cr, uid, move.id, {'price_unit': new_price})
|
||||
|
||||
if (qty > 0):
|
||||
new_price = currency_obj.compute(cr, uid, currency,
|
||||
user.company_id.currency_id.id, price)
|
||||
new_price = uom_obj._compute_price(cr, uid, uom, new_price,
|
||||
product.uom_id.id)
|
||||
if product.qty_available<=0:
|
||||
new_std_price = new_price
|
||||
else:
|
||||
new_std_price = ((product.standard_price * product.qty_available)\
|
||||
+ (new_price * qty))/(product.qty_available + qty)
|
||||
|
||||
product_obj.write(cr, uid, [product.id],
|
||||
{'standard_price': new_std_price})
|
||||
move_obj.write(cr, uid, [move_lines.id], {'price_unit': new_price})
|
||||
if complete:
|
||||
move_obj.write(cr, uid, [complete.id],{
|
||||
'product_qty': data['form']['move%s' % complete.id],
|
||||
'product_uos_qty': data['form']['move%s' % complete.id],
|
||||
'state':'done' })
|
||||
for move in pick.move_lines:
|
||||
if move.state == 'done':
|
||||
states.append(True)
|
||||
else:
|
||||
states.append(False)
|
||||
if False not in states:
|
||||
pick_obj.write(cr, uid, complete.picking_id.id, {
|
||||
'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking'),
|
||||
'state':'done' })
|
||||
return {'back_order':False}
|
||||
if too_few:
|
||||
pick_obj.write(cr, uid, too_few.picking_id.id, {
|
||||
'name': pool.get('ir.sequence').get(cr, uid, 'stock.picking'),
|
||||
'move_lines' : [],
|
||||
'state':'assigned' })
|
||||
if data['form']['move%s' % too_few.id] <> 0:
|
||||
new_obj = move_obj.copy(cr, uid, too_few.id,
|
||||
for move in too_few:
|
||||
if data['form']['move%s' % move.id] <> 0:
|
||||
new_move = move_obj.copy(cr, uid, move.id,
|
||||
{
|
||||
'product_qty' : data['form']['move%s' % too_few.id],
|
||||
'product_uos_qty':data['form']['move%s' % too_few.id],
|
||||
'picking_id' : too_few.picking_id.id,
|
||||
'product_qty' : data['form']['move%s' % move.id],
|
||||
'product_uos_qty':data['form']['move%s' % move.id],
|
||||
'picking_id' : move.picking_id.id,
|
||||
'state': 'assigned',
|
||||
'move_dest_id': False,
|
||||
'price_unit': too_few.price_unit,
|
||||
'price_unit': move.price_unit,
|
||||
})
|
||||
move_obj.write(cr, uid, [new_obj],{'state':'done'})
|
||||
move_obj.write(cr, uid, [too_few.id],{
|
||||
'product_qty' : move_lines.product_qty - data['form']['move%s' % too_few.id],
|
||||
'product_uos_qty':move_lines.product_qty - data['form']['move%s' % too_few.id],
|
||||
'state':'assigned' })
|
||||
if too_many:
|
||||
move_obj.write(cr, uid, [too_many.id],{
|
||||
'product_qty': data['form']['move%s' % too_many.id],
|
||||
'product_uos_qty': data['form']['move%s' % too_many.id],
|
||||
'state':'assigned' })
|
||||
return {'back_order':False}
|
||||
complete.append(move_obj.browse(cr, uid, new_move))
|
||||
move_obj.write(cr, uid, move.id,
|
||||
{
|
||||
'product_qty' : move.product_qty - data['form']['move%s' % move.id],
|
||||
'product_uos_qty':move.product_qty - data['form']['move%s' % move.id],
|
||||
})
|
||||
|
||||
|
||||
for move in too_many:
|
||||
move_obj.write(cr, uid, move.id,
|
||||
{
|
||||
'product_qty': data['form']['move%s' % move.id],
|
||||
'product_uos_qty': data['form']['move%s' % move.id]
|
||||
})
|
||||
complete.append(move)
|
||||
|
||||
for move in complete:
|
||||
move_obj.action_done(cr, uid, [move.id])
|
||||
|
||||
# TOCHECK : Done picking if all moves are done
|
||||
cr.execute('select move.id from stock_picking pick \
|
||||
right join stock_move move on move.picking_id = pick.id and move.state = ''%s'' where pick.id = %s',
|
||||
('done', move.picking_id.id))
|
||||
res = cr.fetchall()
|
||||
if len(res) == len(move.picking_id.move_lines):
|
||||
pick_obj.action_done(cr, uid, [move.picking_id.id])
|
||||
#wf_service.trg_validate(uid, 'stock.picking', move.picking_id.id, 'button_done', cr)
|
||||
#wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
|
||||
|
||||
return {}
|
||||
|
||||
|
||||
def _get_default(self, cr, uid, data, context):
|
||||
if data['form']['back_order']:
|
||||
data['form']['back_order_notification'] = _('Back Order %s Assigned to this Picking.') % (tools.ustr(data['form']['back_order']),)
|
||||
return data['form']
|
||||
|
||||
class partial_move(wizard.interface):
|
||||
|
||||
@@ -208,9 +201,9 @@ class partial_move(wizard.interface):
|
||||
'result': {'type': 'state', 'state': 'end2'},
|
||||
},
|
||||
'end2': {
|
||||
'actions': [ _get_default ],
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': _moves_arch_end,
|
||||
'fields': _moves_fields_end,
|
||||
'fields': {},
|
||||
'state': (
|
||||
('end', 'Close'),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user